go/types, types2: remove superfluous unalias call (minor cleanup)

Change-Id: Ifc0d6e999777513498f070c5bc2fb4640d38c671
Reviewed-on: https://go-review.googlesource.com/c/go/+/712460
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
This commit is contained in:
Robert Griesemer 2025-10-16 10:33:34 -07:00 committed by Gopher Robot
parent e7351c03c8
commit 41f5659347
4 changed files with 2 additions and 4 deletions

View file

@ -113,7 +113,6 @@ func unalias(a0 *Alias) Type {
for a := a0; a != nil; a, _ = t.(*Alias) { for a := a0; a != nil; a, _ = t.(*Alias) {
t = a.fromRHS t = a.fromRHS
} }
// It's fine to memoize nil types since it's the zero value for actual. // It's fine to memoize nil types since it's the zero value for actual.
// It accomplishes nothing. // It accomplishes nothing.
a0.actual = t a0.actual = t

View file

@ -203,7 +203,7 @@ func (check *Checker) collectRecv(rparam *syntax.Field, scopePos syntax.Pos) (*V
case *Alias: case *Alias:
// Methods on generic aliases are not permitted. // Methods on generic aliases are not permitted.
// Only report an error if the alias type is valid. // Only report an error if the alias type is valid.
if isValid(unalias(t)) { if isValid(t) {
check.errorf(rbase, InvalidRecv, "cannot define new methods on generic alias type %s", t) check.errorf(rbase, InvalidRecv, "cannot define new methods on generic alias type %s", t)
} }
// Ok to continue but do not set basetype in this case so that // Ok to continue but do not set basetype in this case so that

View file

@ -116,7 +116,6 @@ func unalias(a0 *Alias) Type {
for a := a0; a != nil; a, _ = t.(*Alias) { for a := a0; a != nil; a, _ = t.(*Alias) {
t = a.fromRHS t = a.fromRHS
} }
// It's fine to memoize nil types since it's the zero value for actual. // It's fine to memoize nil types since it's the zero value for actual.
// It accomplishes nothing. // It accomplishes nothing.
a0.actual = t a0.actual = t

View file

@ -226,7 +226,7 @@ func (check *Checker) collectRecv(rparam *ast.Field, scopePos token.Pos) (*Var,
case *Alias: case *Alias:
// Methods on generic aliases are not permitted. // Methods on generic aliases are not permitted.
// Only report an error if the alias type is valid. // Only report an error if the alias type is valid.
if isValid(unalias(t)) { if isValid(t) {
check.errorf(rbase, InvalidRecv, "cannot define new methods on generic alias type %s", t) check.errorf(rbase, InvalidRecv, "cannot define new methods on generic alias type %s", t)
} }
// Ok to continue but do not set basetype in this case so that // Ok to continue but do not set basetype in this case so that