JVM IR: reuse JVM code for reified type parameter mappings instead of copy-paste

This commit is contained in:
Alexander Udalov
2019-09-04 16:19:14 +02:00
parent d1df453edc
commit d16bdded7f
10 changed files with 83 additions and 168 deletions
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.types.model.*
interface TypeSystemCommonBackendContext : TypeSystemContext {
fun nullableAnyType(): SimpleTypeMarker
fun arrayType(componentType: KotlinTypeMarker): SimpleTypeMarker
fun KotlinTypeMarker.isArrayOrNullableArray(): Boolean
fun TypeConstructorMarker.isFinalClassOrEnumEntryOrAnnotationClassConstructor(): Boolean
@@ -508,6 +508,11 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
return builtIns.getArrayType(Variance.INVARIANT, componentType)
}
override fun KotlinTypeMarker.isArrayOrNullableArray(): Boolean {
require(this is KotlinType, this::errorMessage)
return KotlinBuiltIns.isArray(this)
}
override fun KotlinTypeMarker.hasAnnotation(fqName: FqName): Boolean {
require(this is KotlinType, this::errorMessage)
return annotations.hasAnnotation(fqName)