Skip to content

Commit 498f43d

Browse files
committed
Require -source future for separation checking being turned on
1 parent a210cb8 commit 498f43d

22 files changed

+46
-40
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object ccConfig:
5353
Feature.sourceVersion.stable != SourceVersion.`3.5`
5454

5555
def useFresh(using Context): Boolean =
56-
Feature.sourceVersion.stable.isAtLeast(SourceVersion.`3.6`)
56+
Feature.sourceVersion.stable.isAtLeast(SourceVersion.`future`)
5757

5858
end ccConfig
5959

tests/neg-custom-args/captures/box-adapt-cases.check

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/box-adapt-cases.scala:7:10 -------------------------------
2-
7 | x.value(cap => cap.use()) // error, was OK
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/box-adapt-cases.scala:8:10 -------------------------------
2+
8 | x.value(cap => cap.use()) // error, was OK
33
| ^^^^^^^^^^^^^^^^
44
| Found: (cap: box Cap^?) => Int
55
| Required: (cap: box Cap^) ->{fresh} Int
66
|
77
| longer explanation available when compiling with `-explain`
8-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/box-adapt-cases.scala:14:10 ------------------------------
9-
14 | x.value(cap => cap.use()) // error
8+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/box-adapt-cases.scala:15:10 ------------------------------
9+
15 | x.value(cap => cap.use()) // error
1010
| ^^^^^^^^^^^^^^^^
1111
| Found: (cap: box Cap^?) ->{io} Int
1212
| Required: (cap: box Cap^{io}) -> Int
1313
|
1414
| longer explanation available when compiling with `-explain`
15-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/box-adapt-cases.scala:28:10 ------------------------------
16-
28 | x.value(cap => cap.use()) // error
15+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/box-adapt-cases.scala:29:10 ------------------------------
16+
29 | x.value(cap => cap.use()) // error
1717
| ^^^^^^^^^^^^^^^^
1818
| Found: (cap: box Cap^?) ->{io, fs} Int
1919
| Required: (cap: box Cap^{io, fs}) ->{io} Int

tests/neg-custom-args/captures/box-adapt-cases.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.future // sepchecks on
12
trait Cap { def use(): Int }
23

