From bbdf3cb046639b4ca10d347a8b91efd8be77d864 Mon Sep 17 00:00:00 2001 From: odersky Date: Thu, 9 Jan 2025 17:21:09 +0100 Subject: [PATCH] Move cc tests to captures subdirectories --- .../captures}/capt-wf.scala | 0 .../captures}/cc-ex-conformance.scala | 0 .../captures}/cc-poly-1.check | 4 +-- .../captures}/cc-poly-1.scala | 0 .../captures}/cc-poly-2.check | 4 +-- .../captures}/cc-poly-2.scala | 0 .../captures}/existential-mapping.check | 26 +++++++++---------- .../captures}/existential-mapping.scala | 0 .../captures}/i19470.check | 2 +- .../captures}/i19470.scala | 0 .../captures}/i20503.scala | 0 .../captures}/language-imports.scala | 0 .../captures}/leak-problem-unboxed.scala | 0 .../captures}/leak-problem.scala | 0 .../captures}/annot-i20272a.scala | 0 .../captures}/byname-purefuns-adapt/A_1.scala | 0 .../captures}/byname-purefuns-adapt/B_2.scala | 0 .../captures}/cc-experimental.scala | 0 .../captures}/cc-poly-1.scala | 0 .../captures}/cc-poly-source-capability.scala | 0 .../captures}/cc-poly-source.scala | 0 .../captures}/dotty-experimental.scala | 0 .../captures}/i18699.scala | 0 .../captures}/i18909.scala | 0 .../captures}/i20135.scala | 0 .../captures}/i21390.TrieMap.scala | 0 .../captures}/infer-exists.scala | 0 .../captures}/invariant-cc.scala | 0 .../captures}/polycap.scala | 0 .../captures}/reach-capability.scala | 0 .../captures}/reach-problem.scala | 0 tests/pos/Buffer.scala | 22 ---------------- 32 files changed, 18 insertions(+), 40 deletions(-) rename tests/{neg => neg-custom-args/captures}/capt-wf.scala (100%) rename tests/{neg => neg-custom-args/captures}/cc-ex-conformance.scala (100%) rename tests/{neg => neg-custom-args/captures}/cc-poly-1.check (60%) rename tests/{neg => neg-custom-args/captures}/cc-poly-1.scala (100%) rename tests/{neg => neg-custom-args/captures}/cc-poly-2.check (65%) rename tests/{neg => neg-custom-args/captures}/cc-poly-2.scala (100%) rename tests/{neg => neg-custom-args/captures}/existential-mapping.check (70%) rename tests/{neg => neg-custom-args/captures}/existential-mapping.scala (100%) rename tests/{neg => neg-custom-args/captures}/i19470.check (62%) rename tests/{neg => neg-custom-args/captures}/i19470.scala (100%) rename tests/{neg => neg-custom-args/captures}/i20503.scala (100%) rename tests/{neg => neg-custom-args/captures}/language-imports.scala (100%) rename tests/{neg => neg-custom-args/captures}/leak-problem-unboxed.scala (100%) rename tests/{neg => neg-custom-args/captures}/leak-problem.scala (100%) rename tests/{pos => pos-custom-args/captures}/annot-i20272a.scala (100%) rename tests/{pos => pos-custom-args/captures}/byname-purefuns-adapt/A_1.scala (100%) rename tests/{pos => pos-custom-args/captures}/byname-purefuns-adapt/B_2.scala (100%) rename tests/{pos => pos-custom-args/captures}/cc-experimental.scala (100%) rename tests/{pos => pos-custom-args/captures}/cc-poly-1.scala (100%) rename tests/{pos => pos-custom-args/captures}/cc-poly-source-capability.scala (100%) rename tests/{pos => pos-custom-args/captures}/cc-poly-source.scala (100%) rename tests/{pos => pos-custom-args/captures}/dotty-experimental.scala (100%) rename tests/{pos => pos-custom-args/captures}/i18699.scala (100%) rename tests/{pos => pos-custom-args/captures}/i18909.scala (100%) rename tests/{pos => pos-custom-args/captures}/i20135.scala (100%) rename tests/{pos => pos-custom-args/captures}/i21390.TrieMap.scala (100%) rename tests/{pos => pos-custom-args/captures}/infer-exists.scala (100%) rename tests/{pos => pos-custom-args/captures}/invariant-cc.scala (100%) rename tests/{pos => pos-custom-args/captures}/polycap.scala (100%) rename tests/{pos => pos-custom-args/captures}/reach-capability.scala (100%) rename tests/{pos => pos-custom-args/captures}/reach-problem.scala (100%) delete mode 100644 tests/pos/Buffer.scala diff --git a/tests/neg/capt-wf.scala b/tests/neg-custom-args/captures/capt-wf.scala similarity index 100% rename from tests/neg/capt-wf.scala rename to tests/neg-custom-args/captures/capt-wf.scala diff --git a/tests/neg/cc-ex-conformance.scala b/tests/neg-custom-args/captures/cc-ex-conformance.scala similarity index 100% rename from tests/neg/cc-ex-conformance.scala rename to tests/neg-custom-args/captures/cc-ex-conformance.scala diff --git a/tests/neg/cc-poly-1.check b/tests/neg-custom-args/captures/cc-poly-1.check similarity index 60% rename from tests/neg/cc-poly-1.check rename to tests/neg-custom-args/captures/cc-poly-1.check index abb507078bf4..ea486f55a61f 100644 --- a/tests/neg/cc-poly-1.check +++ b/tests/neg-custom-args/captures/cc-poly-1.check @@ -1,10 +1,10 @@ --- [E057] Type Mismatch Error: tests/neg/cc-poly-1.scala:12:6 ---------------------------------------------------------- +-- [E057] Type Mismatch Error: tests/neg-custom-args/captures/cc-poly-1.scala:12:6 ------------------------------------- 12 | f[Any](D()) // error | ^ | Type argument Any does not conform to upper bound caps.CapSet^ | | longer explanation available when compiling with `-explain` --- [E057] Type Mismatch Error: tests/neg/cc-poly-1.scala:13:6 ---------------------------------------------------------- +-- [E057] Type Mismatch Error: tests/neg-custom-args/captures/cc-poly-1.scala:13:6 ------------------------------------- 13 | f[String](D()) // error | ^ | Type argument String does not conform to upper bound caps.CapSet^ diff --git a/tests/neg/cc-poly-1.scala b/tests/neg-custom-args/captures/cc-poly-1.scala similarity index 100% rename from tests/neg/cc-poly-1.scala rename to tests/neg-custom-args/captures/cc-poly-1.scala diff --git a/tests/neg/cc-poly-2.check b/tests/neg-custom-args/captures/cc-poly-2.check similarity index 65% rename from tests/neg/cc-poly-2.check rename to tests/neg-custom-args/captures/cc-poly-2.check index 7a2882775a75..90568de385b3 100644 --- a/tests/neg/cc-poly-2.check +++ b/tests/neg-custom-args/captures/cc-poly-2.check @@ -1,11 +1,11 @@ --- [E007] Type Mismatch Error: tests/neg/cc-poly-2.scala:14:19 --------------------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-poly-2.scala:14:19 ------------------------------------ 14 | f[CapSet^{c1}](d) // error | ^ | Found: (d : Test.D^) | Required: Test.D^{c1} | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/cc-poly-2.scala:16:20 --------------------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-poly-2.scala:16:20 ------------------------------------ 16 | val _: D^{c1} = x // error | ^ | Found: (x : Test.D^{d}) diff --git a/tests/neg/cc-poly-2.scala b/tests/neg-custom-args/captures/cc-poly-2.scala similarity index 100% rename from tests/neg/cc-poly-2.scala rename to tests/neg-custom-args/captures/cc-poly-2.scala diff --git a/tests/neg/existential-mapping.check b/tests/neg-custom-args/captures/existential-mapping.check similarity index 70% rename from tests/neg/existential-mapping.check rename to tests/neg-custom-args/captures/existential-mapping.check index edfce67f6eef..cd71337868e1 100644 --- a/tests/neg/existential-mapping.check +++ b/tests/neg-custom-args/captures/existential-mapping.check @@ -1,85 +1,85 @@ --- Error: tests/neg/existential-mapping.scala:44:13 -------------------------------------------------------------------- +-- Error: tests/neg-custom-args/captures/existential-mapping.scala:44:13 ----------------------------------------------- 44 | val z1: A^ => Array[C^] = ??? // error | ^^^^^^^^^^^^^^^ | Array[box C^] captures the root capability `cap` in invariant position --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:9:25 ------------------------------------------------ +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:9:25 --------------------------- 9 | val _: (x: C^) -> C = x1 // error | ^^ | Found: (x1 : (x: C^) -> (ex$3: caps.Exists) -> C^{ex$3}) | Required: (x: C^) -> C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:12:20 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:12:20 -------------------------- 12 | val _: C^ -> C = x2 // error | ^^ | Found: (x2 : C^ -> (ex$7: caps.Exists) -> C^{ex$7}) | Required: C^ -> C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:15:30 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:15:30 -------------------------- 15 | val _: A^ -> (x: C^) -> C = x3 // error | ^^ | Found: (x3 : A^ -> (x: C^) -> (ex$11: caps.Exists) -> C^{ex$11}) | Required: A^ -> (x: C^) -> C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:18:25 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:18:25 -------------------------- 18 | val _: A^ -> C^ -> C = x4 // error | ^^ | Found: (x4 : A^ -> C^ -> (ex$19: caps.Exists) -> C^{ex$19}) | Required: A^ -> C^ -> C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:21:30 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:21:30 -------------------------- 21 | val _: A^ -> (x: C^) -> C = x5 // error | ^^ | Found: (x5 : A^ -> (ex$27: caps.Exists) -> Fun[C^{ex$27}]) | Required: A^ -> (x: C^) -> C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:24:30 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:24:30 -------------------------- 24 | val _: A^ -> (x: C^) => C = x6 // error | ^^ | Found: (x6 : A^ -> (ex$33: caps.Exists) -> IFun[C^{ex$33}]) | Required: A^ -> (ex$36: caps.Exists) -> (x: C^) ->{ex$36} C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:27:25 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:27:25 -------------------------- 27 | val _: (x: C^) => C = y1 // error | ^^ | Found: (y1 : (x: C^) => (ex$38: caps.Exists) -> C^{ex$38}) | Required: (x: C^) => C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:30:20 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:30:20 -------------------------- 30 | val _: C^ => C = y2 // error | ^^ | Found: (y2 : C^ => (ex$42: caps.Exists) -> C^{ex$42}) | Required: C^ => C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:33:30 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:33:30 -------------------------- 33 | val _: A^ => (x: C^) => C = y3 // error | ^^ | Found: (y3 : A^ => (ex$47: caps.Exists) -> (x: C^) ->{ex$47} (ex$46: caps.Exists) -> C^{ex$46}) | Required: A^ => (ex$50: caps.Exists) -> (x: C^) ->{ex$50} C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:36:25 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:36:25 -------------------------- 36 | val _: A^ => C^ => C = y4 // error | ^^ | Found: (y4 : A^ => (ex$53: caps.Exists) -> C^ ->{ex$53} (ex$52: caps.Exists) -> C^{ex$52}) | Required: A^ => (ex$56: caps.Exists) -> C^ ->{ex$56} C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:39:30 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:39:30 -------------------------- 39 | val _: A^ => (x: C^) -> C = y5 // error | ^^ | Found: (y5 : A^ => (ex$58: caps.Exists) -> Fun[C^{ex$58}]) | Required: A^ => (x: C^) -> C | | longer explanation available when compiling with `-explain` --- [E007] Type Mismatch Error: tests/neg/existential-mapping.scala:42:30 ----------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:42:30 -------------------------- 42 | val _: A^ => (x: C^) => C = y6 // error | ^^ | Found: (y6 : A^ => (ex$64: caps.Exists) -> IFun[C^{ex$64}]) diff --git a/tests/neg/existential-mapping.scala b/tests/neg-custom-args/captures/existential-mapping.scala similarity index 100% rename from tests/neg/existential-mapping.scala rename to tests/neg-custom-args/captures/existential-mapping.scala diff --git a/tests/neg/i19470.check b/tests/neg-custom-args/captures/i19470.check similarity index 62% rename from tests/neg/i19470.check rename to tests/neg-custom-args/captures/i19470.check index fdb336bef7e5..68eba72c92bd 100644 --- a/tests/neg/i19470.check +++ b/tests/neg-custom-args/captures/i19470.check @@ -1,4 +1,4 @@ --- [E007] Type Mismatch Error: tests/neg/i19470.scala:9:12 ------------------------------------------------------------- +-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i19470.scala:9:12 ---------------------------------------- 9 | List(foo(f())) // error | ^^^^^^^^ | Found: Inv[box IO^{f?}] diff --git a/tests/neg/i19470.scala b/tests/neg-custom-args/captures/i19470.scala similarity index 100% rename from tests/neg/i19470.scala rename to tests/neg-custom-args/captures/i19470.scala diff --git a/tests/neg/i20503.scala b/tests/neg-custom-args/captures/i20503.scala similarity index 100% rename from tests/neg/i20503.scala rename to tests/neg-custom-args/captures/i20503.scala diff --git a/tests/neg/language-imports.scala b/tests/neg-custom-args/captures/language-imports.scala similarity index 100% rename from tests/neg/language-imports.scala rename to tests/neg-custom-args/captures/language-imports.scala diff --git a/tests/neg/leak-problem-unboxed.scala b/tests/neg-custom-args/captures/leak-problem-unboxed.scala similarity index 100% rename from tests/neg/leak-problem-unboxed.scala rename to tests/neg-custom-args/captures/leak-problem-unboxed.scala diff --git a/tests/neg/leak-problem.scala b/tests/neg-custom-args/captures/leak-problem.scala similarity index 100% rename from tests/neg/leak-problem.scala rename to tests/neg-custom-args/captures/leak-problem.scala diff --git a/tests/pos/annot-i20272a.scala b/tests/pos-custom-args/captures/annot-i20272a.scala similarity index 100% rename from tests/pos/annot-i20272a.scala rename to tests/pos-custom-args/captures/annot-i20272a.scala diff --git a/tests/pos/byname-purefuns-adapt/A_1.scala b/tests/pos-custom-args/captures/byname-purefuns-adapt/A_1.scala similarity index 100% rename from tests/pos/byname-purefuns-adapt/A_1.scala rename to tests/pos-custom-args/captures/byname-purefuns-adapt/A_1.scala diff --git a/tests/pos/byname-purefuns-adapt/B_2.scala b/tests/pos-custom-args/captures/byname-purefuns-adapt/B_2.scala similarity index 100% rename from tests/pos/byname-purefuns-adapt/B_2.scala rename to tests/pos-custom-args/captures/byname-purefuns-adapt/B_2.scala diff --git a/tests/pos/cc-experimental.scala b/tests/pos-custom-args/captures/cc-experimental.scala similarity index 100% rename from tests/pos/cc-experimental.scala rename to tests/pos-custom-args/captures/cc-experimental.scala diff --git a/tests/pos/cc-poly-1.scala b/tests/pos-custom-args/captures/cc-poly-1.scala similarity index 100% rename from tests/pos/cc-poly-1.scala rename to tests/pos-custom-args/captures/cc-poly-1.scala diff --git a/tests/pos/cc-poly-source-capability.scala b/tests/pos-custom-args/captures/cc-poly-source-capability.scala similarity index 100% rename from tests/pos/cc-poly-source-capability.scala rename to tests/pos-custom-args/captures/cc-poly-source-capability.scala diff --git a/tests/pos/cc-poly-source.scala b/tests/pos-custom-args/captures/cc-poly-source.scala similarity index 100% rename from tests/pos/cc-poly-source.scala rename to tests/pos-custom-args/captures/cc-poly-source.scala diff --git a/tests/pos/dotty-experimental.scala b/tests/pos-custom-args/captures/dotty-experimental.scala similarity index 100% rename from tests/pos/dotty-experimental.scala rename to tests/pos-custom-args/captures/dotty-experimental.scala diff --git a/tests/pos/i18699.scala b/tests/pos-custom-args/captures/i18699.scala similarity index 100% rename from tests/pos/i18699.scala rename to tests/pos-custom-args/captures/i18699.scala diff --git a/tests/pos/i18909.scala b/tests/pos-custom-args/captures/i18909.scala similarity index 100% rename from tests/pos/i18909.scala rename to tests/pos-custom-args/captures/i18909.scala diff --git a/tests/pos/i20135.scala b/tests/pos-custom-args/captures/i20135.scala similarity index 100% rename from tests/pos/i20135.scala rename to tests/pos-custom-args/captures/i20135.scala diff --git a/tests/pos/i21390.TrieMap.scala b/tests/pos-custom-args/captures/i21390.TrieMap.scala similarity index 100% rename from tests/pos/i21390.TrieMap.scala rename to tests/pos-custom-args/captures/i21390.TrieMap.scala diff --git a/tests/pos/infer-exists.scala b/tests/pos-custom-args/captures/infer-exists.scala similarity index 100% rename from tests/pos/infer-exists.scala rename to tests/pos-custom-args/captures/infer-exists.scala diff --git a/tests/pos/invariant-cc.scala b/tests/pos-custom-args/captures/invariant-cc.scala similarity index 100% rename from tests/pos/invariant-cc.scala rename to tests/pos-custom-args/captures/invariant-cc.scala diff --git a/tests/pos/polycap.scala b/tests/pos-custom-args/captures/polycap.scala similarity index 100% rename from tests/pos/polycap.scala rename to tests/pos-custom-args/captures/polycap.scala diff --git a/tests/pos/reach-capability.scala b/tests/pos-custom-args/captures/reach-capability.scala similarity index 100% rename from tests/pos/reach-capability.scala rename to tests/pos-custom-args/captures/reach-capability.scala diff --git a/tests/pos/reach-problem.scala b/tests/pos-custom-args/captures/reach-problem.scala similarity index 100% rename from tests/pos/reach-problem.scala rename to tests/pos-custom-args/captures/reach-problem.scala diff --git a/tests/pos/Buffer.scala b/tests/pos/Buffer.scala deleted file mode 100644 index 9ecd51ffa62a..000000000000 --- a/tests/pos/Buffer.scala +++ /dev/null @@ -1,22 +0,0 @@ -import language.experimental.captureChecking - -// Extract of the problem in collection.mutable.Buffers -trait Buffer[A]: - - def apply(i: Int): A = ??? - - def flatMapInPlace(f: A => IterableOnce[A]^): this.type = { - val g = f - val s = 10 - // capture checking: we need the copy since we box/unbox on g* on the next line - // TODO: This looks fishy, need to investigate - // Alternative would be to mark `f` as @use. It's not inferred - // since `^ appears in a function result, not under a box. - val newElems = new Array[(IterableOnce[A]^{f})](s) - var i = 0 - while i < s do - val x = g(this(i)) - newElems(i) = x - i += 1 - this - } \ No newline at end of file