Debian Codegraph @

src/internal/types/testdata/fixedbugs/issue67962.go

raw
1 // Copyright 2024 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package p
6
7 // No `"fmt" imported and not used` error below.
8 // The switch cases must be typechecked even
9 // though the switch expression is invalid.
10
11 import "fmt"
12
13 func _() {
14 x := 1
15 for e := range x.m /* ERROR "x.m undefined (type int has no field or method m)" */ () {
16 switch e.(type) {
17 case int:
18 fmt.Println()
19 }
20 }
21
22 switch t := x /* ERROR "not an interface" */ .(type) {
23 case int, string:
24 _ = t
25 }
26 }