Do subtyping with stub types properly

1) Return stub type if we are calculating super type between two same stub types
2) Return nullable Any if those stub types are different
This commit is contained in:
Victor Petukhov
2021-04-27 14:05:35 +03:00
parent 5d0461c722
commit ac7b459f2a
49 changed files with 1536 additions and 75 deletions
@@ -77,6 +77,13 @@ class ClassicTypeSystemContextForCS(override val builtIns: KotlinBuiltIns) : Typ
return StubType(typeVariable.freshTypeConstructor() as TypeConstructor, typeVariable.defaultType().isMarkedNullable())
}
override fun createStubTypeForTypeVariablesInSubtyping(typeVariable: TypeVariableMarker): StubTypeMarker {
return StubTypeForTypeVariablesInSubtyping(
typeVariable.freshTypeConstructor() as TypeConstructor,
typeVariable.defaultType().isMarkedNullable()
)
}
override fun TypeConstructorMarker.isTypeVariable(): Boolean {
return this is TypeVariableTypeConstructor
}