]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: report an error for x.sel where x is a built-in
authorRobert Griesemer <gri@golang.org>
Fri, 25 Feb 2022 19:10:44 +0000 (11:10 -0800)
committerRobert Griesemer <gri@golang.org>
Sat, 26 Feb 2022 00:21:50 +0000 (00:21 +0000)
commit286e3e61aa9310bb8fd333adac6d06cfb2fcc95b
tree3e0400e2f725cd9fd61cd5bfad3e7d528c624897
parent01e522a97384d2c81c90490654c2749bfe05045e
go/types, types2: report an error for x.sel where x is a built-in

In case of a selector expression x.sel where x is a built-in
we didn't report an error because the type of built-ins is
invalid and we surpress errors on operands of invalid types,
assuming that an error has been reported before.

Add a corresponding check for this case.

Review all places where we call Checker.exprOrType to ensure
(invalid) built-ins are reported.

Adjusted position for index error in types2.

Fixes #51360.

Change-Id: I24693819c729994ab79d31de8fa7bd370b3e8469
Reviewed-on: https://go-review.googlesource.com/c/go/+/388054
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/index.go
src/cmd/compile/internal/types2/testdata/fixedbugs/issue51360.go [new file with mode: 0644]
src/go/types/call.go
src/go/types/index.go
src/go/types/testdata/fixedbugs/issue51360.go [new file with mode: 0644]