Skip to content

Commit

Permalink
Also desugar with-do (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-studios authored Nov 15, 2024
1 parent 7650914 commit 3ef0c61
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions effekt/shared/src/main/scala/effekt/RecursiveDescent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ class RecursiveDescent(positions: Positions, tokens: Seq[Token], source: Source)
case Var(id) =>
val tgt = IdTarget(id)
Return(Call(tgt, Nil, Nil, (BlockLiteral(Nil, vparams, bparams, body)) :: Nil))
case Do(effect, id, targs, vargs, bargs) =>
Return(Do(effect, id, targs, vargs, bargs :+ BlockLiteral(Nil, vparams, bparams, body)))
case term =>
Return(Call(ExprTarget(term), Nil, Nil, (BlockLiteral(Nil, vparams, bparams, body)) :: Nil))
}
Expand Down
3 changes: 3 additions & 0 deletions examples/pos/issue684.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
before
hi
after
12 changes: 12 additions & 0 deletions examples/pos/issue684.effekt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
effect wrap() { program: () => Unit }: Unit

def main() = try {
with do wrap();
println("hi")
} with wrap {
resume { {p} =>
println("before")
p()
println("after")
}
}

0 comments on commit 3ef0c61

Please sign in to comment.