forked from JavaTX/JavaCompilerCore
modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
resuat add in cartesion angepasst modified: src/de/dhbwstuttgart/typeinference/unify/model/Unifier.java modified: src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java equals in UnfyPair auf UndefinedPairs angepasst
This commit is contained in:
parent
21bc2a67a1
commit
615983bf37
@ -318,7 +318,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
*/
|
||||
eqPrimePrimeSet = eqPrimePrimeSet.stream().filter(x -> isSolvedForm(x) || this.isUndefinedPairSet(x)).collect(Collectors.toCollection(HashSet::new));
|
||||
if (!eqPrimePrimeSet.isEmpty() && !isUndefinedPairSetSet(eqPrimePrimeSet))
|
||||
writeLog("Result " + eqPrimePrimeSet.toString());
|
||||
writeLog("Result1 " + eqPrimePrimeSet.toString());
|
||||
return eqPrimePrimeSet;
|
||||
}
|
||||
|
||||
@ -419,10 +419,25 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
elems.add(a);
|
||||
if (remainingSets.isEmpty()) {
|
||||
Set<Set<UnifyPair>> res = unify2(elems, eq, fc, parallel);
|
||||
if (!isUndefinedPairSetSet(res)) {// && isUndefinedPairSetSet(result)) {//wenn korektes Ergebnis gefunden alle Fehlerfaelle loeschen
|
||||
result = new HashSet<>();
|
||||
if (!isUndefinedPairSetSet(res) && isUndefinedPairSetSet(result)) {
|
||||
//wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen
|
||||
result = res;
|
||||
}
|
||||
result.addAll(res);
|
||||
else {
|
||||
if ((isUndefinedPairSetSet(res) && isUndefinedPairSetSet(result))
|
||||
|| (!isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result))
|
||||
|| result.isEmpty()) {
|
||||
//alle Fehlerfaelle und alle korrekten Ergebnis jeweils adden
|
||||
result.addAll(res);
|
||||
}
|
||||
//else {
|
||||
//wenn Korrekte Ergebnisse da und Feherfälle dazukommen Fehlerfälle ignorieren
|
||||
// if (isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) {
|
||||
// result = result;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
else {//duerfte gar nicht mehr vorkommen PL 2018-04-03
|
||||
result.addAll(computeCartesianRecursive(elems, remainingSets, eq, fc, parallel));
|
||||
@ -475,9 +490,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
return (!x.containsAll(durchschnitt));
|
||||
}).collect(Collectors.toCollection(ArrayList::new));
|
||||
writeLog("abhSubst: " + abhSubst.toString());
|
||||
writeLog("a: " + a.toString());
|
||||
writeLog("Durchschnitt: " + durchschnitt.toString());
|
||||
writeLog("nextSet: " + nextSet.toString());
|
||||
writeLog("nextSetasList: " + nextSetasList.toString());
|
||||
writeLog("Durchschnitt: " + durchschnitt.toString());
|
||||
System.out.println("");
|
||||
}
|
||||
//if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
|
||||
|
@ -81,7 +81,8 @@ public class Unifier implements Function<UnifyType, UnifyType>, Iterable<Entry<P
|
||||
Set<UnifyPair> suniUnifyPair = new HashSet<>();
|
||||
suniUnifyPair.addAll(thisAsPair.getAllSubstitutions());
|
||||
suniUnifyPair.add(thisAsPair);
|
||||
if (p.getLhsType() instanceof PlaceholderType && newLhs instanceof PlaceholderType && p.getPairOp() == PairOperator.EQUALSDOT) {
|
||||
if (p.getLhsType() instanceof PlaceholderType //&& newLhs instanceof PlaceholderType entfernt PL 2018-04-13
|
||||
&& p.getPairOp() == PairOperator.EQUALSDOT) {
|
||||
suniUnifyPair.add(p); //p koennte auch subsitution sein
|
||||
}
|
||||
return new UnifyPair(newLhs, newRhs, p.getPairOp(), suniUnifyPair, p);
|
||||
|
@ -148,6 +148,13 @@ public class UnifyPair {
|
||||
|
||||
UnifyPair other = (UnifyPair) obj;
|
||||
|
||||
if (isUndefinedPair()) {
|
||||
if (!other.getBasePair().equals(basePair) ||
|
||||
!other.getAllSubstitutions().equals(getAllSubstitutions())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return other.getPairOp() == pairOp
|
||||
&& other.getLhsType().equals(lhs)
|
||||
&& other.getRhsType().equals(rhs);
|
||||
|
Loading…
Reference in New Issue
Block a user