Skip to content

Commit 13780eb

Browse files
Fix unbox
1 parent 22d01a2 commit 13780eb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

effekt/jvm/src/test/scala/effekt/core/NewNormalizerTests.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,15 @@ class NewNormalizerTests extends CoreTests {
124124
// This example shows a box that contains an extern reference.
125125
// The normalizer is able to unbox this indirection away.
126126
test("extern in box") {
127-
val input =
128-
"""
127+
val input = """
129128
|extern def foo: Int = vm"42"
130129
|
131130
|def run(): Int = {
132131
| val f = box {
133-
| foo
132+
| box foo
134133
| } at { io }
135134
|
136-
| val x = unbox f()()
135+
| val x = /* unbox */ f()()
137136
| return x
138137
|}
139138
|

effekt/shared/src/main/scala/effekt/core/Parser.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class EffektLexers extends Parsers {
9191
lazy val `at` = keyword("at")
9292
lazy val `in` = keyword("in")
9393
lazy val `box` = keyword("box")
94+
lazy val `unbox` = keyword("unbox")
9495
lazy val `return` = keyword("return")
9596
lazy val `region` = keyword("region")
9697
lazy val `resource` = keyword("resource")
@@ -381,6 +382,7 @@ class CoreParsers(names: Names) extends EffektLexers {
381382
// ------
382383
lazy val block: P[Block] =
383384
( blockVar
385+
| `unbox` ~> expr ^^ Block.Unbox.apply
384386
| `new` ~> implementation ^^ Block.New.apply
385387
| blockLit
386388
// TODO check left associative nesting (also for select)

0 commit comments

Comments
 (0)