Skip to content

Commit 5fd2e87

Browse files
committed
Go: Don't extract objects for type aliases
1 parent 6804f94 commit 5fd2e87

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

go/extractor/extractor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,14 +522,14 @@ func extractObjectTypes(tw *trap.Writer) {
522522
// For more information on objects, see:
523523
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
524524
func extractObjectType(tw *trap.Writer, obj types.Object, lbl trap.Label) {
525-
if tp := obj.Type(); tp != nil {
525+
if tp := obj.Type(); tp != nil && !isAlias(tp) {
526526
extractType(tw, tp)
527527
}
528528
}
529529

530530
// emitObjectType emits the type information for a given object
531531
func emitObjectType(tw *trap.Writer, obj types.Object, lbl trap.Label) {
532-
if tp := obj.Type(); tp != nil {
532+
if tp := obj.Type(); tp != nil && !isAlias(tp) {
533533
dbscheme.ObjectTypesTable.Emit(tw, lbl, extractType(tw, tp))
534534
}
535535
}
@@ -1516,7 +1516,7 @@ func isAlias(tp types.Type) bool {
15161516
// If the given type is a type alias, this function resolves it to its underlying type.
15171517
func resolveTypeAlias(tp types.Type) types.Type {
15181518
if isAlias(tp) {
1519-
return tp.Underlying()
1519+
return types.Unalias(tp) // tp.Underlying()
15201520
}
15211521
return tp
15221522
}

0 commit comments

Comments
 (0)