From fc14cf98939b78e322464462ff00dbb748755a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Thu, 28 Feb 2019 18:29:08 +0100 Subject: [PATCH] modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java subst-Anwendung gleich am Anfang von unify eingefuehrt --- .../java/de/dhbwstuttgart/core/JavaTXCompiler.java | 6 +++--- .../typeinference/unify/TypeUnifyTask.java | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 0be50fb5..03567487 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -52,7 +52,7 @@ import org.antlr.v4.parse.ANTLRParser.throwsSpec_return; public class JavaTXCompiler { final CompilationEnvironment environment; - Boolean resultmodel = true; + Boolean resultmodel = false; public final Map sourceFiles = new HashMap<>(); Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"src/test/java/logFiles" geschrieben werden soll? @@ -551,8 +551,8 @@ public class JavaTXCompiler { } /* UnifyResultModel End */ else { - Set> result = unify.unify(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, finiteClosure)); - //Set> result = unify.unifyOderConstraints(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, finiteClosure)); + //Set> result = unify.unify(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, finiteClosure)); + Set> result = unify.unifyOderConstraints(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, finiteClosure)); System.out.println("RESULT: " + result); logFile.write("RES: " + result.toString()+"\n"); logFile.flush(); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 1d383c66..3ef3f8d4 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -529,8 +529,14 @@ public class TypeUnifyTask extends RecursiveTask>> { return ret; } - - Set eq0 = applyTypeUnificationRules(eq, fc); + Set eq0; + Set eq0Prime; + Optional> eqSubst = Optional.of(eq); + do { + eq0Prime = eqSubst.get(); + eq0 = applyTypeUnificationRules(eq0Prime, fc); + eqSubst = rules.subst(eq0, oderConstraints); + } while (eqSubst.isPresent()); /* * Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs