fixed bug in standard unify

This commit is contained in:
Florian Steurer 2016-04-12 15:17:12 +02:00
parent 1b9a9c0841
commit ba636e1da0

View File

@ -57,8 +57,7 @@ public class MartelliMontanariUnify implements IUnify {
}
// REDUCE - Rule
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)
&& (rhsTypeParams.size() != 0 || lhsTypeParams.size() != 0)) {
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
Set<UnifyPair> result = new HashSet<>();
// f<...> = g<...> with f != g are not unifiable
@ -68,13 +67,15 @@ public class MartelliMontanariUnify implements IUnify {
if(rhsTypeParams.size() != lhsTypeParams.size())
return Optional.empty(); // conflict
// Unpack the arguments
for(int i = 0; i < rhsTypeParams.size(); i++)
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
termsList.remove(idx);
termsList.addAll(result);
continue;
if(rhsTypeParams.size() != 0) {
// Unpack the arguments
for(int i = 0; i < rhsTypeParams.size(); i++)
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
termsList.remove(idx);
termsList.addAll(result);
continue;
}
}
// SWAP - Rule