mirror of
https://github.com/golang/go
synced 2024-11-11 21:50:21 -07:00
maps have == so maps should work as map keys.
fix tests of bad map keys to use slices instead. R=r DELTA=7 (0 added, 1 deleted, 6 changed) OCL=31123 CL=31145
This commit is contained in:
parent
75fe1303c1
commit
1af3edc37f
@ -10,7 +10,7 @@ func use(bool) { }
|
||||
|
||||
func main()
|
||||
{
|
||||
var b map[string]int;
|
||||
var b []int;
|
||||
var ib interface{} = b;
|
||||
use(ib == ib);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user