fixed bug in standard unify
This commit is contained in:
parent
1b9a9c0841
commit
ba636e1da0
@ -57,8 +57,7 @@ public class MartelliMontanariUnify implements IUnify {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// REDUCE - Rule
|
// REDUCE - Rule
|
||||||
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)
|
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
|
||||||
&& (rhsTypeParams.size() != 0 || lhsTypeParams.size() != 0)) {
|
|
||||||
Set<UnifyPair> result = new HashSet<>();
|
Set<UnifyPair> result = new HashSet<>();
|
||||||
|
|
||||||
// f<...> = g<...> with f != g are not unifiable
|
// f<...> = g<...> with f != g are not unifiable
|
||||||
@ -68,6 +67,7 @@ public class MartelliMontanariUnify implements IUnify {
|
|||||||
if(rhsTypeParams.size() != lhsTypeParams.size())
|
if(rhsTypeParams.size() != lhsTypeParams.size())
|
||||||
return Optional.empty(); // conflict
|
return Optional.empty(); // conflict
|
||||||
|
|
||||||
|
if(rhsTypeParams.size() != 0) {
|
||||||
// Unpack the arguments
|
// Unpack the arguments
|
||||||
for(int i = 0; i < rhsTypeParams.size(); i++)
|
for(int i = 0; i < rhsTypeParams.size(); i++)
|
||||||
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
|
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
|
||||||
@ -76,6 +76,7 @@ public class MartelliMontanariUnify implements IUnify {
|
|||||||
termsList.addAll(result);
|
termsList.addAll(result);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SWAP - Rule
|
// SWAP - Rule
|
||||||
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
|
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user