Skip to content

Commit 236fd20

Browse files
committed
Drop explicit unboxing
1 parent 427877f commit 236fd20

File tree

14 files changed

+20
-28
lines changed

14 files changed

+20
-28
lines changed

effekt/shared/src/main/scala/effekt/Lexer.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ enum TokenKind {
133133
case `extern`
134134
case `record`
135135
case `box`
136-
case `unbox`
137136
case `return`
138137
case `region`
139138
case `resource`
@@ -179,7 +178,7 @@ object TokenKind {
179178
val keywords = Vector(
180179
`let`, `true`, `false`, `val`, `var`, `if`, `else`, `while`, `type`, `effect`, `interface`,
181180
`try`, `with`, `case`, `do`, `fun`, `match`, `def`, `module`, `import`, `export`, `extern`,
182-
`include`, `record`, `box`, `unbox`, `return`, `region`, `resource`, `new`, `and`, `is`,
181+
`include`, `record`, `box`, `return`, `region`, `resource`, `new`, `and`, `is`,
183182
`namespace`, `pure`, `private`
184183
)
185184

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,6 @@ class Parser(positions: Positions, tokens: Seq[Token], source: Source) {
867867
val blockLiteral = `fun` ~> BlockLiteral(Nil, valueParams().unspan, Nil, braces { stmts(inBraces = true) }, span())
868868
Box(Maybe.None(Span(source, pos(), pos(), Synthesized)), blockLiteral, blockLiteral.span.synthesized)
869869

870-
def unboxExpr(): Term =
871-
nonterminal:
872-
Unbox(`unbox` ~> expr(), span())
873-
874870
def newExpr(): Term =
875871
nonterminal:
876872
New(`new` ~> implementation(), span())
@@ -1183,7 +1179,6 @@ class Parser(positions: Positions, tokens: Seq[Token], source: Source) {
11831179
case `try` => tryExpr()
11841180
case `region` => regionExpr()
11851181
case `box` => boxExpr()
1186-
case `unbox` => unboxExpr()
11871182
case `fun` => funExpr()
11881183
case `new` => newExpr()
11891184
case `do` => doExpr()

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ class EffektLexers(positions: Positions) extends Parsers(positions) {
9393
lazy val `at` = keyword("at")
9494
lazy val `in` = keyword("in")
9595
lazy val `box` = keyword("box")
96-
lazy val `unbox` = keyword("unbox")
9796
lazy val `return` = keyword("return")
9897
lazy val `region` = keyword("region")
9998
lazy val `resource` = keyword("resource")
@@ -106,7 +105,7 @@ class EffektLexers(positions: Positions) extends Parsers(positions) {
106105
"def", "let", "val", "var", "true", "false", "else", "type",
107106
"effect", "interface", "try", "with", "case", "do", "if", "while",
108107
"match", "module", "import", "extern", "fun",
109-
"at", "box", "unbox", "return", "region", "new", "resource", "and", "is", "namespace"
108+
"at", "box", "return", "region", "new", "resource", "and", "is", "namespace"
110109
)
111110

112111
def keyword(kw: String): Parser[String] =
@@ -419,7 +418,6 @@ class CoreParsers(positions: Positions, names: Names) extends EffektLexers(posit
419418
// ------
420419
lazy val block: P[Block] =
421420
( blockVar
422-
| `unbox` ~> pure ^^ Block.Unbox.apply
423421
| `new` ~> implementation ^^ Block.New.apply
424422
| blockLit
425423
// TODO check left associative nesting (also for select)

effekt/shared/src/main/scala/effekt/util/AnsiHighlight.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object AnsiHighlight {
6262
`type` | `effect` | `interface` | `fun` | `do` | `case` | `with` | `try` |
6363
`true` | `false` |
6464
`match` | `def` | `module`| `import`| `export`| `extern`| `include`|
65-
`record`| `box`| `unbox`| `return`| `region`|
65+
`record`| `box`| `return`| `region`|
6666
`resource`| `new`| `and`| `is`| `namespace`| `pure` => keyword(text)
6767

6868
case _ => text

examples/neg/issue362.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ def main() = {
77
val cap = try {
88
foo {arr}
99
} with arr: Exc { def op() = resume(println("hey")) }
10-
(unbox cap)()
10+
cap()
1111
}

examples/neg/issue50.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def escape { prog: () => Unit / { Effect1, Effect2 } }: Unit = region this {
1818
}
1919
}
2020

21-
(unbox k)(())
21+
k(())
2222
}
2323

2424
def main() = {
2525
escape { do Effect1(); do Effect2() }
26-
}
26+
}

examples/neg/issue548a.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def withTime[A] { prog: { Time } => A }: A =
1212
def main() = {
1313
def b { t: Time }: Time at {t} = box t; // this is fine
1414
val cap = withTime {b} // ERROR escape
15-
def t2: Time = unbox cap
15+
def t2: Time = cap
1616
t2.now();
1717
()
1818
}

examples/neg/lambdas/capability_closure.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ def main() = {
1313
} with Get {
1414
def get() = resume(42)
1515
}
16-
(unbox f)()
17-
}
16+
f()
17+
}

examples/neg/lambdas/closure.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ def main() = {
66
val f = try { // @Yield =>
77
val g = fun(){ do Yield() }
88
twice {
9-
def unboxed() = { (unbox g)() };
9+
def unboxed() = { g() };
1010
unboxed()// (@Yield)
1111
}
1212
} with Yield { println("yielded!"); resume(()) }
1313
f()
14-
}
14+
}

examples/pos/capture/defdef.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def myModule { eff : Eff } = region this {
44
def outer = this;
55

66
val e1 = fun() { eff.use(); () };
7-
def x = unbox e1;
7+
def x = e1;
88

99
def test1() = x();
1010
def test1b = x;

0 commit comments

Comments
 (0)