3 // Copyright 2019 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Verify that various erroneous type switches are caught by the compiler.
12 func notused(x interface{}) {
13 // The first t is in a different scope than the 2nd t; it cannot
14 // be accessed (=> declared and not used error); but it is legal
16 switch t := 0; t := x.(type) { // ERROR "declared and not used"
18 _ = t // this is using the t of "t := x.(type)"