Merge pull request #112 from udalov/kt2541
KT-2541 VerifyError on substituting type after inheritance from trait
This commit is contained in:
@@ -823,11 +823,13 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
codegen.generateThisOrOuter(descriptor); // ??? wouldn't it be a good idea to put it?
|
codegen.generateThisOrOuter(descriptor); // ??? wouldn't it be a good idea to put it?
|
||||||
|
|
||||||
Type[] argTypes = function.getArgumentTypes();
|
Type[] argTypes = function.getArgumentTypes();
|
||||||
|
List<Type> originalArgTypes = jvmSignature.getValueParameterTypes();
|
||||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||||
iv.load(0, JetTypeMapper.TYPE_OBJECT);
|
iv.load(0, JetTypeMapper.TYPE_OBJECT);
|
||||||
for (int i = 0, reg = 1; i < argTypes.length; i++) {
|
for (int i = 0, reg = 1; i < argTypes.length; i++) {
|
||||||
Type argType = argTypes[i];
|
Type argType = argTypes[i];
|
||||||
iv.load(reg, argType);
|
iv.load(reg, argType);
|
||||||
|
StackValue.coerce(argType, originalArgTypes.get(i), iv);
|
||||||
//noinspection AssignmentToForLoopParameter
|
//noinspection AssignmentToForLoopParameter
|
||||||
reg += argType.getSize();
|
reg += argType.getSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
trait A<T, U> {
|
||||||
|
fun foo(t: T, u: U) = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
class B<T> : A<T, Int>
|
||||||
|
|
||||||
|
fun box(): String = B<Int>().foo(1, 2)
|
||||||
@@ -64,4 +64,8 @@ public class TraitsTest extends CodegenTestCase {
|
|||||||
public void testTraitFuncCall() {
|
public void testTraitFuncCall() {
|
||||||
blackBoxFile("traits/traitFuncCall.kt");
|
blackBoxFile("traits/traitFuncCall.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKt2541() {
|
||||||
|
blackBoxFile("regressions/kt2541.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user