Skip to content

Commit 406f51b

Browse files
committed
tweak tests
- remove limitation errors - update check files
1 parent 62975d3 commit 406f51b

File tree

8 files changed

+48
-50
lines changed

8 files changed

+48
-50
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
10 | h(f2()) // error
99
| ^^^^
1010
| Found: {cap1} (x$0: Int) -> Int
11-
| Required: {cap2} Int -> Int
11+
| Required: {cap2} (x$0: Int) -> Int
1212
|
1313
| longer explanation available when compiling with `-explain`
1414
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/byname.scala:19:5 ----------------------------------------

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:13:2 ---------------------------------------
2-
13 | (ref1, f1) => map[A, B](ref1, f1) // error // limitation
3-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| Found: ? (ref1: {*} LazyRef[? A]{elem: {*} () -> box ? A}, f1: {*} (x$0: ? A) -> ? B) ->
5-
| {f1, ref1, *} LazyRef[? B]{elem: {*} () -> box ? B}
6-
| Required: (ref: {*} LazyRef[A], f: A => B) -> {f, ref} LazyRef[B]
7-
|
8-
| longer explanation available when compiling with `-explain`
91
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/lazyref.scala:19:28 --------------------------------------
102
19 | val ref1c: LazyRef[Int] = ref1 // error
113
| ^^^^

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def map[A, B](ref: {*} LazyRef[A], f: A => B): {f, ref} LazyRef[B] =
1010
new LazyRef(() => f(ref.elem()))
1111

1212
def mapc[A, B]: (ref: {*} LazyRef[A], f: A => B) -> {f, ref} LazyRef[B] =
13-
(ref1, f1) => map[A, B](ref1, f1) // error // limitation
13+
(ref1, f1) => map[A, B](ref1, f1)
1414

