[FIR] KT-48870: Allow resolution to InaccessibleImplicitReceiverValue
^KT-48870 Fixed
This commit is contained in:
committed by
Space Team
parent
f472f68dc5
commit
76df0f9ad1
+6
@@ -849,6 +849,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
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
|
@Test
|
||||||
@TestMetadata("RecursiveResolve.kt")
|
@TestMetadata("RecursiveResolve.kt")
|
||||||
public void testRecursiveResolve() throws Exception {
|
public void testRecursiveResolve() throws Exception {
|
||||||
|
|||||||
+6
@@ -849,6 +849,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
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
|
@Test
|
||||||
@TestMetadata("RecursiveResolve.kt")
|
@TestMetadata("RecursiveResolve.kt")
|
||||||
public void testRecursiveResolve() throws Exception {
|
public void testRecursiveResolve() throws Exception {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
FILE: instanceAccessBeforeSuperCall.kt
|
FILE: instanceAccessBeforeSuperCall.kt
|
||||||
public final class A : R|kotlin/Any| {
|
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|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
class A {
|
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
|
fun getSomeInt() = 10
|
||||||
var keker = "test"
|
var keker = "test"
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -849,6 +849,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
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
|
@Test
|
||||||
@TestMetadata("RecursiveResolve.kt")
|
@TestMetadata("RecursiveResolve.kt")
|
||||||
public void testRecursiveResolve() throws Exception {
|
public void testRecursiveResolve() throws Exception {
|
||||||
|
|||||||
+6
@@ -849,6 +849,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
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
|
@Test
|
||||||
@TestMetadata("RecursiveResolve.kt")
|
@TestMetadata("RecursiveResolve.kt")
|
||||||
public void testRecursiveResolve() throws Exception {
|
public void testRecursiveResolve() throws Exception {
|
||||||
|
|||||||
+2
@@ -301,6 +301,8 @@ private fun mapInapplicableCandidateError(
|
|||||||
isError = rootCause.isError
|
isError = rootCause.isError
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is InaccessibleReceiver -> FirErrors.INSTANCE_ACCESS_BEFORE_SUPER_CALL.createOn(source, "<this>")
|
||||||
|
|
||||||
else -> genericDiagnostic
|
else -> genericDiagnostic
|
||||||
}
|
}
|
||||||
}.distinct()
|
}.distinct()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
|
|||||||
LowerPriorityIfDynamic,
|
LowerPriorityIfDynamic,
|
||||||
ConstraintSystemForks,
|
ConstraintSystemForks,
|
||||||
CheckIncompatibleTypeVariableUpperBounds,
|
CheckIncompatibleTypeVariableUpperBounds,
|
||||||
|
InaccessibleReceiverResolutionStage,
|
||||||
)
|
)
|
||||||
|
|
||||||
object SyntheticSelect : CallKind(
|
object SyntheticSelect : CallKind(
|
||||||
@@ -59,6 +60,7 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
|
|||||||
LowerPriorityIfDynamic,
|
LowerPriorityIfDynamic,
|
||||||
ConstraintSystemForks,
|
ConstraintSystemForks,
|
||||||
CheckIncompatibleTypeVariableUpperBounds,
|
CheckIncompatibleTypeVariableUpperBounds,
|
||||||
|
InaccessibleReceiverResolutionStage,
|
||||||
)
|
)
|
||||||
|
|
||||||
object DelegatingConstructorCall : CallKind(
|
object DelegatingConstructorCall : CallKind(
|
||||||
@@ -94,6 +96,7 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) {
|
|||||||
CheckIncompatibleTypeVariableUpperBounds,
|
CheckIncompatibleTypeVariableUpperBounds,
|
||||||
ProcessDynamicExtensionAnnotation,
|
ProcessDynamicExtensionAnnotation,
|
||||||
LowerPriorityIfDynamic,
|
LowerPriorityIfDynamic,
|
||||||
|
InaccessibleReceiverResolutionStage,
|
||||||
)
|
)
|
||||||
|
|
||||||
object SyntheticIdForCallableReferencesResolution : CallKind(
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -159,7 +159,7 @@ internal abstract class FirBaseTowerResolveTask(
|
|||||||
|
|
||||||
val receiver = lexical.implicitReceiver
|
val receiver = lexical.implicitReceiver
|
||||||
|
|
||||||
if (receiver != null && receiver !is InaccessibleImplicitReceiverValue) {
|
if (receiver != null) {
|
||||||
onImplicitReceiver(receiver, parentGroup.Implicit(depth))
|
onImplicitReceiver(receiver, parentGroup.Implicit(depth))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -141,3 +141,5 @@ class NoApplicableValueForContextReceiver(
|
|||||||
class AmbiguousValuesForContextReceiverParameter(
|
class AmbiguousValuesForContextReceiverParameter(
|
||||||
val expectedContextReceiverType: ConeKotlinType,
|
val expectedContextReceiverType: ConeKotlinType,
|
||||||
) : ResolutionDiagnostic(INAPPLICABLE)
|
) : 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
|
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) {}
|
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
|
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) {}
|
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) {}
|
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
|
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:7:20: error: 'this' is not defined in this context
|
||||||
|
|||||||
+36
@@ -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
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
class A(
|
class A(
|
||||||
|
|||||||
+3
-3
@@ -17,13 +17,13 @@ class A : S {
|
|||||||
constructor() : super(
|
constructor() : super(
|
||||||
foo(),
|
foo(),
|
||||||
Nested(),
|
Nested(),
|
||||||
<!RESOLUTION_TO_CLASSIFIER!>Inner<!>(),
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>Inner<!>(),
|
||||||
CONST,
|
CONST,
|
||||||
Companion.CONST,
|
Companion.CONST,
|
||||||
Nested.CONST,
|
Nested.CONST,
|
||||||
Interface.CONST,
|
Interface.CONST,
|
||||||
<!UNRESOLVED_REFERENCE!>a<!>,
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>a<!>,
|
||||||
<!UNRESOLVED_REFERENCE!>b<!>()
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>b<!>()
|
||||||
)
|
)
|
||||||
|
|
||||||
class Nested {
|
class Nested {
|
||||||
|
|||||||
-12
@@ -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
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
open class Base<T>(p: Any?) {
|
open class Base<T>(p: Any?) {
|
||||||
|
|||||||
-13
@@ -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
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
open class Base<T>(p: Any?) {
|
open class Base<T>(p: Any?) {
|
||||||
|
|||||||
-12
@@ -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
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
open class Base(p: Any?) {
|
open class Base(p: Any?) {
|
||||||
fun foo1() {}
|
fun foo1() {}
|
||||||
|
|||||||
-13
@@ -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
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
open class Base<T>(p: Any?) {
|
open class Base<T>(p: Any?) {
|
||||||
fun foo1(t: T) {}
|
fun foo1(t: T) {}
|
||||||
|
|||||||
+2
-2
@@ -6,6 +6,6 @@ class Outer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(x: Int)
|
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<!>) :
|
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(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!RESOLUTION_TO_CLASSIFIER!>Inner<!>().<!UNRESOLVED_REFERENCE!>prop<!> + <!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)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -7,9 +7,9 @@ class A {
|
|||||||
constructor(x: () -> Int)
|
constructor(x: () -> Int)
|
||||||
constructor() : this(
|
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<!>.foo() +
|
||||||
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
|
||||||
<!UNRESOLVED_REFERENCE!>foobar<!>()<!>
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foobar<!>()<!>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,6 +2,6 @@
|
|||||||
class A {
|
class A {
|
||||||
fun foo() = 1
|
fun foo() = 1
|
||||||
constructor(x: Int)
|
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()<!>) :
|
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(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>foo<!>() + <!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())
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@ class A {
|
|||||||
fun foo() = 1
|
fun foo() = 1
|
||||||
constructor(x: Any?)
|
constructor(x: Any?)
|
||||||
constructor() : this(object {
|
constructor() : this(object {
|
||||||
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
|
fun bar() = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
|
||||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foobar<!>() + super<!UNRESOLVED_LABEL!>@A<!>.hashCode()
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foobar<!>() + super<!UNRESOLVED_LABEL!>@A<!>.hashCode()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -5,7 +5,7 @@ fun A.foobar() = 3
|
|||||||
class A {
|
class A {
|
||||||
fun foo() = 1
|
fun foo() = 1
|
||||||
constructor( x: Any = object {
|
constructor( x: Any = object {
|
||||||
fun bar() = <!UNRESOLVED_REFERENCE!>foo<!>() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
|
fun bar() = <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this@A<!>.foo() +
|
||||||
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foobar<!>()
|
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foobar<!>()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
-13
@@ -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() { }
|
|
||||||
}
|
|
||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
open class C(val x: Int)
|
open class C(val x: Int)
|
||||||
|
|
||||||
class D : C {
|
class D : C {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,6 +2,6 @@
|
|||||||
class A {
|
class A {
|
||||||
val prop = 1
|
val prop = 1
|
||||||
constructor(x: Int)
|
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<!>) :
|
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(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!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
-2
@@ -2,6 +2,6 @@
|
|||||||
open class B(x: Int)
|
open class B(x: Int)
|
||||||
class A : B {
|
class A : B {
|
||||||
val prop = 1
|
val prop = 1
|
||||||
constructor(x: Int, y: Int = <!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(<!ARGUMENT_TYPE_MISMATCH!>x <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>prop<!> + <!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)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -3,6 +3,6 @@ open class B(x: Int) {
|
|||||||
fun foo() = 1
|
fun foo() = 1
|
||||||
}
|
}
|
||||||
class A : B {
|
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()<!>) :
|
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 <!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 + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -4,6 +4,6 @@ open class B(x: Int) {
|
|||||||
}
|
}
|
||||||
class A : B {
|
class A : B {
|
||||||
override fun foo() = 2
|
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()<!>) :
|
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 <!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 + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>foo<!>() <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.foo() + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.foo()<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
open class B(val prop: Int)
|
open class B(val prop: Int)
|
||||||
class A : B {
|
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<!>) :
|
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 <!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 + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>prop<!> <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>.prop + <!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>super<!>.prop<!>)
|
||||||
}
|
}
|
||||||
|
|||||||
-15
@@ -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
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
fun A.foobar() = 1
|
fun A.foobar() = 1
|
||||||
|
|||||||
Generated
+6
@@ -849,6 +849,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/rawCastToStarProjection_Ok.kt");
|
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
|
@Test
|
||||||
@TestMetadata("RecursiveResolve.kt")
|
@TestMetadata("RecursiveResolve.kt")
|
||||||
public void testRecursiveResolve() throws Exception {
|
public void testRecursiveResolve() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user