[FIR] KT-48870: Allow resolution to InaccessibleImplicitReceiverValue

^KT-48870 Fixed
This commit is contained in:
Nikolay Lunyak
2023-05-03 17:04:48 +03:00
committed by Space Team
parent f472f68dc5
commit 76df0f9ad1
39 changed files with 119 additions and 171 deletions
@@ -849,6 +849,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
}
@Test
@TestMetadata("receiverResolutionInDelegatedConstructor.kt")
public void testReceiverResolutionInDelegatedConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/receiverResolutionInDelegatedConstructor.kt");
}
@Test
@TestMetadata("RecursiveResolve.kt")
public void testRecursiveResolve() throws Exception {
@@ -849,6 +849,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
}
@Test
@TestMetadata("receiverResolutionInDelegatedConstructor.kt")
public void testReceiverResolutionInDelegatedConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/receiverResolutionInDelegatedConstructor.kt");
}
@Test
@TestMetadata("RecursiveResolve.kt")
public void testRecursiveResolve() throws Exception {
@@ -1,6 +1,6 @@
FILE: instanceAccessBeforeSuperCall.kt
public final class A : R|kotlin/Any| {
public constructor(x: R|kotlin/Int| = <Unresolved name: getSomeInt>#(), other: R|A| = this@R|/A|, header: R|kotlin/String| = <Unresolved name: keker>#): R|A| {
public constructor(x: R|kotlin/Int| = this@R|/A|.R|/A.getSomeInt<Inapplicable(RESOLVED_WITH_ERROR): /A.getSomeInt>#|(), other: R|A| = this@R|/A|, header: R|kotlin/String| = this@R|/A|.R|/A.keker<Inapplicable(RESOLVED_WITH_ERROR): /A.keker>#|): R|A| {
super<R|kotlin/Any|>()
}
@@ -1,5 +1,5 @@
class A {
constructor(x: Int = <!UNRESOLVED_REFERENCE!>getSomeInt<!>(), other: A = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>, header: String = <!UNRESOLVED_REFERENCE!>keker<!>) {}
constructor(x: Int = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>getSomeInt<!>(), other: A = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>, header: String = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>keker<!>) {}
fun getSomeInt() = 10
var keker = "test"
}
@@ -849,6 +849,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
}
@Test
@TestMetadata("receiverResolutionInDelegatedConstructor.kt")
public void testReceiverResolutionInDelegatedConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/receiverResolutionInDelegatedConstructor.kt");
}
@Test
@TestMetadata("RecursiveResolve.kt")
public void testRecursiveResolve() throws Exception {
@@ -849,6 +849,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
}
@Test
@TestMetadata("receiverResolutionInDelegatedConstructor.kt")
public void testReceiverResolutionInDelegatedConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/receiverResolutionInDelegatedConstructor.kt");
}
@Test
@TestMetadata("RecursiveResolve.kt")
public void testRecursiveResolve() throws Exception {
@@ -301,6 +301,8 @@ private fun mapInapplicableCandidateError(
isError = rootCause.isError
)
is InaccessibleReceiver -> FirErrors.INSTANCE_ACCESS_BEFORE_SUPER_CALL.createOn(source, "<this>")
else -> genericDiagnostic
}
}.distinct()
@@ -24,6 +24,7 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
LowerPriorityIfDynamic,
ConstraintSystemForks,
CheckIncompatibleTypeVariableUpperBounds,
InaccessibleReceiverResolutionStage,
)
object SyntheticSelect : CallKind(
@@ -59,6 +60,7 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
LowerPriorityIfDynamic,
ConstraintSystemForks,
CheckIncompatibleTypeVariableUpperBounds,
InaccessibleReceiverResolutionStage,
)
object DelegatingConstructorCall : CallKind(
@@ -94,6 +96,7 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
CheckIncompatibleTypeVariableUpperBounds,
ProcessDynamicExtensionAnnotation,
LowerPriorityIfDynamic,
InaccessibleReceiverResolutionStage,
)
object SyntheticIdForCallableReferencesResolution : CallKind(
@@ -698,3 +698,14 @@ internal object ConstraintSystemForks : ResolutionStage() {
}
}
}
internal object InaccessibleReceiverResolutionStage : ResolutionStage() {
override suspend fun check(candidate: Candidate, callInfo: CallInfo, sink: CheckerSink, context: ResolutionContext) {
if (
candidate.dispatchReceiverValue is InaccessibleImplicitReceiverValue ||
candidate.givenExtensionReceiverOptions.any { it is InaccessibleImplicitReceiverValue }
) {
sink.yieldDiagnostic(InaccessibleReceiver)
}
}
}
@@ -159,7 +159,7 @@ internal abstract class FirBaseTowerResolveTask(
val receiver = lexical.implicitReceiver
if (receiver != null && receiver !is InaccessibleImplicitReceiverValue) {
if (receiver != null) {
onImplicitReceiver(receiver, parentGroup.Implicit(depth))
}
}
@@ -141,3 +141,5 @@ class NoApplicableValueForContextReceiver(
class AmbiguousValuesForContextReceiverParameter(
val expectedContextReceiverType: ConeKotlinType,
) : ResolutionDiagnostic(INAPPLICABLE)
object InaccessibleReceiver : ResolutionDiagnostic(RESOLVED_WITH_ERROR)
@@ -1,11 +1,11 @@
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: unresolved reference: getSomeInt
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:26: error: cannot access '<this>' before the instance has been initialized
constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
^
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:51: error: cannot access '<this>' before the instance has been initialized
constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
^
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:74: error: unresolved reference: keker
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:2:74: error: cannot access '<this>' before the instance has been initialized
constructor(x: Int = getSomeInt(), other: A = this, header: String = keker) {}
^
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:7:20: error: 'this' is not defined in this context
@@ -0,0 +1,36 @@
// FIR_IDENTICAL
// ISSUE: KT-48870
open class Base(p: Any?) {
open fun foo1() {}
}
class Vase(p: Any?) : Base(p) {
override fun foo1() {}
}
fun Vase.test1() {
class B : Base {
// FIR: OK, it's this@foo.foo1()
// FE 1.0: INSTANCE_ACCESS_BEFORE_SUPER_CALL
constructor() : super(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo1<!>())
}
}
fun Base.test2() {
class B : Base(foo1()) {}
}
open class BaseLambda(lambda: () -> Any?) {
fun foo1() {}
}
fun Base.test3() {
class B : Base {
constructor() : super({ <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo1<!>() })
}
}
fun Base.test4() {
class B : Base({ foo1() }) {}
}
@@ -1,65 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(
n: Nested = foo(),
n2: Nested = Nested(),
inn: Inner = null!!,
inn2: Inner = <!RESOLUTION_TO_CLASSIFIER!>Inner<!>(),
i: Interface = null!!,
c: Int = CONST,
cc: Int = Companion.CONST,
cn: Int = Nested.CONST,
ci: Int = Interface.CONST,
t1: Int = <!UNRESOLVED_REFERENCE!>a<!>,
t2: Int = <!UNRESOLVED_REFERENCE!>b<!>()
) {
constructor(
dummy: Int,
n: Nested = foo(),
n2: Nested = Nested(),
inn: Inner = null!!,
inn2: Inner = <!RESOLUTION_TO_CLASSIFIER!>Inner<!>(),
i: Interface = null!!,
c: Int = CONST,
cc: Int = Companion.CONST,
cn: Int = Nested.CONST,
ci: Int = Interface.CONST,
t1: Int = <!UNRESOLVED_REFERENCE!>a<!>,
t2: Int = <!UNRESOLVED_REFERENCE!>b<!>()
) : this(
foo(),
Nested(),
inn,
<!RESOLUTION_TO_CLASSIFIER!>Inner<!>(),
i,
CONST,
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
)
class Nested {
companion object {
const val CONST = 2
}
}
inner class Inner
interface Interface {
companion object {
const val CONST = 3
}
}
val a = 1
fun b() = 2
companion object {
const val CONST = 1
fun foo(): Nested = null!!
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(
@@ -17,13 +17,13 @@ class A : S {
constructor() : super(
foo(),
Nested(),
<!RESOLUTION_TO_CLASSIFIER!>Inner<!>(),
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>(),
CONST,
Companion.CONST,
Nested.CONST,
Interface.CONST,
<!UNRESOLVED_REFERENCE!>a<!>,
<!UNRESOLVED_REFERENCE!>b<!>()
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>a<!>,
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>b<!>()
)
class Nested {
@@ -1,12 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
fun foo1(t: T) {}
}
class D: Base<Int>("") {
inner class B : Base<String> {
constructor() : super(foo1(<!ARGUMENT_TYPE_MISMATCH!>""<!>))
constructor(x: Int) : super(foo1(1))
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
@@ -1,13 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
fun foo1(t: T) {}
}
class D: Base<Int>(1) {
inner class B : Base<Int> {
constructor() : super(foo1(1))
constructor(x: Int) : super(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@B<!>.foo1(1))
constructor(x: Int, y: Int) : super(this@D.foo1(1))
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
@@ -1,12 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base(p: Any?) {
fun foo1() {}
}
fun Base.foo() {
class B : Base {
constructor() : super(foo1())
constructor(x: Int) : super(this@foo.foo1())
constructor(x: Int, y: Int) : super(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@B<!>.foo1())
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base(p: Any?) {
fun foo1() {}
@@ -1,13 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
fun foo1(t: T) {}
}
fun Base<Int>.foo() {
class B : Base<String> {
constructor() : super(foo1(<!ARGUMENT_TYPE_MISMATCH!>""<!>))
constructor(x: Int) : super(foo1(1))
constructor(x: Int, y: Int) : super(this@foo.foo1(12))
constructor(x: Int, y: Int, z: Int) : super(<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@B<!>.foo1(""))
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Base<T>(p: Any?) {
fun foo1(t: T) {}
@@ -6,6 +6,6 @@ class Outer {
}
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!RESOLUTION_TO_CLASSIFIER!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.Inner().prop<!>) :
this(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!RESOLUTION_TO_CLASSIFIER!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.Inner().prop<!>)
constructor(x: Int, y: Int, z: Int = x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>().prop <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.Inner().prop) :
this(x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>().prop <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.Inner().prop)
}
@@ -7,9 +7,9 @@ class A {
constructor(x: () -> Int)
constructor() : this(
{
<!ARGUMENT_TYPE_MISMATCH, TYPE_MISMATCH!><!UNRESOLVED_REFERENCE!>foo<!>() +
<!ARGUMENT_TYPE_MISMATCH, TYPE_MISMATCH!><!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!>
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
<!UNRESOLVED_REFERENCE!>foobar<!>()<!>
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foobar<!>()<!>
})
}
@@ -2,6 +2,6 @@
class A {
fun foo() = 1
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo()<!>) :
this(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo()<!>)
constructor(x: Int, y: Int, z: Int = x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo()) :
this(x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo())
}
@@ -6,7 +6,7 @@ class A {
fun foo() = 1
constructor(x: Any?)
constructor() : this(object {
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foobar<!>() + super<!UNRESOLVED_LABEL!>@A<!>.hashCode()
fun bar() = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foobar<!>() + super<!UNRESOLVED_LABEL!>@A<!>.hashCode()
})
}
@@ -5,7 +5,7 @@ fun A.foobar() = 3
class A {
fun foo() = 1
constructor( x: Any = object {
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foobar<!>()
fun bar() = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foobar<!>()
})
}
@@ -1,13 +0,0 @@
open class C(val x: Int)
class D : C {
constructor() : super(
{
val s = ""
<!UNRESOLVED_REFERENCE!>s<!>()
<!FUNCTION_EXPECTED!>""<!>()
42
}())
operator fun String.invoke() { }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
open class C(val x: Int)
class D : C {
@@ -2,6 +2,6 @@
class A {
val prop = 1
constructor(x: Int)
constructor(x: Int, y: Int, z: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop<!>) :
this(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop<!>)
constructor(x: Int, y: Int, z: Int = x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop) :
this(x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop)
}
@@ -2,6 +2,6 @@
open class B(x: Int)
class A : B {
val prop = 1
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop<!>)
constructor(x: Int, y: Int = x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop) :
super(x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop)
}
@@ -3,6 +3,6 @@ open class B(x: Int) {
fun foo() = 1
}
class A : B {
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>)
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>)
}
@@ -4,6 +4,6 @@ open class B(x: Int) {
}
class A : B {
override fun foo() = 2
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>)
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>)
}
@@ -1,6 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(val prop: Int)
class A : B {
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.prop<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.prop<!>)
constructor(x: Int, y: Int = <!TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.prop<!>) :
super(<!ARGUMENT_TYPE_MISMATCH!>x + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.prop<!>)
}
@@ -1,15 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun A.foobar() = 1
val A.prop: Int get() = 2
class A {
constructor(x: Int)
constructor() : this(
<!ARGUMENT_TYPE_MISMATCH!><!UNRESOLVED_REFERENCE!>foobar<!>() +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foobar() +
<!UNRESOLVED_REFERENCE!>prop<!> +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop +
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.prop<!>
)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun A.foobar() = 1
@@ -849,6 +849,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
}
@Test
@TestMetadata("receiverResolutionInDelegatedConstructor.kt")
public void testReceiverResolutionInDelegatedConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/receiverResolutionInDelegatedConstructor.kt");
}
@Test
@TestMetadata("RecursiveResolve.kt")
public void testRecursiveResolve() throws Exception {