diff options
author | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2014-02-24 19:51:59 +0100 |
---|---|---|
committer | R?my Oudompheng <oudomphe@phare.normalesup.org> | 2014-02-24 19:51:59 +0100 |
commit | 2fdb1a25602997f840590e73f75f4fb9fe6b153e (patch) | |
tree | 59b656d08bcd9b24074c06a9a85f414960ff230e /test/cmp.go | |
parent | 5c9b6f9271b5e2315257b32f5758c62d0625902c (diff) | |
download | go-2fdb1a25602997f840590e73f75f4fb9fe6b153e.tar.gz |
cmd/gc: fix walkcompare bugs.
Revision c0e0467635ec (cmd/gc: return canonical Node* from temp)
exposed original nodes of temporaries, allowing callers to mutate
their types.
In walkcompare a temporary could be typed as ideal because of
this. Additionnally, assignment of a comparison result to
a custom boolean type was broken.
Fixes issue 7366.
LGTM=rsc
R=rsc, iant, khr
CC=golang-codereviews
https://codereview.appspot.com/66930044
Diffstat (limited to 'test/cmp.go')
-rw-r--r-- | test/cmp.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cmp.go b/test/cmp.go index 73de502f3..9ac0ebe79 100644 --- a/test/cmp.go +++ b/test/cmp.go @@ -387,6 +387,23 @@ func main() { isfalse(iz != x) } + // named booleans + { + type mybool bool + var b mybool + + type T struct{ data [20]byte } + var x, y T + b = x == y + istrue(x == y) + istrue(bool(b)) + + m := make(map[string][10]interface{}) + b = m["x"] == m["y"] + istrue(m["x"] == m["y"]) + istrue(bool(b)) + } + shouldPanic(p1) shouldPanic(p2) shouldPanic(p3) |