Skip to content

Commit 34e2783

Browse files
committed
compiler: Skip type aliases in all named type considerations.
The other named type compiler output shouldn't be needed for type aliases.
1 parent 61693e9 commit 34e2783

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/package.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
433433
// named types
434434
var typeDecls []*Decl
435435
for _, o := range c.p.typeNames {
436+
if o.IsAlias() {
437+
continue
438+
}
436439
typeName := c.objectName(o)
437440
d := Decl{
438441
Vars: []string{typeName},
@@ -468,9 +471,6 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
468471
c.Printf(`%s = $newType(%d, %s, "%s.%s", %t, "%s", %t, %s);`, lhs, size, typeKind(o.Type()), o.Pkg().Name(), o.Name(), o.Name() != "", o.Pkg().Path(), o.Exported(), constructor)
469472
})
470473
d.MethodListCode = c.CatchOutput(0, func() {
471-
if o.IsAlias() {
472-
return
473-
}
474474
named := o.Type().(*types.Named)
475475
if _, ok := named.Underlying().(*types.Interface); ok {
476476
return

0 commit comments

Comments
 (0)