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

modified:   src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
This commit is contained in:
Martin Plümicke 2018-05-25 14:39:54 +02:00
parent 9d53d9d5d1
commit ae14dfd947
2 changed files with 17 additions and 2 deletions

View File

@ -372,8 +372,19 @@ public class RuleSet implements IRuleSet{
if((pair.getPairOp() != PairOperator.SMALLERDOT) && (pair.getPairOp() != PairOperator.SMALLERNEQDOT))
return false;
if ((pair.getPairOp() == PairOperator.SMALLERNEQDOT) && (pair.getLhsType().equals(pair.getRhsType()))) {
return false;
if (pair.getPairOp() == PairOperator.SMALLERNEQDOT) {
UnifyType lhs = pair.getLhsType();
UnifyType rhs = pair.getRhsType();
if (lhs instanceof WildcardType) {
lhs = ((WildcardType)lhs).getWildcardedType();
}
if (rhs instanceof WildcardType) {
rhs = ((WildcardType)rhs).getWildcardedType();
}
if (lhs.equals(rhs)){
return false;
}
}
UnifyType lhsType = pair.getLhsType();

View File

@ -801,6 +801,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (pairOp == PairOperator.SMALLERNEQDOT) {
Set<UnifyType> remElem = new HashSet<>();
remElem.add(pair.getRhsType());
remElem.add(new ExtendsType(pair.getRhsType()));
remElem.add(new SuperType(pair.getRhsType()));
x1.remove(remElem);
}
//System.out.println(x1);
@ -865,6 +867,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (pairOp == PairOperator.SMALLERNEQDOT) {
Set<UnifyType> remElem = new HashSet<>();
remElem.add(pair.getLhsType());
remElem.add(new ExtendsType(pair.getLhsType()));
remElem.add(new SuperType(pair.getLhsType()));
x1.remove(remElem);
}
if (x1.isEmpty()) {