]> Cypherpunks repositories - gostls13.git/commitdiff
maps have == so maps should work as map keys.
authorRuss Cox <rsc@golang.org>
Fri, 3 Jul 2009 16:45:15 +0000 (09:45 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 3 Jul 2009 16:45:15 +0000 (09:45 -0700)
fix tests of bad map keys to use slices instead.

R=r
DELTA=7  (0 added, 1 deleted, 6 changed)
OCL=31123
CL=31145

test/cmp3.go
test/cmp5.go
test/convert.go
test/golden.out

index 06a67bdf0588cd7ff82646930380c06eda05857f..1f53c07a142ec5a9ee1c1d56b6ccc30d18e27ec3 100644 (file)
@@ -10,7 +10,7 @@ func use(bool) { }
 
 func main()
 {
-       var b map[string]int;
+       var b []int;
        var ib interface{} = b;
        use(ib == ib);
 }
index 7500974223ebe49f014c978e22d21e0f851e54e0..2a55f7b8f4c8fb7feffaf96c13de86ed0734a921 100644 (file)
@@ -8,7 +8,7 @@ package main
 
 func main()
 {
-       var b map[string]int;
+       var b []int;
        var ib interface{} = b;
        var m = make(map[interface{}] int);
        m[ib] = 1;
index 1b933f93bfce40bc64a6069216a04d30de15a4d2..3790bf17ed512e6ee7b03209b2e81ba99afb2944 100644 (file)
@@ -6,11 +6,10 @@
 
 package main
 
-import "unsafe"
+import "reflect"
 
 func typeof(x interface{}) string {
-       val, typ, indir := unsafe.Reflect(x);
-       return typ;
+       return reflect.Typeof(x).String();
 }
 
 func f() int {
index 3f15f483953877901b6a3b8bed40ed91e188cf2f..bcbebb6fe16ddac22b732903d8cebebbffa426fd 100644 (file)
@@ -6,7 +6,7 @@ throw: interface compare
 panic PC=xxx
 
 =========== ./cmp3.go
-comparing uncomparable type map[string] int
+comparing uncomparable type []int
 throw: interface compare
 
 panic PC=xxx
@@ -18,7 +18,7 @@ throw: interface hash
 panic PC=xxx
 
 =========== ./cmp5.go
-hash of unhashable type map[string] int
+hash of unhashable type []int
 throw: interface hash
 
 panic PC=xxx