1515
def test(cap1: Cap, cap2: Cap) =
1616
def f(x: Int) = if cap1 == cap1 then x else 0

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
23 | val a = handle[Exception, CanThrow[Exception]] { // error
33
| ^
44
| Found: ? ({*} CT[Exception]) -> CanThrow[Exception]
5-
| Required: CanThrow[Exception] => box {*} CT[Exception]
5+
| Required: {*} CanThrow[Exception] -> box {*} CT[Exception]
66
24 | (x: CanThrow[Exception]) => x
77
25 | }{
88
|
@@ -11,11 +11,25 @@
1111
29 | val b = handle[Exception, () -> Nothing] { // error
1212
| ^
1313
| Found: ? (x: {*} CT[Exception]) -> {x} () -> Nothing
14-
| Required: CanThrow[Exception] => () -> Nothing
14+
| Required: {*} (x$0: CanThrow[Exception]) -> () -> Nothing
1515
30 | (x: CanThrow[Exception]) => () => raise(new Exception)(using x)
1616
31 | } {
1717
|
1818
| longer explanation available when compiling with `-explain`
19+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:52:2 -------------------------------------------
20+
47 |val global: () -> Int = handle {
21+
48 | (x: CanThrow[Exception]) =>
22+
49 | () =>
23+
50 | raise(new Exception)(using x)
24+
51 | 22
25+
52 |} { // error
26+
| ^
27+
| Found: {x$0} () -> Int
28+
| Required: () -> Int
29+
53 | (ex: Exception) => () => 22
30+
54 |}
31+
|
32+
| longer explanation available when compiling with `-explain`
1933
-- Error: tests/neg-custom-args/captures/try.scala:40:4 ----------------------------------------------------------------
2034
35 | val xx = handle {
2135
36 | (x: CanThrow[Exception]) =>
@@ -24,19 +38,7 @@
2438
39 | 22
2539
40 | } { // error
2640
| ^
27-
| The expression's type box {*} () -> Int is not allowed to capture the root capability `*`.
41+
| The expression's type box {x$0, *} () -> Int is not allowed to capture the root capability `*`.
2842
| This usually means that a capability persists longer than its allowed lifetime.
2943
41 | (ex: Exception) => () => 22
3044
42 | }
31-
-- Error: tests/neg-custom-args/captures/try.scala:52:2 ----------------------------------------------------------------
32-
47 |val global = handle {
33-
48 | (x: CanThrow[Exception]) =>
34-
49 | () =>
35-
50 | raise(new Exception)(using x)
36-
51 | 22
37-
52 |} { // error
38-
| ^
39-
| The expression's type box {*} () -> Int is not allowed to capture the root capability `*`.
40-
| This usually means that a capability persists longer than its allowed lifetime.
41-
53 | (ex: Exception) => () => 22
42-
54 |}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def test =
4444
yy // OK
4545

4646

47-
val global = handle {
47+
val global: () -> Int = handle {
4848
(x: CanThrow[Exception]) =>
4949
() =>
5050
raise(new Exception)(using x)
5151
22
5252
} { // error
5353
(ex: Exception) => () => 22
54-
}
54+
}
Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:23:27 ------------------------------------------------------
2-
23 | val later = usingLogFile { f => () => f.write(0) } // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| {f} () -> Unit cannot be box-converted to box ? () -> Unit
5-
| since one of their capture sets contains the root capability `*`
6-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:29:9 -------------------------------------------------------
7-
29 | later2.x() // error
8-
| ^^^^^^^^
9-
| The expression's type box {*} () -> Unit is not allowed to capture the root capability `*`.
10-
| This usually means that a capability persists longer than its allowed lifetime.
111
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:33:2 -------------------------------------------------------
122
33 | later3() // error
133
| ^^^^^^
@@ -18,18 +8,32 @@
188
| ^^^^^^^^
199
| The expression's type box {*} () -> Unit is not allowed to capture the root capability `*`.
2010
| This usually means that a capability persists longer than its allowed lifetime.
21-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:47:27 ------------------------------------------------------
11+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:23:6 -------------------------------------------------------
12+
23 | val later = usingLogFile { f => () => f.write(0) } // error
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
| Non-local value later cannot have an inferred type
15+
| {x$0} () -> Unit
16+
| with non-empty capture set {x$0}.
17+
| The type needs to be declared explicitly.
18+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:29:9 -------------------------------------------------------
19+
29 | later2.x() // error
20+
| ^^^^^^^^
21+
| The expression's type box {x$0, *} () -> Unit is not allowed to capture the root capability `*`.
22+
| This usually means that a capability persists longer than its allowed lifetime.
23+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:47:6 -------------------------------------------------------
2224
47 | val later = usingLogFile { f => () => f.write(0) } // error
23-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
24-
| {f} () -> Unit cannot be box-converted to box ? () -> Unit
25-
| since one of their capture sets contains the root capability `*`
26-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:62:33 ------------------------------------------------------
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
| Non-local value later cannot have an inferred type
27+
| {x$0} () -> Unit
28+
| with non-empty capture set {x$0}.
29+
| The type needs to be declared explicitly.
30+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:62:25 ------------------------------------------------------
2731
62 | val later = usingFile("out", f => (y: Int) => xs.foreach(x => f.write(x + y))) // error
28-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29-
| {f} (x$0: Int) -> Unit cannot be box-converted to box ? (x$0: Int) -> Unit
30-
| since one of their capture sets contains the root capability `*`
31-
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:71:37 ------------------------------------------------------
32+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33+
| The expression's type box {x$0, *} (x$0: Int) -> Unit is not allowed to capture the root capability `*`.
34+
| This usually means that a capability persists longer than its allowed lifetime.
35+
-- Error: tests/neg-custom-args/captures/usingLogFile.scala:71:25 ------------------------------------------------------
3236
71 | val later = usingFile("logfile", usingLogger(_, l => () => l.log("test"))) // error
33-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34-
| {_$1} () -> Unit cannot be box-converted to box ? () -> Unit
35-
| since one of their capture sets contains the root capability `*`
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
| The expression's type box {x$0, *} () -> Unit is not allowed to capture the root capability `*`.
39+
| This usually means that a capability persists longer than its allowed lifetime.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
-- Error: tests/neg-custom-args/captures/vars.scala:32:8 ---------------------------------------------------------------
2626
32 | local { cap3 => // error
2727
| ^
28-
| The expression's type box {*} (x$0: String) -> String is not allowed to capture the root capability `*`.
28+
| The expression's type box {x$0, *} (x$0: String) -> String is not allowed to capture the root capability `*`.
2929
| This usually means that a capability persists longer than its allowed lifetime.
3030
33 | def g(x: String): String = if cap3 == cap3 then "" else "a"
3131
34 | g

0 commit comments

Comments
 (0)