diff --git a/go/types/call.go b/go/types/call.go index e4744565..d54034ee 100644 --- a/go/types/call.go +++ b/go/types/call.go @@ -143,7 +143,7 @@ func (check *checker) argument(sig *Signature, i int, x *operand, passSlice bool typ = sig.params.vars[n-1].typ if debug { if _, ok := typ.(*Slice); !ok { - check.dump("%s: expected slice type, got %s", sig.params.vars[n-1].Pos(), typ) + check.dump("%s: expected unnamed slice type, got %s", sig.params.vars[n-1].Pos(), typ) } } default: @@ -157,7 +157,7 @@ func (check *checker) argument(sig *Signature, i int, x *operand, passSlice bool check.errorf(x.pos(), "can only use ... with matching parameter") return } - if _, ok := x.typ.(*Slice); !ok { + if _, ok := x.typ.Underlying().(*Slice); !ok { check.errorf(x.pos(), "cannot use %s as parameter of type %s", x, typ) return } diff --git a/go/types/stdlib_test.go b/go/types/stdlib_test.go index d3978520..b84d00d0 100644 --- a/go/types/stdlib_test.go +++ b/go/types/stdlib_test.go @@ -121,6 +121,7 @@ func TestStdfixed(t *testing.T) { "bug373.go", // TODO(gri) implement use checks "bug376.go", // TODO(gri) built-ins must be called (no built-in function expressions) "issue3924.go", // TODO(gri) && and || produce bool result (not untyped bool) + "issue4847.go", // TODO(gri) initialization cycle error not found ) } diff --git a/go/types/testdata/expr3.src b/go/types/testdata/expr3.src index 96434f9b..4eca42b2 100644 --- a/go/types/testdata/expr3.src +++ b/go/types/testdata/expr3.src @@ -380,3 +380,9 @@ func _calls() { fi(0, g2) fi(0, g2 /* ERROR "2-valued expression" */ ()) } + +func issue6344() { + type T []interface{} + var x T + fi(x...) // ... applies also to named slices +}