Source file src/internal/types/testdata/fixedbugs/issue49005.go
1 // Copyright 2021 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 type T1 interface{ M() } 8 9 func F1() T1 10 11 var _ = F1().(*X1 /* ERROR "undefined: X1" */) 12 13 func _() { 14 switch F1().(type) { 15 case *X1 /* ERROR "undefined: X1" */ : 16 } 17 } 18 19 type T2 interface{ M() } 20 21 func F2() T2 22 23 var _ = F2 /* ERROR "impossible type assertion: F2().(*X2)\n\t*X2 does not implement T2 (missing method M)" */ ().(*X2) 24 25 type X2 struct{} 26 27 func _() { 28 switch F2().(type) { 29 case * /* ERROR "impossible type switch case: *X2\n\tF2() (value of interface type T2) cannot have dynamic type *X2 (missing method M)" */ X2: 30 } 31 } 32