From a84d1ffdd75411a5a3e205e1141b345dcb4f549b Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Wed, 8 Nov 2023 18:28:54 +0100 Subject: [PATCH] modified: ../src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java Resultmodell aktiviert modified: ../src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java a < void und void < a => a = void. --- .../de/dhbwstuttgart/core/JavaTXCompiler.java | 4 ++-- .../typeinference/unify/TypeUnifyTask.java | 21 +++++++++++++++---- src/test/java/TestComplete.java | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 91e6e673..8ea08a23 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -68,10 +68,10 @@ public class JavaTXCompiler { // public static JavaTXCompiler INSTANCE; final CompilationEnvironment environment; - Boolean resultmodel = false; + Boolean resultmodel = true; public final Map sourceFiles = new HashMap<>(); - Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll? + Boolean log = false; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll? public volatile UnifyTaskModel usedTasks = new UnifyTaskModel(); private final DirectoryClassLoader classLoader; diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 01834a75..110886dd 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -2024,10 +2024,15 @@ public class TypeUnifyTask extends RecursiveTask>> { if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) { //System.out.println(pair); if (first) { //writeLog(pair.toString()+"\n"); - if (((PlaceholderType)(pair.getLhsType())).getName().equals("AR")) { - System.out.println("AR"); + Set> x1 = new HashSet<>(); + if (pair.getRhsType().getName().equals("void")) { + Set resultOne = new HashSet<>(); + resultOne.add(new UnifyPair (pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + x1.add(resultOne); + } + else { + x1 = unifyCase1(pair, fc); } - Set> x1 = unifyCase1(pair, fc); if (pairOp == PairOperator.SMALLERNEQDOT) { Set remElem = new HashSet<>(); remElem.add(new UnifyPair(pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT)); @@ -2159,7 +2164,15 @@ public class TypeUnifyTask extends RecursiveTask>> { // Case 5: (Theta <. a) else if ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType) if (first) { //writeLog(pair.toString()+"\n"); - Set> x1 = unifyCase5(pair, fc); + Set> x1 = new HashSet<>(); + if (pair.getLhsType().getName().equals("void")) { + Set resultOne = new HashSet<>(); + resultOne.add(new UnifyPair (pair.getRhsType(), pair.getLhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + x1.add(resultOne); + } + else { + x1 = unifyCase5(pair, fc); + } result.get(4).add(x1); if (x1.isEmpty()) { undefined.add(pair); //Theta ist nicht im FC diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index 601e83da..4e885284 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -234,7 +234,7 @@ public class TestComplete { } @Test - @Ignore("This one isn't working") + //@Ignore("This is to complex") public void matrixTest() throws Exception { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Matrix.jav"); var matrix = classFiles.get("Matrix");