diff --git a/go/types/call.go b/go/types/call.go index 2ca943cf..8f77620f 100644 --- a/go/types/call.go +++ b/go/types/call.go @@ -140,7 +140,7 @@ func unpack(get getter, n int, allowCommaOk bool) (getter, int, bool) { if x0.mode == mapindex || x0.mode == commaok { // comma-ok value if allowCommaOk { - a := [2]Type{x0.typ, Typ[Bool]} + a := [2]Type{x0.typ, Typ[UntypedBool]} return func(x *operand, i int) { x.mode = value x.expr = x0.expr diff --git a/go/types/testdata/expr3.src b/go/types/testdata/expr3.src index abed361b..3e710517 100644 --- a/go/types/testdata/expr3.src +++ b/go/types/testdata/expr3.src @@ -98,7 +98,7 @@ func indexes() { // ok is of type bool type mybool bool var ok mybool - _, ok = m /* ERROR "cannot assign" */ ["bar"] + _, ok = m["bar"] _ = ok @@ -372,7 +372,7 @@ func type_asserts() { // ok value is of type bool var myok mybool - _, myok = e /* ERROR "cannot assign" */ .(int) + _, myok = e.(int) _ = myok var t I diff --git a/go/types/testdata/stmt0.src b/go/types/testdata/stmt0.src index 9a98a1e1..026d784e 100644 --- a/go/types/testdata/stmt0.src +++ b/go/types/testdata/stmt0.src @@ -95,14 +95,18 @@ func assignments1() { } func assignments2() { + type mybool bool var m map[string][]bool var s []bool var b bool + var d mybool _ = s _ = b + _ = d // assignments to map index expressions are ok s, b = m["foo"] + _, d = m["bar"] m["foo"] = nil m["foo"] = nil /* ERROR assignment count mismatch */ , false _ = append(m["foo"]) @@ -110,6 +114,7 @@ func assignments2() { var c chan int _, b = <-c + _, d = <-c <- /* ERROR cannot assign */ c = 0 <-c = 0 /* ERROR assignment count mismatch */ , false