mirror of https://github.com/golang/go.git
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()
|
func main()
|
||||||
{
|
{
|
||||||
var b map[string]int;
|
var b []int;
|
||||||
var ib interface{} = b;
|
var ib interface{} = b;
|
||||||
use(ib == ib);
|
use(ib == ib);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ package main
|
||||||
|
|
||||||
func main()
|
func main()
|
||||||
{
|
{
|
||||||
var b map[string]int;
|
var b []int;
|
||||||
var ib interface{} = b;
|
var ib interface{} = b;
|
||||||
var m = make(map[interface{}] int);
|
var m = make(map[interface{}] int);
|
||||||
m[ib] = 1;
|
m[ib] = 1;
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,10 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "unsafe"
|
import "reflect"
|
||||||
|
|
||||||
func typeof(x interface{}) string {
|
func typeof(x interface{}) string {
|
||||||
val, typ, indir := unsafe.Reflect(x);
|
return reflect.Typeof(x).String();
|
||||||
return typ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func f() int {
|
func f() int {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ throw: interface compare
|
||||||
panic PC=xxx
|
panic PC=xxx
|
||||||
|
|
||||||
=========== ./cmp3.go
|
=========== ./cmp3.go
|
||||||
comparing uncomparable type map[string] int
|
comparing uncomparable type []int
|
||||||
throw: interface compare
|
throw: interface compare
|
||||||
|
|
||||||
panic PC=xxx
|
panic PC=xxx
|
||||||
|
|
@ -18,7 +18,7 @@ throw: interface hash
|
||||||
panic PC=xxx
|
panic PC=xxx
|
||||||
|
|
||||||
=========== ./cmp5.go
|
=========== ./cmp5.go
|
||||||
hash of unhashable type map[string] int
|
hash of unhashable type []int
|
||||||
throw: interface hash
|
throw: interface hash
|
||||||
|
|
||||||
panic PC=xxx
|
panic PC=xxx
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue