From eeff6b17d60688f2bd75601cca09f1b1e0c69136 Mon Sep 17 00:00:00 2001 From: odersky Date: Sun, 30 Nov 2025 10:53:50 +0100 Subject: [PATCH] Fix check files to make build work again --- .../captures/consume-tvar-bound.check | 19 +++++++------------ tests/pos-custom-args/captures/i24543.scala | 12 ------------ tests/pos/i24543.scala | 13 +++++++++++++ 3 files changed, 20 insertions(+), 24 deletions(-) delete mode 100644 tests/pos-custom-args/captures/i24543.scala create mode 100644 tests/pos/i24543.scala diff --git a/tests/neg-custom-args/captures/consume-tvar-bound.check b/tests/neg-custom-args/captures/consume-tvar-bound.check index 4adfbf54f8f9..98e21039d2f4 100644 --- a/tests/neg-custom-args/captures/consume-tvar-bound.check +++ b/tests/neg-custom-args/captures/consume-tvar-bound.check @@ -1,15 +1,3 @@ --- [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 | ^^^^ @@ -17,6 +5,13 @@ | 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 | ^^^^ diff --git a/tests/pos-custom-args/captures/i24543.scala b/tests/pos-custom-args/captures/i24543.scala deleted file mode 100644 index e09607cbf53c..000000000000 --- a/tests/pos-custom-args/captures/i24543.scala +++ /dev/null @@ -1,12 +0,0 @@ -import scala.language.experimental.captureChecking - -class Ref -case class Box[T](elem: T) - -def h1[T <: Ref^](x: Box[T]): Unit = - val y: (Ref^, Int) = (x.elem, 1) // was error - -def h2[T <: Ref^](x: List[T]): (Ref^, Int) = (x.head, 1) // was error - - - diff --git a/tests/pos/i24543.scala b/tests/pos/i24543.scala new file mode 100644 index 000000000000..36dbc1e3b881 --- /dev/null +++ b/tests/pos/i24543.scala @@ -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 + + +