Don't generate redundant initializers for 'var' properties.

Since only 'val' properties store initializers as compile time constants in descriptors, we need to take the initializer expression from the PSI and try to evaluate it as a constant.

 #KT-6661 fixed
This commit is contained in:
Dmitry Jemerov
2015-01-30 14:05:25 +01:00
parent 0e7d7ac709
commit 6442b61db8
4 changed files with 38 additions and 3 deletions
@@ -181,6 +181,18 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
doTest(fileName);
}
@TestMetadata("redundantInitializer.kt")
public void testRedundantInitializer() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/redundantInitializer.kt");
doTest(fileName);
}
@TestMetadata("redundantInitializerNumber.kt")
public void testRedundantInitializerNumber() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/redundantInitializerNumber.kt");
doTest(fileName);
}
@TestMetadata("stringBuilderAppend.kt")
public void testStringBuilderAppend() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/stringBuilderAppend.kt");