diff --git a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java index 4cc196b0..b40dee30 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java +++ b/src/de/dhbwstuttgart/typeinference/unify/RuleSet.java @@ -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(); diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index f7795f13..b066115b 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -801,6 +801,8 @@ public class TypeUnifyTask extends RecursiveTask>> { if (pairOp == PairOperator.SMALLERNEQDOT) { Set 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>> { if (pairOp == PairOperator.SMALLERNEQDOT) { Set 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()) {