From d8e7df425ddd64512f99804aa22b00deb70a4f6d Mon Sep 17 00:00:00 2001 From: Florian Steurer Date: Tue, 12 Apr 2016 15:47:38 +0200 Subject: [PATCH] refactoring --- .../unify/MartelliMontanariUnify.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java b/src/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java index 40da3cf9c..80dabce6d 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java @@ -66,16 +66,17 @@ public class MartelliMontanariUnify implements IUnify { // f = f are not unifiable 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)); + // f = g is not unifiable (cannot be f = f because erase rule would have been applied) + //if(rhsTypeParams.size() == 0) + //return Optional.empty(); - termsList.remove(idx); - termsList.addAll(result); - continue; - } + // 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