KT-38337 Fix inline class value coercion in delegated members
This commit is contained in:
@@ -1588,19 +1588,34 @@ public class FunctionCodegen {
|
||||
@NotNull MethodContext context,
|
||||
@NotNull MemberCodegen<?> parentCodegen
|
||||
) {
|
||||
Method delegateToMethod = typeMapper.mapToCallableMethod(delegatedTo, /* superCall = */ false).getAsmMethod();
|
||||
Method delegateMethod = typeMapper.mapAsmMethod(delegateFunction);
|
||||
|
||||
Type[] argTypes = delegateMethod.getArgumentTypes();
|
||||
List<KotlinType> argKotlinTypes = getKotlinTypesForJvmParameters(delegateFunction);
|
||||
|
||||
Method delegateToMethod = typeMapper.mapToCallableMethod(delegatedTo, /* superCall = */ false).getAsmMethod();
|
||||
Type[] originalArgTypes = delegateToMethod.getArgumentTypes();
|
||||
List<KotlinType> originalArgKotlinTypes = getKotlinTypesForJvmParameters(delegatedTo);
|
||||
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
iv.load(0, OBJECT_TYPE);
|
||||
field.put(iv);
|
||||
for (int i = 0, reg = 1; i < argTypes.length; i++) {
|
||||
StackValue.local(reg, argTypes[i]).put(originalArgTypes[i], iv);
|
||||
//noinspection AssignmentToForLoopParameter
|
||||
reg += argTypes[i].getSize();
|
||||
|
||||
// When delegating to inline class, we invoke static implementation method
|
||||
// that takes inline class underlying value as 1st argument.
|
||||
int toArgsShift = toClass.isInline() ? 1 : 0;
|
||||
|
||||
int reg = 1;
|
||||
for (int i = 0; i < argTypes.length; ++i) {
|
||||
Type argType = argTypes[i];
|
||||
KotlinType argKotlinType = argKotlinTypes.get(i);
|
||||
|
||||
Type toArgType = originalArgTypes[i + toArgsShift];
|
||||
KotlinType toArgKotlinType = originalArgKotlinTypes.get(i);
|
||||
|
||||
StackValue.local(reg, argType, argKotlinType)
|
||||
.put(toArgType, toArgKotlinType, iv);
|
||||
|
||||
reg += argType.getSize();
|
||||
}
|
||||
|
||||
String internalName = typeMapper.mapClass(toClass).getInternalName();
|
||||
@@ -1614,6 +1629,7 @@ public class FunctionCodegen {
|
||||
iv.invokevirtual(internalName, delegateToMethod.getName(), delegateToMethod.getDescriptor(), false);
|
||||
}
|
||||
|
||||
//noinspection ConstantConditions
|
||||
StackValue stackValue = AsmUtil.genNotNullAssertions(
|
||||
state,
|
||||
StackValue.onStack(delegateToMethod.getReturnType(), delegatedTo.getReturnType()),
|
||||
@@ -1638,6 +1654,28 @@ public class FunctionCodegen {
|
||||
public boolean skipGenericSignature() {
|
||||
return skipGenericSignature;
|
||||
}
|
||||
|
||||
private List<KotlinType> getKotlinTypesForJvmParameters(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
List<KotlinType> kotlinTypes = new ArrayList<>();
|
||||
|
||||
ReceiverParameterDescriptor extensionReceiver = functionDescriptor.getExtensionReceiverParameter();
|
||||
if (extensionReceiver != null) {
|
||||
kotlinTypes.add(extensionReceiver.getType());
|
||||
}
|
||||
|
||||
for (ValueParameterDescriptor parameter : functionDescriptor.getValueParameters()) {
|
||||
kotlinTypes.add(parameter.getType());
|
||||
}
|
||||
|
||||
if (functionDescriptor.isSuspend()) {
|
||||
// Suspend functions take continuation type as last argument.
|
||||
// It's not an inline class, so we don't really care about exact KotlinType here.
|
||||
// Just make sure argument types are counted properly.
|
||||
kotlinTypes.add(null);
|
||||
}
|
||||
|
||||
return kotlinTypes;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Generated
+53
-5
@@ -12519,11 +12519,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterateOverArrayOfInlineClassValues.kt")
|
||||
public void testIterateOverArrayOfInlineClassValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/iterateOverArrayOfInlineClassValues.kt");
|
||||
@@ -13570,6 +13565,59 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceDelegation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InterfaceDelegation extends AbstractFirBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInterfaceDelegation() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceDelegation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38337.kt")
|
||||
public void testKt38337() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/kt38337.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtValDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtValDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtValDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtVarDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtVarDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtVarDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassInt.kt")
|
||||
public void testMemberFunDelegatedToInlineClassInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassLong.kt")
|
||||
public void testMemberFunDelegatedToInlineClassLong() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassLong.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationToInlineClassWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
inline class Wrapper(val id: Int)
|
||||
|
||||
class DMap(private val map: Map<Wrapper, String>) :
|
||||
Map<Wrapper, String> by map
|
||||
|
||||
fun box(): String {
|
||||
val dmap = DMap(mutableMapOf(Wrapper(42) to "OK"))
|
||||
return dmap[Wrapper(42)] ?: "Fail"
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
inline class S(val x: String)
|
||||
|
||||
interface IFoo {
|
||||
val S.extVal: String
|
||||
}
|
||||
|
||||
interface GFoo<T> {
|
||||
val T.extVal: String
|
||||
}
|
||||
|
||||
object FooImpl : IFoo {
|
||||
override val S.extVal: String
|
||||
get() = x
|
||||
}
|
||||
|
||||
object GFooImpl : GFoo<S> {
|
||||
override val S.extVal: String
|
||||
get() = x
|
||||
}
|
||||
|
||||
class TestFoo : IFoo by FooImpl
|
||||
|
||||
class TestGFoo : GFoo<S> by GFooImpl
|
||||
|
||||
fun box(): String {
|
||||
with(TestFoo()) {
|
||||
assertEquals("OK", S("OK").extVal)
|
||||
}
|
||||
|
||||
with(TestGFoo()) {
|
||||
assertEquals("OK", S("OK").extVal)
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
inline class S(val xs: Array<String>)
|
||||
|
||||
interface IFoo {
|
||||
var S.extVar: String
|
||||
}
|
||||
|
||||
interface GFoo<T> {
|
||||
var T.extVar: String
|
||||
}
|
||||
|
||||
object FooImpl : IFoo {
|
||||
override var S.extVar: String
|
||||
get() = xs[0]
|
||||
set(value) { xs[0] = value }
|
||||
}
|
||||
|
||||
object GFooImpl : GFoo<S> {
|
||||
override var S.extVar: String
|
||||
get() = xs[0]
|
||||
set(value) { xs[0] = value }
|
||||
}
|
||||
|
||||
class TestFoo : IFoo by FooImpl
|
||||
|
||||
class TestGFoo : GFoo<S> by GFooImpl
|
||||
|
||||
fun box(): String {
|
||||
with(TestFoo()) {
|
||||
val s = S(arrayOf("Fail 1"))
|
||||
s.extVar = "OK"
|
||||
assertEquals("OK", s.extVar)
|
||||
}
|
||||
|
||||
with(TestGFoo()) {
|
||||
val s = S(arrayOf("Fail 2"))
|
||||
s.extVar = "OK"
|
||||
assertEquals("OK", s.extVar)
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
interface IFoo {
|
||||
fun foo(s: String): String
|
||||
}
|
||||
|
||||
inline class Z(val x: Int) : IFoo {
|
||||
override fun foo(s: String): String = x.toString() + s
|
||||
}
|
||||
|
||||
class Test(x: Int) : IFoo by Z(x)
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("1OK", Test(1).foo("OK"))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
interface IFoo {
|
||||
fun foo(s: String): String
|
||||
}
|
||||
|
||||
inline class Z(val x: Long) : IFoo {
|
||||
override fun foo(s: String): String = x.toString() + s
|
||||
}
|
||||
|
||||
class Test(x: Long) : IFoo by Z(x)
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("1OK", Test(1L).foo("OK"))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
inline class S(val x: String)
|
||||
|
||||
interface IFoo<T> {
|
||||
fun memberFun(s1: S, s2: String): String
|
||||
fun memberFunT(x1: T, x2: String): String
|
||||
fun <X> genericMemberFun(x1: T, x2: X): String
|
||||
fun S.memberExtFun(s: String): String
|
||||
fun T.memberExtFunT(x: String): String
|
||||
fun <X> T.genericMemberExtFun(x: X): String
|
||||
}
|
||||
|
||||
inline class FooImpl(val xs: Array<String>) : IFoo<S> {
|
||||
override fun memberFun(s1: S, s2: String): String = xs[0] + s1.x + s2
|
||||
override fun memberFunT(x1: S, x2: String): String = xs[0] + x1.x + x2
|
||||
override fun <X> genericMemberFun(x1: S, x2: X): String = xs[0] + x1.x + x2.toString()
|
||||
override fun S.memberExtFun(s: String): String = xs[0] + this.x + s
|
||||
override fun S.memberExtFunT(x: String): String = xs[0] + this.x + x
|
||||
override fun <X> S.genericMemberExtFun(x: X): String = xs[0] + this.x + x.toString()
|
||||
}
|
||||
|
||||
class Test : IFoo<S> by FooImpl(arrayOf("1"))
|
||||
|
||||
fun box(): String {
|
||||
val test = Test()
|
||||
|
||||
assertEquals("1OK", test.memberFun(S("O"), "K"))
|
||||
assertEquals("1OK", test.memberFunT(S("O"), "K"))
|
||||
assertEquals("1OK", test.genericMemberFun(S("O"), "K"))
|
||||
|
||||
with(test) {
|
||||
assertEquals("1OK", S("O").memberExtFun("K"))
|
||||
assertEquals("1OK", S("O").memberExtFunT("K"))
|
||||
assertEquals("1OK", S("O").genericMemberExtFun("K"))
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
inline class S(val x: String)
|
||||
|
||||
interface IFoo<T> {
|
||||
fun memberFun(s1: S, s2: String): String
|
||||
fun memberFunT(x1: T, x2: String): String
|
||||
fun <X> genericMemberFun(x1: T, x2: X): String
|
||||
fun S.memberExtFun(s: String): String
|
||||
fun T.memberExtFunT(x: String): String
|
||||
fun <X> T.genericMemberExtFun(x: X): String
|
||||
}
|
||||
|
||||
object FooImpl : IFoo<S> {
|
||||
override fun memberFun(s1: S, s2: String): String = s1.x + s2
|
||||
override fun memberFunT(x1: S, x2: String): String = x1.x + x2
|
||||
override fun <X> genericMemberFun(x1: S, x2: X): String = x1.x + x2.toString()
|
||||
override fun S.memberExtFun(s: String): String = this.x + s
|
||||
override fun S.memberExtFunT(x: String): String = this.x + x
|
||||
override fun <X> S.genericMemberExtFun(x: X): String = this.x + x.toString()
|
||||
}
|
||||
|
||||
class Test : IFoo<S> by FooImpl
|
||||
|
||||
fun box(): String {
|
||||
val test = Test()
|
||||
|
||||
assertEquals("OK", test.memberFun(S("O"), "K"))
|
||||
assertEquals("OK", test.memberFunT(S("O"), "K"))
|
||||
assertEquals("OK", test.genericMemberFun(S("O"), "K"))
|
||||
|
||||
with(test) {
|
||||
assertEquals("OK", S("O").memberExtFun("K"))
|
||||
assertEquals("OK", S("O").memberExtFunT("K"))
|
||||
assertEquals("OK", S("O").genericMemberExtFun("K"))
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+53
-5
@@ -13734,11 +13734,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterateOverArrayOfInlineClassValues.kt")
|
||||
public void testIterateOverArrayOfInlineClassValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/iterateOverArrayOfInlineClassValues.kt");
|
||||
@@ -14785,6 +14780,59 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceDelegation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InterfaceDelegation extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInterfaceDelegation() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceDelegation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38337.kt")
|
||||
public void testKt38337() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/kt38337.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtValDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtValDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtValDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtVarDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtVarDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtVarDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassInt.kt")
|
||||
public void testMemberFunDelegatedToInlineClassInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassLong.kt")
|
||||
public void testMemberFunDelegatedToInlineClassLong() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassLong.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationToInlineClassWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+53
-5
@@ -13739,11 +13739,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterateOverArrayOfInlineClassValues.kt")
|
||||
public void testIterateOverArrayOfInlineClassValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/iterateOverArrayOfInlineClassValues.kt");
|
||||
@@ -14785,6 +14780,59 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceDelegation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InterfaceDelegation extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInterfaceDelegation() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceDelegation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38337.kt")
|
||||
public void testKt38337() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/kt38337.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtValDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtValDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtValDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtVarDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtVarDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtVarDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassInt.kt")
|
||||
public void testMemberFunDelegatedToInlineClassInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassLong.kt")
|
||||
public void testMemberFunDelegatedToInlineClassLong() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassLong.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationToInlineClassWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+53
-5
@@ -12519,11 +12519,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterateOverArrayOfInlineClassValues.kt")
|
||||
public void testIterateOverArrayOfInlineClassValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/iterateOverArrayOfInlineClassValues.kt");
|
||||
@@ -13570,6 +13565,59 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceDelegation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InterfaceDelegation extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInterfaceDelegation() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceDelegation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38337.kt")
|
||||
public void testKt38337() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/kt38337.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtValDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtValDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtValDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtVarDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtVarDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtVarDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassInt.kt")
|
||||
public void testMemberFunDelegatedToInlineClassInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassLong.kt")
|
||||
public void testMemberFunDelegatedToInlineClassLong() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassLong.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationToInlineClassWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Generated
+53
-5
@@ -10789,11 +10789,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterateOverArrayOfInlineClassValues.kt")
|
||||
public void testIterateOverArrayOfInlineClassValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/iterateOverArrayOfInlineClassValues.kt");
|
||||
@@ -11765,6 +11760,59 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceDelegation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InterfaceDelegation extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInterfaceDelegation() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceDelegation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38337.kt")
|
||||
public void testKt38337() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/kt38337.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtValDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtValDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtValDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtVarDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtVarDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtVarDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassInt.kt")
|
||||
public void testMemberFunDelegatedToInlineClassInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassLong.kt")
|
||||
public void testMemberFunDelegatedToInlineClassLong() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassLong.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationToInlineClassWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+53
-5
@@ -10854,11 +10854,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineFunctionInsideInlineClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterateOverArrayOfInlineClassValues.kt")
|
||||
public void testIterateOverArrayOfInlineClassValues() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/iterateOverArrayOfInlineClassValues.kt");
|
||||
@@ -11830,6 +11825,59 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceDelegation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InterfaceDelegation extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInterfaceDelegation() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inlineClasses/interfaceDelegation"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceImplementationByDelegation.kt")
|
||||
public void testInterfaceImplementationByDelegation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/interfaceImplementationByDelegation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38337.kt")
|
||||
public void testKt38337() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/kt38337.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtValDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtValDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtValDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtVarDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberExtVarDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberExtVarDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassInt.kt")
|
||||
public void testMemberFunDelegatedToInlineClassInt() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegatedToInlineClassLong.kt")
|
||||
public void testMemberFunDelegatedToInlineClassLong() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegatedToInlineClassLong.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationToInlineClassWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationToInlineClassWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunDelegationWithInlineClassParameterTypes.kt")
|
||||
public void testMemberFunDelegationWithInlineClassParameterTypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/interfaceDelegation/memberFunDelegationWithInlineClassParameterTypes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/interfaceMethodCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user