Made sure that user-defined types are resolved before looking for matching operator definitions

This commit is contained in:
Neil Brown 2009-04-08 10:18:14 +00:00
parent 62dfdec9ab
commit 26be673ce1
2 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
-- | Type inference and checking.
module Types
(
specTypeOfName, typeOfSpec, typeOfSpec', abbrevModeOfName, underlyingType, stripArrayType, abbrevModeOfVariable, abbrevModeOfSpec
specTypeOfName, typeOfSpec, typeOfSpec', abbrevModeOfName, underlyingType, underlyingTypeOf, stripArrayType, abbrevModeOfVariable, abbrevModeOfSpec
, isRealType, isIntegerType, isNumericType, isCaseableType, isScalarType, isDataType, isCommunicableType, isSequenceType, isMobileType
, resolveUserType, isSafeConversion, isPreciseConversion, isImplicitConversionRain
, isOperator, functionOperator, occamDefaultOperator, occamBuiltInOperatorFunctions
@ -64,6 +64,9 @@ class ASTTypeable a where
instance ASTTypeable A.Type where
astTypeOf = return
underlyingTypeOf :: (ASTTypeable a, CSMR m, Die m) => Meta -> a -> m A.Type
underlyingTypeOf m = underlyingType m <.< astTypeOf
-- | Gets the 'A.AbbrevMode' for a given 'A.Name' from the recorded types in the 'CompState'. Dies with an error if the name is unknown.
abbrevModeOfName :: (CSMR m, Die m) => A.Name -> m A.AbbrevMode
abbrevModeOfName n

View File

@ -721,7 +721,7 @@ inferTypes = occamOnlyPass "Infer types"
n -> show n ++ "-ary"
es' <- noTypeContext $ mapM recurse es
tes <- sequence [astTypeOf e `catchError` (const $ return A.Infer) | e <- es']
tes <- sequence [underlyingTypeOf m e `catchError` (const $ return A.Infer) | e <- es']
cs <- getCompState