Change information
Commit message:
go/types, types2: only report version errors if new(expr) is ok otherwise
If new(expr) is used before Go 1.26, don't report version errors if there
are other problems with the expression.
While at it, implement multiple missing type checks for new(expr) and
add corresponding test cases that were missed in CL 704935 (tests for
no value expressions, generic types, untyped nil).
Reorganize/rename builtins0.go tests for new to match existing test case
patterns again.
Fixes #75986.
For #45624.
Change-Id: I39e5516d3f8d191cc390a4d8b9911c312bbb177c
Files:
- M src/cmd/compile/internal/types2/builtins.go
- M src/go/types/builtins.go
- M src/internal/types/testdata/check/builtins0.go
- M src/internal/types/testdata/check/go1_25.go
- A src/internal/types/testdata/fixedbugs/issue75986.go
Change size: M
Delta: 5 files changed, 91 insertions(+), 48 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Mark Freeman, +1 by Robert Griesemer
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI