]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/map1.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / map1.go
index 369e49da5d0bf4d1683f26f344f8a81435681928..a6b27e6ebd3a6b14502a69d889bb9fc84216bb75 100644 (file)
@@ -1,6 +1,6 @@
 // errorcheck
 
-// Copyright 2011 The Go Authors.  All rights reserved.
+// Copyright 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
@@ -9,8 +9,6 @@
 
 package main
 
-func main() {}
-
 type v bool
 
 var (
@@ -41,4 +39,30 @@ var (
        _ map[[]int]v       // ERROR "invalid map key"
        _ map[func()]v      // ERROR "invalid map key"
        _ map[map[int]int]v // ERROR "invalid map key"
+       _ map[T1]v    // ERROR "invalid map key"
+       _ map[T2]v    // ERROR "invalid map key"
+       _ map[T3]v    // ERROR "invalid map key"
+       _ map[T4]v    // ERROR "invalid map key"
+       _ map[T5]v
+       _ map[T6]v
+       _ map[T7]v
+       _ map[T8]v
 )
+
+type T1 []int
+type T2 struct { F T1 }
+type T3 []T4
+type T4 struct { F T3 }
+
+type T5 *int
+type T6 struct { F T5 }
+type T7 *T4
+type T8 struct { F *T7 }
+
+func main() {
+       m := make(map[int]int)
+       delete()        // ERROR "missing arguments|not enough arguments"
+       delete(m)       // ERROR "missing second \(key\) argument|not enough arguments"
+       delete(m, 2, 3) // ERROR "too many arguments"
+       delete(1, m)    // ERROR "first argument to delete must be map|argument 1 must be a map|is not a map"
+}