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:
Chris Smowton
2022-03-24 12:10:16 +00:00
committed by Ian Lynagh
parent 97d44d9583
commit db9ab22437
3 changed files with 6 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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

View File

@@ -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.