Support single-underscore named variables in JVM backend

There are mainly two kind of changes:
- skipping 'componentX' calls for destructuring entries named _
- fixing local variable table for them
 - skip entries for destructuring entries named _
 - use $noName_<i> format for lambda parameters named _

 #KT-3824 Fixed
 #KT-2783 Fixed
This commit is contained in:
Denis Zharkov
2016-10-20 17:23:42 +03:00
parent 544d8f5b66
commit a9fcee098d
18 changed files with 355 additions and 7 deletions
@@ -3445,6 +3445,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/underscoreParameters.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/closures/captureOuterProperty")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -5776,6 +5782,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("underscoreNames.kt")
public void testUnderscoreNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam/underscoreNames.kt");
doTest(fileName);
}
@TestMetadata("withIndexed.kt")
public void testWithIndexed() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam/withIndexed.kt");
@@ -7238,6 +7250,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt");
doTest(fileName);
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/box/functions/invoke")
@@ -9043,6 +9061,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("UnderscoreNames.kt")
public void testUnderscoreNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/multiDecl/UnderscoreNames.kt");
doTest(fileName);
}
@TestMetadata("ValCapturedInFunctionLiteral.kt")
public void testValCapturedInFunctionLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/multiDecl/ValCapturedInFunctionLiteral.kt");
@@ -9189,6 +9213,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("UnderscoreNames.kt")
public void testUnderscoreNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/multiDecl/forRange/UnderscoreNames.kt");
doTest(fileName);
}
@TestMetadata("UnderscoreNamesDontCallComponent.kt")
public void testUnderscoreNamesDontCallComponent() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/multiDecl/forRange/UnderscoreNamesDontCallComponent.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/multiDecl/forRange/explicitRangeTo")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -118,4 +118,10 @@ public class CheckLocalVariablesTableTestGenerated extends AbstractCheckLocalVar
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/checkLocalVariablesTable/localFun.kt");
doTest(fileName);
}
@TestMetadata("underscoreNames.kt")
public void testUnderscoreNames() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/checkLocalVariablesTable/underscoreNames.kt");
doTest(fileName);
}
}