modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

Typeinference-Exception eingefuegt, wenn kein korrekter Typ inferierbar ist.

	modified:   ../../resources/bytecode/javFiles/Id.jav
This commit is contained in:
Martin Plümicke 2019-04-06 00:53:35 +02:00
parent 656c77d16b
commit e53c29f582
2 changed files with 11 additions and 6 deletions

View File

@ -19,6 +19,8 @@ import java.util.function.BinaryOperator;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import de.dhbwstuttgart.exceptions.TypeinferenceException;
import de.dhbwstuttgart.parser.NullToken;
import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory;
import de.dhbwstuttgart.typeinference.constraints.Constraint; import de.dhbwstuttgart.typeinference.constraints.Constraint;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
@ -228,7 +230,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
catch (IOException ioE) { catch (IOException ioE) {
System.err.println("no log-File"); 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; else return res;
} }
/* /*
@ -478,15 +482,16 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst //PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst
//eqPrimePrime Veraenderungen in subst repraesentieren. //eqPrimePrime Veraenderungen in subst repraesentieren.
//try { //try {
if (isSolvedForm(eqPrime)) { //if (isSolvedForm(eqPrime)) {
writeLog("eqPrime:" + eqPrime.toString()+"\n"); // writeLog("eqPrime:" + eqPrime.toString()+"\n");
} //}
//} //}
//catch (IOException e) { //catch (IOException e) {
// System.err.println("log-File nicht vorhanden"); // System.err.println("log-File nicht vorhanden");
//} //}
eqPrimePrimeSet.add(eqPrime); eqPrimePrimeSet.add(eqPrime);
if (finalresult) { if (finalresult && isSolvedForm(eqPrime)) {
writeLog("eqPrime:" + eqPrime.toString()+"\n");
urm.notify(eqPrimePrimeSet); urm.notify(eqPrimePrimeSet);
} }
} }

View File

@ -1,6 +1,6 @@
public class Id { public class Id {
<A> id(A b){ <A extends B, B> B id(A b){
return b; return b;
} }
} }