@@ -1038,8 +1038,13 @@ deprecated class NamedType = DefinedType;
1038
1038
1039
1039
/** A defined type. */
1040
1040
class DefinedType extends @definedtype, CompositeType {
1041
- /** Gets the type which this type is defined to be. */
1042
- Type getBaseType ( ) { underlying_type ( this , result ) }
1041
+ /**
1042
+ * Gets the type which this type is defined to be, if available.
1043
+ *
1044
+ * Note that this is only defined for types declared in the project being
1045
+ * analyzed. It will not be defined for type declared in external packages.
1046
+ */
1047
+ Type getBaseType ( ) { result = this .getEntity ( ) .( DeclaredType ) .getSpec ( ) .getTypeExpr ( ) .getType ( ) }
1043
1048
1044
1049
override Method getMethod ( string m ) {
1045
1050
result = CompositeType .super .getMethod ( m )
@@ -1049,7 +1054,7 @@ class DefinedType extends @definedtype, CompositeType {
1049
1054
or
1050
1055
// handle promoted methods
1051
1056
exists ( StructType s , Type embedded |
1052
- s = this .getBaseType ( ) and
1057
+ s = this .getUnderlyingType ( ) and
1053
1058
s .hasOwnField ( _, _, embedded , true ) and
1054
1059
// ensure `m` can be promoted
1055
1060
not s .hasOwnField ( _, m , _, _) and
@@ -1063,7 +1068,7 @@ class DefinedType extends @definedtype, CompositeType {
1063
1068
)
1064
1069
}
1065
1070
1066
- override Type getUnderlyingType ( ) { result = this . getBaseType ( ) . getUnderlyingType ( ) }
1071
+ override Type getUnderlyingType ( ) { underlying_type ( this , result ) }
1067
1072
}
1068
1073
1069
1074
/**
0 commit comments