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

SMALERNEQDOT in Regel a <!=. Theta korrigiert
SMALERNEQDOT in Regel Theta <!=. a geloescht
This commit is contained in:
Martin Plümicke 2018-05-28 16:07:29 +02:00
parent 581e5e574e
commit 66587a8f71
4 changed files with 28 additions and 17 deletions

View File

@ -799,10 +799,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (first) { //writeLog(pair.toString()+"\n");
Set<Set<UnifyPair>> x1 = unifyCase1(pair, fc);
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()));
Set<UnifyPair> 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<Set<Set<UnifyPair>>> {
// 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<Set<UnifyPair>> x1 = unifyCase5(pair, fc);
result.get(4).add(x1);
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()) {
undefined.add(pair); //Theta ist nicht im FC
}

View File

@ -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; }
}
//m(x) { return x || x; }
}
class Main {
main(x) {
var ol;
ol = new OL();
return ol.m(x);
}
}

View File

@ -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;
}