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
This commit is contained in:
+35
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user