提交 f7a04097 编写于 作者: D Dmitry Jemerov

couple of fixes to allow generation of generic extension functions

上级 7f69d9a3
......@@ -232,6 +232,10 @@ public class JetTypeMapper {
return Type.getObjectType(jvmName((ClassDescriptor) descriptor, kind));
}
if (descriptor instanceof TypeParameterDescriptor) {
return mapType(((TypeParameterDescriptor) descriptor).getBoundsAsType(), kind);
}
throw new UnsupportedOperationException("Unknown type " + jetType);
}
......
......@@ -152,7 +152,12 @@ public abstract class StackValue {
}
else if (this.type.getSort() == Type.OBJECT && type.getSort() <= Type.DOUBLE) {
if (this.type.equals(JetTypeMapper.TYPE_OBJECT)) {
v.checkcast(Type.getObjectType("java/lang/Number"));
if (type.getSort() == Type.BOOLEAN) {
v.checkcast(Type.getObjectType("java/lang/Boolean"));
}
else {
v.checkcast(Type.getObjectType("java/lang/Number"));
}
}
unbox(type, v);
}
......
......@@ -16,6 +16,6 @@ fun box(): String {
list.add("Moscow")
list.add("Munich")
val m: ArrayList<String> = list.findAll({(name: String) => name.startsWith("M")})
val m: ArrayList<String> = list.findAll<String>({(name: String) => name.startsWith("M")})
return if (m.size() == 2) "OK" else "fail"
}
......@@ -24,7 +24,7 @@ public class ExtensionFunctionsTest extends CodegenTestCase {
assertThrows(foo, Exception.class, null, new StringBuilder());
}
public void _testGeneric() throws Exception {
public void testGeneric() throws Exception {
blackBoxFile("extensionFunctions/generic.jet");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册