Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+
This commit is contained in:
+6
@@ -5080,6 +5080,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicIndyDataClass.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicIndyDataClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("concatDynamicUnit.kt")
|
||||||
|
public void testConcatDynamicUnit() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicUnit.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("concatNotDynamic.kt")
|
@TestMetadata("concatNotDynamic.kt")
|
||||||
public void testConcatNotDynamic() throws Exception {
|
public void testConcatNotDynamic() throws Exception {
|
||||||
|
|||||||
+3
-2
@@ -1283,8 +1283,9 @@ class ExpressionCodegen(
|
|||||||
generator.putValueOrProcessConstant(StackValue.constant(arg.value, type, null))
|
generator.putValueOrProcessConstant(StackValue.constant(arg.value, type, null))
|
||||||
} else {
|
} else {
|
||||||
val value = arg.accept(this, data)
|
val value = arg.accept(this, data)
|
||||||
value.materializeAt(value.type, value.irType)
|
val generatingType = if (value.type == Type.VOID_TYPE) AsmTypes.UNIT_TYPE else value.type
|
||||||
generator.invokeAppend(value.type)
|
value.materializeAt(generatingType, value.irType)
|
||||||
|
generator.invokeAppend(generatingType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
generator.genToString()
|
generator.genToString()
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// JVM_TARGET: 9
|
||||||
|
data class A(val x: Unit)
|
||||||
|
|
||||||
|
fun test(): Unit {}
|
||||||
|
|
||||||
|
interface B<T> {
|
||||||
|
fun test() : T {
|
||||||
|
return null!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo : B<Unit> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val a = A(Unit)
|
||||||
|
|
||||||
|
val test = "Test ${a.component1()} ${test()} ${Foo().test()}"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
// one in data class `toString` and one in `box` method
|
||||||
|
// 2 INVOKEDYNAMIC makeConcatWithConstants
|
||||||
|
// 1 makeConcatWithConstants\(Lkotlin/Unit;\)
|
||||||
|
// 1 makeConcatWithConstants\(Lkotlin/Unit;Lkotlin/Unit;Lkotlin/Unit;\)
|
||||||
|
// 0 append
|
||||||
|
// 0 stringPlus
|
||||||
|
|
||||||
+6
@@ -4948,6 +4948,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicIndyDataClass.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicIndyDataClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("concatDynamicUnit.kt")
|
||||||
|
public void testConcatDynamicUnit() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicUnit.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("concatNotDynamic.kt")
|
@TestMetadata("concatNotDynamic.kt")
|
||||||
public void testConcatNotDynamic() throws Exception {
|
public void testConcatNotDynamic() throws Exception {
|
||||||
|
|||||||
+6
@@ -5080,6 +5080,12 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicIndyDataClass.kt");
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicIndyDataClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("concatDynamicUnit.kt")
|
||||||
|
public void testConcatDynamicUnit() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/stringOperations/concatDynamicUnit.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("concatNotDynamic.kt")
|
@TestMetadata("concatNotDynamic.kt")
|
||||||
public void testConcatNotDynamic() throws Exception {
|
public void testConcatNotDynamic() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user