]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: avoid spurious "undefined" errors" for invalid identifiers
authorRobert Griesemer <gri@golang.org>
Thu, 1 Aug 2024 18:16:27 +0000 (11:16 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 6 Aug 2024 22:12:59 +0000 (22:12 +0000)
commit5bd442aba31c1720bb333dafbb65cf977091d292
treefa03d13f8c10c7926299d342c68f2513be8b2a9a
parent44ed517c42a52e0c5831383b59eae5b38428656d
go/types, types2: avoid spurious "undefined" errors" for invalid identifiers

The syntax parser complains about invalid identifiers.
Don't report a typechecker error when such an identifier
cannot be found in the current scope.

For now add a local test for types2 only because the
go/parser behaves differently than the syntax parser
which leads to slightly different error positions.

Fixes #68183.

Change-Id: Idbfe62fafcd704886069182744ec5e6b37ffc4e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/602476
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/predicates.go
src/cmd/compile/internal/types2/testdata/local/issue68183.go [new file with mode: 0644]
src/cmd/compile/internal/types2/typexpr.go
src/go/types/call.go
src/go/types/predicates.go
src/go/types/typexpr.go