diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 2468f52b74..a746b34180 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -1239,6 +1239,7 @@ func typecheck1(n *Node, top int) (res *Node) { // call and call like case OCALL: + typecheckslice(n.Ninit.Slice(), ctxStmt) // imported rewritten f(g()) calls (#30907) n.Left = typecheck(n.Left, ctxExpr|Etype|ctxCallee) if n.Left.Diag() { n.SetDiag(true) diff --git a/test/fixedbugs/issue30907.dir/a.go b/test/fixedbugs/issue30907.dir/a.go new file mode 100644 index 0000000000..e1a5c0cc3b --- /dev/null +++ b/test/fixedbugs/issue30907.dir/a.go @@ -0,0 +1,19 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +type UUID string + +func New() UUID { + return Must(NewRandom()) +} + +func NewRandom() (UUID, error) { + return "", nil +} + +func Must(uuid UUID, err error) UUID { + return uuid +} diff --git a/test/fixedbugs/issue30907.dir/b.go b/test/fixedbugs/issue30907.dir/b.go new file mode 100644 index 0000000000..f4f5fc4fdd --- /dev/null +++ b/test/fixedbugs/issue30907.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +import "./a" + +func F() { + a.New() +} diff --git a/test/fixedbugs/issue30907.go b/test/fixedbugs/issue30907.go new file mode 100644 index 0000000000..973ae1dcef --- /dev/null +++ b/test/fixedbugs/issue30907.go @@ -0,0 +1,7 @@ +// compiledir + +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ignored