Made sure that user-defined types are resolved before looking for matching operator definitions
This commit is contained in:
parent
62dfdec9ab
commit
26be673ce1
|
@ -19,7 +19,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-- | Type inference and checking.
|
-- | Type inference and checking.
|
||||||
module Types
|
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
|
, isRealType, isIntegerType, isNumericType, isCaseableType, isScalarType, isDataType, isCommunicableType, isSequenceType, isMobileType
|
||||||
, resolveUserType, isSafeConversion, isPreciseConversion, isImplicitConversionRain
|
, resolveUserType, isSafeConversion, isPreciseConversion, isImplicitConversionRain
|
||||||
, isOperator, functionOperator, occamDefaultOperator, occamBuiltInOperatorFunctions
|
, isOperator, functionOperator, occamDefaultOperator, occamBuiltInOperatorFunctions
|
||||||
|
@ -64,6 +64,9 @@ class ASTTypeable a where
|
||||||
instance ASTTypeable A.Type where
|
instance ASTTypeable A.Type where
|
||||||
astTypeOf = return
|
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.
|
-- | 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 :: (CSMR m, Die m) => A.Name -> m A.AbbrevMode
|
||||||
abbrevModeOfName n
|
abbrevModeOfName n
|
||||||
|
|
|
@ -721,7 +721,7 @@ inferTypes = occamOnlyPass "Infer types"
|
||||||
n -> show n ++ "-ary"
|
n -> show n ++ "-ary"
|
||||||
|
|
||||||
es' <- noTypeContext $ mapM recurse es
|
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
|
cs <- getCompState
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user