Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix a bug with the optimised Dot applier.
This was erroneously optimising polymorphic functions, which clearly it
cannot do since it does not know how these values will be instantiated
at runtime.
  • Loading branch information
tomgr committed Feb 16, 2016
1 parent 0771080 commit e51d055
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/CSPM/Evaluator/Expr.hs
Expand Up @@ -745,6 +745,9 @@ evaluateDotApplication (exp@(An loc _ (DotApp left right))) = do

isDotable (TDotable _ _) = True
isDotable (TExtendable _ _) = True
-- We must be inside a polymorphic function, so cannot be sure what type this will be. Hence, it is unsafe
-- to assume it is not dotable. Thus, we assume the worst.
isDotable (TVar _) = True
isDotable _ = False

catVDots v v'@(VDot (VDataType _ : vs)) = VDot [v, v']
Expand Down
14 changes: 14 additions & 0 deletions tests/evaluator/should_pass/extensions.csp
@@ -0,0 +1,14 @@
datatype Direction = ack

CellId = {1}

channel write : CellId.Direction

f(b) = { b.x | x <- extensions(write) }

test1 =
let s1 = f(write)
s2 = {| write.1 |}
within card(union(s1, s2)) > 0

assert if test1 then STOP else STOP :[deadlock free]

0 comments on commit e51d055

Please sign in to comment.