X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Finterpreter%2Fsubst.c;h=f97d86668cfcdb9b9b18ec673a9095648aaa2200;hb=c1556b843de5295fe1bc8cd3e79e0cd72a6fd3b1;hp=3ca1ed4324381534122e8385e4ff1a8cbe567569;hpb=210fe8695601b3f79fc653346d5a570b9fcb8d9d;p=ghc-hetmet.git diff --git a/ghc/interpreter/subst.c b/ghc/interpreter/subst.c index 3ca1ed4..f97d866 100644 --- a/ghc/interpreter/subst.c +++ b/ghc/interpreter/subst.c @@ -10,8 +10,8 @@ * included in the distribution. * * $RCSfile: subst.c,v $ - * $Revision: 1.11 $ - * $Date: 2000/03/06 08:38:04 $ + * $Revision: 1.12 $ + * $Date: 2000/03/09 10:19:33 $ * ------------------------------------------------------------------------*/ #include "prelude.h" @@ -1350,9 +1350,15 @@ Cell pi1; /* Assumes preds are kind correct */ Int o1; /* with the same class. */ Cell pi; Int o; { - for (; isAp(pi1); pi1=fun(pi1), pi=fun(pi)) - if (!unify(arg(pi1),o1,arg(pi),o)) - return FALSE; + for (; isAp(pi1); pi1=fun(pi1), pi=fun(pi)) { + if (!isAp(pi) || !unify(arg(pi1),o1,arg(pi),o)) + return FALSE; + } + /* pi1 has exhausted its argument chain, we also need to check that + pi has no remaining arguments. However, under this condition, + the pi1 == pi will always return FALSE, giving the desired + result. */ + #if IPARAM if (isIP(pi1) && isIP(pi)) return textOf(pi1)==textOf(pi);