File tree 2 files changed +29
-0
lines changed
tests/neg-custom-args/captures
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21614.scala:9:33 ----------------------------------------
2
+ 9 | files.map((f: F) => new Logger(f)) // error, Q: can we make this pass (see #19076)?
3
+ | ^
4
+ | Found: (f : F^)
5
+ | Required: File^
6
+ |
7
+ | longer explanation available when compiling with `-explain`
8
+ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21614.scala:12:12 ---------------------------------------
9
+ 12 | files.map(new Logger(_)) // error, Q: can we improve the error message?
10
+ | ^^^^^^^^^^^^^
11
+ | Found: Logger{val f: (_$1 : File^{files*})}^
12
+ | Required: Logger{val f: File^?}^?
13
+ |
14
+ | Note that the universal capability `cap`
15
+ | cannot be included in capture set ?
16
+ |
17
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ import language .experimental .captureChecking
2
+ import caps .Capability
3
+ import caps .unbox
4
+
5
+ trait File extends Capability
6
+ class Logger (f : File ^ ) extends Capability // <- will work if we remove the extends clause
7
+
8
+ def mkLoggers1 [F <: File ^ ](@ unbox files : List [F ]): List [Logger ^ ] =
9
+ files.map((f : F ) => new Logger (f)) // error, Q: can we make this pass (see #19076)?
10
+
11
+ def mkLoggers2 (@ unbox files : List [File ^ ]): List [Logger ^ ] =
12
+ files.map(new Logger (_)) // error, Q: can we improve the error message?
You can’t perform that action at this time.
0 commit comments