Introduce AbstractTypeMapper based on type markers

This commit is contained in:
Dmitriy Novozhilov
2020-09-22 18:20:57 +03:00
parent 7380abac13
commit 86d4d320c4
5 changed files with 208 additions and 51 deletions
@@ -50,3 +50,28 @@ interface TypeSystemCommonBackendContext : TypeSystemContext {
fun KotlinTypeMarker.isInterfaceOrAnnotationClass(): Boolean
}
interface TypeSystemCommonBackendContextForTypeMapping : TypeSystemCommonBackendContext {
fun TypeConstructorMarker.isTypeParameter(): Boolean
fun TypeConstructorMarker.defaultType(): SimpleTypeMarker
fun SimpleTypeMarker.isSuspendFunction(): Boolean
fun SimpleTypeMarker.isKClass(): Boolean
fun KotlinTypeMarker.isRawType(): Boolean
fun TypeConstructorMarker.typeWithArguments(arguments: List<KotlinTypeMarker>): SimpleTypeMarker
fun TypeConstructorMarker.typeWithArguments(vararg arguments: KotlinTypeMarker): SimpleTypeMarker {
return typeWithArguments(arguments.toList())
}
fun TypeArgumentMarker.adjustedType(): KotlinTypeMarker {
if (this.isStarProjection()) return nullableAnyType()
return getType()
}
fun TypeParameterMarker.representativeUpperBound(): SimpleTypeMarker
fun continuationTypeConstructor(): TypeConstructorMarker
fun functionNTypeConstructor(n: Int): TypeConstructorMarker
}