Skip to content

Commit

Permalink
cmd/compile: add missing Unalias call when writing type alias
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cuonglm authored and gopherbot committed Mar 1, 2024
1 parent 4d923e3 commit cda1e40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/noder/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
13 changes: 13 additions & 0 deletions test/fixedbugs/issue65778.go
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit cda1e40

Please sign in to comment.