Skip to content

Commit 28c21ee

Browse files
committed
Add capture-checking test for boundary
1 parent 315e47f commit 28c21ee

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/boundary.scala:8:31 --------------------------------------
2+
8 | boundary.break(l2)(using l1) // error
3+
| ^^
4+
| Found: (local : scala.util.boundary.Label[scala.util.boundary.Label[Unit]]^)
5+
| Required: scala.util.boundary.Label[box scala.util.boundary.Label[Unit]^{local²}]^
6+
|
7+
| where: local is a value locally defined in object test
8+
| local² is a value locally defined in object test
9+
|
10+
| longer explanation available when compiling with `-explain`
11+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/boundary.scala:6:32 --------------------------------------
12+
6 | boundary[boundary.Label[Unit]]: l1 ?=> // error
13+
| ^
14+
| Found: scala.util.boundary.Break[scala.util.boundary.Label[Unit]] @unchecked
15+
| Required: scala.util.boundary.Break[box scala.util.boundary.Label[Unit]^] @unchecked
16+
7 | boundary[Unit]: l2 ?=>
17+
8 | boundary.break(l2)(using l1) // error
18+
9 | ???
19+
|--------------------------------------------------------------------------------------------------------------------
20+
|Inline stack trace
21+
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22+
|This location contains code that was inlined from boundary.scala:73
23+
73 | catch case ex: Break[T] @unchecked =>
24+
| ^
25+
--------------------------------------------------------------------------------------------------------------------
26+
|
27+
| longer explanation available when compiling with `-explain`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import language.experimental.captureChecking
2+
3+
import scala.util.boundary
4+
5+
object test:
6+
boundary[boundary.Label[Unit]]: l1 ?=> // error
7+
boundary[Unit]: l2 ?=>
8+
boundary.break(l2)(using l1) // error
9+
???

0 commit comments

Comments
 (0)