|
| 1 | +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/sep-curried-par.scala:23:32 ------------------------------ |
| 2 | +23 | val bar = (p1: () => Unit) => (p2: () ->{p1, cap} Unit) => par(p1, p2) // error, but error message could be better |
| 3 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 4 | + | Found: (p2: () ->{p1, cap} Unit) ->{p1} Unit |
| 5 | + | Required: (() ->'s1 Unit) ->'s2 Unit |
| 6 | + | |
| 7 | + | Note that capability p1, defined in method $anonfun |
| 8 | + | cannot be included in outer capture set 's2. |
| 9 | + | |
| 10 | + | where: cap is the universal root capability |
| 11 | + | |
| 12 | + | longer explanation available when compiling with `-explain` |
| 13 | +-- Error: tests/neg-custom-args/captures/sep-curried-par.scala:6:48 ---------------------------------------------------- |
| 14 | +6 |def parCurriedBad(p1: () => Unit): (() => Unit) => Unit = // error: consume failure |
| 15 | + | ^^^^^^^^^^^^^^^^^^^^ |
| 16 | + | Separation failure: method parCurriedBad's result type (() => Unit) => Unit hides parameter p1. |
| 17 | + | The parameter needs to be annotated with consume to allow this. |
| 18 | +-- Error: tests/neg-custom-args/captures/sep-curried-par.scala:15:6 ---------------------------------------------------- |
| 19 | +15 | par(p, p) // error: separation |
| 20 | + | ^ |
| 21 | + |Separation failure: argument of type (p : () => Unit) |
| 22 | + |to method par: (p1: () => Unit, p2: () => Unit): Unit |
| 23 | + |corresponds to capture-polymorphic formal parameter p1 of type () =>² Unit |
| 24 | + |and hides capabilities {p}. |
| 25 | + |Some of these overlap with the captures of the second argument with type (p : () => Unit). |
| 26 | + | |
| 27 | + | Hidden set of current argument : {p} |
| 28 | + | Hidden footprint of current argument : {p} |
| 29 | + | Capture set of second argument : {p} |
| 30 | + | Footprint set of second argument : {p} |
| 31 | + | The two sets overlap at : {p} |
| 32 | + | |
| 33 | + |where: => refers to a fresh root capability in the type of value p |
| 34 | + | =>² refers to a fresh root capability created in method test when checking argument to parameter p1 of method par |
| 35 | +-- Error: tests/neg-custom-args/captures/sep-curried-par.scala:18:16 --------------------------------------------------- |
| 36 | +18 | parCurried(p)(p) // error: consume failure |
| 37 | + | ^ |
| 38 | + | Separation failure: Illegal access to (p : () => Unit), which was passed to a |
| 39 | + | consume parameter or was used as a prefix to a consume method on line 18 |
| 40 | + | and therefore is no longer available. |
| 41 | + | |
| 42 | + | where: => refers to a fresh root capability in the type of value p |
| 43 | +-- Error: tests/neg-custom-args/captures/sep-curried-par.scala:21:9 ---------------------------------------------------- |
| 44 | +21 | foo(c)(c) // error: separation |
| 45 | + | ^ |
| 46 | + |Separation failure: argument of type (c : () => Unit) |
| 47 | + |to a function of type (() => Unit) ->{c} Unit |
| 48 | + |corresponds to capture-polymorphic formal parameter v1 of type () =>² Unit |
| 49 | + |and hides capabilities {c}. |
| 50 | + |Some of these overlap with the captures of the function prefix. |
| 51 | + | |
| 52 | + | Hidden set of current argument : {c} |
| 53 | + | Hidden footprint of current argument : {c} |
| 54 | + | Capture set of function prefix : {c} |
| 55 | + | Footprint set of function prefix : {c} |
| 56 | + | The two sets overlap at : {c} |
| 57 | + | |
| 58 | + |where: => refers to a fresh root capability in the type of parameter c |
| 59 | + | =>² refers to a fresh root capability created in method test when checking argument to parameter v1 of method apply |
0 commit comments