Introduce an API to convert TypeConstructorMarker to TypeParameterMarker
This commit is contained in:
+10
-2
@@ -28,11 +28,19 @@ internal class KtFe10TypeSystemCommonBackendContextForTypeMapping(
|
||||
override fun TypeConstructorMarker.isTypeParameter(): Boolean {
|
||||
require(this is TypeConstructor)
|
||||
return when (this) {
|
||||
is NewTypeVariableConstructor -> true
|
||||
is NewTypeVariableConstructor -> originalTypeParameter != null
|
||||
else -> declarationDescriptor is TypeParameterDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.asTypeParameter(): TypeParameterMarker {
|
||||
require(this is TypeConstructor)
|
||||
return when (this) {
|
||||
is NewTypeVariableConstructor -> originalTypeParameter!!
|
||||
else -> declarationDescriptor as TypeParameterDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.defaultType(): KotlinTypeMarker {
|
||||
require(this is TypeConstructor)
|
||||
val declaration = declarationDescriptor ?: return ErrorUtils.createErrorType("Unresolved declaration descriptor ($this)")
|
||||
@@ -104,4 +112,4 @@ internal class KtFe10TypeSystemCommonBackendContextForTypeMapping(
|
||||
override fun functionNTypeConstructor(n: Int): TypeConstructorMarker {
|
||||
return builtIns.getKFunction(n).typeConstructor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user