couple of fixes to allow generation of generic extension functions
This commit is contained in:
@@ -232,6 +232,10 @@ public class JetTypeMapper {
|
|||||||
return Type.getObjectType(jvmName((ClassDescriptor) descriptor, kind));
|
return Type.getObjectType(jvmName((ClassDescriptor) descriptor, kind));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (descriptor instanceof TypeParameterDescriptor) {
|
||||||
|
return mapType(((TypeParameterDescriptor) descriptor).getBoundsAsType(), kind);
|
||||||
|
}
|
||||||
|
|
||||||
throw new UnsupportedOperationException("Unknown type " + jetType);
|
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) {
|
else if (this.type.getSort() == Type.OBJECT && type.getSort() <= Type.DOUBLE) {
|
||||||
if (this.type.equals(JetTypeMapper.TYPE_OBJECT)) {
|
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);
|
unbox(type, v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ fun box(): String {
|
|||||||
list.add("Moscow")
|
list.add("Moscow")
|
||||||
list.add("Munich")
|
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"
|
return if (m.size() == 2) "OK" else "fail"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ExtensionFunctionsTest extends CodegenTestCase {
|
|||||||
assertThrows(foo, Exception.class, null, new StringBuilder());
|
assertThrows(foo, Exception.class, null, new StringBuilder());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _testGeneric() throws Exception {
|
public void testGeneric() throws Exception {
|
||||||
blackBoxFile("extensionFunctions/generic.jet");
|
blackBoxFile("extensionFunctions/generic.jet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user