From e53c29f58205c1d97516c46c886f240e0ceec8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Sat, 6 Apr 2019 00:53:35 +0200 Subject: [PATCH] modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java Typeinference-Exception eingefuegt, wenn kein korrekter Typ inferierbar ist. modified: ../../resources/bytecode/javFiles/Id.jav --- .../typeinference/unify/TypeUnifyTask.java | 15 ++++++++++----- src/test/resources/bytecode/javFiles/Id.jav | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 8eb49691..f1e3b7a7 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -19,6 +19,8 @@ import java.util.function.BinaryOperator; import java.util.stream.Collectors; import java.util.stream.Stream; +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.parser.NullToken; import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; import de.dhbwstuttgart.typeinference.constraints.Constraint; import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; @@ -228,7 +230,9 @@ public class TypeUnifyTask extends RecursiveTask>> { catch (IOException ioE) { System.err.println("no log-File"); } - if (isUndefinedPairSetSet(res)) { return new HashSet<>(); } + if (isUndefinedPairSetSet(res)) { + throw new TypeinferenceException("Unresolved constraints: " + res.toString(), new NullToken()); //return new HashSet<>(); + } else return res; } /* @@ -478,15 +482,16 @@ public class TypeUnifyTask extends RecursiveTask>> { //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)) { - writeLog("eqPrime:" + eqPrime.toString()+"\n"); - } + //if (isSolvedForm(eqPrime)) { + // writeLog("eqPrime:" + eqPrime.toString()+"\n"); + //} //} //catch (IOException e) { // System.err.println("log-File nicht vorhanden"); //} eqPrimePrimeSet.add(eqPrime); - if (finalresult) { + if (finalresult && isSolvedForm(eqPrime)) { + writeLog("eqPrime:" + eqPrime.toString()+"\n"); urm.notify(eqPrimePrimeSet); } } diff --git a/src/test/resources/bytecode/javFiles/Id.jav b/src/test/resources/bytecode/javFiles/Id.jav index 43718582..a8d85dfd 100644 --- a/src/test/resources/bytecode/javFiles/Id.jav +++ b/src/test/resources/bytecode/javFiles/Id.jav @@ -1,6 +1,6 @@ public class Id { - id(A b){ + B id(A b){ return b; } }