Skip to content

Commit

Permalink
go/types, types2: pull up Unalias call to cover all of cycleFinder.typ
Browse files Browse the repository at this point in the history
Without a test because it's unclear the situation can actually occur,
but the code is correct because it now mimics the behavior without
explicit Alias nodes.

For #67547.

Change-Id: I21a31af28880ca6d599fe465563d9574c26ed1f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/588117
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
  • Loading branch information
griesemer authored and gopherbot committed May 24, 2024
1 parent 35ef4a9 commit 3ea2be1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/cmd/compile/internal/types2/infer.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ type cycleFinder struct {
}

func (w *cycleFinder) typ(typ Type) {
typ = Unalias(typ)
if w.seen[typ] {
// We have seen typ before. If it is one of the type parameters
// in w.tparams, iterative substitution will lead to infinite expansion.
Expand All @@ -714,8 +715,8 @@ func (w *cycleFinder) typ(typ Type) {
case *Basic:
// nothing to do

case *Alias:
w.typ(Unalias(t))
// *Alias:
// This case should not occur because of Unalias(typ) at the top.

case *Array:
w.typ(t.elem)
Expand Down
5 changes: 3 additions & 2 deletions src/go/types/infer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ea2be1

Please sign in to comment.