]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] go/types, types2: don't crash in selectors referring to the...
authorRobert Griesemer <gri@golang.org>
Sun, 6 Mar 2022 23:44:42 +0000 (15:44 -0800)
committerDmitri Shuralyov <dmitshur@golang.org>
Tue, 8 Mar 2022 00:42:20 +0000 (00:42 +0000)
commitaeced244987a870a8c52a5e340e43d301015ecdb
treee0babbdd8f10cedf815e4187d54d7e184a37a9de
parentf913f9dd1aea3d0a4754f63a30af6b8e2e50d9c8
[release-branch.go1.18] go/types, types2: don't crash in selectors referring to the type being declared

In Checker.typInternal, the SelectorExpr case was the only case that
didn't either set or pass along the incoming def *Named type.

Handle this by passing it along to Checker.selector and report a
cycle if one is detected.

Fixes #51509.

Change-Id: I6c2d46835f225aeb4cb25fe0ae55f6180cef038b
Reviewed-on: https://go-review.googlesource.com/c/go/+/390314
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
(cherry picked from commit 114d5deac2f513a7397ab4c2ee8d2d567a901266)
Reviewed-on: https://go-review.googlesource.com/c/go/+/390423
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/testdata/fixedbugs/issue51509.go [new file with mode: 0644]
src/cmd/compile/internal/types2/typexpr.go
src/go/types/call.go
src/go/types/expr.go
src/go/types/testdata/fixedbugs/issue51509.go [new file with mode: 0644]
src/go/types/typexpr.go