Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/neg-custom-args/captures/i24667.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i24667.scala:10:18 ---------------------------------------
10 | val _: AnyRef = w // error on this line
| ^
| Found: (w : O.type)
| Required: AnyRef
|
| Note that capability c is not included in capture set {}.
|
| longer explanation available when compiling with `-explain`
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i24667.scala:11:22 ---------------------------------------
11 | val _: AnyRef^{c} = w // error on this line, since d is also captured
| ^
| Found: (w : O.type)
| Required: Object^{c}
|
| Note that capability O is not included in capture set {c}.
|
| longer explanation available when compiling with `-explain`
13 changes: 13 additions & 0 deletions tests/neg-custom-args/captures/i24667.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import language.experimental.captureChecking

def foo(c: AnyRef^, d: AnyRef^, e: AnyRef^): Unit =
trait I
object O:
val x = c
def foo = println(d)

val w: O.type = O // O is not pure
val _: AnyRef = w // error on this line
val _: AnyRef^{c} = w // error on this line, since d is also captured
val _: AnyRef^{c, d} = w // ok

Loading