Introduce an API to convert TypeConstructorMarker to TypeParameterMarker
This commit is contained in:
@@ -122,7 +122,7 @@ object AbstractTypeMapper {
|
||||
}
|
||||
|
||||
typeConstructor.isTypeParameter() -> {
|
||||
val typeParameter = typeConstructor as TypeParameterMarker
|
||||
val typeParameter = typeConstructor.asTypeParameter()
|
||||
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->
|
||||
sw?.writeTypeVariable(typeParameter.getName(), asmType)
|
||||
}
|
||||
|
||||
+5
@@ -207,6 +207,11 @@ class ConeTypeSystemCommonBackendContextForTypeMapping(
|
||||
return this is ConeTypeParameterLookupTag
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.asTypeParameter(): TypeParameterMarker {
|
||||
require(isTypeParameter())
|
||||
return this as ConeTypeParameterLookupTag
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.defaultType(): ConeSimpleKotlinType {
|
||||
require(this is ConeClassifierLookupTag)
|
||||
return when (this) {
|
||||
|
||||
@@ -223,6 +223,11 @@ private class IrTypeCheckerContextForTypeMapping(
|
||||
return this is IrTypeParameterSymbol
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.asTypeParameter(): TypeParameterMarker {
|
||||
require(isTypeParameter())
|
||||
return this as IrTypeParameterSymbol
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.defaultType(): IrType {
|
||||
return when (this) {
|
||||
is IrClassSymbol -> owner.defaultType
|
||||
|
||||
Reference in New Issue
Block a user