Resolved the types of the operators before searching through them for matches

This commit is contained in:
Neil Brown 2009-04-08 12:30:48 +00:00
parent dc4cfe331b
commit 397d8b7936

View File

@ -725,12 +725,17 @@ inferTypes = occamOnlyPass "Infer types"
cs <- getCompState 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 -- The nubBy will ensure that only one definition remains for each
-- set of type-arguments, and will keep the first definition in the -- set of type-arguments, and will keep the first definition in the
-- list (which will be the most recent) -- list (which will be the most recent)
possibles <- return possibles <- return
[ ((opFuncName, es'), ts) [ ((opFuncName, es'), ts)
| (raw, opFuncName, ts) <- nubBy opsMatch $ csOperators cs | (raw, opFuncName, ts) <- nubBy opsMatch resolvedOps
-- Must be right operator: -- Must be right operator:
, raw == A.nameName n , raw == A.nameName n
-- Must be right arity: -- Must be right arity: