From 4365084645f8c568d0889409336484cda509ad87 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 2 Nov 2017 10:25:46 +0300 Subject: [PATCH] Lookup for local variables taking into account uninitialized this Consider a context with uninitialized this, e.g.: fun foo() { val x = "..." class Local(y: String) : Base(L@{ x + y }) } Lambda 'L' is an argument of a super class constructor call. Here 'this@Local' is not initialized yet. Thus local variables captured in 'Local' can't be used. Instead, they should be captured by lambda 'L' itself. Note that lambda 'L' sees both 'x' and 'y' as local variables that should be captured. When in context with uninitialized this (generating arguments for super type constructor or delegating constructor call), and a variable in question is not found in the current context, use enclosing local lookup to determine whether a local variable should be captured by a closure. --- .../kotlin/codegen/ExpressionCodegen.java | 14 +- .../codegen/context/CodegenContext.java | 39 ++- ...terAndLocalCapturedInLambdaInLocalClass.kt | 11 + ...orParameterCapturedInLambdaInLocalClass.kt | 9 + ...rParameterCapturedInLambdaInLocalClass2.kt | 9 + .../kt13454.kt | 0 .../kt14148.kt | 0 .../kt4174.kt | 0 .../kt4174a.kt | 0 ...alCapturedInAnonymousObjectInLocalClass.kt | 16 + ...lCapturedInAnonymousObjectInLocalClass2.kt | 21 ++ ...apturedInLambdaInInnerClassInLocalClass.kt | 11 + .../localCapturedInLambdaInLocalClass.kt | 9 + .../localFunctionCapturedInLambda.kt | 11 + .../outerAndLocalCapturedInLocalClass.kt | 14 + ...rCapturedAsImplicitThisInBoundReference.kt | 0 .../outerCapturedInFunctionLiteral.kt | 0 .../outerCapturedInInlineLambda.kt | 0 .../outerCapturedInInlineLambda2.kt | 10 + .../outerCapturedInLambda.kt | 0 .../outerCapturedInLambda2.kt | 0 ...rCapturedInLambdaInSecondaryConstructor.kt | 0 .../outerCapturedInLambdaInSubExpression.kt | 10 + .../outerCapturedInLocalClass.kt | 0 .../outerCapturedInNestedLambda.kt | 0 .../outerCapturedInNestedObject.kt | 0 .../outerCapturedInObject.kt | 0 .../outerCapturedInObject2.kt | 0 ...erEnumEntryCapturedInLambdaInInnerClass.kt | 0 .../properValueCapturedByClosure1.kt | 16 + .../properValueCapturedByClosure2.kt | 11 + ...nceToCapturedVariablesInMultipleLambdas.kt | 16 + .../ir/IrBlackBoxCodegenTestGenerated.java | 294 +++++++++++------ .../codegen/BlackBoxCodegenTestGenerated.java | 294 +++++++++++------ .../LightAnalysisModeTestGenerated.java | 294 +++++++++++------ .../semantics/JsCodegenBoxTestGenerated.java | 306 +++++++++++------- 36 files changed, 973 insertions(+), 442 deletions(-) create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/kt13454.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/kt14148.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/kt4174.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/kt4174a.kt (100%) create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedAsImplicitThisInBoundReference.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInFunctionLiteral.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInInlineLambda.kt (100%) create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInLambda.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInLambda2.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInLambdaInSecondaryConstructor.kt (100%) create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInLocalClass.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInNestedLambda.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInNestedObject.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInObject.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerCapturedInObject2.kt (100%) rename compiler/testData/codegen/box/closures/{capturingOuterClassInstanceInSuperCall => captureInSuperConstructorCall}/outerEnumEntryCapturedInLambdaInInnerClass.kt (100%) create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt create mode 100644 compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java index fefb32454b5..43acf28e842 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ExpressionCodegen.java @@ -393,6 +393,9 @@ public class ExpressionCodegen extends KtVisitor impleme new ImplementationBodyCodegen(declaration, objectContext, classBuilder, state, getParentCodegen(), /* isLocal = */ true).generate(); if (declaration instanceof KtClass && ((KtClass) declaration).isInterface()) { + // TODO consider dropping this code + // It looks like this code generates DefaultImpl class for a local interface. + // Local interfaces are prohibited in Kotlin 1.0. Type traitImplType = state.getTypeMapper().mapDefaultImpls(descriptor); ClassBuilder traitImplBuilder = state.getFactory().newVisitor(JvmDeclarationOriginKt.DefaultImpls(declaration, descriptor), traitImplType, declaration.getContainingFile()); ClassContext traitImplContext = context.intoAnonymousClass(descriptor, this, OwnerKind.DEFAULT_IMPLS); @@ -1869,7 +1872,16 @@ public class ExpressionCodegen extends KtVisitor impleme @Override public boolean isLocal(DeclarationDescriptor descriptor) { - return lookupLocalIndex(descriptor) != -1; + if (lookupLocalIndex(descriptor) != -1) return true; + + if (context.isContextWithUninitializedThis()) { + LocalLookup outerLookup = context.getParentContext().getEnclosingLocalLookup(); + if (outerLookup != null) { + return outerLookup.isLocal(descriptor); + } + } + + return false; } public int lookupLocalIndex(DeclarationDescriptor descriptor) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java index 1fa6c3803df..c63772c8022 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java @@ -354,26 +354,28 @@ public abstract class CodegenContext { @Nullable public CodegenContext getEnclosingClassContext() { - CodegenContext cur = getParentContext(); + CodegenContext cur = getEnclosingThisContext(); while (cur != null) { - if (cur.isContextWithUninitializedThis()) { - // If the current context is a constructor with uninitialized 'this', - // skip it and the corresponding class context - CodegenContext parent = cur.getParentContext(); - assert parent != null : "Context " + cur + " should have a parent"; - cur = parent; - } - else { - DeclarationDescriptor curDescriptor = cur.getContextDescriptor(); - if (curDescriptor instanceof ClassDescriptor) { - return cur; - } + DeclarationDescriptor curDescriptor = cur.getContextDescriptor(); + if (curDescriptor instanceof ClassDescriptor) { + return cur; } cur = cur.getParentContext(); } return null; } + @Nullable + public CodegenContext getEnclosingThisContext() { + CodegenContext cur = getParentContext(); + while (cur != null && cur.isContextWithUninitializedThis()) { + CodegenContext parent = cur.getParentContext(); + assert parent != null : "Context " + cur + " should have a parent"; + cur = parent.getParentContext(); + } + return cur; + } + @Nullable public ClassDescriptor getEnclosingClass() { // TODO store enclosing context class in the context itself @@ -541,8 +543,10 @@ public abstract class CodegenContext { StackValue resultValue; if (myOuter != null && getEnclosingClass() == d) { resultValue = result; - } else { - resultValue = parentContext != null ? parentContext.lookupInContext(d, result, state, ignoreNoOuter) : null; + } + else { + CodegenContext enclosingClassContext = getEnclosingThisContext(); + resultValue = enclosingClassContext != null ? enclosingClassContext.lookupInContext(d, result, state, ignoreNoOuter) : null; } if (myOuter != null && resultValue != null && !isStaticField(resultValue)) { @@ -709,4 +713,9 @@ public abstract class CodegenContext { public CodegenContext getFirstCrossInlineOrNonInlineContext() { return this; } + + @Nullable + public LocalLookup getEnclosingLocalLookup() { + return enclosingLocalLookup; + } } diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt new file mode 100644 index 00000000000..df5b4c8b93d --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt @@ -0,0 +1,11 @@ +open class Base(val fn: () -> String) + +fun box(): String { + val o = "O" + + class Local { + inner class Inner(k: String) : Base({ o + k }) + } + + return Local().Inner("K").fn() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt new file mode 100644 index 00000000000..7e9ab06f9da --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt @@ -0,0 +1,9 @@ +open class Base(val fn: () -> String) + +fun box(): String { + class Local { + inner class Inner(ok: String) : Base({ ok }) + } + + return Local().Inner("OK").fn() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt new file mode 100644 index 00000000000..1ad6db0a2a7 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt @@ -0,0 +1,9 @@ +open class Base(val fn: () -> String) + +fun box(): String { + class Local(val ok: String) { + inner class Inner : Base({ ok }) + } + + return Local("OK").Inner().fn() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt13454.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt13454.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt13454.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt13454.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt14148.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt14148.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt14148.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt14148.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174a.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174a.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174a.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174a.kt diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt new file mode 100644 index 00000000000..b2670e3b1eb --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt @@ -0,0 +1,16 @@ +interface Callback { + fun invoke(): String +} + +open class Base(val fn: Callback) + +fun box(): String { + val ok = "OK" + + class Local : Base( + object : Callback { + override fun invoke() = ok + }) + + return Local().fn.invoke() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt new file mode 100644 index 00000000000..566809f3cb3 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt @@ -0,0 +1,21 @@ +interface Callback { + fun invoke(): String +} + +open class Base(val fn: Callback): Callback { + override fun invoke() = fn.invoke() +} + +fun box(): String { + val ok = "OK" + + class Local : Base( + object : Base( + object : Callback { + override fun invoke() = ok + } + ) {} + ) + + return Local().fn.invoke() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt new file mode 100644 index 00000000000..d64429c5e83 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt @@ -0,0 +1,11 @@ +open class Base(val fn: () -> String) + +fun box(): String { + val ok = "OK" + + class Local { + inner class Inner : Base({ ok }) + } + + return Local().Inner().fn() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt new file mode 100644 index 00000000000..477975f2193 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt @@ -0,0 +1,9 @@ +open class Base(val fn: () -> String) + +fun box(): String { + val o = "O" + + class Local(k: String) : Base({ o + k }) + + return Local("K").fn() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt new file mode 100644 index 00000000000..78f9220fb50 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt @@ -0,0 +1,11 @@ +open class Base(val fn: () -> String) + +fun box(): String { + val x = "O" + + fun localFn() = x + + class Local(y: String) : Base({ localFn() + y }) + + return Local("K").fn() +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt new file mode 100644 index 00000000000..86edb054282 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt @@ -0,0 +1,14 @@ +abstract class Base(val fn: () -> String) + +open class Outer { + val outerO = "O" + + fun test(): Base { + val localK = "K" + class Local : Base({ outerO + localK }) + + return Local() + } +} + +fun box() = Outer().test().fn() \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedAsImplicitThisInBoundReference.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedAsImplicitThisInBoundReference.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedAsImplicitThisInBoundReference.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedAsImplicitThisInBoundReference.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInFunctionLiteral.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInFunctionLiteral.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInFunctionLiteral.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInFunctionLiteral.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInInlineLambda.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInInlineLambda.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda.kt diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt new file mode 100644 index 00000000000..4b135115783 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt @@ -0,0 +1,10 @@ +open class Base(val callback: () -> String) + +class Outer { + val ok = "OK" + + inner class Inner : Base(run { { ok } }) +} + +fun box(): String = + Outer().Inner().callback() \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda2.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda2.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda2.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda2.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambdaInSecondaryConstructor.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSecondaryConstructor.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambdaInSecondaryConstructor.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSecondaryConstructor.kt diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt new file mode 100644 index 00000000000..b9d634b53e1 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt @@ -0,0 +1,10 @@ +open class Foo(val x: () -> String) +open class Foo2(val foo: Foo) + +class Outer { + val s = "OK" + + inner class Inner : Foo2(Foo({ s })) +} + +fun box() = Outer().Inner().foo.x() diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLocalClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLocalClass.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLocalClass.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLocalClass.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedLambda.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedLambda.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedLambda.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedLambda.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedObject.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedObject.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedObject.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedObject.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject2.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject2.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject2.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject2.kt diff --git a/compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerEnumEntryCapturedInLambdaInInnerClass.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerEnumEntryCapturedInLambdaInInnerClass.kt similarity index 100% rename from compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerEnumEntryCapturedInLambdaInInnerClass.kt rename to compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerEnumEntryCapturedInLambdaInInnerClass.kt diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt new file mode 100644 index 00000000000..5cc5a863009 --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt @@ -0,0 +1,16 @@ +open class Outer(val fn: (() -> String)?) { + companion object { + val ok = "Fail: Companion.ok" + } + + val ok = "Fail: Outer.ok" + + fun test(): Outer { + val ok = "OK" + class Local : Outer({ ok }) + + return Local() + } +} + +fun box() = Outer(null).test().fn?.invoke()!! \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt new file mode 100644 index 00000000000..5416746471e --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt @@ -0,0 +1,11 @@ +open class Outer(val fn: (() -> String)?) { + companion object { + val ok = "OK" + } + + val ok = "Fail: Outer.ok" + + inner class Inner : Outer({ ok }) +} + +fun box() = Outer(null).Inner().fn?.invoke()!! \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt new file mode 100644 index 00000000000..fdcfe92442e --- /dev/null +++ b/compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt @@ -0,0 +1,16 @@ +open class Base(val fn1: () -> String, val fn2: () -> String) + +fun box(): String { + val x = "x" + + class Local(y: String) : Base({ x + y }, { y + x }) + + val local = Local("y") + val z1 = local.fn1() + val z2 = local.fn2() + + if (z1 != "xy") return "Fail: z1=$z1" + if (z2 != "yx") return "Fail: z2=$z2" + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 7382aa71c92..c5d8bd20ea2 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -3893,6 +3893,195 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class CaptureInSuperConstructorCall extends AbstractIrBlackBoxCodegenTest { + public void testAllFilesPresentInCaptureInSuperConstructorCall() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/captureInSuperConstructorCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("constructorParameterAndLocalCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterAndLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass2.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("kt13454.kt") + public void testKt13454() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt13454.kt"); + doTest(fileName); + } + + @TestMetadata("kt14148.kt") + public void testKt14148() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt14148.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174.kt") + public void testKt4174() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174a.kt") + public void testKt4174a() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174a.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass2.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInInnerClassInLocalClass.kt") + public void testLocalCapturedInLambdaInInnerClassInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInLocalClass.kt") + public void testLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localFunctionCapturedInLambda.kt") + public void testLocalFunctionCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerAndLocalCapturedInLocalClass.kt") + public void testOuterAndLocalCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") + public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedAsImplicitThisInBoundReference.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInFunctionLiteral.kt") + public void testOuterCapturedInFunctionLiteral() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInFunctionLiteral.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda.kt") + public void testOuterCapturedInInlineLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda2.kt") + public void testOuterCapturedInInlineLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda.kt") + public void testOuterCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda2.kt") + public void testOuterCapturedInLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") + public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSecondaryConstructor.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSubExpression.kt") + public void testOuterCapturedInLambdaInSubExpression() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLocalClass.kt") + public void testOuterCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedLambda.kt") + public void testOuterCapturedInNestedLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedObject.kt") + public void testOuterCapturedInNestedObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject.kt") + public void testOuterCapturedInObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject2.kt") + public void testOuterCapturedInObject2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject2.kt"); + doTest(fileName); + } + + @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") + public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure1.kt") + public void testProperValueCapturedByClosure1() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure2.kt") + public void testProperValueCapturedByClosure2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt"); + doTest(fileName); + } + + @TestMetadata("referenceToCapturedVariablesInMultipleLambdas.kt") + public void testReferenceToCapturedVariablesInMultipleLambdas() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/closures/captureOuterProperty") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -4019,111 +4208,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } - @TestMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class CapturingOuterClassInstanceInSuperCall extends AbstractIrBlackBoxCodegenTest { - public void testAllFilesPresentInCapturingOuterClassInstanceInSuperCall() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); - } - - @TestMetadata("kt13454.kt") - public void testKt13454() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt13454.kt"); - doTest(fileName); - } - - @TestMetadata("kt14148.kt") - public void testKt14148() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt14148.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174.kt") - public void testKt4174() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174a.kt") - public void testKt4174a() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174a.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") - public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedAsImplicitThisInBoundReference.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInFunctionLiteral.kt") - public void testOuterCapturedInFunctionLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInFunctionLiteral.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInInlineLambda.kt") - public void testOuterCapturedInInlineLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInInlineLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda.kt") - public void testOuterCapturedInLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda2.kt") - public void testOuterCapturedInLambda2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda2.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") - public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambdaInSecondaryConstructor.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLocalClass.kt") - public void testOuterCapturedInLocalClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLocalClass.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedLambda.kt") - public void testOuterCapturedInNestedLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedObject.kt") - public void testOuterCapturedInNestedObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject.kt") - public void testOuterCapturedInObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject2.kt") - public void testOuterCapturedInObject2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject2.kt"); - doTest(fileName); - } - - @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") - public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); - doTest(fileName); - } - } - @TestMetadata("compiler/testData/codegen/box/closures/closureInsideClosure") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 43df132d504..c825a58398f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -3893,6 +3893,195 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class CaptureInSuperConstructorCall extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInCaptureInSuperConstructorCall() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/captureInSuperConstructorCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("constructorParameterAndLocalCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterAndLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass2.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("kt13454.kt") + public void testKt13454() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt13454.kt"); + doTest(fileName); + } + + @TestMetadata("kt14148.kt") + public void testKt14148() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt14148.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174.kt") + public void testKt4174() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174a.kt") + public void testKt4174a() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174a.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass2.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInInnerClassInLocalClass.kt") + public void testLocalCapturedInLambdaInInnerClassInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInLocalClass.kt") + public void testLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localFunctionCapturedInLambda.kt") + public void testLocalFunctionCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerAndLocalCapturedInLocalClass.kt") + public void testOuterAndLocalCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") + public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedAsImplicitThisInBoundReference.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInFunctionLiteral.kt") + public void testOuterCapturedInFunctionLiteral() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInFunctionLiteral.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda.kt") + public void testOuterCapturedInInlineLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda2.kt") + public void testOuterCapturedInInlineLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda.kt") + public void testOuterCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda2.kt") + public void testOuterCapturedInLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") + public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSecondaryConstructor.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSubExpression.kt") + public void testOuterCapturedInLambdaInSubExpression() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLocalClass.kt") + public void testOuterCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedLambda.kt") + public void testOuterCapturedInNestedLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedObject.kt") + public void testOuterCapturedInNestedObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject.kt") + public void testOuterCapturedInObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject2.kt") + public void testOuterCapturedInObject2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject2.kt"); + doTest(fileName); + } + + @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") + public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure1.kt") + public void testProperValueCapturedByClosure1() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure2.kt") + public void testProperValueCapturedByClosure2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt"); + doTest(fileName); + } + + @TestMetadata("referenceToCapturedVariablesInMultipleLambdas.kt") + public void testReferenceToCapturedVariablesInMultipleLambdas() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/closures/captureOuterProperty") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -4019,111 +4208,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } - @TestMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class CapturingOuterClassInstanceInSuperCall extends AbstractBlackBoxCodegenTest { - public void testAllFilesPresentInCapturingOuterClassInstanceInSuperCall() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); - } - - @TestMetadata("kt13454.kt") - public void testKt13454() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt13454.kt"); - doTest(fileName); - } - - @TestMetadata("kt14148.kt") - public void testKt14148() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt14148.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174.kt") - public void testKt4174() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174a.kt") - public void testKt4174a() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174a.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") - public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedAsImplicitThisInBoundReference.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInFunctionLiteral.kt") - public void testOuterCapturedInFunctionLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInFunctionLiteral.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInInlineLambda.kt") - public void testOuterCapturedInInlineLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInInlineLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda.kt") - public void testOuterCapturedInLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda2.kt") - public void testOuterCapturedInLambda2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda2.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") - public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambdaInSecondaryConstructor.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLocalClass.kt") - public void testOuterCapturedInLocalClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLocalClass.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedLambda.kt") - public void testOuterCapturedInNestedLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedObject.kt") - public void testOuterCapturedInNestedObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject.kt") - public void testOuterCapturedInObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject2.kt") - public void testOuterCapturedInObject2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject2.kt"); - doTest(fileName); - } - - @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") - public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); - doTest(fileName); - } - } - @TestMetadata("compiler/testData/codegen/box/closures/closureInsideClosure") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index cc8ddb5832f..f7e7a82a392 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -3893,6 +3893,195 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } + @TestMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class CaptureInSuperConstructorCall extends AbstractLightAnalysisModeTest { + public void testAllFilesPresentInCaptureInSuperConstructorCall() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/captureInSuperConstructorCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("constructorParameterAndLocalCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterAndLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass2.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("kt13454.kt") + public void testKt13454() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt13454.kt"); + doTest(fileName); + } + + @TestMetadata("kt14148.kt") + public void testKt14148() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt14148.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174.kt") + public void testKt4174() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174a.kt") + public void testKt4174a() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174a.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass2.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInInnerClassInLocalClass.kt") + public void testLocalCapturedInLambdaInInnerClassInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInLocalClass.kt") + public void testLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localFunctionCapturedInLambda.kt") + public void testLocalFunctionCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerAndLocalCapturedInLocalClass.kt") + public void testOuterAndLocalCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") + public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedAsImplicitThisInBoundReference.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInFunctionLiteral.kt") + public void testOuterCapturedInFunctionLiteral() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInFunctionLiteral.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda.kt") + public void testOuterCapturedInInlineLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda2.kt") + public void testOuterCapturedInInlineLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda.kt") + public void testOuterCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda2.kt") + public void testOuterCapturedInLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") + public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSecondaryConstructor.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSubExpression.kt") + public void testOuterCapturedInLambdaInSubExpression() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLocalClass.kt") + public void testOuterCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedLambda.kt") + public void testOuterCapturedInNestedLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedObject.kt") + public void testOuterCapturedInNestedObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject.kt") + public void testOuterCapturedInObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject2.kt") + public void testOuterCapturedInObject2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject2.kt"); + doTest(fileName); + } + + @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") + public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure1.kt") + public void testProperValueCapturedByClosure1() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure2.kt") + public void testProperValueCapturedByClosure2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt"); + doTest(fileName); + } + + @TestMetadata("referenceToCapturedVariablesInMultipleLambdas.kt") + public void testReferenceToCapturedVariablesInMultipleLambdas() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/closures/captureOuterProperty") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -4019,111 +4208,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } - @TestMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class CapturingOuterClassInstanceInSuperCall extends AbstractLightAnalysisModeTest { - public void testAllFilesPresentInCapturingOuterClassInstanceInSuperCall() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); - } - - @TestMetadata("kt13454.kt") - public void testKt13454() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt13454.kt"); - doTest(fileName); - } - - @TestMetadata("kt14148.kt") - public void testKt14148() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt14148.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174.kt") - public void testKt4174() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174a.kt") - public void testKt4174a() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174a.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") - public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedAsImplicitThisInBoundReference.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInFunctionLiteral.kt") - public void testOuterCapturedInFunctionLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInFunctionLiteral.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInInlineLambda.kt") - public void testOuterCapturedInInlineLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInInlineLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda.kt") - public void testOuterCapturedInLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda2.kt") - public void testOuterCapturedInLambda2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda2.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") - public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambdaInSecondaryConstructor.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLocalClass.kt") - public void testOuterCapturedInLocalClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLocalClass.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedLambda.kt") - public void testOuterCapturedInNestedLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedObject.kt") - public void testOuterCapturedInNestedObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject.kt") - public void testOuterCapturedInObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject2.kt") - public void testOuterCapturedInObject2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject2.kt"); - doTest(fileName); - } - - @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") - public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); - doTest(fileName); - } - } - @TestMetadata("compiler/testData/codegen/box/closures/closureInsideClosure") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index e3fc3207392..2197869d1c3 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -4523,6 +4523,201 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } + @TestMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class CaptureInSuperConstructorCall extends AbstractJsCodegenBoxTest { + public void testAllFilesPresentInCaptureInSuperConstructorCall() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/captureInSuperConstructorCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); + } + + @TestMetadata("constructorParameterAndLocalCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterAndLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterAndLocalCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("constructorParameterCapturedInLambdaInLocalClass2.kt") + public void testConstructorParameterCapturedInLambdaInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/constructorParameterCapturedInLambdaInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("kt13454.kt") + public void testKt13454() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt13454.kt"); + doTest(fileName); + } + + @TestMetadata("kt14148.kt") + public void testKt14148() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt14148.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174.kt") + public void testKt4174() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174.kt"); + doTest(fileName); + } + + @TestMetadata("kt4174a.kt") + public void testKt4174a() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/kt4174a.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInAnonymousObjectInLocalClass2.kt") + public void testLocalCapturedInAnonymousObjectInLocalClass2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInAnonymousObjectInLocalClass2.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInInnerClassInLocalClass.kt") + public void testLocalCapturedInLambdaInInnerClassInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInInnerClassInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localCapturedInLambdaInLocalClass.kt") + public void testLocalCapturedInLambdaInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localCapturedInLambdaInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("localFunctionCapturedInLambda.kt") + public void testLocalFunctionCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/localFunctionCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerAndLocalCapturedInLocalClass.kt") + public void testOuterAndLocalCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerAndLocalCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") + public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedAsImplicitThisInBoundReference.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInFunctionLiteral.kt") + public void testOuterCapturedInFunctionLiteral() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInFunctionLiteral.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda.kt") + public void testOuterCapturedInInlineLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInInlineLambda2.kt") + public void testOuterCapturedInInlineLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInInlineLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda.kt") + public void testOuterCapturedInLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambda2.kt") + public void testOuterCapturedInLambda2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambda2.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") + public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSecondaryConstructor.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + + @TestMetadata("outerCapturedInLambdaInSubExpression.kt") + public void testOuterCapturedInLambdaInSubExpression() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLambdaInSubExpression.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInLocalClass.kt") + public void testOuterCapturedInLocalClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInLocalClass.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedLambda.kt") + public void testOuterCapturedInNestedLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedLambda.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInNestedObject.kt") + public void testOuterCapturedInNestedObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInNestedObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject.kt") + public void testOuterCapturedInObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject.kt"); + doTest(fileName); + } + + @TestMetadata("outerCapturedInObject2.kt") + public void testOuterCapturedInObject2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerCapturedInObject2.kt"); + doTest(fileName); + } + + @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") + public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure1.kt") + public void testProperValueCapturedByClosure1() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure1.kt"); + doTest(fileName); + } + + @TestMetadata("properValueCapturedByClosure2.kt") + public void testProperValueCapturedByClosure2() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/properValueCapturedByClosure2.kt"); + doTest(fileName); + } + + @TestMetadata("referenceToCapturedVariablesInMultipleLambdas.kt") + public void testReferenceToCapturedVariablesInMultipleLambdas() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/captureInSuperConstructorCall/referenceToCapturedVariablesInMultipleLambdas.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/closures/captureOuterProperty") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -4649,117 +4844,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } - @TestMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class CapturingOuterClassInstanceInSuperCall extends AbstractJsCodegenBoxTest { - public void testAllFilesPresentInCapturingOuterClassInstanceInSuperCall() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); - } - - @TestMetadata("kt13454.kt") - public void testKt13454() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt13454.kt"); - doTest(fileName); - } - - @TestMetadata("kt14148.kt") - public void testKt14148() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt14148.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174.kt") - public void testKt4174() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174.kt"); - doTest(fileName); - } - - @TestMetadata("kt4174a.kt") - public void testKt4174a() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/kt4174a.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedAsImplicitThisInBoundReference.kt") - public void testOuterCapturedAsImplicitThisInBoundReference() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedAsImplicitThisInBoundReference.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInFunctionLiteral.kt") - public void testOuterCapturedInFunctionLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInFunctionLiteral.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInInlineLambda.kt") - public void testOuterCapturedInInlineLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInInlineLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda.kt") - public void testOuterCapturedInLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambda2.kt") - public void testOuterCapturedInLambda2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambda2.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInLambdaInSecondaryConstructor.kt") - public void testOuterCapturedInLambdaInSecondaryConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLambdaInSecondaryConstructor.kt"); - try { - doTest(fileName); - } - catch (Throwable ignore) { - return; - } - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); - } - - @TestMetadata("outerCapturedInLocalClass.kt") - public void testOuterCapturedInLocalClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInLocalClass.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedLambda.kt") - public void testOuterCapturedInNestedLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedLambda.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInNestedObject.kt") - public void testOuterCapturedInNestedObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInNestedObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject.kt") - public void testOuterCapturedInObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject.kt"); - doTest(fileName); - } - - @TestMetadata("outerCapturedInObject2.kt") - public void testOuterCapturedInObject2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerCapturedInObject2.kt"); - doTest(fileName); - } - - @TestMetadata("outerEnumEntryCapturedInLambdaInInnerClass.kt") - public void testOuterEnumEntryCapturedInLambdaInInnerClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/capturingOuterClassInstanceInSuperCall/outerEnumEntryCapturedInLambdaInInnerClass.kt"); - doTest(fileName); - } - } - @TestMetadata("compiler/testData/codegen/box/closures/closureInsideClosure") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)