File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ -- [E007] Type Mismatch Error: tests/neg/i20481.scala:8:14 -------------------------------------------------------------
2+ 8 | val c1: A = a // error
3+ | ^
4+ | Found: (a : A^)
5+ | Required: A
6+ |
7+ | Note that capability cap is not included in capture set {}.
8+ |
9+ | where: ^ and cap refer to a fresh root capability in the type of parameter a
10+ |
11+ | longer explanation available when compiling with `-explain`
12+ -- [E007] Type Mismatch Error: tests/neg/i20481.scala:10:16 ------------------------------------------------------------
13+ 10 | val c3: A = a.f // error
14+ | ^^^
15+ | Found: (a.f : A^)
16+ | Required: A
17+ |
18+ | Note that capability cap is not included in capture set {}.
19+ |
20+ | where: ^ and cap refer to a fresh root capability in the type of value f
21+ |
22+ | longer explanation available when compiling with `-explain`
23+ -- [E007] Type Mismatch Error: tests/neg/i20481.scala:11:23 ------------------------------------------------------------
24+ 11 | val f1: () -> Unit = () => println(a) // error
25+ | ^^^^^^^^^^^^^^^^
26+ | Found: () ->{a} Unit
27+ | Required: () -> Unit
28+ |
29+ | Note that capability a is not included in capture set {}.
30+ |
31+ | longer explanation available when compiling with `-explain`
32+ -- [E007] Type Mismatch Error: tests/neg/i20481.scala:13:23 ------------------------------------------------------------
33+ 13 | val f3: () -> Unit = () => println(a.f) // error
34+ | ^^^^^^^^^^^^^^^^^^
35+ | Found: () ->{a.f} Unit
36+ | Required: () -> Unit
37+ |
38+ | Note that capability a.f is not included in capture set {}.
39+ |
40+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change 1+ import language .experimental .captureChecking
2+
3+ class A :
4+ val b : A = this
5+ val f : A ^ = this
6+
7+ def test (a : A ^ ) =
8+ val c1 : A = a // error
9+ val c2 : A = a.b // ok
10+ val c3 : A = a.f // error
11+ val f1 : () -> Unit = () => println(a) // error
12+ val f2 : () -> Unit = () => println(a.b) // ok!
13+ val f3 : () -> Unit = () => println(a.f) // error
You can’t perform that action at this time.
0 commit comments