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
19 changes: 7 additions & 12 deletions tests/neg-custom-args/captures/consume-tvar-bound.check
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/consume-tvar-bound.scala:9:44 ----------------------------
9 |def hh[T <: Ref^](x: Box[T]): (Ref^, Int) = (x.elem, 1) // error (but msg is strange since it does not highlight the underlying box conflict)
| ^^^^^^^^^^^
| Found: (T^'s1, Int)
| Required: (Ref^, Int)
|
| Note that capability cap is not included in capture set {}.
|
| where: ^ refers to a fresh root capability in the result type of method hh
| cap is a fresh root capability in the type of type T
|
| longer explanation available when compiling with `-explain`
-- Error: tests/neg-custom-args/captures/consume-tvar-bound.scala:7:29 -------------------------------------------------
7 |def h[T <: Ref^](x: Box[T]): Ref^ = x.elem // error
| ^^^^
| Separation failure: method h's result type Ref^ hides cap, which appears in the bound of type T.
| This is not allowed. The type T has to be returned explicitly in the result type.
|
| where: cap is a fresh root capability in the type of type T
-- Error: tests/neg-custom-args/captures/consume-tvar-bound.scala:9:30 -------------------------------------------------
9 |def hh[T <: Ref^](x: Box[T]): (Ref^, Int) = (x.elem, 1) // error (but msg is strange since it does not highlight the underlying box conflict)
| ^^^^^^^^^^^
| Separation failure: method hh's result type (Ref^, Int) hides cap, which appears in the bound of type T.
| This is not allowed. The type T has to be returned explicitly in the result type.
|
| where: cap is a fresh root capability in the type of type T
-- Error: tests/neg-custom-args/captures/consume-tvar-bound.scala:11:37 ------------------------------------------------
11 |def g[T <: Ref^](consume x: Box[T]): Ref^ = x.elem // error
| ^^^^
Expand Down
12 changes: 0 additions & 12 deletions tests/pos-custom-args/captures/i24543.scala

This file was deleted.

13 changes: 13 additions & 0 deletions tests/pos/i24543.scala
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was it moved out of pos-custom-args/captures ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All files in pos-custom-args/captures undergo separation checking, but this one causes errors with it.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import scala.language.experimental.captureChecking
// no separation checking

class Ref
case class Box[T](elem: T)

def h1[T <: Ref^](x: Box[T]): Unit =
val y: (Ref^, Int) = (x.elem, 1) // would be sep error

def h2[T <: Ref^](x: List[T]): (Ref^, Int) = (x.head, 1) // would be sep error



Loading