From 5f3e296f196ff6dd29eeb1a534459e3b7c4ff9cc Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Wed, 27 May 2020 01:04:30 +0200 Subject: [PATCH] Fix bugs with capturing rhs into EXACTLY_ONCE lambda There are multiple ways to declare a named variable-like entity in Kotlin: 1. val/var variable declaration 2. destructuring declaration 3. parameter of a function 4. parameter of a lambda 5. destructured lambda parameter 6. for-loop's variable declaration 7. catch block exception declaration 8. val in when 9. field declaration Out of them, only variable and field can be assignable, in other words, they can be on the left hand side of an assignment. Val/var variable declarations were already supported. So, we needed to just support field initialization and tell the backend that other ways are prohibited. Function and lambda parameters were already been supported. So, the only thing to explain to the backend are remaining ways. #KT-39113 Fixed #KT-34048 Fixed --- .../kotlin/codegen/PropertyCodegen.java | 8 +++ .../ir/FirBlackBoxCodegenTestGenerated.java | 35 ++++++++++ .../kotlin/resolve/BindingContext.java | 1 + .../checkers/CapturingInClosureChecker.kt | 64 +++++++++++++++++-- .../box/contracts/destructuredVariable.kt | 26 ++++++++ .../codegen/box/contracts/exception.kt | 28 ++++++++ .../testData/codegen/box/contracts/field.kt | 26 ++++++++ .../testData/codegen/box/contracts/forLoop.kt | 61 ++++++++++++++++++ .../box/contracts/functionParameter.kt | 24 +++++++ .../codegen/box/contracts/lambdaParameter.kt | 37 +++++++++++ .../codegen/box/contracts/valInWhen.kt | 26 ++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 35 ++++++++++ .../LightAnalysisModeTestGenerated.java | 35 ++++++++++ .../ir/IrBlackBoxCodegenTestGenerated.java | 35 ++++++++++ .../IrJsCodegenBoxTestGenerated.java | 35 ++++++++++ .../semantics/JsCodegenBoxTestGenerated.java | 35 ++++++++++ 16 files changed, 506 insertions(+), 5 deletions(-) create mode 100644 compiler/testData/codegen/box/contracts/destructuredVariable.kt create mode 100644 compiler/testData/codegen/box/contracts/exception.kt create mode 100644 compiler/testData/codegen/box/contracts/field.kt create mode 100644 compiler/testData/codegen/box/contracts/forLoop.kt create mode 100644 compiler/testData/codegen/box/contracts/functionParameter.kt create mode 100644 compiler/testData/codegen/box/contracts/lambdaParameter.kt create mode 100644 compiler/testData/codegen/box/contracts/valInWhen.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java index d445ef887bc..ad89c1d21cc 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java @@ -422,6 +422,14 @@ public class PropertyCodegen { } modifiers |= getVisibilityForBackingField(propertyDescriptor, isDelegate); + // If val is initialized in EXACTLY_ONCE closure, other class from the same package initializes it + // so, its visibility should be package private and not final + if (!propertyDescriptor.isVar() && + bindingContext.get(BindingContext.FIELD_CAPTURED_IN_EXACLY_ONCE_CLOSURE, propertyDescriptor) != null + ) { + modifiers &= ~(ACC_PRIVATE | ACC_FINAL); + } + if (AsmUtil.isPropertyWithBackingFieldCopyInOuterClass(propertyDescriptor)) { ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen(); parentBodyCodegen.addCompanionObjectPropertyToCopy(propertyDescriptor, defaultValue); diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 284fb53fba6..8f1d5e74dd9 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -5082,10 +5082,45 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/contracts/constructorArgument.kt"); } + @TestMetadata("destructuredVariable.kt") + public void testDestructuredVariable() throws Exception { + runTest("compiler/testData/codegen/box/contracts/destructuredVariable.kt"); + } + @TestMetadata("exactlyOnceNotInline.kt") public void testExactlyOnceNotInline() throws Exception { runTest("compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt"); } + + @TestMetadata("exception.kt") + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/contracts/exception.kt"); + } + + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("compiler/testData/codegen/box/contracts/field.kt"); + } + + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/codegen/box/contracts/forLoop.kt"); + } + + @TestMetadata("functionParameter.kt") + public void testFunctionParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/functionParameter.kt"); + } + + @TestMetadata("lambdaParameter.kt") + public void testLambdaParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); + } + + @TestMetadata("valInWhen.kt") + public void testValInWhen() throws Exception { + runTest("compiler/testData/codegen/box/contracts/valInWhen.kt"); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures") diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java index d694904da69..2158c9b7c77 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java @@ -179,6 +179,7 @@ public interface BindingContext { WritableSlice USED_AS_RESULT_OF_LAMBDA = Slices.createSimpleSetSlice(); WritableSlice CAPTURED_IN_CLOSURE = new BasicWritableSlice<>(DO_NOTHING); + WritableSlice FIELD_CAPTURED_IN_EXACLY_ONCE_CLOSURE = new BasicWritableSlice<>(DO_NOTHING); WritableSlice PRELIMINARY_VISITOR = new BasicWritableSlice<>(DO_NOTHING); WritableSlice, Boolean> DEFERRED_TYPE = Slices.createCollectiveSetSlice(); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/CapturingInClosureChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/CapturingInClosureChecker.kt index aed72e1d6b3..c9346c4a55c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/CapturingInClosureChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/checkers/CapturingInClosureChecker.kt @@ -10,10 +10,13 @@ import org.jetbrains.kotlin.contracts.description.CallsEffectDeclaration import org.jetbrains.kotlin.contracts.description.ContractProviderKey import org.jetbrains.kotlin.contracts.description.InvocationKind import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.psi.KtFunction -import org.jetbrains.kotlin.psi.KtPsiUtil +import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor +import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor +import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl +import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingContext.CAPTURED_IN_CLOSURE +import org.jetbrains.kotlin.resolve.BindingContext.FIELD_CAPTURED_IN_EXACLY_ONCE_CLOSURE import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall @@ -23,6 +26,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall import org.jetbrains.kotlin.resolve.inline.InlineUtil import org.jetbrains.kotlin.resolve.scopes.LexicalScope +import org.jetbrains.kotlin.resolve.source.KotlinSourceElement import org.jetbrains.kotlin.types.expressions.CaptureKind class CapturingInClosureChecker : CallChecker { @@ -40,8 +44,16 @@ class CapturingInClosureChecker : CallChecker { if (isCapturedVariable(variableParent, scopeContainer)) { if (trace.get(CAPTURED_IN_CLOSURE, variable) != CaptureKind.NOT_INLINE) { trace.record(CAPTURED_IN_CLOSURE, variable, getCaptureKind(trace.bindingContext, scopeContainer, variableParent, variable)) + return } } + // Check whether a field is captured in EXACTLY_ONCE contract + if (variable !is PropertyDescriptor || scopeContainer !is AnonymousFunctionDescriptor) return + val scopeDeclaration = DescriptorToSourceUtils.descriptorToDeclaration(scopeContainer) as? KtFunction ?: return + if (scopeContainer.containingDeclaration !is ConstructorDescriptor) return + if (isExactlyOnceContract(trace.bindingContext, scopeDeclaration)) { + trace.record(FIELD_CAPTURED_IN_EXACLY_ONCE_CLOSURE, variable) + } } private fun isCapturedVariable(variableParent: DeclarationDescriptor, scopeContainer: DeclarationDescriptor): Boolean { @@ -75,10 +87,52 @@ class CapturingInClosureChecker : CallChecker { ) CaptureKind.INLINE_ONLY else CaptureKind.NOT_INLINE } val exactlyOnceContract = isExactlyOnceContract(context, scopeDeclaration) - // We cannot box arguments. - val isArgument = variable is ValueParameterDescriptor && variableParent is CallableDescriptor + if (!exactlyOnceContract) return CaptureKind.NOT_INLINE + // We cannot box function/lambda arguments, destructured lambda arguments, for-loop index variables, + // exceptions inside catch blocks ans vals in when + return if (isArgument(variable, variableParent) || + isDestructuredVariable(variable, variableParent) || + isForLoopParameter(variable) || + isCatchBlockParameter(variable) || + isValInWhen(variable) + ) { + CaptureKind.NOT_INLINE + } else { + CaptureKind.EXACTLY_ONCE_EFFECT + } + } + + private fun isArgument(variable: VariableDescriptor, variableParent: DeclarationDescriptor): Boolean = + variable is ValueParameterDescriptor && variableParent is CallableDescriptor && variableParent.valueParameters.contains(variable) - return if (exactlyOnceContract && !isArgument) CaptureKind.EXACTLY_ONCE_EFFECT else CaptureKind.NOT_INLINE + + private fun isDestructuredVariable(variable: VariableDescriptor, variableParent: DeclarationDescriptor): Boolean = + variable is LocalVariableDescriptor && variableParent is AnonymousFunctionDescriptor && + variableParent.valueParameters.any { + it is ValueParameterDescriptorImpl.WithDestructuringDeclaration && it.destructuringVariables.contains(variable) + } + + private fun isValInWhen(variable: VariableDescriptor): Boolean { + val psi = ((variable as? LocalVariableDescriptor)?.source as? KotlinSourceElement)?.psi ?: return false + return (psi.parent as? KtWhenExpression)?.let { it.subjectVariable == psi } == true + } + + private fun isCatchBlockParameter(variable: VariableDescriptor): Boolean { + val psi = ((variable as? LocalVariableDescriptor)?.source as? KotlinSourceElement)?.psi ?: return false + return psi.parent.parent.let { it is KtCatchClause && it.parameterList?.parameters?.contains(psi) == true } + } + + private fun isForLoopParameter(variable: VariableDescriptor): Boolean { + val psi = ((variable as? LocalVariableDescriptor)?.source as? KotlinSourceElement)?.psi ?: return false + if (psi.parent is KtForExpression) { + val forExpression = psi.parent as KtForExpression + return forExpression.loopParameter == psi + } else if (psi.parent is KtDestructuringDeclaration) { + val parameter = psi.parent.parent as? KtParameter ?: return false + val forExpression = parameter.parent as? KtForExpression ?: return false + return forExpression.loopParameter == parameter + } + return false } private fun isExactlyOnceParameter(function: DeclarationDescriptor, parameter: VariableDescriptor): Boolean { diff --git a/compiler/testData/codegen/box/contracts/destructuredVariable.kt b/compiler/testData/codegen/box/contracts/destructuredVariable.kt new file mode 100644 index 00000000000..6aa3fcb6460 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/destructuredVariable.kt @@ -0,0 +1,26 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE, JS +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +fun ok(): String { + val res: String + val (o, _) = "OK" to "FAIL" + runOnce { + res = o + } + return res +} + +fun box(): String { + return ok() +} diff --git a/compiler/testData/codegen/box/contracts/exception.kt b/compiler/testData/codegen/box/contracts/exception.kt new file mode 100644 index 00000000000..8cd2360d1a2 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/exception.kt @@ -0,0 +1,28 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +fun foo(): String { + var res = "FAIL" + try { + error("OK") + } catch(e: Exception) { + runOnce { + res = e.message!! + } + } + return res +} + +fun box(): String { + return foo() +} diff --git a/compiler/testData/codegen/box/contracts/field.kt b/compiler/testData/codegen/box/contracts/field.kt new file mode 100644 index 00000000000..23f17b21876 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/field.kt @@ -0,0 +1,26 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME +// IGNORE_LIGHT_ANALYSIS + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +class Foo { + val res: String + init { + runOnce { + res = "OK" + } + } +} + +fun box(): String { + return Foo().res +} diff --git a/compiler/testData/codegen/box/contracts/forLoop.kt b/compiler/testData/codegen/box/contracts/forLoop.kt new file mode 100644 index 00000000000..455b38d8ec2 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/forLoop.kt @@ -0,0 +1,61 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +fun test1(): String { + var res = "" + for (s in listOf("OK")) { + runOnce { + res += s + } + } + return res +} + +fun test2(): String { + var res = "" + for (s: String in listOf("OK")) { + runOnce { + res += s + } + } + return res +} + +fun test3(): String { + var res = "" + for ((s, _) in listOf("OK" to "FAIL")) { + runOnce { + res += s + } + } + return res +} + +fun test4(): String { + var res = "" + for ((s: String, _) in listOf("OK" to "FAIL")) { + runOnce { + res += s + } + } + return res +} + +fun box(): String { + test1().let { if (it != "OK") return "FAIL 1: $it" } + test2().let { if (it != "OK") return "FAIL 2: $it" } + test3().let { if (it != "OK") return "FAIL 3: $it" } + test4().let { if (it != "OK") return "FAIL 4: $it" } + return "OK" +} diff --git a/compiler/testData/codegen/box/contracts/functionParameter.kt b/compiler/testData/codegen/box/contracts/functionParameter.kt new file mode 100644 index 00000000000..bcc77a3f99e --- /dev/null +++ b/compiler/testData/codegen/box/contracts/functionParameter.kt @@ -0,0 +1,24 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +fun foo(b: Boolean): String { + val res: String + runOnce { + b + res = "OK" + } + return res +} + +fun box(): String { + return foo(true) +} diff --git a/compiler/testData/codegen/box/contracts/lambdaParameter.kt b/compiler/testData/codegen/box/contracts/lambdaParameter.kt new file mode 100644 index 00000000000..5d95ae1bff5 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/lambdaParameter.kt @@ -0,0 +1,37 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME +// KJS_WITH_FULL_RUNTIME + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +fun o(): String { + var res = "FAIL1 " + ("O" to "").let { (a, _) -> + runOnce { + res = a + } + } + return res +} + +fun k(): String { + val res: String + "K".let { b -> + runOnce { + res = b + } + } + return res +} + +fun box(): String { + return o() + k() +} diff --git a/compiler/testData/codegen/box/contracts/valInWhen.kt b/compiler/testData/codegen/box/contracts/valInWhen.kt new file mode 100644 index 00000000000..3057f4e64b6 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/valInWhen.kt @@ -0,0 +1,26 @@ +// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts +// IGNORE_BACKEND: NATIVE +// WITH_RUNTIME + +import kotlin.contracts.* + +fun runOnce(action: () -> Unit) { + contract { + callsInPlace(action, InvocationKind.EXACTLY_ONCE) + } + action() +} + +fun ok(): String { + val res: String + when (val o = "OK") { + else -> runOnce { + res = o + } + } + return res +} + +fun box(): String { + return ok() +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index da8f056ac15..1dd669efe64 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -5112,10 +5112,45 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/contracts/constructorArgument.kt"); } + @TestMetadata("destructuredVariable.kt") + public void testDestructuredVariable() throws Exception { + runTest("compiler/testData/codegen/box/contracts/destructuredVariable.kt"); + } + @TestMetadata("exactlyOnceNotInline.kt") public void testExactlyOnceNotInline() throws Exception { runTest("compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt"); } + + @TestMetadata("exception.kt") + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/contracts/exception.kt"); + } + + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("compiler/testData/codegen/box/contracts/field.kt"); + } + + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/codegen/box/contracts/forLoop.kt"); + } + + @TestMetadata("functionParameter.kt") + public void testFunctionParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/functionParameter.kt"); + } + + @TestMetadata("lambdaParameter.kt") + public void testLambdaParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); + } + + @TestMetadata("valInWhen.kt") + public void testValInWhen() throws Exception { + runTest("compiler/testData/codegen/box/contracts/valInWhen.kt"); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index beda7597354..d803ef856a3 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5112,10 +5112,45 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/contracts/constructorArgument.kt"); } + @TestMetadata("destructuredVariable.kt") + public void testDestructuredVariable() throws Exception { + runTest("compiler/testData/codegen/box/contracts/destructuredVariable.kt"); + } + @TestMetadata("exactlyOnceNotInline.kt") public void testExactlyOnceNotInline() throws Exception { runTest("compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt"); } + + @TestMetadata("exception.kt") + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/contracts/exception.kt"); + } + + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("compiler/testData/codegen/box/contracts/field.kt"); + } + + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/codegen/box/contracts/forLoop.kt"); + } + + @TestMetadata("functionParameter.kt") + public void testFunctionParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/functionParameter.kt"); + } + + @TestMetadata("lambdaParameter.kt") + public void testLambdaParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); + } + + @TestMetadata("valInWhen.kt") + public void testValInWhen() throws Exception { + runTest("compiler/testData/codegen/box/contracts/valInWhen.kt"); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index e1bac8cd49d..24ef15fd00f 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -5082,10 +5082,45 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/contracts/constructorArgument.kt"); } + @TestMetadata("destructuredVariable.kt") + public void testDestructuredVariable() throws Exception { + runTest("compiler/testData/codegen/box/contracts/destructuredVariable.kt"); + } + @TestMetadata("exactlyOnceNotInline.kt") public void testExactlyOnceNotInline() throws Exception { runTest("compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt"); } + + @TestMetadata("exception.kt") + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/contracts/exception.kt"); + } + + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("compiler/testData/codegen/box/contracts/field.kt"); + } + + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/codegen/box/contracts/forLoop.kt"); + } + + @TestMetadata("functionParameter.kt") + public void testFunctionParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/functionParameter.kt"); + } + + @TestMetadata("lambdaParameter.kt") + public void testLambdaParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); + } + + @TestMetadata("valInWhen.kt") + public void testValInWhen() throws Exception { + runTest("compiler/testData/codegen/box/contracts/valInWhen.kt"); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 94a2d65b3f3..1337d969d4e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -4122,10 +4122,45 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/contracts/constructorArgument.kt"); } + @TestMetadata("destructuredVariable.kt") + public void testDestructuredVariable() throws Exception { + runTest("compiler/testData/codegen/box/contracts/destructuredVariable.kt"); + } + @TestMetadata("exactlyOnceNotInline.kt") public void testExactlyOnceNotInline() throws Exception { runTest("compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt"); } + + @TestMetadata("exception.kt") + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/contracts/exception.kt"); + } + + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("compiler/testData/codegen/box/contracts/field.kt"); + } + + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/codegen/box/contracts/forLoop.kt"); + } + + @TestMetadata("functionParameter.kt") + public void testFunctionParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/functionParameter.kt"); + } + + @TestMetadata("lambdaParameter.kt") + public void testLambdaParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); + } + + @TestMetadata("valInWhen.kt") + public void testValInWhen() throws Exception { + runTest("compiler/testData/codegen/box/contracts/valInWhen.kt"); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures") 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 e532e3e227f..38b2e619aa6 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 @@ -4122,10 +4122,45 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/contracts/constructorArgument.kt"); } + @TestMetadata("destructuredVariable.kt") + public void testDestructuredVariable() throws Exception { + runTest("compiler/testData/codegen/box/contracts/destructuredVariable.kt"); + } + @TestMetadata("exactlyOnceNotInline.kt") public void testExactlyOnceNotInline() throws Exception { runTest("compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt"); } + + @TestMetadata("exception.kt") + public void testException() throws Exception { + runTest("compiler/testData/codegen/box/contracts/exception.kt"); + } + + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("compiler/testData/codegen/box/contracts/field.kt"); + } + + @TestMetadata("forLoop.kt") + public void testForLoop() throws Exception { + runTest("compiler/testData/codegen/box/contracts/forLoop.kt"); + } + + @TestMetadata("functionParameter.kt") + public void testFunctionParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/functionParameter.kt"); + } + + @TestMetadata("lambdaParameter.kt") + public void testLambdaParameter() throws Exception { + runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); + } + + @TestMetadata("valInWhen.kt") + public void testValInWhen() throws Exception { + runTest("compiler/testData/codegen/box/contracts/valInWhen.kt"); + } } @TestMetadata("compiler/testData/codegen/box/controlStructures")