modified: ../../src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

logging ergaenzt

	modified:   ../../src/de/dhbwstuttgart/typeinference/unify/model/Unifier.java
getSubstitution() durch getAllSubstitutions() ersetzt
This commit is contained in:
Martin Plümicke 2018-04-06 20:01:14 +02:00
parent baee0024e9
commit 603c4c9c46
2 changed files with 9 additions and 2 deletions

View File

@ -171,7 +171,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// If pairs occured that did not match one of the cartesian product cases,
// those pairs are contradictory and the unification is impossible.
if(!undefinedPairs.isEmpty()) {
writeLog("UndefinedPairs; " + undefinedPairs);
for (UnifyPair up : undefinedPairs) {
writeLog("UndefinedPairs; " + up);
writeLog("BasePair; " + up.getBasePair());
}
Set<Set<UnifyPair>> error = new HashSet<>();
undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new));
error.add(undefinedPairs);
@ -467,6 +470,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//}
return (!x.containsAll(durchschnitt));
}).collect(Collectors.toCollection(ArrayList::new));
writeLog("abhSubst: " + abhSubst.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) {

View File

@ -79,7 +79,7 @@ public class Unifier implements Function<UnifyType, UnifyType>, Iterable<Entry<P
UnifyType newRhs = this.apply(p.getRhsType());
if (!(p.getLhsType().equals(newLhs)) || !(p.getRhsType().equals(newRhs))) {//Die Anwendung von this hat was veraendert PL 2018-04-01
Set<UnifyPair> suniUnifyPair = new HashSet<>();
suniUnifyPair.addAll(thisAsPair.getSubstitution());
suniUnifyPair.addAll(thisAsPair.getAllSubstitutions());
suniUnifyPair.add(thisAsPair);
if (p.getLhsType() instanceof PlaceholderType && newLhs instanceof PlaceholderType && p.getPairOp() == PairOperator.EQUALSDOT) {
suniUnifyPair.add(p); //p koennte auch subsitution sein