Debian Codegraph @

test/fixedbugs/issue20185.go

raw
1 // errorcheck
2
3 // Copyright 2017 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.
6
7 // Issue 20185: type switching on untyped values (e.g. nil or consts)
8 // caused an internal compiler error.
9
10 package p
11
12 func F() {
13 switch t := nil.(type) { // ERROR "cannot type switch on non-interface value|not an interface"
14 default:
15 _ = t
16 }
17 }
18
19 const x = 1
20
21 func G() {
22 switch t := x.(type) { // ERROR "cannot type switch on non-interface value|declared and not used|not an interface"
23 default:
24 }
25 }