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,6 +67,7 @@ public class MartelliMontanariUnify implements IUnify {
if(rhsTypeParams.size() != lhsTypeParams.size())
return Optional.empty(); // conflict
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));
@ -76,6 +76,7 @@ public class MartelliMontanariUnify implements IUnify {
termsList.addAll(result);
continue;
}
}
// SWAP - Rule
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {