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

@ -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: