diff --git a/src/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/de/dhbwstuttgart/core/JavaTXCompiler.java index a04f3c4c..8c43c826 100644 --- a/src/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -98,6 +98,8 @@ public class JavaTXCompiler { Set> results = new HashSet<>(); try { FileWriter logFile = new FileWriter(new File(System.getProperty("user.dir")+"/test/logFiles/"+"log")); + logFile.write("FC:\\" + finiteClosure.toString()+"\n"); + logFile.flush(); for (List> xCons : unifyCons.cartesianProduct()) { Set xConsSet = new HashSet<>(); for (Constraint constraint : xCons) { diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index cd7288e8..45a886c9 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -719,7 +719,17 @@ public class TypeUnifyTask extends RecursiveTask>> { //cs.add(thetaPrime); //PL 18-02-06 entfernt - for(UnifyType c : cs) { + //cs muessen fresh Typvars gesetzt werden PL 2018-03-18 + Set csPHRenamed = cs.stream().map(x -> { + BinaryOperator> combiner = (aa,b) -> { aa.putAll(b); return aa;}; + HashMap hm = x.getInvolvedPlaceholderTypes().stream() + .reduce(new HashMap(), + (aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner); + return x.accept(new freshPlaceholder(), hm); + }).collect(Collectors.toCollection(HashSet::new)); + + + for(UnifyType c : csPHRenamed) { //PL 18-02-05 getChildren durch smaller ersetzt in getChildren werden die Varianlen nicht ersetzt. Set thetaQs = fc.smaller(c).stream().collect(Collectors.toCollection(HashSet::new)); //Set thetaQs = fc.getChildren(c).stream().collect(Collectors.toCollection(HashSet::new)); @@ -746,18 +756,8 @@ public class TypeUnifyTask extends RecursiveTask>> { } for(UnifyType tqp : thetaQPrimes) { - //System.out.println(tqp.toString()); - //i++; - //System.out.println(i); - //if (i == 62) - // System.out.println(tqp.toString()); - BinaryOperator> combiner = (x,y) -> { x.putAll(y); return x;}; - HashMap hm = tqp.getInvolvedPlaceholderTypes().stream() - .reduce(new HashMap(), - (x, y)-> { x.put(y,PlaceholderType.freshPlaceholder()); return x; }, combiner); - Optional opt = stdUnify.unify( - tqp.accept(new freshPlaceholder(), hm), thetaPrime); - if (!opt.isPresent()) { //tqp muesse fresh Typvars gesetzt werden PL 2018-03-16 + Optional opt = stdUnify.unify(tqp, thetaPrime); + if (!opt.isPresent()) { continue; } @@ -765,9 +765,6 @@ public class TypeUnifyTask extends RecursiveTask>> { unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams()); Set substitutionSet = new HashSet<>(); for (Entry sigma : unifier) { - if (tqp.getInvolvedPlaceholderTypes().contains(sigma.getKey())) { //PL eingefuegt 2018-03-16 - break; //TypePalceHolder aus dem FC nicht in das substitutionSet } - } substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT)); } //List freshTphs = new ArrayList<>(); PL 18-02-06 in die For-Schleife verschoben diff --git a/test/javFiles/Matrix.jav b/test/javFiles/Matrix.jav index ec3fdb93..a680370f 100644 --- a/test/javFiles/Matrix.jav +++ b/test/javFiles/Matrix.jav @@ -17,7 +17,7 @@ class Matrix extends Vector> { var k = 0; while(k < v1.size()) { //erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); - erg = add(erg, mul1(v1.elementAt(k), + erg = add1(erg, mul1(v1.elementAt(k), m.elementAt(k).elementAt(j))); k++; } v2.addElement(new Integer(erg));