@@ -518,7 +518,6 @@ func extractMethod(tw *trap.Writer, meth *types.Func) trap.Label {
518
518
// For more information on objects, see:
519
519
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
520
520
func extractObject (tw * trap.Writer , obj types.Object , lbl trap.Label ) {
521
- checkObjectNotSpecialized (obj )
522
521
name := obj .Name ()
523
522
isBuiltin := obj .Parent () == types .Universe
524
523
var kind int
@@ -1638,7 +1637,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1638
1637
// Note that methods coming from embedded interfaces can be
1639
1638
// accessed through `Method(i)`, so there is no need to
1640
1639
// deal with them separately.
1641
- meth := tp .Method (i ). Origin ()
1640
+ meth := tp .Method (i )
1642
1641
1643
1642
// Note that methods do not have a parent scope, so they are
1644
1643
// not dealt with by `extractScopes`
@@ -1708,15 +1707,15 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1708
1707
// ensure all methods have labels - note that methods do not have a
1709
1708
// parent scope, so they are not dealt with by `extractScopes`
1710
1709
for i := 0 ; i < origintp .NumMethods (); i ++ {
1711
- meth := origintp .Method (i ). Origin ()
1710
+ meth := origintp .Method (i )
1712
1711
1713
1712
extractMethod (tw , meth )
1714
1713
}
1715
1714
1716
1715
// associate all methods of underlying interface with this type
1717
1716
if underlyingInterface , ok := underlying .(* types.Interface ); ok {
1718
1717
for i := 0 ; i < underlyingInterface .NumMethods (); i ++ {
1719
- methlbl := extractMethod (tw , underlyingInterface .Method (i ). Origin () )
1718
+ methlbl := extractMethod (tw , underlyingInterface .Method (i ))
1720
1719
dbscheme .MethodHostsTable .Emit (tw , methlbl , lbl )
1721
1720
}
1722
1721
}
@@ -1788,7 +1787,7 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
1788
1787
case * types.Interface :
1789
1788
var b strings.Builder
1790
1789
for i := 0 ; i < tp .NumMethods (); i ++ {
1791
- meth := tp .Method (i ). Origin ()
1790
+ meth := tp .Method (i )
1792
1791
methLbl := extractType (tw , meth .Type ())
1793
1792
if i > 0 {
1794
1793
b .WriteString ("," )
@@ -2144,20 +2143,3 @@ func skipExtractingValueForLeftOperand(tw *trap.Writer, be *ast.BinaryExpr) bool
2144
2143
}
2145
2144
return true
2146
2145
}
2147
-
2148
- // checkObjectNotSpecialized exits the program if `obj` is specialized. Note
2149
- // that specialization is only possible for function objects and variable
2150
- // objects.
2151
- func checkObjectNotSpecialized (obj types.Object ) {
2152
- if funcObj , ok := obj .(* types.Func ); ok && funcObj != funcObj .Origin () {
2153
- log .Fatalf ("Encountered unexpected specialization %s of generic function object %s" , funcObj .FullName (), funcObj .Origin ().FullName ())
2154
- }
2155
- if varObj , ok := obj .(* types.Var ); ok && varObj != varObj .Origin () {
2156
- log .Fatalf ("Encountered unexpected specialization %s of generic variable object %s" , varObj .String (), varObj .Origin ().String ())
2157
- }
2158
- if typeNameObj , ok := obj .(* types.TypeName ); ok {
2159
- if namedType , ok := typeNameObj .Type ().(* types.Named ); ok && namedType != namedType .Origin () {
2160
- log .Fatalf ("Encountered type object for specialization %s of named type %s" , namedType .String (), namedType .Origin ().String ())
2161
- }
2162
- }
2163
- }
0 commit comments