aboutsummaryrefslogtreecommitdiff
path: root/test/switch3.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-11-13 22:58:08 -0500
committerRuss Cox <rsc@golang.org>2011-11-13 22:58:08 -0500
commit5bb54b8e9cd810d378397bae464f8933509e62bc (patch)
treecc49af668faa74c1f3eb55e3978e14844bc1bbc0 /test/switch3.go
parentefb74460c366286cf17225874c7d6333542647bc (diff)
downloadgo-5bb54b8e9cd810d378397bae464f8933509e62bc.tar.gz
go-5bb54b8e9cd810d378397bae464f8933509e62bc.zip
gc: remove func, map compare
R=ken, ken CC=golang-dev https://golang.org/cl/5373079
Diffstat (limited to 'test/switch3.go')
-rw-r--r--test/switch3.go28
1 files changed, 24 insertions, 4 deletions
diff --git a/test/switch3.go b/test/switch3.go
index 95ff6ec3c2..e91499db09 100644
--- a/test/switch3.go
+++ b/test/switch3.go
@@ -6,9 +6,8 @@
package main
-
type I interface {
- M()
+ M()
}
func bad() {
@@ -16,11 +15,32 @@ func bad() {
var s string
switch i {
- case s: // ERROR "mismatched types string and I"
+ case s: // ERROR "mismatched types string and I"
}
switch s {
- case i: // ERROR "mismatched types I and string"
+ case i: // ERROR "mismatched types I and string"
+ }
+
+ var m, m1 map[int]int
+ switch m {
+ case nil:
+ case m1: // ERROR "can only compare map m to nil"
+ default:
+ }
+
+ var a, a1 []int
+ switch a {
+ case nil:
+ case a1: // ERROR "can only compare slice a to nil"
+ default:
+ }
+
+ var f, f1 func()
+ switch f {
+ case nil:
+ case f1: // ERROR "can only compare func f to nil"
+ default:
}
}