|
1 |
| --- Error: tests/neg-custom-args/captures/vars.scala:13:6 --------------------------------------------------------------- |
2 |
| -13 | var a: String => String = f // error |
3 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
4 |
| - | Mutable variable a cannot have type box String => String since |
5 |
| - | that type captures the root capability `cap`. |
6 |
| - | This restriction serves to prevent local capabilities from escaping the scope where they are defined. |
7 |
| --- Error: tests/neg-custom-args/captures/vars.scala:14:6 --------------------------------------------------------------- |
8 |
| -14 | var b: List[String => String] = Nil // error |
9 |
| - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
10 |
| - | Mutable variable b cannot have type List[String => String] since |
11 |
| - | the part String => String of that type captures the root capability `cap`. |
12 |
| - | This restriction serves to prevent local capabilities from escaping the scope where they are defined. |
13 | 1 | -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/vars.scala:11:24 -----------------------------------------
|
14 | 2 | 11 | val z2c: () -> Unit = z2 // error
|
15 | 3 | | ^^
|
16 | 4 | | Found: () ->{z2} Unit
|
17 | 5 | | Required: () -> Unit
|
18 | 6 | |
|
19 | 7 | | longer explanation available when compiling with `-explain`
|
20 |
| --- Error: tests/neg-custom-args/captures/vars.scala:32:2 --------------------------------------------------------------- |
21 |
| -32 | local { cap3 => // error |
| 8 | +-- Error: tests/neg-custom-args/captures/vars.scala:23:14 -------------------------------------------------------------- |
| 9 | +23 | a = x => g(x) // error |
| 10 | + | ^^^^ |
| 11 | + | reference (cap3 : CC^) is not included in the allowed capture set {cap[test]} |
| 12 | + | of an enclosing function literal with expected type box String ->{cap[test]} String |
| 13 | +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/vars.scala:24:8 ------------------------------------------ |
| 14 | +24 | a = g // error |
| 15 | + | ^ |
| 16 | + | Found: box (x: String) ->{cap3} String |
| 17 | + | Required: box (x$0: String) ->{cap[test]} String |
| 18 | + | |
| 19 | + | longer explanation available when compiling with `-explain` |
| 20 | +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/vars.scala:26:12 ----------------------------------------- |
| 21 | +26 | b = List(g) // error |
| 22 | + | ^^^^^^^ |
| 23 | + | Found: List[box (x$0: String) ->{cap3} String] |
| 24 | + | Required: List[String ->{cap[test]} String] |
| 25 | + | |
| 26 | + | longer explanation available when compiling with `-explain` |
| 27 | +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/vars.scala:30:10 ----------------------------------------- |
| 28 | +30 | val s = scope // error (but should be OK, we need to allow poly-captures) |
| 29 | + | ^^^^^ |
| 30 | + | Found: (x$0: String) ->{cap[scope]} String |
| 31 | + | Required: (x$0: String) ->? String |
| 32 | + | |
| 33 | + | Note that reference (cap[scope] : caps.Root), defined at level 2 |
| 34 | + | cannot be included in outer capture set ?, defined at level 1 in method test |
| 35 | + | |
| 36 | + | longer explanation available when compiling with `-explain` |
| 37 | +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/vars.scala:31:29 ----------------------------------------- |
| 38 | +31 | val sc: String => String = scope // error (but should also be OK) |
| 39 | + | ^^^^^ |
| 40 | + | Found: (x$0: String) ->{cap[scope]} String |
| 41 | + | Required: String => String |
| 42 | + | |
| 43 | + | Note that reference (cap[scope] : caps.Root), defined at level 2 |
| 44 | + | cannot be included in outer capture set ?, defined at level 1 in method test |
| 45 | + | |
| 46 | + | longer explanation available when compiling with `-explain` |
| 47 | +-- Error: tests/neg-custom-args/captures/vars.scala:35:2 --------------------------------------------------------------- |
| 48 | +35 | local { root => cap3 => // error |
22 | 49 | | ^^^^^
|
23 |
| - | Sealed type variable T cannot be instantiated to box (x$0: String) => String since |
24 |
| - | that type captures the root capability `cap`. |
25 |
| - | This is often caused by a local capability in an argument of method local |
26 |
| - | leaking as part of its result. |
| 50 | + | escaping local reference root.type |
0 commit comments