diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index b066115b..ef2ae74c 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -799,10 +799,14 @@ public class TypeUnifyTask extends RecursiveTask>> { if (first) { //writeLog(pair.toString()+"\n"); Set> x1 = unifyCase1(pair, fc); if (pairOp == PairOperator.SMALLERNEQDOT) { - Set remElem = new HashSet<>(); - remElem.add(pair.getRhsType()); - remElem.add(new ExtendsType(pair.getRhsType())); - remElem.add(new SuperType(pair.getRhsType())); + Set remElem = new HashSet<>(); + remElem.add(new UnifyPair(pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT)); + x1.remove(remElem); + remElem = new HashSet<>(); + remElem.add(new UnifyPair(pair.getLhsType(), new ExtendsType(pair.getRhsType()), PairOperator.EQUALSDOT)); + x1.remove(remElem); + remElem = new HashSet<>(); + remElem.add(new UnifyPair(pair.getLhsType(), new SuperType(pair.getRhsType()), PairOperator.EQUALSDOT)); x1.remove(remElem); } //System.out.println(x1); @@ -860,17 +864,10 @@ public class TypeUnifyTask extends RecursiveTask>> { // result.get(3).add(unifyCase4((PlaceholderType) lhsType, rhsType, fc)); // Case 5: (Theta <. a) - else if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && rhsType instanceof PlaceholderType) + else if ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType) if (first) { //writeLog(pair.toString()+"\n"); Set> x1 = unifyCase5(pair, fc); result.get(4).add(x1); - 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()) { undefined.add(pair); //Theta ist nicht im FC } diff --git a/target/JavaTXcompiler-0.1-jar-with-dependencies.jar b/target/JavaTXcompiler-0.1-jar-with-dependencies.jar index e681dd03..a79c625f 100644 Binary files a/target/JavaTXcompiler-0.1-jar-with-dependencies.jar and b/target/JavaTXcompiler-0.1-jar-with-dependencies.jar differ diff --git a/test/bytecode/javFiles/OL.jav b/test/bytecode/javFiles/OL.jav index 493c2499..dbd746b8 100644 --- a/test/bytecode/javFiles/OL.jav +++ b/test/bytecode/javFiles/OL.jav @@ -1,9 +1,23 @@ import java.lang.Integer; +import java.lang.Double; import java.lang.Boolean; class OL { - m(Integer x) { return x + x; } + m(x) { return x + x; } - m(Boolean x) {return x || x; } -} \ No newline at end of file + //m(x) { return x || x; } + + + } + + +class Main { + + main(x) { + var ol; + ol = new OL(); + return ol.m(x); + } +} + diff --git a/test/bytecode/javFiles/While.jav b/test/bytecode/javFiles/While.jav index 5b983f3e..f4d9d0e9 100644 --- a/test/bytecode/javFiles/While.jav +++ b/test/bytecode/javFiles/While.jav @@ -2,10 +2,10 @@ import java.lang.Integer; // wenn nur ein Import da steht,wird die Type von // dem Literal 2 Number berechnet => Deswegen kann // nicht auf den Stack geladen. -//import java.lang.Long; +import java.lang.Long; public class While { - m(x) { + m(x) { while(x < 2) { x = x+1; }