Fix incorrect usage of mapReturnType in param assertions

This commit is contained in:
Alexander Udalov
2013-12-26 18:50:41 +04:00
parent 2553cd1907
commit d8c5b0236d
3 changed files with 15 additions and 9 deletions
@@ -491,7 +491,7 @@ public class AsmUtil {
if (type == null || isNullableType(type)) continue;
int index = frameMap.getIndex(parameter);
Type asmType = state.getTypeMapper().mapReturnType(type);
Type asmType = state.getTypeMapper().mapType(type);
if (asmType.getSort() == Type.OBJECT || asmType.getSort() == Type.ARRAY) {
v.load(index, asmType);
v.visitLdcInsn(parameter.getName().asString());
@@ -2,13 +2,13 @@ package test;
import org.jetbrains.annotations.NotNull;
public abstract class doGenerateParamAssertions {
public abstract class doGenerateParamAssertions<Type> {
public abstract void bar(@NotNull String s);
public abstract void doTest(@NotNull Type s);
public static void foo(doGenerateParamAssertions a) {
public static void runTest(doGenerateParamAssertions a) {
try {
a.bar(null);
a.doTest(null);
} catch (IllegalArgumentException e) {
return;
}
@@ -1,8 +1,14 @@
import test.doGenerateParamAssertions as C
class A : C() {
override fun bar(s: String) {
}
class TestString : C<String>() {
override fun doTest(s: String) { }
}
fun doTest() = C.foo(A())
class TestUnit : C<Unit>() {
override fun doTest(s: Unit) { }
}
fun doTest() {
C.runTest(TestString())
C.runTest(TestUnit())
}