forked from JavaTX/JavaCompilerCore
Fix codegen a bit, and add missing constraints
This commit is contained in:
parent
239698c8d6
commit
29f654279b
@ -949,7 +949,7 @@ public class Codegen {
|
||||
mv.visitMethodInsn(call.isInterface() ? INVOKEINTERFACE : call.isStatic() ? INVOKESTATIC: call.name().equals("<init>") ? INVOKESPECIAL : INVOKEVIRTUAL,
|
||||
call.owner().getInternalName(), call.name(), descriptor, call.isInterface());
|
||||
|
||||
if (call.returnType() != null && !(call.returnType() instanceof TargetPrimitiveType)) {
|
||||
if (call.type() != null && call.returnType() != null && !(call.returnType() instanceof TargetPrimitiveType)) {
|
||||
if (!call.returnType().equals(call.type()) && !(call.type() instanceof TargetGenericType))
|
||||
mv.visitTypeInsn(CHECKCAST, call.type().getInternalName());
|
||||
unboxPrimitive(state, call.type());
|
||||
|
@ -575,16 +575,22 @@ public class ASTToTargetAST {
|
||||
private void findChain(Set<TypePlaceholder> referenced, Set<ResultPair<?, ?>> input, Set<ResultPair<?, ?>> output, TypePlaceholder start, TypePlaceholder end, Set<TypePlaceholder> chain) {
|
||||
if (referenced.contains(end)) {
|
||||
var pair = new PairTPHsmallerTPH(start, end);
|
||||
if (input.contains(pair)) output.add(pair);
|
||||
output.add(pair);
|
||||
return;
|
||||
}
|
||||
var foundNext = false;
|
||||
for (var pair : input) {
|
||||
if (pair instanceof PairTPHsmallerTPH ptph && ptph.left.equals(end)) {
|
||||
if (chain.contains(ptph.right)) return;
|
||||
chain = new HashSet<>(chain);
|
||||
chain.add(ptph.right);
|
||||
findChain(referenced, input, output, start, ptph.right, chain);
|
||||
foundNext = true;
|
||||
}
|
||||
}
|
||||
if (!foundNext) {
|
||||
output.add(new PairTPHequalRefTypeOrWildcardType(start, OBJECT));
|
||||
}
|
||||
}
|
||||
|
||||
void eliminateInnerTypeVariables(Set<TypePlaceholder> referenced, Set<ResultPair<?, ?>> input) {
|
||||
@ -594,7 +600,6 @@ public class ASTToTargetAST {
|
||||
if (pair instanceof PairTPHsmallerTPH pthp && pthp.left.equals(tph)) {
|
||||
var chain = new HashSet<TypePlaceholder>();
|
||||
chain.add(tph);
|
||||
chain.add(pthp.right);
|
||||
findChain(referenced, input, output, tph, pthp.right, chain);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user