IR: Don't use IrStringConcatenation for ordinary toString calls

We can only use IrStrinConcatentation to represent calls to Any?.toString
and toString calls on primitive types. Otherwise, x.toString() and "$x"
are observably different when x is a non-null type with null value
(e.g., an @NotNull value coming from Java).
This commit is contained in:
Steven Schäfer
2020-03-26 13:15:24 +01:00
committed by Dmitry Petrov
parent c1b9fdd2f3
commit 58685be4e2
9 changed files with 73 additions and 8 deletions
@@ -27846,6 +27846,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/strings/interpolation.kt");
}
@TestMetadata("javaToStringNPE.kt")
public void testJavaToStringNPE() throws Exception {
runTest("compiler/testData/codegen/box/strings/javaToStringNPE.kt");
}
@TestMetadata("kt2592.kt")
public void testKt2592() throws Exception {
runTest("compiler/testData/codegen/box/strings/kt2592.kt");
@@ -4245,6 +4245,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/singleConcat.kt");
}
@TestMetadata("stringBuilderToString.kt")
public void testStringBuilderToString() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/stringBuilderToString.kt");
}
@TestMetadata("stringPlus.kt")
public void testStringPlus() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/stringPlus.kt");
@@ -26663,6 +26663,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/strings/interpolation.kt");
}
@TestMetadata("javaToStringNPE.kt")
public void testJavaToStringNPE() throws Exception {
runTest("compiler/testData/codegen/box/strings/javaToStringNPE.kt");
}
@TestMetadata("kt2592.kt")
public void testKt2592() throws Exception {
runTest("compiler/testData/codegen/box/strings/kt2592.kt");
@@ -26325,6 +26325,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/strings/interpolation.kt");
}
@TestMetadata("javaToStringNPE.kt")
public void testJavaToStringNPE() throws Exception {
runTest("compiler/testData/codegen/box/strings/javaToStringNPE.kt");
}
@TestMetadata("kt2592.kt")
public void testKt2592() throws Exception {
runTest("compiler/testData/codegen/box/strings/kt2592.kt");
@@ -4163,6 +4163,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/singleConcat.kt");
}
@TestMetadata("stringBuilderToString.kt")
public void testStringBuilderToString() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/stringBuilderToString.kt");
}
@TestMetadata("stringPlus.kt")
public void testStringPlus() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/stringOperations/stringPlus.kt");