Fixed various typing problems involving channel bundles

This commit is contained in:
Neil Brown 2009-04-13 19:20:15 +00:00
parent e409b15b58
commit 04974ae470
2 changed files with 7 additions and 3 deletions

View File

@ -271,6 +271,7 @@ typeOfVariable (A.DirectedVariable m dir v)
if dir == dir'
then return t
else dieP m $ "Attempted to reverse direction of a channel-end"
A.ChanDataType _ a b -> return $ A.ChanDataType dir a b
A.Infer -> return $ A.ChanEnd dir A.Unshared A.Infer
_ -> diePC m $ formatCode "Direction specified on non-channel variable of type: %" t
typeOfVariable (A.VariableSizes m v)
@ -588,6 +589,7 @@ isCommunicableType (A.Array _ t) = isCommunicableType t
isCommunicableType (A.List t) = isCommunicableType t
isCommunicableType (A.Record _) = True
isCommunicableType (A.Mobile _) = True
isCommunicableType (A.ChanDataType {}) = True
isCommunicableType t = isScalarType t
-- | Types that support 'Size' and subscripting.

View File

@ -1340,6 +1340,7 @@ checkVariables = checkDepthM doVariable
A.Chan _ _ -> ok
A.Array _ (A.ChanEnd oldDir _ _) -> checkDir oldDir
A.Array _ (A.Chan _ _) -> ok
A.ChanDataType oldDir _ _ -> checkDir oldDir
_ -> diePC m $ formatCode "Direction specified on non-channel variable of type: %" t
where
checkDir oldDir
@ -1429,10 +1430,11 @@ checkSpecTypes = checkDepthM doSpecType
doSpecType (A.Is m am t (A.ActualClaim v))
= do tv <- astTypeOf v
checkAbbrev m A.Abbrev am
checkType (findMeta v) t tv
case tv of
A.ChanEnd _ A.Shared _ -> return ()
A.ChanDataType _ A.Shared _ -> return ()
A.ChanEnd a A.Shared b ->
checkType (findMeta v) t (A.ChanEnd a A.Unshared b)
A.ChanDataType a A.Shared b ->
checkType (findMeta v) t (A.ChanDataType a A.Unshared b)
_ -> dieP m "Expected shared channel end in claim"
doSpecType (A.Is m am rawT (A.ActualChannelArray cs))
= do t <- resolveUserType m rawT