Remove obsolete assertion in ExpressionCodegen

With the mangling added in 488418d960, there's no longer any risk in
writing "special" function name ("<anonymous>" in this case) to the
local variable table.

 #KT-34356 Fixed
This commit is contained in:
Alexander Udalov
2019-10-25 12:45:08 +02:00
parent e7fe144f5c
commit dac0fc7397
7 changed files with 34 additions and 3 deletions
@@ -1447,9 +1447,6 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
leaveTasks.add(answer -> {
int index = myFrameMap.leave(functionDescriptor);
assert !functionDescriptor.getName().isSpecial()
: "Local variable should be generated only for function with name: " + localFunction.getText();
String functionIndex = StringsKt.substringAfterLast(type.getInternalName(), '$', "");
assert !functionIndex.isEmpty();
@@ -0,0 +1,9 @@
fun <T> block(block: () -> T): T = block()
fun foo() {}
fun test(): () -> Unit = block { fun() = foo() }
fun box(): String {
test()
return "OK"
}
@@ -11591,6 +11591,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt");
}
@TestMetadata("insideGenericLambda.kt")
public void testInsideGenericLambda() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt");
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");
@@ -11591,6 +11591,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt");
}
@TestMetadata("insideGenericLambda.kt")
public void testInsideGenericLambda() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt");
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");
@@ -10471,6 +10471,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt");
}
@TestMetadata("insideGenericLambda.kt")
public void testInsideGenericLambda() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt");
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");
@@ -9016,6 +9016,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt");
}
@TestMetadata("insideGenericLambda.kt")
public void testInsideGenericLambda() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt");
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");
@@ -10101,6 +10101,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt");
}
@TestMetadata("insideGenericLambda.kt")
public void testInsideGenericLambda() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/insideGenericLambda.kt");
}
@TestMetadata("underscoreParameters.kt")
public void testUnderscoreParameters() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionExpression/underscoreParameters.kt");