Add test for for kt42457 wrong behaviour. Align runtime concatenation with it
#KT-42457
This commit is contained in:
Generated
+5
@@ -30208,6 +30208,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/strings/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5389_stringBuilderGet.kt")
|
@TestMetadata("kt5389_stringBuilderGet.kt")
|
||||||
public void testKt5389_stringBuilderGet() throws Exception {
|
public void testKt5389_stringBuilderGet() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
||||||
|
|||||||
Generated
+5
@@ -4551,6 +4551,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multipleNestedConcat.kt")
|
@TestMetadata("multipleNestedConcat.kt")
|
||||||
public void testMultipleNestedConcat() throws Exception {
|
public void testMultipleNestedConcat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
||||||
|
|||||||
+3
@@ -193,6 +193,9 @@ private class JvmDynamicStringConcatenationLowering(val context: JvmBackendConte
|
|||||||
arguments.isEmpty() ->
|
arguments.isEmpty() ->
|
||||||
irString("")
|
irString("")
|
||||||
|
|
||||||
|
arguments.size == 1 ->
|
||||||
|
lowerInlineClassArgument(arguments[0]) ?: callToString(arguments[0].unwrapImplicitNotNull())
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
IrStringConcatenationImpl(
|
IrStringConcatenationImpl(
|
||||||
expression.startOffset,
|
expression.startOffset,
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
fun box(): String {
|
||||||
|
val toString: String? = JavaClass().toString()
|
||||||
|
if (toString != null) return "fail 1: $toString"
|
||||||
|
val template: String? = "${JavaClass()}"
|
||||||
|
if (template != null) return "fail 2: $template"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// KOTLIN_CONFIGURATION_FLAGS: STRING_CONCAT=indy-with-constants
|
||||||
|
// JVM_TARGET: 9
|
||||||
|
// FILE: JavaClass.java
|
||||||
|
|
||||||
|
public class JavaClass {
|
||||||
|
public String toString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Kotlin.kt
|
||||||
|
fun box() {
|
||||||
|
val toString: String? = JavaClass().toString()
|
||||||
|
val template: String = "${JavaClass()}"
|
||||||
|
}
|
||||||
|
// 0 INVOKEDYNAMIC makeConcat
|
||||||
|
// 1 JavaClass.toString
|
||||||
|
// 1 String.valueOf
|
||||||
|
// 0 append
|
||||||
+5
@@ -31974,6 +31974,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/strings/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5389_stringBuilderGet.kt")
|
@TestMetadata("kt5389_stringBuilderGet.kt")
|
||||||
public void testKt5389_stringBuilderGet() throws Exception {
|
public void testKt5389_stringBuilderGet() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
||||||
|
|||||||
@@ -4583,6 +4583,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multipleNestedConcat.kt")
|
@TestMetadata("multipleNestedConcat.kt")
|
||||||
public void testMultipleNestedConcat() throws Exception {
|
public void testMultipleNestedConcat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
||||||
|
|||||||
+5
@@ -29608,6 +29608,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/strings/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5389_stringBuilderGet.kt")
|
@TestMetadata("kt5389_stringBuilderGet.kt")
|
||||||
public void testKt5389_stringBuilderGet() throws Exception {
|
public void testKt5389_stringBuilderGet() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
||||||
|
|||||||
+5
@@ -30208,6 +30208,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
runTest("compiler/testData/codegen/box/strings/kt3652.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/strings/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5389_stringBuilderGet.kt")
|
@TestMetadata("kt5389_stringBuilderGet.kt")
|
||||||
public void testKt5389_stringBuilderGet() throws Exception {
|
public void testKt5389_stringBuilderGet() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
runTest("compiler/testData/codegen/box/strings/kt5389_stringBuilderGet.kt");
|
||||||
|
|||||||
+5
@@ -4551,6 +4551,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt19037.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt42457_old.kt")
|
||||||
|
public void testKt42457_old() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/kt42457_old.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multipleNestedConcat.kt")
|
@TestMetadata("multipleNestedConcat.kt")
|
||||||
public void testMultipleNestedConcat() throws Exception {
|
public void testMultipleNestedConcat() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/multipleNestedConcat.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user