forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
modified: src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java variance von Pairs geloescht.
This commit is contained in:
parent
a5662cdd9a
commit
23384f413d
@ -308,7 +308,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
nOfUnify++;
|
||||
writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString());
|
||||
writeLog(nOfUnify.toString() + " Oderconstraints: " + oderConstraints.toString());
|
||||
//eq = eq.stream().map(x -> {x.setVariance((byte)-1); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||
|
||||
/*
|
||||
* Variancen auf alle Gleichungen vererben
|
||||
@ -2033,7 +2032,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
protected Set<Set<UnifyPair>> unifyCase1(UnifyPair pair, IFiniteClosure fc) {
|
||||
PlaceholderType a = (PlaceholderType)pair.getLhsType();
|
||||
UnifyType thetaPrime = pair.getRhsType();
|
||||
byte variance = pair.getVariance();
|
||||
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
@ -2158,7 +2156,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
}
|
||||
resultPrime.addAll(substitutionSet);
|
||||
//writeLog("Substitution: " + substitutionSet.toString());
|
||||
resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||
result.add(resultPrime);
|
||||
//writeLog("Result: " + resultPrime.toString());
|
||||
//writeLog("MAX: " + oup.max(resultPrime.iterator()).toString());
|
||||
@ -2177,7 +2174,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
private Set<Set<UnifyPair>> unifyCase2(UnifyPair pair, IFiniteClosure fc) {
|
||||
PlaceholderType a = (PlaceholderType) pair.getLhsType();
|
||||
ExtendsType extThetaPrime = (ExtendsType) pair.getRhsType();
|
||||
byte variance = pair.getVariance();
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
UnifyType aPrime = PlaceholderType.freshPlaceholder();
|
||||
@ -2192,7 +2188,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, extAPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||
resultPrime.add(new UnifyPair(aPrime, thetaPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair));
|
||||
resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||
result.add(resultPrime);
|
||||
//writeLog("Result: " + resultPrime.toString());
|
||||
return result;
|
||||
@ -2205,7 +2200,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
PlaceholderType a = (PlaceholderType) pair.getLhsType();
|
||||
a.reversVariance();
|
||||
SuperType subThetaPrime = (SuperType) pair.getRhsType();
|
||||
byte variance = pair.getVariance();
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
UnifyType aPrime = PlaceholderType.freshPlaceholder();
|
||||
@ -2221,7 +2215,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, supAPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||
resultPrime.add(new UnifyPair(thetaPrime, aPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair));
|
||||
resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||
result.add(resultPrime);
|
||||
//writeLog(resultPrime.toString());
|
||||
|
||||
@ -2234,7 +2227,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
private Set<Set<UnifyPair>> unifyCase5(UnifyPair pair, IFiniteClosure fc) {
|
||||
UnifyType theta = pair.getLhsType();
|
||||
PlaceholderType a = (PlaceholderType) pair.getRhsType();
|
||||
byte variance = pair.getVariance();
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
boolean allGen = theta.getTypeParams().size() > 0;
|
||||
@ -2298,7 +2290,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||
else
|
||||
resultPrime.add(new UnifyPair(a, thetaS.setTypeParams(new TypeParams(freshTphs)), PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||
resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||
result.add(resultPrime);
|
||||
//writeLog("FBOUNDED2: " + pair.getfBounded());
|
||||
//writeLog("resultPrime Theta < a: " + greater + pair + "THETA: " + theta + "FBOUNDED: " + pair.getfBounded() + " " + resultPrime.toString());
|
||||
@ -2313,8 +2304,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
private Set<Set<UnifyPair>> unifyCase8(UnifyPair pair, IFiniteClosure fc) {
|
||||
UnifyType theta = pair.getLhsType();
|
||||
PlaceholderType a = (PlaceholderType) pair.getRhsType();
|
||||
byte variance = pair.getVariance();
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
//for(UnifyType thetaS : fc.grArg(theta)) {
|
||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, theta, PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||
@ -2334,7 +2324,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, new SuperType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||
resultPrime.add(new UnifyPair(freshTph, theta, PairOperator.SMALLERDOT, pair.getSubstitution(), pair));
|
||||
resultPrime = resultPrime.stream().map(x -> { x.setVariance(variance); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||
result.add(resultPrime);
|
||||
//writeLog(resultPrime.toString());
|
||||
//}
|
||||
|
@ -29,15 +29,6 @@ public class UnifyPair {
|
||||
*/
|
||||
private PairOperator pairOp;
|
||||
|
||||
/** wieder loesecn wird nicht mehr benoetigt PL 2018-03-31
|
||||
* variance shows the variance of the pair
|
||||
* -1: contravariant
|
||||
* 1 covariant
|
||||
* 0 invariant
|
||||
* PL 2018-03-21
|
||||
*/
|
||||
private byte variance = 0;
|
||||
|
||||
private boolean undefinedPair = false;
|
||||
|
||||
/**
|
||||
@ -83,7 +74,6 @@ public class UnifyPair {
|
||||
pairOp = op;
|
||||
substitution = uni;
|
||||
basePair = base;
|
||||
this.variance = variance;
|
||||
|
||||
|
||||
// Caching hashcode
|
||||
@ -125,14 +115,6 @@ public class UnifyPair {
|
||||
substitution.addAll(sup);
|
||||
}
|
||||
|
||||
public byte getVariance() {
|
||||
return variance;
|
||||
}
|
||||
|
||||
public void setVariance(byte v) {
|
||||
variance = v;
|
||||
}
|
||||
|
||||
public void setUndefinedPair() {
|
||||
undefinedPair = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user