34
def test1(): Unit = {

tests/neg-custom-args/captures/depfun-reach.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import language.experimental.captureChecking
22
import caps.cap
3-
3+
import language.future // sepchecks on
44
def test(io: Object^, async: Object^) =
55
def compose(op: List[(() ->{cap} Unit, () ->{cap} Unit)]): List[() ->{op*} Unit] =
66
List(() => op.foreach((f,g) => { f(); g() }))

tests/neg-custom-args/captures/existential-mapping.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import language.experimental.captureChecking
2-
2+
import language.future // sepchecks on
33
class A
44
class C
55
type Fun[X] = (x: C^) -> X

tests/neg-custom-args/captures/filevar-expanded.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import language.experimental.captureChecking
22
import language.experimental.modularity
33
import compiletime.uninitialized
4-
4+
import language.future // sepchecks on
55
object test1:
66
class File:
77
def write(x: String): Unit = ???

tests/neg-custom-args/captures/i19330.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
2-
1+
import language.future // sepchecks on
32
import language.experimental.captureChecking
43

4+
55
trait Logger
66
def usingLogger[T](op: Logger^ => T): T = ???
77

tests/neg-custom-args/captures/i21614.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import language.experimental.captureChecking
22
import caps.Capability
33
import caps.use
4-
4+
import language.future // sepchecks on
55
trait List[+T]:
66
def map[U](f: T => U): List[U]
77

tests/neg-custom-args/captures/lazyref.check

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:19:28 --------------------------------------
2-
19 | val ref1c: LazyRef[Int] = ref1 // error
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:20:28 --------------------------------------
2+
20 | val ref1c: LazyRef[Int] = ref1 // error
33
| ^^^^
44
| Found: (ref1 : LazyRef[Int]{val elem: () ->{cap1} Int}^{cap1})
55
| Required: LazyRef[Int]
66
|
77
| longer explanation available when compiling with `-explain`
8-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:21:35 --------------------------------------
9-
21 | val ref2c: LazyRef[Int]^{cap2} = ref2 // error
8+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:22:35 --------------------------------------
9+
22 | val ref2c: LazyRef[Int]^{cap2} = ref2 // error
1010
| ^^^^
1111
| Found: LazyRef[Int]{val elem: () ->{ref2*} Int}^{ref2}
1212
| Required: LazyRef[Int]^{cap2}
1313
|
1414
| longer explanation available when compiling with `-explain`
15-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:23:35 --------------------------------------
16-
23 | val ref3c: LazyRef[Int]^{ref1} = ref3 // error
15+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:24:35 --------------------------------------
16+
24 | val ref3c: LazyRef[Int]^{ref1} = ref3 // error
1717
| ^^^^
1818
| Found: LazyRef[Int]{val elem: () ->{ref3*} Int}^{ref3}
1919
| Required: LazyRef[Int]^{ref1}
2020
|
2121
| longer explanation available when compiling with `-explain`
22-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:25:35 --------------------------------------
23-
25 | val ref4c: LazyRef[Int]^{cap1} = ref4 // error
22+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:26:35 --------------------------------------
23+
26 | val ref4c: LazyRef[Int]^{cap1} = ref4 // error
2424
| ^^^^
2525
| Found: LazyRef[Int]{val elem: () ->{ref4*} Int}^{ref4}
2626
| Required: LazyRef[Int]^{cap1}
2727
|
2828
| longer explanation available when compiling with `-explain`
29-
-- Error: tests/neg-custom-args/captures/lazyref.scala:24:55 -----------------------------------------------------------
30-
24 | val ref4 = (if cap1 == cap2 then ref1 else ref2).map(g) // error: separation failure
29+
-- Error: tests/neg-custom-args/captures/lazyref.scala:25:55 -----------------------------------------------------------
30+
25 | val ref4 = (if cap1 == cap2 then ref1 else ref2).map(g) // error: separation failure
3131
| ^
3232
|Separation failure: argument of type (x: Int) ->{cap2} Int
3333
|to method map: [U](f: T => U): LazyRef[U]^{f, LazyRef.this}

tests/neg-custom-args/captures/lazyref.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.future // sepchecks on
12
class CC
23
type Cap = CC^
34

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:11:8 -------------------------------------
2-
11 | x = q // error
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:12:8 -------------------------------------
2+
12 | x = q // error
33
| ^
44
| Found: (q : () => Unit)
55
| Required: () ->{p, q²} Unit
@@ -8,15 +8,15 @@
88
| q² is a parameter in method test
99
|
1010
| longer explanation available when compiling with `-explain`
11-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:12:9 -------------------------------------
12-
12 | x = (q: Proc) // error
11+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:13:9 -------------------------------------
12+
13 | x = (q: Proc) // error
1313
| ^^^^^^^
1414
| Found: () => Unit
1515
| Required: () ->{p, q} Unit
1616
|
1717
| longer explanation available when compiling with `-explain`
18-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:13:9 -------------------------------------
19-
13 | y = (q: Proc) // error
18+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:14:9 -------------------------------------
19+
14 | y = (q: Proc) // error
2020
| ^^^^^^^
2121
| Found: () => Unit
2222
| Required: () ->{p} Unit
@@ -25,8 +25,8 @@
2525
| cannot be included in capture set {p} of variable y
2626
|
2727
| longer explanation available when compiling with `-explain`
28-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:14:8 -------------------------------------
29-
14 | y = q // error, was OK under unsealed
28+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:15:8 -------------------------------------
29+
15 | y = q // error, was OK under unsealed
3030
| ^
3131
| Found: (q : () => Unit)
3232
| Required: () ->{p} Unit
@@ -35,8 +35,8 @@
3535
| cannot be included in outer capture set {p}
3636
|
3737
| longer explanation available when compiling with `-explain`
38-
-- Error: tests/neg-custom-args/captures/outer-var.scala:16:57 ---------------------------------------------------------
39-
16 | var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // error, was OK under unsealed
38+
-- Error: tests/neg-custom-args/captures/outer-var.scala:17:57 ---------------------------------------------------------
39+
17 | var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // error, was OK under unsealed
4040
| ^^^^^^^^^^
4141
| Type variable A of object ListBuffer cannot be instantiated to box () => Unit since
4242
| that type captures the root capability `cap`.

tests/neg-custom-args/captures/outer-var.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.future // sepchecks on
12
class CC
23
type Cap = CC^
34

tests/neg-custom-args/captures/reaches.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import caps.use
1+
import caps.use; import language.future // sepchecks on
22
class File:
33
def write(): Unit = ???
44

tests/neg-custom-args/captures/sep-compose.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import caps.cap
2-
2+
import language.future // sepchecks on
33
def seq1(x: () => Unit, y: () ->{x, cap} Unit): Unit =
44
x(); y()
55

tests/neg-custom-args/captures/sepchecks.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import caps.Mutable
22
import caps.cap
3+
import language.future // sepchecks on
34

45
trait Rdr[T]:
56
def get: T

tests/neg-custom-args/captures/unsound-reach-2.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import language.experimental.captureChecking
1+
import language.experimental.captureChecking; import language.future // sepchecks on
22
trait Consumer[-T]:
33
def apply(x: T): Unit
44

tests/neg-custom-args/captures/unsound-reach-3.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
import language.experimental.captureChecking
3+
import language.experimental.captureChecking; import language.future // sepchecks on
44
trait File:
55
def close(): Unit
66

tests/neg-custom-args/captures/unsound-reach-4.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
import language.experimental.captureChecking
3+
import language.experimental.captureChecking; import language.future // sepchecks on
44
trait File:
55
def close(): Unit
66

tests/neg-custom-args/captures/unsound-reach.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import language.experimental.captureChecking
1+
import language.experimental.captureChecking; import language.future // sepchecks on
22
trait File:
33
def close(): Unit
44

tests/neg-custom-args/captures/vars.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
import language.future // sepchecks on
22

33
class CC
44
type Cap = CC^

tests/pos-custom-args/captures/sep-compose.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import caps.cap
2+
import language.future // sepchecks on
23

34
def seq1(x: () => Unit, y: () ->{x, cap} Unit): Unit =
45
x(); y()

tests/pos-custom-args/captures/sep-eq.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import caps.Mutable
22
import caps.cap
3+
import language.future // sepchecks on
34

45
extension (x: Object^)
56
infix def eql (y: Object^{x, cap}): Boolean = x eq y

0 commit comments

Comments
 (0)