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?
|
||||
|
||||
Type[] argTypes = function.getArgumentTypes();
|
||||
List<Type> originalArgTypes = jvmSignature.getValueParameterTypes();
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
iv.load(0, JetTypeMapper.TYPE_OBJECT);
|
||||
for (int i = 0, reg = 1; i < argTypes.length; i++) {
|
||||
Type argType = argTypes[i];
|
||||
iv.load(reg, argType);
|
||||
StackValue.coerce(argType, originalArgTypes.get(i), iv);
|
||||
//noinspection AssignmentToForLoopParameter
|
||||
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() {
|
||||
blackBoxFile("traits/traitFuncCall.kt");
|
||||
}
|
||||
|
||||
public void testKt2541() {
|
||||
blackBoxFile("regressions/kt2541.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user