FIR: fix source of callee reference in delegated constructor call

Previously the callee reference of a delegated constructor call is
always the same as the call itself. This violates the contract that no
two FIR elements can have identical sources.  In addition, this sets the
entire call expression as the source of the callee expression.

This change instead sets the proper constructor ref as the callee.

Also fixed EXPLICIT_DELEGATION_CALL_REQUIRED type. It should be an error
instead of a warning.
This commit is contained in:
Tianyu Geng
2021-03-25 16:27:03 -07:00
committed by Dmitriy Novozhilov
parent fb14b03824
commit ae902e6fe5
16 changed files with 59 additions and 22 deletions
@@ -10,18 +10,18 @@ open class A3(x: String, y: String = "") {
constructor(x: String, b: Boolean = true) : this(x, x)
}
class B3_1 : <!AMBIGUITY{LT}!><!AMBIGUITY{PSI}!>A3<!>("")<!>
class B3_1 : <!AMBIGUITY!>A3<!>("")
class B3_2 : A3("", "asas")
class B3_3 : A3("", true)
class B3_4 : <!NONE_APPLICABLE{LT}!><!NONE_APPLICABLE{PSI}!>A3<!>("", Unit)<!>
class B3_4 : <!NONE_APPLICABLE!>A3<!>("", Unit)
open class A4(val x: Byte)
class B4 : <!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>A4<!>( 1 + 1)<!>
class B4 : <!INAPPLICABLE_CANDIDATE!>A4<!>( 1 + 1)
open class A5 {
constructor(x: Byte)
constructor(x: Short)
}
class B5_1 : <!NONE_APPLICABLE{LT}!><!NONE_APPLICABLE{PSI}!>A5<!>(1 + 1)<!>
class B5_2 : <!NONE_APPLICABLE{LT}!><!NONE_APPLICABLE{PSI}!>A5<!>(100 * 2)<!>
class B5_1 : <!NONE_APPLICABLE!>A5<!>(1 + 1)
class B5_2 : <!NONE_APPLICABLE!>A5<!>(100 * 2)