]> Cypherpunks.ru repositories - gostls13.git/commit
go/types, types2: don't look up fields or methods when expecting a type
authorRobert Findley <rfindley@google.com>
Wed, 11 Jan 2023 19:41:03 +0000 (14:41 -0500)
committerGopher Robot <gobot@golang.org>
Wed, 11 Jan 2023 22:29:34 +0000 (22:29 +0000)
commit245e95dfabd77f337373bf2d6bb47cd353ad8d74
tree051d706f3319c8ee7bd1680505d26c5bde357c82
parent18625d9becc559e65ab5b39aa5d27ae6eb7b00aa
go/types, types2: don't look up fields or methods when expecting a type

As we have seen many times, the type checker must be careful to avoid
accessing named type information before the type is fully set up. We
need a more systematic solution to this problem, but for now avoid one
case that causes a crash: checking a selector expression on an
incomplete type when a type expression is expected.

For golang/go#57522

Change-Id: I7ed31b859cca263276e3a0647d1f1b49670023a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/461577
Run-TryBot: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
12 files changed:
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/typexpr.go
src/go/types/call.go
src/go/types/expr.go
src/go/types/typexpr.go
src/internal/types/testdata/check/cycles0.go
src/internal/types/testdata/check/decls0.go
src/internal/types/testdata/check/issues0.go
src/internal/types/testdata/fixedbugs/issue39634.go
src/internal/types/testdata/fixedbugs/issue57522.go [new file with mode: 0644]
test/fixedbugs/issue18392.go