diff --git a/checks/Check.hs b/checks/Check.hs index 1ee80eb..d81ee96 100644 --- a/checks/Check.hs +++ b/checks/Check.hs @@ -314,8 +314,13 @@ checkPlainVarUsage sharedAttr (m, p) = check p splitEnds :: (Var, a) -> m [(Var, a)] splitEnds (Var v, x) = do t <- astTypeOf v - case t of - A.Chan {} -> return + case (t, v) of + -- Push the direction up to the array, not outside: + (A.Chan {}, A.SubscriptedVariable m sub v') + -> return [(Var $ A.SubscriptedVariable m sub $ + A.DirectedVariable m dir v', x) + | dir <- [A.DirInput, A.DirOutput]] + (A.Chan {}, _) -> return [(Var $ A.DirectedVariable (findMeta v) dir v, x) | dir <- [A.DirInput, A.DirOutput]] _ -> return [(Var v, x)] diff --git a/transformations/SimplifyAbbrevs.hs b/transformations/SimplifyAbbrevs.hs index e7710c6..7467c8f 100644 --- a/transformations/SimplifyAbbrevs.hs +++ b/transformations/SimplifyAbbrevs.hs @@ -204,7 +204,7 @@ abbrevCheckPass return s doStructured s@(A.Spec _ (A.Specification m n (A.IsExpr _ A.ValAbbrev _ e)) scope) = do checkNotWritten (A.Variable m n) scope "VAL-abbreviated variable % written-to inside the scope of the abbreviation" - sequence_ [checkAbbreved v scope + sequence_ [checkNotWritten v scope "Abbreviated variable % used inside the scope of the abbreviation" | A.ExprVariable _ v <- listify (const True) e] return s