]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: remove superfluous unalias call (minor cleanup)
authorRobert Griesemer <gri@google.com>
Thu, 16 Oct 2025 17:33:34 +0000 (10:33 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 16 Oct 2025 18:03:04 +0000 (11:03 -0700)
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>
src/cmd/compile/internal/types2/alias.go
src/cmd/compile/internal/types2/signature.go
src/go/types/alias.go
src/go/types/signature.go

index 90dda18cc88426437e2dea4913150c31372abe5c..d306600ebd2710eb975fc9212432ad49390f1b7b 100644 (file)
@@ -113,7 +113,6 @@ func unalias(a0 *Alias) Type {
        for a := a0; a != nil; a, _ = t.(*Alias) {
                t = a.fromRHS
        }
-
        // It's fine to memoize nil types since it's the zero value for actual.
        // It accomplishes nothing.
        a0.actual = t
index ea1cfd88cc60b40c8d5f38ddf79beb55c3b39c7a..1e004eef4aeda62321f2768c6b89f0eca7d00dc3 100644 (file)
@@ -203,7 +203,7 @@ func (check *Checker) collectRecv(rparam *syntax.Field, scopePos syntax.Pos) (*V
                        case *Alias:
                                // Methods on generic aliases are not permitted.
                                // 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)
                                }
                                // Ok to continue but do not set basetype in this case so that
index f15ff57030354015c363a9646ae72bffcd8a8678..a2eeb3afac8e85edfed9dc399cb02bf84846cfbb 100644 (file)
@@ -116,7 +116,6 @@ func unalias(a0 *Alias) Type {
        for a := a0; a != nil; a, _ = t.(*Alias) {
                t = a.fromRHS
        }
-
        // It's fine to memoize nil types since it's the zero value for actual.
        // It accomplishes nothing.
        a0.actual = t
index fa41c797b29403c02e4506e16bd2e41c3306e38c..972de97b1a17623492f624551175917164f63dfb 100644 (file)
@@ -226,7 +226,7 @@ func (check *Checker) collectRecv(rparam *ast.Field, scopePos token.Pos) (*Var,
                        case *Alias:
                                // Methods on generic aliases are not permitted.
                                // 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)
                                }
                                // Ok to continue but do not set basetype in this case so that