TESTEN OB DAS SINN MACHT

modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
	modified:   src/test/java/AllgemeinTest.java
This commit is contained in:
pl@gohorb.ba-horb.de 2023-09-01 17:18:51 +02:00
parent a15cbcba7b
commit dfd91b5f8b
2 changed files with 18 additions and 1 deletions

View File

@ -371,6 +371,21 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
do {
eq0Prime = eqSubst.get();
eq0 = applyTypeUnificationRules(eq0Prime, fc);
Set<UnifyPair> occurcheck = new HashSet<>(eq0);
occurcheck.removeAll(eq0Prime);
ocurrPairs = occurcheck.stream().filter(x -> {
UnifyType lhs, rhs;
return (lhs = x.getLhsType()) instanceof PlaceholderType
&& !((rhs = x.getRhsType()) instanceof PlaceholderType)
&& rhs.getTypeParams().occurs((PlaceholderType)lhs);})
.map(x -> { x.setUndefinedPair(); return x;})
.collect(Collectors.toCollection(HashSet::new));
writeLog("ocurrPairs: " + ocurrPairs);
if (ocurrPairs.size() > 0) {
Set<Set<UnifyPair>> ret = new HashSet<>();
ret.add(ocurrPairs);
return ret;
}
eqSubst = rules.subst(eq0, oderConstraints);
} while (eqSubst.isPresent());

View File

@ -41,6 +41,7 @@ public class AllgemeinTest {
//String className = "Var";
//String className = "Put";
//String className = "Twice";
//String className = "Twice2";
//String className = "TestSubTypless";
//String className = "addList";
//String className = "M";
@ -56,7 +57,8 @@ public class AllgemeinTest {
//String className = "UseWildcardPair";
//String className = "Assign";
//String className = "StreamTest";
String className = "Iteration";
//String className = "Iteration";
String className = "Cycle";
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";