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,9 +372,20 @@ public class RuleSet implements IRuleSet{
if((pair.getPairOp() != PairOperator.SMALLERDOT) && (pair.getPairOp() != PairOperator.SMALLERNEQDOT)) if((pair.getPairOp() != PairOperator.SMALLERDOT) && (pair.getPairOp() != PairOperator.SMALLERNEQDOT))
return false; return false;
if ((pair.getPairOp() == PairOperator.SMALLERNEQDOT) && (pair.getLhsType().equals(pair.getRhsType()))) { 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; return false;
} }
}
UnifyType lhsType = pair.getLhsType(); UnifyType lhsType = pair.getLhsType();
if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType)) if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType))

View File

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