mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Fix definition of DefinedType.getBaseType
This commit is contained in:
@@ -1038,8 +1038,13 @@ deprecated class NamedType = DefinedType;
|
||||
|
||||
/** A defined type. */
|
||||
class DefinedType extends @definedtype, CompositeType {
|
||||
/** Gets the type which this type is defined to be. */
|
||||
Type getBaseType() { underlying_type(this, result) }
|
||||
/**
|
||||
* Gets the type which this type is defined to be, if available.
|
||||
*
|
||||
* Note that this is only defined for types declared in the project being
|
||||
* analyzed. It will not be defined for type declared in external packages.
|
||||
*/
|
||||
Type getBaseType() { result = this.getEntity().(DeclaredType).getSpec().getTypeExpr().getType() }
|
||||
|
||||
override Method getMethod(string m) {
|
||||
result = CompositeType.super.getMethod(m)
|
||||
@@ -1049,7 +1054,7 @@ class DefinedType extends @definedtype, CompositeType {
|
||||
or
|
||||
// handle promoted methods
|
||||
exists(StructType s, Type embedded |
|
||||
s = this.getBaseType() and
|
||||
s = this.getUnderlyingType() and
|
||||
s.hasOwnField(_, _, embedded, true) and
|
||||
// ensure `m` can be promoted
|
||||
not s.hasOwnField(_, m, _, _) and
|
||||
@@ -1063,7 +1068,7 @@ class DefinedType extends @definedtype, CompositeType {
|
||||
)
|
||||
}
|
||||
|
||||
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
|
||||
override Type getUnderlyingType() { underlying_type(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user