aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/api_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/types2/api_test.go')
-rw-r--r--src/cmd/compile/internal/types2/api_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/api_test.go b/src/cmd/compile/internal/types2/api_test.go
index 840a3f3bdc..cf3c105f6c 100644
--- a/src/cmd/compile/internal/types2/api_test.go
+++ b/src/cmd/compile/internal/types2/api_test.go
@@ -3005,3 +3005,20 @@ type B = T[A]
t.Errorf("Unalias(type B = T[A]) = %q, want %q", got, want)
}
}
+
+func TestAlias_Rhs(t *testing.T) {
+ const src = `package p
+
+type A = B
+type B = C
+type C = int
+`
+
+ pkg := mustTypecheck(src, &Config{EnableAlias: true}, nil)
+ A := pkg.Scope().Lookup("A")
+
+ got, want := A.Type().(*Alias).Rhs().String(), "p.B"
+ if got != want {
+ t.Errorf("A.Rhs = %s, want %s", got, want)
+ }
+}