Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix processing & linking of alias types #6

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,23 @@ func (p *processor) loadType(pkg *loader.Package, t gotypes.Type, depth int) *ty
if typeDef.UnderlyingType != nil && typeDef.UnderlyingType.Kind == types.BasicKind {
typeDef.Package = ""
}
return typeDef

case *gotypes.Slice:
typeDef.Kind = types.SliceKind
typeDef.UnderlyingType = p.loadType(pkg, x.Elem(), depth+1)
if typeDef.UnderlyingType != nil && typeDef.UnderlyingType.Kind == types.BasicKind {
typeDef.Package = ""
}
return typeDef

case *gotypes.Array:
typeDef.Kind = types.ArrayKind
typeDef.UnderlyingType = p.loadType(pkg, x.Elem(), depth+1)
if typeDef.UnderlyingType != nil && typeDef.UnderlyingType.Kind == types.BasicKind {
typeDef.Package = ""
}
return typeDef

case *gotypes.Map:
typeDef.Kind = types.MapKind
Expand Down
2 changes: 1 addition & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (t *Type) IsBasic() bool {
switch t.Kind {
case BasicKind:
return true
case AliasKind, SliceKind, ArrayKind, PointerKind:
case SliceKind, ArrayKind, PointerKind:
return t.UnderlyingType != nil && t.UnderlyingType.IsBasic()
case MapKind:
return t.KeyType != nil && t.KeyType.IsBasic() && t.ValueType != nil && t.ValueType.IsBasic()
Expand Down