Skip to content

Commit 0f663ca

Browse files
committed
Some more fun -> box
1 parent 401d7e6 commit 0f663ca

10 files changed

+31
-31
lines changed

examples/neg/issue50.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[error] examples/neg/issue50.effekt:16:11: Not allowed {Effect2}
2-
k = fun (x: Unit) { resume(x) };
3-
^^^^^^^^^^^^^^^^^^^^^^^^^^^
2+
k = box { x => resume(x) };
3+
^^^^^^^^^^^^^^^^^^^^^^

examples/neg/issue50.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ def handle2 { prog: () => Unit / { Effect2 } }: Unit = {
88
}
99

1010
def escape { prog: () => Unit / { Effect1, Effect2 } }: Unit = region this {
11-
var k: (Unit) => Unit at { this, prog } in this = fun (x: Unit) { () }
11+
var k: (Unit) => Unit at { this, prog } in this = box { x => () }
1212
handle2 {
1313
try {
1414
prog()
1515
} with Effect1 { () =>
16-
k = fun (x: Unit) { resume(x) };
16+
k = box { x => resume(x) };
1717
resume(())
1818
}
1919
}

examples/neg/lambdas/capability_closure.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface Get {
44

55
def outer() = {
66
def inner(): Int / {} = do get()
7-
fun() { inner() }
7+
box { inner() }
88
}
99

1010
def main() = {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[error] examples/neg/lambdas/continuations.effekt:17:14: Not allowed {Raise}
2-
cont = fun() { resume(()) };
3-
^^^^^^^^^^^^^^^^^^^^
2+
cont = box { resume(()) };
3+
^^^^^^^^^^^^^^^^^^

examples/neg/lambdas/continuations.effekt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ effect Yield(): Unit
44
def main() = region this {
55

66
// here we use the region of the main function
7-
var cont: () => Unit at {this} in this = fun() { () }
7+
var cont: () => Unit at {this} in this = box { () }
88

99
try {
1010
try {
@@ -14,12 +14,12 @@ def main() = region this {
1414
} with Yield {
1515
// the assignment is not valid since the continuation must not leave
1616
// the current scope, which is the one of Raise.
17-
cont = fun() { resume(()) };
17+
cont = box { resume(()) };
1818
()
1919
}
2020
} with Raise { msg =>
2121
println("exception " ++ msg ++ ", but we keep on going..."); resume(())
2222
}
2323

2424
cont()
25-
}
25+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
[error] examples/neg/lambdas/inference.effekt:13:8: Expected type
2-
(Int => Bool at {}) => String
2+
(Int => Bool at {}) => String at {}
33
but got type
4-
(Int => Unit at {}) => String
4+
(Int => Unit at {}) => String at ?C
55

66
Type mismatch between Bool and Unit.
77
comparing the argument types of
88
(Int => Unit at {}) => String (given)
99
(Int => Bool at {}) => String (expected)
1010
when comparing the return type of the function.
11-
hof2(fun(f: (Int) => Unit at {}) { "" })
12-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13-
[error] examples/neg/lambdas/inference.effekt:13:8: Expected type
14-
(Int => Bool at {}) => String at {}
11+
hof2(box { (f: (Int) => Unit at {}) => "" })
12+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13+
[error] examples/neg/lambdas/inference.effekt:13:12: Expected type
14+
(Int => Bool at {}) => String
1515
but got type
16-
(Int => Unit at {}) => String at ?C
16+
(Int => Unit at {}) => String
1717

1818
Type mismatch between Bool and Unit.
1919
comparing the argument types of
2020
(Int => Unit at {}) => String (given)
2121
(Int => Bool at {}) => String (expected)
2222
when comparing the return type of the function.
23-
hof2(fun(f: (Int) => Unit at {}) { "" })
24-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25-
[error] examples/neg/lambdas/inference.effekt:13:12: Type Int => Unit at {} does not match the declared type Int => Bool at {}.
23+
hof2(box { (f: (Int) => Unit at {}) => "" })
24+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25+
[error] examples/neg/lambdas/inference.effekt:13:15: Type Int => Unit at {} does not match the declared type Int => Bool at {}.
2626
when comparing the return type of the function.
27-
hof2(fun(f: (Int) => Unit at {}) { "" })
28-
^^^^^^^^^^^^^^^^^^^^^^
27+
hof2(box { (f: (Int) => Unit at {}) => "" })
28+
^^^^^^^^^^^^^^^^^^^^^^

examples/neg/lambdas/localstate.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def main() = {
77

88
def count1(n: Int): Int = if (n == 0) n else count1(n - 1)
99

10-
def hof { g2 : => Unit } = fun () {
10+
def hof { g2 : => Unit } = box {
1111
x = x + 1
1212
println(x + y); g2()
1313
}
@@ -21,4 +21,4 @@ def main() = {
2121
incrementer
2222
}
2323
local()
24-
}
24+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[error] examples/neg/lambdas/polymorphicescape.effekt:37:14: Not allowed {leak}
2-
leak = fun() { resume(h) } // ERROR
3-
^^^^^^^^^^^^^^^^^^^
2+
leak = box { resume(h) } // ERROR
3+
^^^^^^^^^^^^^^^^^

examples/neg/lambdas/polymorphicescape.effekt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def two[A, B]() =
1616
(do get[A](), do get[B]())
1717

1818
def main() = {
19-
var leak: () => String at {io} = fun() { "" };
19+
var leak: () => String at {io} = box { "" };
2020
try {
2121
val (n1, n2) = two[Int, Int]();
2222
println(n1);
@@ -34,8 +34,8 @@ def main() = {
3434
def get() = resume("")
3535
def put[S](n, x) = {
3636
val h = x;
37-
leak = fun() { resume(h) } // ERROR
37+
leak = box { resume(h) } // ERROR
3838
resume(h)
3939
}
4040
}
41-
}
41+
}

examples/neg/lambdas/simpleescape.effekt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ def main() = {
66
try {
77
def block(msg: String): Unit / {} = { do Raise(msg) }
88
val f = if (do Flip()) {
9-
fun() { block("first") }
9+
box { block("first") }
1010
} else {
11-
fun() { block("second") }
11+
box { block("second") }
1212
}
1313
f
1414
} with Raise { msg =>

0 commit comments

Comments
 (0)