[FIR] Keep bare type for type alias case

This commit is contained in:
Mikhail Glukhikh
2020-09-01 15:52:04 +03:00
parent 3a5d0ab427
commit db2e3f219f
3 changed files with 4 additions and 2 deletions
@@ -71,6 +71,9 @@ private fun mapTypeAliasArguments(
abbreviatedType: ConeClassLikeType, abbreviatedType: ConeClassLikeType,
resultingType: ConeClassLikeType, resultingType: ConeClassLikeType,
): ConeKotlinType { ): ConeKotlinType {
if (typeAlias.typeParameters.isNotEmpty() && abbreviatedType.typeArguments.isEmpty()) {
return resultingType.lookupTag.constructClassType(emptyArray(), resultingType.isNullable)
}
val typeAliasMap = typeAlias.typeParameters.map { it.symbol }.zip(abbreviatedType.typeArguments).toMap() val typeAliasMap = typeAlias.typeParameters.map { it.symbol }.zip(abbreviatedType.typeArguments).toMap()
val substitutor = object : AbstractConeSubstitutor() { val substitutor = object : AbstractConeSubstitutor() {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME // KJS_WITH_FULL_RUNTIME
// IGNORE_BACKEND: NATIVE // IGNORE_BACKEND: NATIVE
@@ -3,5 +3,5 @@ open class Ref<T>(var x: T)
typealias R<T> = Ref<T> typealias R<T> = Ref<T>
// Type inference SHOULD NOT work for type alias constructor in supertypes list // Type inference SHOULD NOT work for type alias constructor in supertypes list
class Test1 : <!INAPPLICABLE_CANDIDATE!>R<!>(0) class Test1 : R(0)
class Test2 : R<Int>(0) class Test2 : R<Int>(0)