diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 298784f9981..5764674be26 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -10582,6 +10582,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt"); } + @Test + @TestMetadata("contextKeywordWithElvis.kt") + public void testContextKeywordWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt"); + } + @Test @TestMetadata("contextReceiverTypeParamsUsage.kt") public void testContextReceiverTypeParamsUsage() throws Exception { @@ -10630,12 +10636,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("manyReceivers.kt") public void testManyReceivers() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 4b2ece5cc30..b00b4afdd02 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -10582,6 +10582,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt"); } + @Test + @TestMetadata("contextKeywordWithElvis.kt") + public void testContextKeywordWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt"); + } + @Test @TestMetadata("contextReceiverTypeParamsUsage.kt") public void testContextReceiverTypeParamsUsage() throws Exception { @@ -10630,12 +10636,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("manyReceivers.kt") public void testManyReceivers() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 836370cf02d..881ef2051ca 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -10582,6 +10582,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt"); } + @Test + @TestMetadata("contextKeywordWithElvis.kt") + public void testContextKeywordWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt"); + } + @Test @TestMetadata("contextReceiverTypeParamsUsage.kt") public void testContextReceiverTypeParamsUsage() throws Exception { @@ -10630,12 +10636,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("manyReceivers.kt") public void testManyReceivers() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 84f761632be..a6c116f87bb 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -16223,12 +16223,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/iteratorOperator.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("overload.kt") public void testOverload() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java index a069fc4429e..2ec288fadb9 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java @@ -823,12 +823,6 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("overloadPriority.kt") public void testOverloadPriority() throws Exception { diff --git a/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java b/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java index dfa2aac42ad..0206ffe9bb5 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java +++ b/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java @@ -1094,9 +1094,6 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing { */ private boolean parseLocalDeclaration(boolean rollbackIfDefinitelyNotExpression, boolean isScriptTopLevel) { PsiBuilder.Marker decl = mark(); - if (atSet(CONTEXT_KEYWORD)) { - myKotlinParsing.parseContextReceiverList(); - } KotlinParsing.ModifierDetector detector = new KotlinParsing.ModifierDetector(); myKotlinParsing.parseModifierList(detector, DEFAULT, TokenSet.EMPTY); diff --git a/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java b/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java index b08285a646b..ec1682686ee 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java +++ b/compiler/psi/src/org/jetbrains/kotlin/parsing/KotlinParsing.java @@ -620,7 +620,7 @@ public class KotlinParsing extends AbstractKotlinParsing { * contextReceiverList * : "context" "(" (contextReceiver{","})+ ")" */ - public void parseContextReceiverList() { + private void parseContextReceiverList() { assert _at(CONTEXT_KEYWORD); PsiBuilder.Marker contextReceiverList = mark(); advance(); // CONTEXT_KEYWORD diff --git a/compiler/testData/codegen/box/extensionFunctions/contextReceivers/localDeclaration.kt b/compiler/testData/codegen/box/extensionFunctions/contextReceivers/localDeclaration.kt deleted file mode 100644 index 37af174a7bd..00000000000 --- a/compiler/testData/codegen/box/extensionFunctions/contextReceivers/localDeclaration.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !LANGUAGE: +ContextReceivers -// TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND_FIR: JVM_IR - -interface A { - val ok get() = "OK" -} -class B : A - -fun box(): String { - context(A) fun result() = ok - return with(B()) { - result() - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.fir.kt new file mode 100644 index 00000000000..21d118b03f4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.fir.kt @@ -0,0 +1,6 @@ +class Context(val project: Any?) + +fun calculateResult(context: Context?) { + context!! + val project = context.project!! +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt new file mode 100644 index 00000000000..8283dabc6e7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt @@ -0,0 +1,6 @@ +class Context(val project: Any?) + +fun calculateResult(context: Context?) { + context!! + val project = context.project!! +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.txt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.txt new file mode 100644 index 00000000000..3fcc780ba09 --- /dev/null +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.txt @@ -0,0 +1,11 @@ +package + +public fun calculateResult(/*0*/ context: Context?): kotlin.Unit + +public final class Context { + public constructor Context(/*0*/ project: kotlin.Any?) + public final val project: kotlin.Any? + 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/extensions/contextReceivers/localDeclaration.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.fir.kt deleted file mode 100644 index 8978b33cd44..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.fir.kt +++ /dev/null @@ -1,30 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -interface A { - fun f() {} -} -class B : A - -fun testLocalFunction() { - context(A) - fun local() { - f() - } - with(B()) { - local() - } - local() -} - -fun testLocalClass() { - context(A) - class Local { - fun local() { - f() - } - } - with(B()) { - Local().local() - } - Local() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt deleted file mode 100644 index a8cc3e34185..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt +++ /dev/null @@ -1,30 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -interface A { - fun f() {} -} -class B : A - -fun testLocalFunction() { - context(A) - fun local() { - f() - } - with(B()) { - local() - } - local() -} - -fun testLocalClass() { - context(A) - class Local { - fun local() { - f() - } - } - with(B()) { - Local().local() - } - Local() -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.txt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.txt deleted file mode 100644 index 93fc4b3fb44..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.txt +++ /dev/null @@ -1,19 +0,0 @@ -package - -public fun testLocalClass(): kotlin.Unit -public fun testLocalFunction(): kotlin.Unit - -public interface A { - public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public open fun f(): kotlin.Unit - public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String -} - -public final 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 f(): kotlin.Unit - 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/ir/irText/declarations/contextReceivers/localDeclaration.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.ir.txt deleted file mode 100644 index 6943accc8f2..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.ir.txt +++ /dev/null @@ -1,103 +0,0 @@ -FILE fqName: fileName:/localDeclaration.kt - CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A - FUN name:f visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.Unit - $this: VALUE_PARAMETER name: type:.A - BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:B modality:FINAL visibility:public superTypes:[.A] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B - CONSTRUCTOR visibility:public <> () returnType:.B [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[.A]' - FUN FAKE_OVERRIDE name:f visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.Unit [fake_override] - overridden: - public open fun f (): kotlin.Unit declared in .A - $this: VALUE_PARAMETER name: type:.A - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int [fake_override] declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String [fake_override] declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:testLocalFunction visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - FUN LOCAL_FUNCTION name:local visibility:local modality:FINAL <> (:.A) returnType:kotlin.Unit - contextReceiverParametersCount: 1 - VALUE_PARAMETER name: index:0 type:.A - BLOCK_BODY - CALL 'public open fun f (): kotlin.Unit declared in .A' type=kotlin.Unit origin=null - $this: GET_VAR ': .A declared in .testLocalFunction.local' type=.A origin=null - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null - : .B - : kotlin.Unit - receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .B' type=.B origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.B, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.B) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name:$this$with type:.B - BLOCK_BODY - CALL 'local final fun local (: .A): kotlin.Unit declared in .testLocalFunction' type=kotlin.Unit origin=null - : GET_VAR '$this$with: .B declared in .testLocalFunction.' type=.B origin=null - FUN name:testLocalClass visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - CLASS CLASS name:Local modality:FINAL visibility:local superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.testLocalClass.Local - FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:.A visibility:private [final] - CONSTRUCTOR visibility:public <> (:.A) returnType:.testLocalClass.Local [primary] - VALUE_PARAMETER name: index:0 type:.A - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - SET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:.A visibility:private [final]' type=kotlin.Unit origin=null - receiver: GET_VAR ': .testLocalClass.Local declared in .testLocalClass.Local' type=.testLocalClass.Local origin=null - value: GET_VAR ': .A declared in .testLocalClass.Local.' type=.A origin=null - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Local modality:FINAL visibility:local superTypes:[kotlin.Any]' - FUN name:local visibility:public modality:FINAL <> ($this:.testLocalClass.Local) returnType:kotlin.Unit - $this: VALUE_PARAMETER name: type:.testLocalClass.Local - BLOCK_BODY - CALL 'public open fun f (): kotlin.Unit declared in .A' type=kotlin.Unit origin=null - $this: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:.A visibility:private [final]' type=.A origin=null - receiver: GET_VAR ': .testLocalClass.Local declared in .testLocalClass.Local.local' type=.testLocalClass.Local origin=null - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - CALL 'public final fun with (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null - : .B - : kotlin.Unit - receiver: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .B' type=.B origin=null - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<.B, kotlin.Unit> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:.B) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name:$this$with type:.B - BLOCK_BODY - CALL 'public final fun local (): kotlin.Unit declared in .testLocalClass.Local' type=kotlin.Unit origin=null - $this: CONSTRUCTOR_CALL 'public constructor (: .A) [primary] declared in .testLocalClass.Local' type=.testLocalClass.Local origin=null - : GET_VAR '$this$with: .B declared in .testLocalClass.' type=.B origin=null diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt b/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt deleted file mode 100644 index df56b6e7025..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt +++ /dev/null @@ -1,29 +0,0 @@ -// !LANGUAGE: +ContextReceivers -// IGNORE_BACKEND_FIR: JVM_IR - -interface A { - fun f() {} -} -class B : A - -fun testLocalFunction() { - context(A) - fun local() { - f() - } - with(B()) { - local() - } -} - -fun testLocalClass() { - context(A) - class Local { - fun local() { - f() - } - } - with(B()) { - Local().local() - } -} \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt.txt deleted file mode 100644 index 0d896315195..00000000000 --- a/compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt.txt +++ /dev/null @@ -1,47 +0,0 @@ -interface A { - fun f() { - } - -} - -class B : A { - constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - -} - -fun testLocalFunction() { - local fun local(: A) { - .f() - } - - with(receiver = B(), block = local fun B.() { - local( = $this$with) - } -) -} - -fun testLocalClass() { - local class Local { - private /* final field */ val contextReceiverField0: A - constructor(: A) /* primary */ { - super/*Any*/() - .#contextReceiverField0 = - /* () */ - - } - - fun local() { - .#contextReceiverField0.f() - } - - } - - with(receiver = B(), block = local fun B.() { - Local( = $this$with).local() - } -) -} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index d38fa7094cf..280fd505331 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -10588,6 +10588,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt"); } + @Test + @TestMetadata("contextKeywordWithElvis.kt") + public void testContextKeywordWithElvis() throws Exception { + runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/contextKeywordWithElvis.kt"); + } + @Test @TestMetadata("contextReceiverTypeParamsUsage.kt") public void testContextReceiverTypeParamsUsage() throws Exception { @@ -10636,12 +10642,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("manyReceivers.kt") public void testManyReceivers() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 1b6f7377319..9892426fef8 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -16223,12 +16223,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/iteratorOperator.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("overload.kt") public void testOverload() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java index c2b84133ba0..ba6f32346c6 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java @@ -823,12 +823,6 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("overloadPriority.kt") public void testOverloadPriority() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java index 2814bc7a86c..52907a13a59 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/KlibTextTestCaseGenerated.java @@ -633,11 +633,6 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase { runTest("compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt"); } - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/ir/irText/declarations/contextReceivers/localDeclaration.kt"); - } - @TestMetadata("overloadPriority.kt") public void testOverloadPriority() throws Exception { runTest("compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt"); diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeExtBlackBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeExtBlackBoxTestGenerated.java index dc1ef2f1d70..0e5c1a45bfd 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeExtBlackBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeExtBlackBoxTestGenerated.java @@ -16410,12 +16410,6 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest { runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/iteratorOperator.kt"); } - @Test - @TestMetadata("localDeclaration.kt") - public void testLocalDeclaration() throws Exception { - runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/localDeclaration.kt"); - } - @Test @TestMetadata("overload.kt") public void testOverload() throws Exception {