diff --git a/go/types/builtins.go b/go/types/builtins.go index ebe83024..7fe8353c 100644 --- a/go/types/builtins.go +++ b/go/types/builtins.go @@ -397,7 +397,7 @@ func (check *checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b check.invalidArg(call.Args[1].Pos(), "length and capacity swapped") // safe to continue } - x.mode = variable + x.mode = value x.typ = T if check.Types != nil { params := [...]Type{T, Typ[Int], Typ[Int]} @@ -412,7 +412,7 @@ func (check *checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b return } - x.mode = variable + x.mode = value x.typ = &Pointer{base: T} if check.Types != nil { check.recordBuiltinType(call.Fun, makeSig(x.typ, T)) diff --git a/go/types/testdata/builtins.src b/go/types/testdata/builtins.src index 3cabd8ae..9d39d409 100644 --- a/go/types/testdata/builtins.src +++ b/go/types/testdata/builtins.src @@ -436,6 +436,7 @@ func make1() { _ = make([]int, 10 /* ERROR length and capacity swapped */ , 9) _ = make([]int, 1 /* ERROR overflows */ <<100, 12345) _ = make([]int, m /* ERROR must be integer */ ) + _ = &make /* ERROR cannot take address */ ([]int, 0) // maps _ = make /* ERROR arguments */ (map[int]string, 10, 20) @@ -446,6 +447,7 @@ func make1() { _ = make(map[int]float32, int64(n)) _ = make(map[string]bool, 10.0) _ = make(map[string]bool, 10.0<