Continue with eliminating inner type variables
This commit is contained in:
parent
5243b160f5
commit
64ec7989b4
@ -568,6 +568,8 @@ public class ASTToTargetAST {
|
||||
}
|
||||
|
||||
void eliminateInnerTypeVariables(Set<TypePlaceholder> referenced, Set<ResultPair<?, ?>> input) {
|
||||
// Remove type variables that are part of a relation A < B < C where B is not in referenced
|
||||
// Add new pair A < C
|
||||
var oldInput = new HashSet<>(input);
|
||||
for (var pair : oldInput) {
|
||||
if (pair instanceof PairTPHsmallerTPH ptph && !referenced.contains(ptph.left)) {
|
||||
@ -581,6 +583,21 @@ public class ASTToTargetAST {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove lone type variables, A = RefType where A is in no relation X < A or A < X and A is not in referenced
|
||||
oldInput = new HashSet<>(input);
|
||||
outer:
|
||||
for (var pair : oldInput) {
|
||||
if (pair instanceof PairTPHequalRefTypeOrWildcardType ptph) {
|
||||
if (!referenced.contains(ptph.left)) {
|
||||
for (var pair2 : oldInput) {
|
||||
if (pair != pair2 && (pair2.getLeft().equals(ptph.left) || pair2.getRight().equals(ptph.left)))
|
||||
continue outer;
|
||||
}
|
||||
input.remove(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void eliminateCycles(Set<ResultPair<?, ?>> input) {
|
||||
|
Loading…
Reference in New Issue
Block a user