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

modified:   ../../src/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java
Variancen gesetzt
This commit is contained in:
Martin Plümicke 2018-03-11 20:39:38 +01:00
parent 95943b1627
commit 1667b394f2
2 changed files with 8 additions and 5 deletions

View File

@ -572,7 +572,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if(pairOp == PairOperator.SMALLERDOT && lhsType instanceof PlaceholderType) {
//System.out.println(pair);
if (first) { //writeLog(pair.toString()+"\n");
Set<Set<UnifyPair>> x1 = unifyCase1((PlaceholderType) pair.getLhsType(), pair.getRhsType(), pair.getVariance(), fc);
Set<Set<UnifyPair>> x1 = unifyCase1((PlaceholderType) pair.getLhsType(), pair.getRhsType(), (byte)1, fc);
//System.out.println(x1);
result.get(0).add(x1);
}
@ -588,7 +588,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// Case 2: (a <.? ? ext Theta')
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType)
if (first) { //writeLog(pair.toString()+"\n");
result.get(1).add(unifyCase2((PlaceholderType) pair.getLhsType(), (ExtendsType) pair.getRhsType(), pair.getVariance(), fc));
result.get(1).add(unifyCase2((PlaceholderType) pair.getLhsType(), (ExtendsType) pair.getRhsType(), (byte)0, fc));
}
else {
Set<UnifyPair> s1 = new HashSet<>();
@ -601,7 +601,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// Case 3: (a <.? ? sup Theta')
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType)
if (first) { //writeLog(pair.toString()+"\n");
result.get(2).add(unifyCase3((PlaceholderType) lhsType, (SuperType) rhsType, pair.getVariance(), fc));
result.get(2).add(unifyCase3((PlaceholderType) lhsType, (SuperType) rhsType, (byte)0, fc));
}
else {
Set<UnifyPair> s1 = new HashSet<>();
@ -619,7 +619,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// Case 5: (Theta <. a)
else if(pairOp == PairOperator.SMALLERDOT && rhsType instanceof PlaceholderType)
if (first) { //writeLog(pair.toString()+"\n");
result.get(4).add(unifyCase5(lhsType, (PlaceholderType) rhsType, pair.getVariance(), fc));
if (rhsType.getName().equals("A"))
System.out.println();
result.get(4).add(unifyCase5(lhsType, (PlaceholderType) rhsType, (byte)-1, fc));
}
else {
Set<UnifyPair> s1 = new HashSet<>();
@ -643,7 +645,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
else if(pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType)
if (first) { //writeLog(pair.toString()+"\n");
result.get(7).add(
unifyCase8(lhsType, (PlaceholderType) rhsType, pair.getVariance(), fc));
unifyCase8(lhsType, (PlaceholderType) rhsType, (byte)0, fc));
}
else {
Set<UnifyPair> s1 = new HashSet<>();

View File

@ -90,6 +90,7 @@ public class OrderingUnifyPair extends Ordering<Set<UnifyPair>> {
.filter(x -> ((x.getLhsType() instanceof PlaceholderType || x.getRhsType() instanceof PlaceholderType)
&& x.getPairOp() == PairOperator.SMALLERDOTWC))
.collect(Collectors.toCollection(HashSet::new));
//System.out.println(left.toString());
//Fall 2 und 3
if (lefteq.size() == 1 && leftle.size() == 1 && righteq.size() == 0 && rightle.size() == 1) {
return 1;