@@ -1546,15 +1546,20 @@ func extractTypeWithFlags(tw *trap.Writer, tp types.Type, transparentAliases boo
15461546 for i := 0 ; i < tp .NumFields (); i ++ {
15471547 field := tp .Field (i )
15481548
1549- // ensure the field is associated with a label - note that
1550- // struct fields do not have a parent scope, so they are not
1551- // dealt with by `extractScopes`
1552- fieldlbl , exists := tw .Labeler .FieldID (field , i , lbl )
1553- if ! exists {
1554- extractObject (tw , field , fieldlbl )
1555- }
1549+ if ! transparentAliases {
1550+ // ensure the field is associated with a label - note that
1551+ // struct fields do not have a parent scope, so they are not
1552+ // dealt with by `extractScopes`.
1553+
1554+ // Skip this when extracting a type with transparent aliases;
1555+ // this is not the definitive version of the type.
1556+ fieldlbl , exists := tw .Labeler .FieldID (field , i , lbl )
1557+ if ! exists {
1558+ extractObject (tw , field , fieldlbl )
1559+ }
15561560
1557- dbscheme .FieldStructsTable .Emit (tw , fieldlbl , lbl )
1561+ dbscheme .FieldStructsTable .Emit (tw , fieldlbl , lbl )
1562+ }
15581563
15591564 name := field .Name ()
15601565 if field .Embedded () {
@@ -1571,9 +1576,14 @@ func extractTypeWithFlags(tw *trap.Writer, tp types.Type, transparentAliases boo
15711576 for i := 0 ; i < tp .NumMethods (); i ++ {
15721577 meth := tp .Method (i )
15731578
1574- // Note that methods do not have a parent scope, so they are
1575- // not dealt with by `extractScopes`
1576- extractMethod (tw , meth )
1579+ if ! transparentAliases {
1580+ // Note that methods do not have a parent scope, so they are
1581+ // not dealt with by `extractScopes`
1582+
1583+ // Skip this when extracting a type with transparent aliases;
1584+ // this is not the definitive version of the type.
1585+ extractMethod (tw , meth )
1586+ }
15771587
15781588 extractComponentType (tw , lbl , i , meth .Name (), meth .Type (), transparentAliases )
15791589 }
@@ -1620,23 +1630,30 @@ func extractTypeWithFlags(tw *trap.Writer, tp types.Type, transparentAliases boo
16201630 dbscheme .TypeNameTable .Emit (tw , lbl , origintp .Obj ().Name ())
16211631 underlying := origintp .Underlying ()
16221632 extractUnderlyingType (tw , lbl , underlying )
1623- trackInstantiatedStructFields (tw , tp , origintp )
16241633
1625- extractTypeObject (tw , lbl , origintp .Obj ())
1634+ if ! transparentAliases {
1635+ // The transparent and non-transparent versions of a named typed
1636+ // should be equal, so this is probably harmless, but regardless
1637+ // don't repeat it to save time.
16261638
1627- // ensure all methods have labels - note that methods do not have a
1628- // parent scope, so they are not dealt with by `extractScopes`
1629- for i := 0 ; i < origintp .NumMethods (); i ++ {
1630- meth := origintp .Method (i )
1639+ trackInstantiatedStructFields (tw , tp , origintp )
16311640
1632- extractMethod (tw , meth )
1633- }
1641+ extractTypeObject (tw , lbl , origintp .Obj ())
1642+
1643+ // ensure all methods have labels - note that methods do not have a
1644+ // parent scope, so they are not dealt with by `extractScopes`
1645+ for i := 0 ; i < origintp .NumMethods (); i ++ {
1646+ meth := origintp .Method (i )
16341647
1635- // associate all methods of underlying interface with this type
1636- if underlyingInterface , ok := underlying .(* types.Interface ); ok {
1637- for i := 0 ; i < underlyingInterface .NumMethods (); i ++ {
1638- methlbl := extractMethod (tw , underlyingInterface .Method (i ))
1639- dbscheme .MethodHostsTable .Emit (tw , methlbl , lbl )
1648+ extractMethod (tw , meth )
1649+ }
1650+
1651+ // associate all methods of underlying interface with this type
1652+ if underlyingInterface , ok := underlying .(* types.Interface ); ok {
1653+ for i := 0 ; i < underlyingInterface .NumMethods (); i ++ {
1654+ methlbl := extractMethod (tw , underlyingInterface .Method (i ))
1655+ dbscheme .MethodHostsTable .Emit (tw , methlbl , lbl )
1656+ }
16401657 }
16411658 }
16421659 case * types.TypeParam :
0 commit comments