]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/switch6.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / switch6.go
index bd62c620b6f6657e28eeafbe6a5eeb0fc675bf14..fd66df5a5888dac4bcaaf96527501138296ebecd 100644 (file)
@@ -15,18 +15,32 @@ package main
 // Verify that type switch statements with impossible cases are detected by the compiler.
 func f0(e error) {
        switch e.(type) {
-       case int: // ERROR "impossible type switch case: e \(type error\) cannot have dynamic type int \(missing Error method\)"
+       case int: // ERROR "impossible type switch case: (int\n\t)?e \(.*type error\) cannot have dynamic type int \(missing method Error\)"
        }
 }
 
 // Verify that the compiler rejects multiple default cases.
 func f1(e interface{}) {
-       switch e { // ERROR "multiple defaults in switch"
-       default:
+       switch e {
        default:
+       default: // ERROR "multiple defaults( in switch)?"
        }
-       switch e.(type) { // ERROR "multiple defaults in switch"
-       default:
+       switch e.(type) {
        default:
+       default: // ERROR "multiple defaults( in switch)?"
+       }
+}
+
+type I interface {
+       Foo()
+}
+
+type X int
+
+func (*X) Foo() {}
+func f2() {
+       var i I
+       switch i.(type) {
+       case X: // ERROR "impossible type switch case: (X\n\t)?i \(.*type I\) cannot have dynamic type X \(method Foo has pointer receiver\)"
        }
 }