diff --git a/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala b/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala index 539983a0d..8dcffbeb7 100644 --- a/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala +++ b/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala @@ -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)) } diff --git a/examples/pos/issue684.check b/examples/pos/issue684.check new file mode 100644 index 000000000..24e226ed1 --- /dev/null +++ b/examples/pos/issue684.check @@ -0,0 +1,3 @@ +before +hi +after diff --git a/examples/pos/issue684.effekt b/examples/pos/issue684.effekt new file mode 100644 index 000000000..51a3aaede --- /dev/null +++ b/examples/pos/issue684.effekt @@ -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") + } +} \ No newline at end of file