UnifyWithoutWildcards Test läuft durch

This commit is contained in:
JanUlrich 2018-03-08 01:41:38 +01:00
parent 9f2702276f
commit 3deaceec01
2 changed files with 6 additions and 6 deletions

View File

@ -1,15 +1,12 @@
package de.dhbwstuttgart.sat.asp.parser; package de.dhbwstuttgart.sat.asp.parser;
import de.dhbwstuttgart.exceptions.DebugException; import de.dhbwstuttgart.exceptions.DebugException;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.parser.NullToken; import de.dhbwstuttgart.parser.NullToken;
import de.dhbwstuttgart.parser.scope.JavaClassName; import de.dhbwstuttgart.parser.scope.JavaClassName;
import de.dhbwstuttgart.sat.asp.ASPStringConverter; import de.dhbwstuttgart.sat.asp.ASPStringConverter;
import de.dhbwstuttgart.sat.asp.model.ASPRule; import de.dhbwstuttgart.sat.asp.model.ASPRule;
import de.dhbwstuttgart.sat.asp.parser.model.ParsedType; import de.dhbwstuttgart.sat.asp.parser.model.ParsedType;
import de.dhbwstuttgart.sat.asp.writer.ASPGenerator;
import de.dhbwstuttgart.sat.asp.writer.model.ASPParameterList;
import de.dhbwstuttgart.sat.asp.writer.model.ASPRefType;
import de.dhbwstuttgart.sat.asp.writer.model.ASPType;
import de.dhbwstuttgart.syntaxtree.type.*; import de.dhbwstuttgart.syntaxtree.type.*;
import de.dhbwstuttgart.typeinference.result.*; import de.dhbwstuttgart.typeinference.result.*;
@ -98,6 +95,9 @@ public class ASPParser {
RefTypeOrTPHOrWildcardOrGeneric rsType = this.getType(rs); RefTypeOrTPHOrWildcardOrGeneric rsType = this.getType(rs);
if(lsType instanceof TypePlaceholder && rsType instanceof RefType) if(lsType instanceof TypePlaceholder && rsType instanceof RefType)
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder) lsType, rsType); return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder) lsType, rsType);
else if(lsType instanceof TypePlaceholder && rsType instanceof TypePlaceholder)
return new PairTPHEqualTPH((TypePlaceholder)lsType, (TypePlaceholder)rsType);
else throw new NotImplementedException();
} }
return null; return null;
} }

View File

@ -27,10 +27,10 @@ public class UnifyWithoutWildcards {
@Test @Test
public void adapt() throws InterruptedException, IOException, ClassNotFoundException { public void adapt() throws InterruptedException, IOException, ClassNotFoundException {
ConstraintSet<Pair> testSet = new ConstraintSet<>(); ConstraintSet<Pair> testSet = new ConstraintSet<>();
List<RefTypeOrTPHOrWildcardOrGeneric> list1 = Arrays.asList(TypePlaceholder.fresh(new NullToken())); List<RefTypeOrTPHOrWildcardOrGeneric> list1 = Arrays.asList(TypePlaceholder.fresh(new NullToken()),TypePlaceholder.fresh(new NullToken()));
List<RefTypeOrTPHOrWildcardOrGeneric> list2 = Arrays.asList(TypePlaceholder.fresh(new NullToken())); List<RefTypeOrTPHOrWildcardOrGeneric> list2 = Arrays.asList(TypePlaceholder.fresh(new NullToken()));
RefType t1 = new RefType(new JavaClassName("asp.UnifyWithoutWildcards$Matrix"), list1, new NullToken()); RefType t1 = new RefType(new JavaClassName("asp.UnifyWithoutWildcards$Matrix"), list1, new NullToken());
RefType t2 = new RefType(new JavaClassName("Vector"), list2, new NullToken()); RefType t2 = new RefType(new JavaClassName("java.util.HashMap"), list2, new NullToken());
testSet.addUndConstraint(new Pair(t1, t2, PairOperator.SMALLERDOT)); testSet.addUndConstraint(new Pair(t1, t2, PairOperator.SMALLERDOT));
ResultSet resultSet = run(testSet); ResultSet resultSet = run(testSet);
System.out.println(resultSet.results); System.out.println(resultSet.results);