From 7ea6777906f5523a63a844edd06c5333c6206791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Fri, 18 May 2018 13:12:49 +0200 Subject: [PATCH] modified: ../../src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java modified: ../javFiles/Lambda.jav modified: ../typeinference/UnifyTest.java --- .../typeinference/unify/TypeUnifyTask.java | 16 ++++++++-------- test/javFiles/Lambda.jav | 3 ++- test/typeinference/UnifyTest.java | 11 +++++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 710f2095..1f9a67d1 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -297,10 +297,10 @@ public class TypeUnifyTask extends RecursiveTask>> { * Step 6 a) Restart (fork) for pairs where subst was applied */ if(parallel) { - if (eqPrime.equals(eq)) //PL 2017-09-29 auskommentiert und durch - //(!eqPrimePrime.isPresent()) //PL 2071-09-29 dies ersetzt - //Begruendung: Wenn in der Substitution keine Veraenderung - //(!eqPrimePrime.isPresent()) erfolgt ist, ist das Ergebnis erzielt. + if (eqPrime.equals(eq) && !eqPrimePrime.isPresent()) //PL 2017-09-29 //(!eqPrimePrime.isPresent()) auskommentiert und durch + //PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent()) + //PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst + //eqPrimePrime Veraenderungen in subst repraesentieren. eqPrimePrimeSet.add(eqPrime); else if(eqPrimePrime.isPresent()) { //System.out.println("nextStep: " + eqPrimePrime.get()); @@ -317,10 +317,10 @@ public class TypeUnifyTask extends RecursiveTask>> { } else { // sequentiell (Step 6b is included) if (printtag) System.out.println("nextStep: " + eqPrimePrime); - if (eqPrime.equals(eq)) { //PL 2017-09-29 auskommentiert und durch - //(!eqPrimePrime.isPresent()) //PL 2071-09-29 dies ersetzt - //Begruendung: Wenn in der Substitution keine Veraenderung - //(!eqPrimePrime.isPresent()) erfolgt ist, ist das Ergebnis erzielt. + if (eqPrime.equals(eq) && !eqPrimePrime.isPresent()) { //PL 2017-09-29 //(!eqPrimePrime.isPresent()) auskommentiert und durch + //PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent()) + //PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst + //eqPrimePrime Veraenderungen in subst repraesentieren. try { if (isSolvedForm(eqPrime)) { logFile.write(eqPrime.toString()+"\n"); diff --git a/test/javFiles/Lambda.jav b/test/javFiles/Lambda.jav index 3ff77fd1..553dc496 100644 --- a/test/javFiles/Lambda.jav +++ b/test/javFiles/Lambda.jav @@ -1,9 +1,10 @@ import java.lang.Integer; +import java.lang.Number; public class Lambda { m () { - var lam1 = (Integer x) -> { + var lam1 = (x) -> { return x; }; return lam1; diff --git a/test/typeinference/UnifyTest.java b/test/typeinference/UnifyTest.java index 2d6064cd..2a496166 100644 --- a/test/typeinference/UnifyTest.java +++ b/test/typeinference/UnifyTest.java @@ -28,10 +28,11 @@ public class UnifyTest { public void finiteClosure() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"fc.jav")); } - + */ +/* @Test public void lambda() throws IOException, ClassNotFoundException { - execute(new File(rootDirectory+"LambdaField.jav")); + execute(new File(rootDirectory+"Lambda.jav")); } */ /* @@ -45,6 +46,12 @@ public class UnifyTest { public void lambda3() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"Lambda3.jav")); } + + @Test + public void lambdafield() throws IOException, ClassNotFoundException { + execute(new File(rootDirectory+"LambdaField.jav")); + } + @Test public void mathStruc() throws IOException, ClassNotFoundException { execute(new File(rootDirectory+"mathStruc.jav"));