on master help sign in
Properly check for WritableStream types
2a6e92bEvan Czaplicki
src/AST/Variable.hs+3−3
@@ -68,9 +68,9 @@ isStream =
68 is ["Signal"] "Stream"
68 is ["Signal"] "Stream"
69
69
70
70
71−isWritableStream :: Canonical -> Bool
71+isMailbox :: Canonical -> Bool
72−isWritableStream =
72+isMailbox =
73− is ["Signal"] "WritableStream"
73+ is ["Mailbox"] "Mailbox"
74
74
75
75
76isVarying :: Canonical -> Bool
76isVarying :: Canonical -> Bool
src/Type/ExtraChecks.hs+12−7
@@ -261,18 +261,23 @@ checkLoobacks name tipe hasExpr =
261
261
262checkLoobacksHelp :: String -> ST.CanonicalType -> ST.CanonicalType -> Bool -> Either [P.Doc] ()
262checkLoobacksHelp :: String -> ST.CanonicalType -> ST.CanonicalType -> Bool -> Either [P.Doc] ()
263checkLoobacksHelp name rootType tipe hasExpr =
263checkLoobacksHelp name rootType tipe hasExpr =
264− case tipe of
264+ case ST.dealias tipe of
265− ST.Aliased _ t ->
265+ ST.Record
266− checkLoobacksHelp name rootType t hasExpr
266+ [ ("mailbox", ST.App (ST.Type mailbox) [a])
267+ , ("stream", ST.App (ST.Type stream) [b])
268+ ]
269+ Nothing
270+ | not hasExpr
271+ && Var.isStream stream
272+ && Var.isMailbox mailbox
273+ && a == b
274+ ->
275+ return ()
267
276
268 ST.App (ST.Type signal) [ ST.App (ST.Type result) [_,_] ]
277 ST.App (ST.Type signal) [ ST.App (ST.Type result) [_,_] ]
269 | hasExpr && Var.isStream signal && Var.isResult result ->
278 | hasExpr && Var.isStream signal && Var.isResult result ->
270 return ()
279 return ()
271
280
272− ST.App (ST.Type signal) [ _ ]
273− | not hasExpr && Var.isWritableStream signal ->
274− return ()
275−
276 _ ->
281 _ ->
277 throw $
282 throw $
278 [ P.text "Loopback Error:"
283 [ P.text "Loopback Error:"