forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21614.scala:9:33 ---------------------------------------- | ||
9 | files.map((f: F) => new Logger(f)) // error, Q: can we make this pass (see #19076)? | ||
| ^ | ||
| Found: (f : F^) | ||
| Required: File^ | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21614.scala:12:12 --------------------------------------- | ||
12 | files.map(new Logger(_)) // error, Q: can we improve the error message? | ||
| ^^^^^^^^^^^^^ | ||
| Found: Logger{val f: (_$1 : File^{files*})}^ | ||
| Required: Logger{val f: File^?}^? | ||
| | ||
| Note that the universal capability `cap` | ||
| cannot be included in capture set ? | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import language.experimental.captureChecking | ||
import caps.Capability | ||
import caps.unbox | ||
|
||
trait File extends Capability | ||
class Logger(f: File^) extends Capability // <- will work if we remove the extends clause | ||
|
||
def mkLoggers1[F <: File^](@unbox files: List[F]): List[Logger^] = | ||
files.map((f: F) => new Logger(f)) // error, Q: can we make this pass (see #19076)? | ||
|
||
def mkLoggers2(@unbox files: List[File^]): List[Logger^] = | ||
files.map(new Logger(_)) // error, Q: can we improve the error message? |