diff --git a/common/Types.hs b/common/Types.hs index b344003..4c66a9c 100644 --- a/common/Types.hs +++ b/common/Types.hs @@ -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. diff --git a/frontends/OccamTypes.hs b/frontends/OccamTypes.hs index 410b0b6..941fd74 100644 --- a/frontends/OccamTypes.hs +++ b/frontends/OccamTypes.hs @@ -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