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

modified:   test/javFiles/Matrix.jav
Fehler entdeckt, in unifyCase1 fuer die Typen aus FC keine fresh TV getsetzt werden.
This commit is contained in:
Martin Plümicke 2018-03-16 14:10:40 +01:00
parent bd98bed5ca
commit 3638edfa73
2 changed files with 10 additions and 7 deletions

View File

@ -393,7 +393,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
} }
} }
if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result)) { if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
return result; return result;
} }
//else result.stream().filter(y -> !isUndefinedPairSet(y)); //else result.stream().filter(y -> !isUndefinedPairSet(y));
@ -749,16 +749,19 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//System.out.println(i); //System.out.println(i);
//if (i == 62) //if (i == 62)
// System.out.println(tqp.toString()); // System.out.println(tqp.toString());
Optional<Unifier> opt = stdUnify.unify(tqp, thetaPrime); Optional<Unifier> opt = stdUnify.unify(tqp.setTypeParams(newTp), thetaPrime);
if (!opt.isPresent()) if (!opt.isPresent()) tpq muesse freshtv gesetzt werden PL 2018-03-16
continue; continue;
Unifier unifier = opt.get(); Unifier unifier = opt.get();
unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams()); unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams());
Set<UnifyPair> substitutionSet = new HashSet<>(); Set<UnifyPair> substitutionSet = new HashSet<>();
for (Entry<PlaceholderType, UnifyType> sigma : unifier) for (Entry<PlaceholderType, UnifyType> sigma : unifier) {
if (tqp.getInvolvedPlaceholderTypes().contains(sigma.getKey())) { //PL eingefuegt 2018-03-16
break; //TypePalceHolder aus dem FC nicht in das substitutionSet }
}
substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT)); substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT));
}
//List<UnifyType> freshTphs = new ArrayList<>(); PL 18-02-06 in die For-Schleife verschoben //List<UnifyType> freshTphs = new ArrayList<>(); PL 18-02-06 in die For-Schleife verschoben
for (UnifyType tq : thetaQs) { for (UnifyType tq : thetaQs) {
Set<UnifyType> smaller = fc.smaller(unifier.apply(tq)); Set<UnifyType> smaller = fc.smaller(unifier.apply(tq));

View File

@ -17,8 +17,8 @@ class Matrix extends Vector<Vector<Integer>> {
var k = 0; var k = 0;
while(k < v1.size()) { while(k < v1.size()) {
//erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); //erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
//erg = add1(erg, mul1(v1.elementAt(k), erg = add1(erg, mul1(v1.elementAt(k),
// m.elementAt(k).elementAt(j))); m.elementAt(k).elementAt(j)));
k++; } k++; }
v2.addElement(new Integer(erg)); v2.addElement(new Integer(erg));
j++; } j++; }