diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt index bec24014444..ddab95951e7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/TowerResolver.kt @@ -72,16 +72,9 @@ class TowerResolver { return run(context, processor, false, AllCandidatesCollector(context)) } - private fun ScopeTower.createLevels(): List { + private fun ScopeTower.createNonLocalLevels(): List { val result = ArrayList() - // locals win - lexicalScope.parentsWithSelf. - filterIsInstance(). - filter { it.kind.withLocalDescriptors }. - mapTo(result) { ScopeBasedTowerLevel(this, it) } - - var isFirstImportingScope = true lexicalScope.parentsWithSelf.forEach { scope -> if (scope is LexicalScope) { if (!scope.kind.withLocalDescriptors) result.add(ScopeBasedTowerLevel(this, scope)) @@ -89,10 +82,6 @@ class TowerResolver { scope.implicitReceiver?.let { result.add(ReceiverScopeTowerLevel(this, it.value)) } } else { - if (isFirstImportingScope) { - isFirstImportingScope = false - result.add(SyntheticScopeBasedTowerLevel(this, syntheticScopes)) - } result.add(ImportingScopeBasedTowerLevel(this, scope as ImportingScope)) } } @@ -103,18 +92,56 @@ class TowerResolver { private fun ScopeTower.createTowerDataList(): List = ArrayList().apply { operator fun TowerData.unaryPlus() = add(this) - // this Data needs for InvokeProcessors - for (implicitReceiver in implicitReceivers) { - + TowerData.OnlyImplicitReceiver(implicitReceiver) - } - // possible there is explicit member - + TowerData.Empty + val localLevels = lexicalScope.parentsWithSelf. + filterIsInstance().filter { it.kind.withLocalDescriptors }. + map { ScopeBasedTowerLevel(this@createTowerDataList, it) } - for (level in createLevels()) { - for (implicitReceiver in implicitReceivers) { - + TowerData.BothTowerLevelAndImplicitReceiver(level, implicitReceiver) + val nonLocalLevels = createNonLocalLevels() + val syntheticLevel = SyntheticScopeBasedTowerLevel(this@createTowerDataList, syntheticScopes) + + // possibly there is explicit member + + TowerData.Empty + // synthetic member for explicit receiver + + TowerData.TowerLevel(syntheticLevel) + + // local non-extensions or extension for explicit receiver + for (localLevel in localLevels) { + + TowerData.TowerLevel(localLevel) + } + + for (scope in lexicalScope.parentsWithSelf) { + if (scope is LexicalScope) { + // statics + if (!scope.kind.withLocalDescriptors) { + + TowerData.TowerLevel(ScopeBasedTowerLevel(this@createTowerDataList, scope)) + } + + val implicitReceiver = scope.implicitReceiver?.value + if (implicitReceiver != null) { + // members of implicit receiver or member extension for explicit receiver + + TowerData.TowerLevel(ReceiverScopeTowerLevel(this@createTowerDataList, implicitReceiver)) + + // synthetic members + + TowerData.BothTowerLevelAndImplicitReceiver(syntheticLevel, implicitReceiver) + + // invokeExtension on local variable + + TowerData.OnlyImplicitReceiver(implicitReceiver) + + // local extensions for implicit receiver + for (localLevel in localLevels) { + + TowerData.BothTowerLevelAndImplicitReceiver(localLevel, implicitReceiver) + } + + // extension for implicit receiver + for (nonLocalLevel in nonLocalLevels) { + + TowerData.BothTowerLevelAndImplicitReceiver(nonLocalLevel, implicitReceiver) + } + } + } + else { + // functions with no receiver or extension for explicit receiver + + TowerData.TowerLevel(ImportingScopeBasedTowerLevel(this@createTowerDataList, scope as ImportingScope)) } - + TowerData.TowerLevel(level) } } diff --git a/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.kt b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.kt new file mode 100644 index 00000000000..0100fcd772d --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.kt @@ -0,0 +1,20 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + +class A + +class B { + fun foo() = this +} + +fun test(foo: A.() -> Int) { + with(A()) { + foo() checkType { _() } + with(B()) { + foo() checkType { _() } + this.foo() checkType { _() } + } + } +} + +fun with(receiver: T, f: T.() -> R): R = receiver.f() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.txt b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.txt new file mode 100644 index 00000000000..eb0e531c162 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.txt @@ -0,0 +1,19 @@ +package + +public fun test(/*0*/ foo: A.() -> kotlin.Int): kotlin.Unit +public fun with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class B { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): B + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.kt b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.kt new file mode 100644 index 00000000000..1553f4e3cd1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.kt @@ -0,0 +1,15 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + +class A { + fun foo() = this +} + +fun test(foo: A.() -> Int) { + with(A()) { + foo() checkType { _() } + this.foo() checkType { _() } + } +} + +fun with(receiver: T, f: T.() -> R): R = receiver.f() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.txt b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.txt new file mode 100644 index 00000000000..568fbfdd799 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.txt @@ -0,0 +1,12 @@ +package + +public fun test(/*0*/ foo: A.() -> kotlin.Int): kotlin.Unit +public fun with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): A + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt b/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt new file mode 100644 index 00000000000..0029475c148 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt @@ -0,0 +1,23 @@ +// FILE: Calendar.java +public class Calendar { + public void setTimeInMillis(long millis) {} + public long getTimeInMillis() { return 1; } +} + +// FILE: 1.kt +class A + +var A.timeInMillis: String + get() = "" + set(v) {} + +fun a(c: Calendar) { + A().apply { + c.apply { + timeInMillis = 5 // synthesized variable for get|setTimeInMillis + timeInMillis = "" + } + timeInMillis = "" + } +} +fun T.apply(f: T.() -> Unit): T { f(); return this } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/kt10219.txt b/compiler/testData/diagnostics/tests/resolve/priority/kt10219.txt new file mode 100644 index 00000000000..ab8e6e491a6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/kt10219.txt @@ -0,0 +1,21 @@ +package + +public var A.timeInMillis: kotlin.String +public fun a(/*0*/ c: Calendar): kotlin.Unit +public fun T.apply(/*0*/ f: T.() -> kotlin.Unit): T + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class Calendar { + public constructor Calendar() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open fun getTimeInMillis(): kotlin.Long + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open fun setTimeInMillis(/*0*/ millis: kotlin.Long): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/kt10510.kt b/compiler/testData/diagnostics/tests/resolve/priority/kt10510.kt new file mode 100644 index 00000000000..3f37e2d061a --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/kt10510.kt @@ -0,0 +1,13 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + +class ClassA { + fun method1() = this + + fun String.method2() { + method1() checkType { _() } + this.method1() checkType { _() } + } +} + +fun String.method1() = this \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/kt10510.txt b/compiler/testData/diagnostics/tests/resolve/priority/kt10510.txt new file mode 100644 index 00000000000..2c77d306663 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/kt10510.txt @@ -0,0 +1,12 @@ +package + +public fun kotlin.String.method1(): kotlin.String + +public final class ClassA { + public constructor ClassA() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun method1(): ClassA + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + public final fun kotlin.String.method2(): kotlin.Unit +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.kt b/compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.kt new file mode 100644 index 00000000000..9d0f393e7e7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.kt @@ -0,0 +1,19 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + + +class A + +fun A.foo() = this + +fun test(a: A) { + fun A.foo() = 3 + + a.foo() checkType { _() } + with(a) { + foo() checkType { _() } + } +} + + +fun with(receiver: T, f: T.() -> R): R = receiver.f() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.txt b/compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.txt new file mode 100644 index 00000000000..3c29b197fba --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.txt @@ -0,0 +1,12 @@ +package + +public fun test(/*0*/ a: A): kotlin.Unit +public fun with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R +public fun A.foo(): A + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt b/compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt new file mode 100644 index 00000000000..aff7e4da226 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt @@ -0,0 +1,20 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + +class A { + fun foo() = this +} + + +fun test(a: A) { + fun A.foo() = 4 + + a.foo() checkType { _() } + + with(a) { + foo() checkType { _() } + this.foo() checkType { _() } + } +} + +fun with(receiver: T, f: T.() -> R): R = receiver.f() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.txt b/compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.txt new file mode 100644 index 00000000000..11b6821450b --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.txt @@ -0,0 +1,12 @@ +package + +public fun test(/*0*/ a: A): kotlin.Unit +public fun with(/*0*/ receiver: T, /*1*/ f: T.() -> R): R + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): A + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.kt b/compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.kt new file mode 100644 index 00000000000..0d2b4d5060c --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.kt @@ -0,0 +1,19 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE + +// FILE: A.java +public class A { + public static void foo() {} +} + +// FILE: 1.kt + +class C { + fun foo() = this + + inner class B : A() { + fun test() { + foo() checkType { _() } + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.txt b/compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.txt new file mode 100644 index 00000000000..ff955e8a61c --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.txt @@ -0,0 +1,27 @@ +package + +public open class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public open fun foo(): kotlin.Unit +} + +public final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): C + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final inner class B : A { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsExtensions.kt b/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsExtensions.kt index 928dd95d8c6..706aa7cd4fe 100644 --- a/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsExtensions.kt +++ b/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsExtensions.kt @@ -21,9 +21,9 @@ class B { private val A.foo: B get() = this@B fun test(a: A) { - a.foo checkType { _() } // todo + a.foo checkType { _() } with(a) { - foo checkType { _() } // todo + foo checkType { _() } } } } diff --git a/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsMembers.kt b/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsMembers.kt index 4492fe901ed..facc0d01425 100644 --- a/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsMembers.kt +++ b/compiler/testData/diagnostics/tests/resolve/priority/syntheticPropertiesVsMembers.kt @@ -30,7 +30,7 @@ fun test(a: A, b: B, c: C) { with(c) { with(a) { - foo checkType { _() } // todo + foo checkType { _() } } } } diff --git a/compiler/testData/resolve/candidatesPriority/closerReceiver1.resolve b/compiler/testData/resolve/candidatesPriority/closerReceiver1.resolve index e283361c0a4..7bee47d37c9 100644 --- a/compiler/testData/resolve/candidatesPriority/closerReceiver1.resolve +++ b/compiler/testData/resolve/candidatesPriority/closerReceiver1.resolve @@ -5,5 +5,5 @@ class A { class B { ~A.foo~fun A.foo() = 1 - fun A.bar() = `foo`foo() + fun A.bar() = `A.foo`foo() } diff --git a/compiler/testData/resolve/candidatesPriority/dispatchReceiverVsExtensionReceiver2.resolve b/compiler/testData/resolve/candidatesPriority/dispatchReceiverVsExtensionReceiver2.resolve index 48dd07865d0..ced989d3db7 100644 --- a/compiler/testData/resolve/candidatesPriority/dispatchReceiverVsExtensionReceiver2.resolve +++ b/compiler/testData/resolve/candidatesPriority/dispatchReceiverVsExtensionReceiver2.resolve @@ -3,7 +3,7 @@ class A class B { ~foo~fun foo() = 2 - fun A.bar() = `foo`foo() + fun A.bar() = `A.foo`foo() } ~A.foo~fun A.foo() = 1 diff --git a/compiler/testData/resolve/candidatesPriority/extensionToCloserReceiverVsMember.resolve b/compiler/testData/resolve/candidatesPriority/extensionToCloserReceiverVsMember.resolve index a49659bdbcd..f1c15448968 100644 --- a/compiler/testData/resolve/candidatesPriority/extensionToCloserReceiverVsMember.resolve +++ b/compiler/testData/resolve/candidatesPriority/extensionToCloserReceiverVsMember.resolve @@ -8,7 +8,7 @@ class B { fun test(a: A, b: B) { with (a) { with (b) { - `A.foo`foo() + `B.foo`foo() } } } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 5a617cf3625..15da5a3845f 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -13985,12 +13985,54 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/resolve/priority"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("invokeExtensionVsOther.kt") + public void testInvokeExtensionVsOther() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther.kt"); + doTest(fileName); + } + + @TestMetadata("invokeExtensionVsOther2.kt") + public void testInvokeExtensionVsOther2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/invokeExtensionVsOther2.kt"); + doTest(fileName); + } + + @TestMetadata("kt10219.kt") + public void testKt10219() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/kt10219.kt"); + doTest(fileName); + } + + @TestMetadata("kt10510.kt") + public void testKt10510() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/kt10510.kt"); + doTest(fileName); + } + @TestMetadata("kt9965.kt") public void testKt9965() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/kt9965.kt"); doTest(fileName); } + @TestMetadata("localExtVsNonLocalExt.kt") + public void testLocalExtVsNonLocalExt() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/localExtVsNonLocalExt.kt"); + doTest(fileName); + } + + @TestMetadata("memberVsLocalExt.kt") + public void testMemberVsLocalExt() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/memberVsLocalExt.kt"); + doTest(fileName); + } + + @TestMetadata("staticVsImplicitReceiverMember.kt") + public void testStaticVsImplicitReceiverMember() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/staticVsImplicitReceiverMember.kt"); + doTest(fileName); + } + @TestMetadata("synthesizedMembersVsExtension.kt") public void testSynthesizedMembersVsExtension() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/resolve/priority/synthesizedMembersVsExtension.kt"); diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterDialog.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterDialog.kt index 6733cc650c7..28407cde51e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterDialog.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterDialog.kt @@ -261,7 +261,7 @@ class KotlinIntroduceParameterDialog private constructor( var newArgumentValue = descriptor.newArgumentValue var newReplacer = descriptor.occurrenceReplacer - val startMarkAction = StartMarkAction.start(editor, myProject, commandName) + val startMarkAction = StartMarkAction.start(editor, myProject, this@KotlinIntroduceParameterDialog.commandName) lambdaExtractionDescriptor?.let { oldDescriptor -> val newDescriptor = KotlinExtractFunctionDialog.createNewDescriptor( @@ -318,7 +318,7 @@ class KotlinIntroduceParameterDialog private constructor( override fun createUsageViewDescriptor(usages: Array) = BaseUsageViewDescriptor() - override fun getCommandName(): String = commandName + override fun getCommandName(): String = this@KotlinIntroduceParameterDialog.commandName } ) } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/pushDown/KotlinPushDownProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/pushDown/KotlinPushDownProcessor.kt index e7ed1150d33..a1841b0becc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/pushDown/KotlinPushDownProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/pushDown/KotlinPushDownProcessor.kt @@ -148,7 +148,7 @@ class KotlinPushDownProcessor( addModifierWithSpace(KtTokens.OVERRIDE_KEYWORD) } } ?: addMemberToTarget(member, targetClass).apply { - if (context.sourceClassDescriptor.kind == ClassKind.INTERFACE) { + if (this@KotlinPushDownProcessor.context.sourceClassDescriptor.kind == ClassKind.INTERFACE) { if (targetClassDescriptor.kind != ClassKind.INTERFACE && memberDescriptor.modality == Modality.ABSTRACT) { addModifierWithSpace(KtTokens.ABSTRACT_KEYWORD) } diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt index ac06ae2aed0..6c30cd5394c 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/AbstractKotlinEvaluateExpressionTest.kt @@ -348,7 +348,7 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestBase() { val sourcePosition = ContextUtil.getSourcePosition(this) val contextElement = createContextElement(this) - contextElement.putCopyableUserData(KotlinCodeFragmentFactory.DEBUG_FRAME_FOR_TESTS, evaluationContext.frameProxy) + contextElement.putCopyableUserData(KotlinCodeFragmentFactory.DEBUG_FRAME_FOR_TESTS, this@AbstractKotlinEvaluateExpressionTest.evaluationContext.frameProxy) try { @@ -360,7 +360,7 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestBase() { if (evaluator == null) throw AssertionError("Cannot create an Evaluator for Evaluate Expression") - val value = evaluator.evaluate(evaluationContext) + val value = evaluator.evaluate(this@AbstractKotlinEvaluateExpressionTest.evaluationContext) val actualResult = value.asValue().asString() Assert.assertTrue("Evaluate expression returns wrong result for $text:\nexpected = $expectedResult\nactual = $actualResult\n", expectedResult == actualResult) diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt index 358a47a9418..277af4459f8 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/stubBuilder/BuiltInDecompilerTest.kt @@ -48,17 +48,17 @@ class BuiltInDecompilerTest : LightCodeInsightFixtureTestCase() { val stubTreeFromDecompiler = KotlinBuiltInStubBuilder().buildFileStub(FileContentImpl.createByFile(anyKotlinClass))!! myFixture.configureFromExistingVirtualFile(anyKotlinClass) val psiFile = myFixture.file - KotlinTestUtils.assertEqualsToFile(File(testDataPath + "$testDataName.text"), psiFile.text) + KotlinTestUtils.assertEqualsToFile(File(testDirPath + "$testDataName.text"), psiFile.text) val stubTreeFromDecompiledText = KtFileStubBuilder().buildStubTree(psiFile) val expectedText = stubTreeFromDecompiledText.serializeToString() Assert.assertEquals(expectedText, stubTreeFromDecompiler.serializeToString()) - KotlinTestUtils.assertEqualsToFile(File(testDataPath + "$testDataName.stubs"), expectedText) + KotlinTestUtils.assertEqualsToFile(File(testDirPath + "$testDataName.stubs"), expectedText) } override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE companion object { - private val testDataPath = PluginTestCaseBase.getTestDataPathBase() + "/decompiler/builtIns/" + private val testDirPath = PluginTestCaseBase.getTestDataPathBase() + "/decompiler/builtIns/" } } diff --git a/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt b/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt index d724928ceb2..19799784f85 100644 --- a/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt +++ b/jps-plugin/testData/incremental/lookupTracker/classifierMembers/foo.kt @@ -18,9 +18,9 @@ import bar.* /*c:foo.A*/foo() this./*c:foo.A*/a this./*c:foo.A*/foo() - /*c:foo.A c:foo.A.Companion*/baz() - /*c:foo.A*/Companion./*c:foo.A.Companion*/a - /*c:foo.A*/O./*c:foo.A.O*/v = "OK" + /*c:foo.A c:foo.A(getBaz) c:foo.A(getBAZ) c:foo.A.Companion p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/baz() + /*c:foo.A c:foo.A.Companion p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/Companion./*c:foo.A.Companion*/a + /*c:foo.A c:foo.A.Companion p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/O./*c:foo.A.O*/v = "OK" } class B { @@ -64,8 +64,8 @@ import bar.* val a = 1 fun foo() { /*c:foo.E*/a - /*c:foo.E*/Y./*c:foo.E*/a + /*c:foo.E p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/Y./*c:foo.E*/a /*c:foo.E*/foo() - /*c:foo.E*/X./*c:foo.E*/foo() + /*c:foo.E p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/X./*c:foo.E*/foo() } } diff --git a/jps-plugin/testData/incremental/lookupTracker/localDeclarations/locals.kt b/jps-plugin/testData/incremental/lookupTracker/localDeclarations/locals.kt index f139ae7a727..8ae9ed1928f 100644 --- a/jps-plugin/testData/incremental/lookupTracker/localDeclarations/locals.kt +++ b/jps-plugin/testData/incremental/lookupTracker/localDeclarations/locals.kt @@ -31,7 +31,7 @@ import bar.* } localFun() - 1.localExtFun() + 1./*c:kotlin.Int(getLocalExtFun) c:kotlin.Int(getLOCALExtFun)*/localExtFun() val c = LocalC() c.a diff --git a/jps-plugin/testData/incremental/lookupTracker/packageDeclarations/foo1.kt b/jps-plugin/testData/incremental/lookupTracker/packageDeclarations/foo1.kt index e212405db19..3b7575c7e00 100644 --- a/jps-plugin/testData/incremental/lookupTracker/packageDeclarations/foo1.kt +++ b/jps-plugin/testData/incremental/lookupTracker/packageDeclarations/foo1.kt @@ -12,6 +12,6 @@ import baz./*p:baz*/C } /*p:foo*/fun /*p:foo*/MyClass.extFunc(p: /**p:foo p:bar*//*p:foo*/Array, e: /*p:foo*/MyEnum, c: /**???*/C): /*p:foo*/MyInterface { - /*c:foo.MyClass c:foo.MyClass(getB) p:foo*/b - return /*c:foo.MyClass p:foo*/MyClass() + /*c:foo.MyClass c:foo.MyClass(getB) p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/b + return /*c:foo.MyClass p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io*/MyClass() }