From 397d8b79361900883cf404d13273ef66333d5787 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 8 Apr 2009 12:30:48 +0000 Subject: [PATCH] Resolved the types of the operators before searching through them for matches --- frontends/OccamTypes.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontends/OccamTypes.hs b/frontends/OccamTypes.hs index c3a995f..9425e16 100644 --- a/frontends/OccamTypes.hs +++ b/frontends/OccamTypes.hs @@ -724,13 +724,18 @@ inferTypes = occamOnlyPass "Infer types" tes <- sequence [underlyingTypeOf m e `catchError` (const $ return A.Infer) | e <- es'] cs <- getCompState + + resolvedOps <- sequence [ do ts' <- mapM (underlyingType m) ts + return (op, n, ts') + | (op, n, ts) <- csOperators cs + ] -- The nubBy will ensure that only one definition remains for each -- set of type-arguments, and will keep the first definition in the -- list (which will be the most recent) possibles <- return [ ((opFuncName, es'), ts) - | (raw, opFuncName, ts) <- nubBy opsMatch $ csOperators cs + | (raw, opFuncName, ts) <- nubBy opsMatch resolvedOps -- Must be right operator: , raw == A.nameName n -- Must be right arity: