]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: add missing Unalias call when writing type alias
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 22 Feb 2024 11:52:39 +0000 (18:52 +0700)
committerGopher Robot <gobot@golang.org>
Fri, 1 Mar 2024 01:40:00 +0000 (01:40 +0000)
Fixes #65778

Change-Id: I93af42967c7976d63b4f460b7ffbcb9a9c05ffe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/565995
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
src/cmd/compile/internal/noder/writer.go
test/fixedbugs/issue65778.go [new file with mode: 0644]

index 87c54b976943ebc9ba8280a8d86478c7ccbda1fb..c57ccdf36db0090dd568f08c8f448dd0e6cb73b2 100644 (file)
@@ -831,7 +831,7 @@ func (w *writer) doObj(wext *writer, obj types2.Object) pkgbits.CodeObj {
        case *types2.TypeName:
                if obj.IsAlias() {
                        w.pos(obj)
-                       w.typ(obj.Type())
+                       w.typ(types2.Unalias(obj.Type()))
                        return pkgbits.ObjAlias
                }
 
diff --git a/test/fixedbugs/issue65778.go b/test/fixedbugs/issue65778.go
new file mode 100644 (file)
index 0000000..30c6804
--- /dev/null
@@ -0,0 +1,13 @@
+// compile -godebug gotypesalias=1
+
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+type A = int
+
+type T[P any] *A
+
+var _ T[int]