Skip to content

Commit 427877f

Browse files
committed
Never perform box inference
1 parent 2d012a3 commit 427877f

28 files changed

+56
-56
lines changed

effekt/shared/src/main/scala/effekt/typer/BoxUnboxInference.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ object BoxUnboxInference extends Phase[NameResolved, NameResolved] {
5252
case v: Var => v.definition match {
5353
// TODO maybe we should synthesize a call to get here already?
5454
case sym: (ValueSymbol | symbols.RefBinder) => v
55-
case sym: BlockSymbol => Box(Maybe.None(v.span.emptyAfter), v, v.span.synthesized).inheritPosition(v)
55+
case sym: BlockSymbol => v //Box(Maybe.None(v.span.emptyAfter), v, v.span.synthesized).inheritPosition(v)
5656
}
5757

58-
case n: New => Box(Maybe.None(n.span.emptyAfter), rewriteAsBlock(n), n.span.synthesized).inheritPosition(n)
58+
case n: New => rewriteAsBlock(n) // Box(Maybe.None(n.span.emptyAfter), rewriteAsBlock(n), n.span.synthesized).inheritPosition(n)
5959

60-
case b: BlockLiteral => Box(Maybe.None(b.span.emptyAfter), rewriteAsBlock(b), b.span.synthesized).inheritPosition(b)
60+
case b: BlockLiteral => rewriteAsBlock(b) // Box(Maybe.None(b.span.emptyAfter), rewriteAsBlock(b), b.span.synthesized).inheritPosition(b)
6161

6262
case l: Literal => l
6363

examples/benchmarks/are_we_fast_yet/bounce.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def randomBall { rand: Random }: Ball at {global} = {
1616
val y = ref(toDouble(rand.next().mod(500)));
1717
val xVel = ref(toDouble(rand.next().mod(300) - 150));
1818
val yVel = ref(toDouble(rand.next().mod(300) - 150));
19-
new Ball {
19+
box new Ball {
2020
def bounce() = {
2121
val xLimit = 500.0;
2222
val yLimit = 500.0;

examples/benchmarks/other/generator.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def generator { prog: => Unit / Yield } {r: Region}: Generator at {prog, r} = {
3030
cont = box { resume(()) }
3131
}
3232
}
33-
new Generator {
33+
box new Generator {
3434
def value() = v
3535
def next() = cont()
3636
}

examples/benchmarks/other/nbe.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def reify(v: Value): Term / fresh = v match {
6262
/// strong normalization of the term
6363
def normalize(t: Term): Term = {
6464
var i = 0
65-
try reify(eval(empty[Name, Value](compareInt), t))
65+
try reify(eval(empty[Name, Value](box compareInt), t))
6666
with fresh { i = i + 1; resume(i) }
6767
}
6868

examples/benchmarks/other/variadic_combinators.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def f3(fs: List[=> (Int => Int at {}) at {}]) =
4141
else first(fs)()(n - 1)
4242
}
4343

44-
def mod3(x: Int): Int = first(vfix([f1, f2, f3]))()(x)
44+
def mod3(x: Int): Int = first(vfix([box f1, box f2, box f3]))()(x)
4545

4646
def run(n: Int) = {
4747
mod3(n) + mod3(n + 1) + mod3(n + 2)

examples/llvm/issue1012.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def use { g: (Int) => Int } : Int = {
77
}
88

99
def main() : Unit = {
10-
val t = [f]
10+
val t = [box f]
1111
list::map(t) { y => use {y} }
1212
println("hi")
13-
}
13+
}

examples/llvm/nosuchelement.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def id[A](f: ((A) => Unit at {io, global}) => Unit at {io, global}): ((A) => Uni
99
// [error] java.util.NoSuchElementException: key not found: h
1010
def main() = {
1111
val f = box { (n: Int) => println(n) }
12-
def h = id(g);
12+
def h = id(box g);
1313
val x = h(f);
1414
println(x)
1515
}

examples/llvm/prompt-duplication.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def main() : Unit = {
99
} with E { () =>
1010
def f() = { () }
1111
def g() = {
12-
resume(f)
12+
resume(box f)
1313
}
14-
resume(g)
14+
resume(box g)
1515
}
1616
}

examples/neg/blocks_in_value_pos.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
Unit
33
but got type
44
() => Unit / { MyPrint } at ?C
5-
resume(prog);
6-
^^^^
5+
resume(box prog);
6+
^^^^^^^^

examples/neg/blocks_in_value_pos.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ effect MyPrint(n: Int): Unit
44

55
def main { prog: => Unit / MyPrint } =
66
try { prog(); prog() } with MyPrint { (n: Int) =>
7-
resume(prog);
7+
resume(box prog);
88
println(n)
99
}

0 commit comments

Comments
 (0)