[FIR] Properly add the outer type parameters

Looks like a type.

^KT-59393 Fixed
(because other differences are related to
nested typealiases)
This commit is contained in:
Nikolay Lunyak
2023-07-11 12:02:18 +03:00
committed by Space Team
parent 4bba93f633
commit a41273b966
4 changed files with 9 additions and 10 deletions
@@ -113,10 +113,9 @@ fun FirResolvedQualifier.continueQualifier(
symbol = nestedClassSymbol as FirClassLikeSymbol<*>
isFullyQualified = true
val outerTypeArguments = this.typeArguments.toList()
this.typeArguments.clear()
this.typeArguments.addAll(typeArguments)
this.typeArguments.addAll(outerTypeArguments)
this.typeArguments.addAll(this@continueQualifier.typeArguments)
this.nonFatalDiagnostics.addAll(nonFatalDiagnosticsFromExpression.orEmpty())
this.nonFatalDiagnostics.addAll(
extractNonFatalDiagnostics(
@@ -1124,14 +1124,14 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
ConeStarProjection
}
}
val typeRef = symbol?.constructType(typeArguments, isNullable = false)
if (typeRef != null) {
val coneType = symbol?.constructType(typeArguments, isNullable = false)
if (coneType != null) {
lhs.replaceTypeRef(
buildResolvedTypeRef { type = typeRef }.also {
buildResolvedTypeRef { type = coneType }.also {
session.lookupTracker?.recordTypeResolveAsLookup(it, getClassCall.source, components.file.source)
}
)
typeRef
coneType
} else {
lhs.resultType.coneType
}
@@ -15,8 +15,8 @@ val n1 = A.Nested::class
val n2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>A.Nested<*>::class<!>
val i1 = A.Inner::class
val i2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>A<*>.Inner<*>::class<!>
val i3 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>A<Int>.Inner<CharSequence>::class<!>
val i2 = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<*>.Inner<*><!>::class
val i3 = <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int>.Inner<CharSequence><!>::class
val m1 = Map::class
val m2 = <!CLASS_LITERAL_LHS_NOT_A_CLASS!>Map<Int, *>::class<!>
@@ -19,8 +19,8 @@ fun test() {
a<Foo.Bar<String>>()
a<Foo.Bar.Baz>()
Foo<String>.Bar::class
Foo<String>.Bar.Baz::class
<!CLASS_LITERAL_LHS_NOT_A_CLASS!>Foo<String>.Bar::class<!>
<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar.Baz<!>::class
a<Foo<String>.<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Bar<!>>()
a<Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar.Baz>()