diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go index 9de6d4f45eb..fe1c76e81b8 100644 --- a/src/cmd/compile/internal/syntax/parser.go +++ b/src/cmd/compile/internal/syntax/parser.go @@ -991,7 +991,7 @@ func (p *parser) operand(keep_parens bool) Expr { case _Func: pos := p.pos() p.next() - _, ftyp := p.funcType("function literal") + _, ftyp := p.funcType("function type") if p.tok == _Lbrace { p.xnest++ diff --git a/src/cmd/compile/internal/syntax/testdata/issue48382.go b/src/cmd/compile/internal/syntax/testdata/issue48382.go index c00fee6f826..7c024a051f6 100644 --- a/src/cmd/compile/internal/syntax/testdata/issue48382.go +++ b/src/cmd/compile/internal/syntax/testdata/issue48382.go @@ -8,7 +8,8 @@ type _ func /* ERROR function type must have no type parameters */ [ /* ERROR em type _ func /* ERROR function type must have no type parameters */ [ x /* ERROR missing type constraint */ ]() type _ func /* ERROR function type must have no type parameters */ [P any]() -var _ = func /* ERROR function literal must have no type parameters */ [P any]() {} +var _ = (func /* ERROR function type must have no type parameters */ [P any]())(nil) +var _ = func /* ERROR function type must have no type parameters */ [P any]() {} type _ interface{ m /* ERROR interface method must have no type parameters */ [P any]()