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

modified:   ../../src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java
	modified:   ../javFiles/Matrix.jav
This commit is contained in:
Martin Plümicke 2018-03-14 13:56:28 +01:00
parent dea3da3b69
commit 273ddb92d7
3 changed files with 11 additions and 2 deletions

View File

@ -156,7 +156,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// those pairs are contradictory and the unification is impossible.
if(!undefinedPairs.isEmpty()) {
writeLog("UndefinedPairs; " + undefinedPairs);
return new HashSet<>();
Set<Set<UnifyPair>> error = new HashSet<>();
error.add(undefinedPairs);
return error;
}
/* Up to here, no cartesian products are calculated.
@ -310,7 +312,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
int i = 0;
byte variance = nextSetasList.iterator().next().iterator().next().getVariance();
Set<UnifyPair> a_next = null;
if (nextSetasList.iterator().next().iterator().next().getLhsType().getName().equals("A"))
if (nextSetasList.iterator().next().iterator().next().getLhsType().getName().equals("D"))
System.out.print("");
if (nextSetasList.size()>1) {
if (variance == 1) {
@ -360,6 +362,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
else {
result.addAll(computeCartesianRecursive(elems, remainingSets, eq, fc, parallel));
}
if (result.size() == 1) {
System.out.println(result.toString());
result.remove(result.iterator().next());
}
if (!result.isEmpty()) {
if (variance == 1) {
if (a.iterator().next().getLhsType().getName().equals("WL"))

View File

@ -27,6 +27,8 @@ public class UnifyPair {
private PairOperator pairOp;
private byte variance = 0;
private boolean undefinedPair = false;
private final int hashCode;

View File

@ -16,6 +16,7 @@ class Matrix extends Vector<Vector<Integer>> {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
erg = add(erg, mul1(v1.elementAt(k),
m.elementAt(k).elementAt(j)));
k++; }