Skip to content

Commit

Permalink
compiler: Skip type aliases in all named type considerations.
Browse files Browse the repository at this point in the history
The other named type compiler output shouldn't be needed for type
aliases.
  • Loading branch information
dmitshur committed Aug 26, 2017
1 parent 61693e9 commit 34e2783
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
// named types
var typeDecls []*Decl
for _, o := range c.p.typeNames {
if o.IsAlias() {
continue
}
typeName := c.objectName(o)
d := Decl{
Vars: []string{typeName},
Expand Down Expand Up @@ -468,9 +471,6 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
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)
})
d.MethodListCode = c.CatchOutput(0, func() {
if o.IsAlias() {
return
}
named := o.Type().(*types.Named)
if _, ok := named.Underlying().(*types.Interface); ok {
return
Expand Down

0 comments on commit 34e2783

Please sign in to comment.