Skip to content

Commit ba9e59a

Browse files
authored
Test for #21614 (#21615)
2 parents 493dbe2 + b9f86dc commit ba9e59a

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Diff for: tests/neg-custom-args/captures/i21614.check

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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`

Diff for: tests/neg-custom-args/captures/i21614.scala

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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?

0 commit comments

Comments
 (0)