modified: ../../src/de/dhbwstuttgart/core/JavaTXCompiler.java

Variance distribut korrigiert
	modified:   ../../src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Fehler im computeCartesianRecursiveOderConstraints beseitigt

	modified:   ../bytecode/javFiles/Matrix.jav
This commit is contained in:
Martin Plümicke 2018-11-05 23:28:08 +01:00
parent d5d49ad30e
commit d08708878f
3 changed files with 24 additions and 14 deletions

View File

@ -315,17 +315,24 @@ public class JavaTXCompiler {
}
}
return x;//HIER DIE JEWEILS RECHT BZW. LINKE SEITE AUF GLEICHE VARIANZ SETZEN WIE DIE JEWEILS ANDERE SEITE
}).map( y -> {
if ((y.getLhsType() instanceof PlaceholderType) && (y.getRhsType() instanceof PlaceholderType)) {
if (((PlaceholderType)y.getLhsType()).getVariance() != 0 && ((PlaceholderType)y.getRhsType()).getVariance() == 0) {
((PlaceholderType)y.getRhsType()).setVariance(((PlaceholderType)y.getLhsType()).getVariance());
});
Set<PlaceholderType> varianceTPHold;
Set<PlaceholderType> varianceTPH = new HashSet<>();
do { //PL 2018-11-05 Huellenbildung Variance auf alle TPHs der Terme auf der jeweiligen
//anderen Seite übertragen
varianceTPHold = new HashSet<>(varianceTPH);
varianceTPH = varianceInheritanceConstraintSet(unifyCons);
unifyCons.map( y -> {
if ((y.getLhsType() instanceof PlaceholderType) && (y.getRhsType() instanceof PlaceholderType)) {
if (((PlaceholderType)y.getLhsType()).getVariance() != 0 && ((PlaceholderType)y.getRhsType()).getVariance() == 0) {
((PlaceholderType)y.getRhsType()).setVariance(((PlaceholderType)y.getLhsType()).getVariance());
}
if (((PlaceholderType)y.getLhsType()).getVariance() == 0 && ((PlaceholderType)y.getRhsType()).getVariance() != 0) {
((PlaceholderType)y.getLhsType()).setVariance(((PlaceholderType)y.getRhsType()).getVariance());
}
}
if (((PlaceholderType)y.getLhsType()).getVariance() == 0 && ((PlaceholderType)y.getRhsType()).getVariance() != 0) {
((PlaceholderType)y.getLhsType()).setVariance(((PlaceholderType)y.getRhsType()).getVariance());
}
}
return y; } );
varianceInheritanceConstraintSet(unifyCons);
return y; } ); }
while (!varianceTPHold.equals(varianceTPH));
//Set<Set<UnifyPair>> result = unify.unifySequential(xConsSet, finiteClosure, logFile, log);
//Set<Set<UnifyPair>> result = unify.unify(xConsSet, finiteClosure);
Set<Set<UnifyPair>> result = unify.unifyOderConstraints(unifyCons.getUndConstraints(), unifyCons.getOderConstraints(), finiteClosure, logFile, log);
@ -360,7 +367,7 @@ public class JavaTXCompiler {
* wenn a eine Variance !=0 hat auf alle Typvariablen in Theta.
* @param eq The set of constraints
*/
private void varianceInheritanceConstraintSet(ConstraintSet<UnifyPair> cons) {
private Set<PlaceholderType> varianceInheritanceConstraintSet(ConstraintSet<UnifyPair> cons) {
Set<UnifyPair> eq = cons.getAll();
Set<PlaceholderType> usedTPH = new HashSet<>();
Set<PlaceholderType> phSet = eq.stream().map(x -> {
@ -396,6 +403,7 @@ public class JavaTXCompiler {
//phSetVariance = new ArrayList<>(phSet); macht vermutlich keinen Sinn PL 2018-10-18
//phSetVariance.removeIf(x -> (x.getVariance() == 0 || usedTPH.contains(x)));
}
return usedTPH;
}

View File

@ -354,6 +354,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
/* auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */
/* PL 2018-11-05 wird falsch weil es auf der obersten Ebene ist.
if (isUndefinedPairSetSet(res)) {
int nofstred= 0;
Set<UnifyPair> abhSubst = res.stream()
@ -406,6 +407,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("Number of Backtracking: " + noBacktracking);
System.out.println("");
}
*/
//if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
// return result;
//}

View File

@ -1,8 +1,8 @@
import java.util.Vector;
import java.lang.Integer;
//import java.lang.Float;
import java.lang.Float;
//import java.lang.Byte;
import java.lang.Boolean;
//import java.lang.Boolean;
public class Matrix extends Vector<Vector<Integer>> {