Calculate default mask shift properly
#KT-18689 Fixed
This commit is contained in:
@@ -366,7 +366,9 @@ abstract class InlineCodegen<out T: BaseExpressionCodegen>(
|
||||
assert(constantValue is Int) { "Mask should be of Integer type, but " + constantValue }
|
||||
maskValues.add(constantValue as Int)
|
||||
if (maskStartIndex == -1) {
|
||||
maskStartIndex = invocationParamBuilder.nextParameterOffset
|
||||
maskStartIndex = invocationParamBuilder.listAllParams().sumBy {
|
||||
if (it is CapturedParamInfo) 0 else it.type.size
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun foo() = "OK"
|
||||
fun foo2() = "OK2"
|
||||
}
|
||||
|
||||
inline fun inlineFn(a: String, crossinline fn: () -> String, x: Long = 1, crossinline fn2: () -> String, c: String): String {
|
||||
return a + fn() + x + fn2() + c
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
private val foo = Foo()
|
||||
|
||||
fun box(): String {
|
||||
val result = inlineFn("a", foo::foo, 5, foo::foo2, "end")
|
||||
return if (result == "aOK5OK2end") "OK" else "fail: $result"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun foo() = "OK"
|
||||
}
|
||||
|
||||
inline fun inlineFn(crossinline fn: () -> String, x: Int? = 1): String {
|
||||
return fn()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
private val foo = Foo()
|
||||
|
||||
fun box(): String {
|
||||
return inlineFn(foo::foo)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun foo() = "O"
|
||||
}
|
||||
|
||||
inline fun inlineFn(crossinline fn: () -> String, x: String = "K"): String {
|
||||
return fn() + x
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
private val foo = Foo()
|
||||
|
||||
fun box(): String {
|
||||
return inlineFn(foo::foo)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun foo() = "O"
|
||||
}
|
||||
|
||||
inline fun inlineFn(crossinline fn: () -> String, x: String = "X"): String {
|
||||
return fn() + x
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
private val foo = Foo()
|
||||
|
||||
fun box(): String {
|
||||
return inlineFn(foo::foo, "K")
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Foo {
|
||||
fun foo() = "OK"
|
||||
}
|
||||
|
||||
inline fun inlineFn(crossinline fn: () -> String, x: Long = 1L): String {
|
||||
return fn()
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
private val foo = Foo()
|
||||
|
||||
fun box(): String {
|
||||
return inlineFn(foo::foo)
|
||||
}
|
||||
+30
@@ -742,6 +742,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mixed.kt")
|
||||
public void testMixed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/mixed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectProperty.kt")
|
||||
public void testObjectProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/objectProperty.kt");
|
||||
@@ -983,6 +989,30 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689.kt")
|
||||
public void testKt18689() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_2.kt")
|
||||
public void testKt18689_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_3.kt")
|
||||
public void testKt18689_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_4.kt")
|
||||
public void testKt18689_4() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_4.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5685.kt")
|
||||
public void testKt5685() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt5685.kt");
|
||||
|
||||
+30
@@ -742,6 +742,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mixed.kt")
|
||||
public void testMixed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/mixed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectProperty.kt")
|
||||
public void testObjectProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/objectProperty.kt");
|
||||
@@ -983,6 +989,30 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689.kt")
|
||||
public void testKt18689() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_2.kt")
|
||||
public void testKt18689_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_3.kt")
|
||||
public void testKt18689_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_4.kt")
|
||||
public void testKt18689_4() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_4.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5685.kt")
|
||||
public void testKt5685() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt5685.kt");
|
||||
|
||||
@@ -742,6 +742,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mixed.kt")
|
||||
public void testMixed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/mixed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectProperty.kt")
|
||||
public void testObjectProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/objectProperty.kt");
|
||||
@@ -983,6 +989,30 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689.kt")
|
||||
public void testKt18689() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_2.kt")
|
||||
public void testKt18689_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_3.kt")
|
||||
public void testKt18689_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_4.kt")
|
||||
public void testKt18689_4() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_4.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5685.kt")
|
||||
public void testKt5685() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt5685.kt");
|
||||
|
||||
+30
@@ -742,6 +742,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mixed.kt")
|
||||
public void testMixed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/mixed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectProperty.kt")
|
||||
public void testObjectProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/objectProperty.kt");
|
||||
@@ -983,6 +989,30 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689.kt")
|
||||
public void testKt18689() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_2.kt")
|
||||
public void testKt18689_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_3.kt")
|
||||
public void testKt18689_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_4.kt")
|
||||
public void testKt18689_4() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_4.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5685.kt")
|
||||
public void testKt5685() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt5685.kt");
|
||||
|
||||
+6
@@ -146,6 +146,12 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mixed.kt")
|
||||
public void testMixed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/mixed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectProperty.kt")
|
||||
public void testObjectProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/callableReference/bound/objectProperty.kt");
|
||||
|
||||
+24
@@ -96,6 +96,30 @@ public class InlineDefaultValuesTestsGenerated extends AbstractInlineDefaultValu
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689.kt")
|
||||
public void testKt18689() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_2.kt")
|
||||
public void testKt18689_2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_3.kt")
|
||||
public void testKt18689_3() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_3.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt18689_4.kt")
|
||||
public void testKt18689_4() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt18689_4.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5685.kt")
|
||||
public void testKt5685() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/defaultValues/kt5685.kt");
|
||||
|
||||
Reference in New Issue
Block a user