mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Erasure: produce raw types, not unbound types
This affects the trap labels for methods, and therefore consistency with the Java extractor. TODO: check whether we can unify `erase` and `toRawType` entirely.
This commit is contained in:
committed by
Ian Lynagh
parent
97d44d9583
commit
db9ab22437
@@ -320,7 +320,7 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
}
|
||||
|
||||
// `typeArgs` can be null to describe a raw generic type.
|
||||
// `argsIncludingOuterClasses` can be null to describe a raw generic type.
|
||||
// For non-generic types it will be zero-length list.
|
||||
fun extractMemberPrototypes(c: IrClass, argsIncludingOuterClasses: List<IrTypeArgument>?, id: Label<out DbClassorinterface>) {
|
||||
with("member prototypes", c) {
|
||||
|
||||
@@ -1071,7 +1071,10 @@ open class KotlinUsesExtractor(
|
||||
}
|
||||
|
||||
if (owner is IrClass) {
|
||||
return withQuestionMark((classifier as IrClassSymbol).typeWith(), t.hasQuestionMark)
|
||||
return if (t.arguments.isNotEmpty())
|
||||
t.addAnnotations(listOf(RawTypeAnnotation.annotationConstructor))
|
||||
else
|
||||
t
|
||||
}
|
||||
}
|
||||
return t
|
||||
|
||||
@@ -127,7 +127,7 @@ fun IrType.substituteTypeAndArguments(substitutionMap: Map<IrTypeParameterSymbol
|
||||
} ?: this
|
||||
} ?: this
|
||||
|
||||
private object RawTypeAnnotation {
|
||||
object RawTypeAnnotation {
|
||||
// Much of this is taken from JvmGeneratorExtensionsImpl.kt, which is not easily accessible in plugin context.
|
||||
// The constants "kotlin.internal.ir" and "RawType" could be referred to symbolically, but they move package
|
||||
// between different versions of the Kotlin compiler.
|
||||
|
||||
Reference in New Issue
Block a user