Fix type variable being declared twice

This commit is contained in:
Victorious3 2023-04-04 13:09:28 +02:00
parent aa9782edd7
commit e231cf722b

View File

@ -116,6 +116,8 @@ public class ASTToTargetAST {
} }
return false; return false;
}); });
} else if (input.stream().anyMatch(p -> p.getLeft().equals(pair.getLeft()))) {
return;
} }
input.add(pair); input.add(pair);
@ -605,14 +607,14 @@ public class ASTToTargetAST {
if (left.equals(tph)) { if (left.equals(tph)) {
var pair = new PairTPHsmallerTPH(tph, right); var pair = new PairTPHsmallerTPH(tph, right);
if (!generics.contains(pair)) { if (!generics.contains(pair)) {
generics.add(pair); addToPairs(generics, pair);
findAllBounds(right, generics, equality); findAllBounds(right, generics, equality);
found = true; found = true;
} }
} }
} }
if (!found) if (!found)
generics.add(new PairTPHequalRefTypeOrWildcardType(tph, OBJECT)); addToPairs(generics, new PairTPHequalRefTypeOrWildcardType(tph, OBJECT));
} else if (type instanceof RefType refType) { } else if (type instanceof RefType refType) {
refType.getParaList().forEach(t -> findAllBounds(t, generics, equality)); refType.getParaList().forEach(t -> findAllBounds(t, generics, equality));
} }
@ -663,7 +665,6 @@ public class ASTToTargetAST {
} }
} }
} }
System.out.println(input);
} }
void findTphs(RefTypeOrTPHOrWildcardOrGeneric type, Set<TypePlaceholder> tphs, Map<TypePlaceholder, TypePlaceholder> equality) { void findTphs(RefTypeOrTPHOrWildcardOrGeneric type, Set<TypePlaceholder> tphs, Map<TypePlaceholder, TypePlaceholder> equality) {