[Parser] Do not support local contextual declarations
This commit is contained in:
committed by
teamcity
parent
4fd61ad1b0
commit
4d3035e2f7
+6
-6
@@ -10582,6 +10582,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
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
|
@Test
|
||||||
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
||||||
public void testContextReceiverTypeParamsUsage() throws Exception {
|
public void testContextReceiverTypeParamsUsage() throws Exception {
|
||||||
@@ -10630,12 +10636,6 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyReceivers.kt")
|
@TestMetadata("manyReceivers.kt")
|
||||||
public void testManyReceivers() throws Exception {
|
public void testManyReceivers() throws Exception {
|
||||||
|
|||||||
+6
-6
@@ -10582,6 +10582,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
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
|
@Test
|
||||||
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
||||||
public void testContextReceiverTypeParamsUsage() throws Exception {
|
public void testContextReceiverTypeParamsUsage() throws Exception {
|
||||||
@@ -10630,12 +10636,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyReceivers.kt")
|
@TestMetadata("manyReceivers.kt")
|
||||||
public void testManyReceivers() throws Exception {
|
public void testManyReceivers() throws Exception {
|
||||||
|
|||||||
+6
-6
@@ -10582,6 +10582,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
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
|
@Test
|
||||||
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
||||||
public void testContextReceiverTypeParamsUsage() throws Exception {
|
public void testContextReceiverTypeParamsUsage() throws Exception {
|
||||||
@@ -10630,12 +10636,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyReceivers.kt")
|
@TestMetadata("manyReceivers.kt")
|
||||||
public void testManyReceivers() throws Exception {
|
public void testManyReceivers() throws Exception {
|
||||||
|
|||||||
-6
@@ -16223,12 +16223,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/iteratorOperator.kt");
|
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
|
@Test
|
||||||
@TestMetadata("overload.kt")
|
@TestMetadata("overload.kt")
|
||||||
public void testOverload() throws Exception {
|
public void testOverload() throws Exception {
|
||||||
|
|||||||
Generated
-6
@@ -823,12 +823,6 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
|||||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt");
|
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
|
@Test
|
||||||
@TestMetadata("overloadPriority.kt")
|
@TestMetadata("overloadPriority.kt")
|
||||||
public void testOverloadPriority() throws Exception {
|
public void testOverloadPriority() throws Exception {
|
||||||
|
|||||||
@@ -1094,9 +1094,6 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
*/
|
*/
|
||||||
private boolean parseLocalDeclaration(boolean rollbackIfDefinitelyNotExpression, boolean isScriptTopLevel) {
|
private boolean parseLocalDeclaration(boolean rollbackIfDefinitelyNotExpression, boolean isScriptTopLevel) {
|
||||||
PsiBuilder.Marker decl = mark();
|
PsiBuilder.Marker decl = mark();
|
||||||
if (atSet(CONTEXT_KEYWORD)) {
|
|
||||||
myKotlinParsing.parseContextReceiverList();
|
|
||||||
}
|
|
||||||
KotlinParsing.ModifierDetector detector = new KotlinParsing.ModifierDetector();
|
KotlinParsing.ModifierDetector detector = new KotlinParsing.ModifierDetector();
|
||||||
myKotlinParsing.parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
|
myKotlinParsing.parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
|
||||||
|
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
|||||||
* contextReceiverList
|
* contextReceiverList
|
||||||
* : "context" "(" (contextReceiver{","})+ ")"
|
* : "context" "(" (contextReceiver{","})+ ")"
|
||||||
*/
|
*/
|
||||||
public void parseContextReceiverList() {
|
private void parseContextReceiverList() {
|
||||||
assert _at(CONTEXT_KEYWORD);
|
assert _at(CONTEXT_KEYWORD);
|
||||||
PsiBuilder.Marker contextReceiverList = mark();
|
PsiBuilder.Marker contextReceiverList = mark();
|
||||||
advance(); // CONTEXT_KEYWORD
|
advance(); // CONTEXT_KEYWORD
|
||||||
|
|||||||
-15
@@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
class Context(val project: Any?)
|
||||||
|
|
||||||
|
fun calculateResult(context: Context?) {
|
||||||
|
context!!
|
||||||
|
val project = context.project!!
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
class Context(val project: Any?)
|
||||||
|
|
||||||
|
fun calculateResult(context: Context?) {
|
||||||
|
context!!
|
||||||
|
val project = <!DEBUG_INFO_SMARTCAST!>context<!>.project!!
|
||||||
|
}
|
||||||
Vendored
+11
@@ -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
|
||||||
|
}
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
// !LANGUAGE: +ContextReceivers
|
|
||||||
|
|
||||||
interface A {
|
|
||||||
fun f() {}
|
|
||||||
}
|
|
||||||
class B : A
|
|
||||||
|
|
||||||
fun testLocalFunction() {
|
|
||||||
context(A)
|
|
||||||
fun local() {
|
|
||||||
<!UNRESOLVED_REFERENCE!>f<!>()
|
|
||||||
}
|
|
||||||
with(B()) {
|
|
||||||
local()
|
|
||||||
}
|
|
||||||
local()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testLocalClass() {
|
|
||||||
context(A)
|
|
||||||
class Local {
|
|
||||||
fun local() {
|
|
||||||
<!UNRESOLVED_REFERENCE!>f<!>()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
with(B()) {
|
|
||||||
Local().local()
|
|
||||||
}
|
|
||||||
Local()
|
|
||||||
}
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
// !LANGUAGE: +ContextReceivers
|
|
||||||
|
|
||||||
interface A {
|
|
||||||
fun f() {}
|
|
||||||
}
|
|
||||||
class B : A
|
|
||||||
|
|
||||||
fun testLocalFunction() {
|
|
||||||
context(A)
|
|
||||||
fun local() {
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
with(B()) {
|
|
||||||
local()
|
|
||||||
}
|
|
||||||
<!NO_CONTEXT_RECEIVER!>local()<!>
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testLocalClass() {
|
|
||||||
context(A)
|
|
||||||
class Local {
|
|
||||||
fun local() {
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
with(B()) {
|
|
||||||
Local().local()
|
|
||||||
}
|
|
||||||
<!NO_CONTEXT_RECEIVER!>Local()<!>
|
|
||||||
}
|
|
||||||
-19
@@ -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
|
|
||||||
}
|
|
||||||
-103
@@ -1,103 +0,0 @@
|
|||||||
FILE fqName:<root> fileName:/localDeclaration.kt
|
|
||||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
|
||||||
FUN name:f visibility:public modality:OPEN <> ($this:<root>.A) returnType:kotlin.Unit
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.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:<this> 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:<this> 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:<this> type:kotlin.Any
|
|
||||||
CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.A]
|
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
|
|
||||||
BLOCK_BODY
|
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[<root>.A]'
|
|
||||||
FUN FAKE_OVERRIDE name:f visibility:public modality:OPEN <> ($this:<root>.A) returnType:kotlin.Unit [fake_override]
|
|
||||||
overridden:
|
|
||||||
public open fun f (): kotlin.Unit declared in <root>.A
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.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 <root>.A
|
|
||||||
$this: VALUE_PARAMETER name:<this> 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 <root>.A
|
|
||||||
$this: VALUE_PARAMETER name:<this> 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 <root>.A
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
|
||||||
FUN name:testLocalFunction visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
|
||||||
BLOCK_BODY
|
|
||||||
FUN LOCAL_FUNCTION name:local visibility:local modality:FINAL <> (<this>:<root>.A) returnType:kotlin.Unit
|
|
||||||
contextReceiverParametersCount: 1
|
|
||||||
VALUE_PARAMETER name:<this> index:0 type:<root>.A
|
|
||||||
BLOCK_BODY
|
|
||||||
CALL 'public open fun f (): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=null
|
|
||||||
$this: GET_VAR '<this>: <root>.A declared in <root>.testLocalFunction.local' type=<root>.A origin=null
|
|
||||||
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null
|
|
||||||
<T>: <root>.B
|
|
||||||
<R>: kotlin.Unit
|
|
||||||
receiver: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B' type=<root>.B origin=null
|
|
||||||
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.B, kotlin.Unit> origin=LAMBDA
|
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.B) returnType:kotlin.Unit
|
|
||||||
$receiver: VALUE_PARAMETER name:$this$with type:<root>.B
|
|
||||||
BLOCK_BODY
|
|
||||||
CALL 'local final fun local (<this>: <root>.A): kotlin.Unit declared in <root>.testLocalFunction' type=kotlin.Unit origin=null
|
|
||||||
<this>: GET_VAR '$this$with: <root>.B declared in <root>.testLocalFunction.<anonymous>' type=<root>.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:<this> type:<root>.testLocalClass.Local
|
|
||||||
FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.A visibility:private [final]
|
|
||||||
CONSTRUCTOR visibility:public <> (<this>:<root>.A) returnType:<root>.testLocalClass.Local [primary]
|
|
||||||
VALUE_PARAMETER name:<this> index:0 type:<root>.A
|
|
||||||
BLOCK_BODY
|
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
|
||||||
SET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.A visibility:private [final]' type=kotlin.Unit origin=null
|
|
||||||
receiver: GET_VAR '<this>: <root>.testLocalClass.Local declared in <root>.testLocalClass.Local' type=<root>.testLocalClass.Local origin=null
|
|
||||||
value: GET_VAR '<this>: <root>.A declared in <root>.testLocalClass.Local.<init>' type=<root>.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:<root>.testLocalClass.Local) returnType:kotlin.Unit
|
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.testLocalClass.Local
|
|
||||||
BLOCK_BODY
|
|
||||||
CALL 'public open fun f (): kotlin.Unit declared in <root>.A' type=kotlin.Unit origin=null
|
|
||||||
$this: GET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:<root>.A visibility:private [final]' type=<root>.A origin=null
|
|
||||||
receiver: GET_VAR '<this>: <root>.testLocalClass.Local declared in <root>.testLocalClass.Local.local' type=<root>.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:<this> 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:<this> 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:<this> type:kotlin.Any
|
|
||||||
CALL 'public final fun with <T, R> (receiver: T of kotlin.StandardKt.with, block: @[ExtensionFunctionType] kotlin.Function1<T of kotlin.StandardKt.with, R of kotlin.StandardKt.with>): R of kotlin.StandardKt.with [inline] declared in kotlin.StandardKt' type=kotlin.Unit origin=null
|
|
||||||
<T>: <root>.B
|
|
||||||
<R>: kotlin.Unit
|
|
||||||
receiver: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B' type=<root>.B origin=null
|
|
||||||
block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.B, kotlin.Unit> origin=LAMBDA
|
|
||||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.B) returnType:kotlin.Unit
|
|
||||||
$receiver: VALUE_PARAMETER name:$this$with type:<root>.B
|
|
||||||
BLOCK_BODY
|
|
||||||
CALL 'public final fun local (): kotlin.Unit declared in <root>.testLocalClass.Local' type=kotlin.Unit origin=null
|
|
||||||
$this: CONSTRUCTOR_CALL 'public constructor <init> (<this>: <root>.A) [primary] declared in <root>.testLocalClass.Local' type=<root>.testLocalClass.Local origin=null
|
|
||||||
<this>: GET_VAR '$this$with: <root>.B declared in <root>.testLocalClass.<anonymous>' type=<root>.B origin=null
|
|
||||||
-29
@@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
interface A {
|
|
||||||
fun f() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class B : A {
|
|
||||||
constructor() /* primary */ {
|
|
||||||
super/*Any*/()
|
|
||||||
/* <init>() */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testLocalFunction() {
|
|
||||||
local fun local(<this>: A) {
|
|
||||||
<this>.f()
|
|
||||||
}
|
|
||||||
|
|
||||||
with<B, Unit>(receiver = B(), block = local fun B.<anonymous>() {
|
|
||||||
local(<this> = $this$with)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testLocalClass() {
|
|
||||||
local class Local {
|
|
||||||
private /* final field */ val contextReceiverField0: A
|
|
||||||
constructor(<this>: A) /* primary */ {
|
|
||||||
super/*Any*/()
|
|
||||||
<this>.#contextReceiverField0 = <this>
|
|
||||||
/* <init>() */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun local() {
|
|
||||||
<this>.#contextReceiverField0.f()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
with<B, Unit>(receiver = B(), block = local fun B.<anonymous>() {
|
|
||||||
Local(<this> = $this$with).local()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Generated
+6
-6
@@ -10588,6 +10588,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.kt");
|
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
|
@Test
|
||||||
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
@TestMetadata("contextReceiverTypeParamsUsage.kt")
|
||||||
public void testContextReceiverTypeParamsUsage() throws Exception {
|
public void testContextReceiverTypeParamsUsage() throws Exception {
|
||||||
@@ -10636,12 +10642,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.kt");
|
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
|
@Test
|
||||||
@TestMetadata("manyReceivers.kt")
|
@TestMetadata("manyReceivers.kt")
|
||||||
public void testManyReceivers() throws Exception {
|
public void testManyReceivers() throws Exception {
|
||||||
|
|||||||
-6
@@ -16223,12 +16223,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/iteratorOperator.kt");
|
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
|
@Test
|
||||||
@TestMetadata("overload.kt")
|
@TestMetadata("overload.kt")
|
||||||
public void testOverload() throws Exception {
|
public void testOverload() throws Exception {
|
||||||
|
|||||||
Generated
-6
@@ -823,12 +823,6 @@ public class IrTextTestGenerated extends AbstractIrTextTest {
|
|||||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt");
|
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
|
@Test
|
||||||
@TestMetadata("overloadPriority.kt")
|
@TestMetadata("overloadPriority.kt")
|
||||||
public void testOverloadPriority() throws Exception {
|
public void testOverloadPriority() throws Exception {
|
||||||
|
|||||||
@@ -633,11 +633,6 @@ public class KlibTextTestCaseGenerated extends AbstractKlibTextTestCase {
|
|||||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/lazy.kt");
|
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")
|
@TestMetadata("overloadPriority.kt")
|
||||||
public void testOverloadPriority() throws Exception {
|
public void testOverloadPriority() throws Exception {
|
||||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt");
|
runTest("compiler/testData/ir/irText/declarations/contextReceivers/overloadPriority.kt");
|
||||||
|
|||||||
-6
@@ -16410,12 +16410,6 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/extensionFunctions/contextReceivers/iteratorOperator.kt");
|
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
|
@Test
|
||||||
@TestMetadata("overload.kt")
|
@TestMetadata("overload.kt")
|
||||||
public void testOverload() throws Exception {
|
public void testOverload() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user