[FIR] Don't transform call arguments during TYPES phase

Instead, it should happen during BODY_RESOLVE phase.

This fixes KT-66150. The problem was, that `super<B>.f()` expression
in delegated constructor call was transformed during TYPES phase,
and type transformer has no special logic for allowing bare types in
super qualifiers, like the one in expressions transformer (see
`org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer.transformSuperReceiver`).
As a result, `B` without type argument leads to
WrongNumberOfTypeArgumentsError.
It looks incorrect that expressions in constructor call resolved
during TYPES phase, so skipping transformation of
argument list seems like the best solution here.

^KT-66150 Fixed
This commit is contained in:
Roman Efremov
2024-03-12 11:38:41 +01:00
committed by Space Team
parent c4f89ab32e
commit 284d5437e5
5 changed files with 14 additions and 37 deletions
@@ -1,15 +0,0 @@
interface B<T> {
fun f() = true
}
open class A(b: Boolean)
class C : B<Int> {
inner class Inner : A(super<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>B<!>>.<!UNRESOLVED_REFERENCE!>f<!>())
inner class Inner2 : A(super<B<!TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER!><Int><!>>.f())
fun test() {
class LocalClass : A(super<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>B<!>>.<!UNRESOLVED_REFERENCE!>f<!>())
class LocalClass2 : A(super<B<!TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER!><Int><!>>.f())
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface B<T> {
fun f() = true
}
@@ -1,18 +0,0 @@
// LL_FIR_DIVERGENCE
// WRONG_NUMBER_OF_TYPE_ARGUMENTS not reported in Inner class because of BodyBuildingMode.LAZY_BODIES
// LL_FIR_DIVERGENCE
interface B<T> {
fun f() = true
}
open class A(b: Boolean)
class C : B<Int> {
inner class Inner : A(super<B>.f())
inner class Inner2 : A(super<B<!TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER!><Int><!>>.f())
fun test() {
class LocalClass : A(super<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>B<!>>.<!UNRESOLVED_REFERENCE!>f<!>())
class LocalClass2 : A(super<B<!TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER!><Int><!>>.f())
}
}