Skip to content

Commit 3bf9407

Browse files
committed
Fix tests
1 parent 086518e commit 3bf9407

File tree

7 files changed

+33
-39
lines changed

7 files changed

+33
-39
lines changed

tests/neg-custom-args/captures/try2.scala renamed to tests/disabled/neg-custom-args/captures/try2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Retains syntax for classes not (yet?) supported
12
import language.experimental.erasedDefinitions
23
import annotation.ability
34

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:3:2 ------------------------------------------
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:3:5 ------------------------------------------
22
3 | () => if x == null then y else y // error
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
| Found: {x} () => C
55
| Required: () => C
66

77
longer explanation available when compiling with `-explain`
8-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:6:2 ------------------------------------------
8+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:6:5 ------------------------------------------
99
6 | () => if x == null then y else y // error
1010
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1111
| Found: {x} () => C
@@ -19,24 +19,24 @@ longer explanation available when compiling with `-explain`
1919
| Required: Any
2020

2121
longer explanation available when compiling with `-explain`
22-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:23:3 -----------------------------------------
22+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:23:2 -----------------------------------------
2323
23 | F(22) // error
2424
| ^^^^^
25-
| Found: {x} F
25+
| Found: {x} A
2626
| Required: A
2727

2828
longer explanation available when compiling with `-explain`
2929
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:27:40 ----------------------------------------
3030
27 | def m() = if x == null then y else y // error
3131
| ^
32-
| Found: {x} A {...}
32+
| Found: {x} A
3333
| Required: A
3434

3535
longer explanation available when compiling with `-explain`
36-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:32:24 ----------------------------------------
36+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:32:27 ----------------------------------------
3737
32 | val z2 = h[() => Cap](() => x)(() => C()) // error
3838
| ^^^^^^^
39-
| Found: (() => Cap) retains x
39+
| Found: {x} () => Cap
4040
| Required: () => Cap
4141

4242
longer explanation available when compiling with `-explain`
Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,29 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:29:32 ------------------------------------------
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:29:35 ------------------------------------------
22
29 | (x: CanThrow[Exception]) => () => raise(new Exception)(using x) // error
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
| Found: {x} () => Nothing
55
| Required: () => Nothing
66

77
longer explanation available when compiling with `-explain`
8-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:43:2 -------------------------------------------
9-
43 | yy // error
10-
| ^^
11-
| Found: (yy : List[(xx : (() => Int) retains *)])
12-
| Required: List[() => Int]
8+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:36:9 -------------------------------------------
9+
36 | () => // error
10+
| ^
11+
| Found: {x} () => Int
12+
| Required: () => Int
13+
37 | raise(new Exception)(using x)
14+
38 | 22
1315

1416
longer explanation available when compiling with `-explain`
15-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:50:2 -------------------------------------------
16-
45 |val global = handle {
17-
46 | (x: CanThrow[Exception]) =>
18-
47 | () =>
17+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/try.scala:47:7 -------------------------------------------
18+
47 | () => // error
19+
| ^
20+
| Found: {x} () => Int
21+
| Required: () => Int
1922
48 | raise(new Exception)(using x)
2023
49 | 22
21-
50 |} { // error
22-
| ^
23-
| Found: (() => Int) retains *
24-
| Required: () => Int
25-
51 | (ex: Exception) => () => 22
26-
52 |}
2724

2825
longer explanation available when compiling with `-explain`
2926
-- Error: tests/neg-custom-args/captures/try.scala:22:28 ---------------------------------------------------------------
3027
22 | val a = handle[Exception, CanThrow[Exception]] { // error
3128
| ^^^^^^^^^^^^^^^^^^^
32-
| type argument is not allowed to capture the universal capability *
33-
-- Error: tests/neg-custom-args/captures/try.scala:34:11 ---------------------------------------------------------------
34-
34 | val xx = handle { // error
35-
| ^^^^^^
36-
| inferred type argument ((() => Int) retains *) is not allowed to capture the universal capability *
37-
|
38-
| The inferred arguments are: [Exception, ((() => Int) retains *)]
29+
| type argument is not allowed to capture the universal capability (* : Any)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ def test: List[() => Int] =
3131
(ex: Exception) => ???
3232
}
3333

34-
val xx = handle { // error
34+
val xx = handle {
3535
(x: CanThrow[Exception]) =>
36-
() =>
36+
() => // error
3737
raise(new Exception)(using x)
3838
22
3939
} {
4040
(ex: Exception) => () => 22
4141
}
4242
val yy = xx :: Nil
43-
yy // error
43+
yy // OK
4444

4545
val global = handle {
4646
(x: CanThrow[Exception]) =>
47-
() =>
47+
() => // error
4848
raise(new Exception)(using x)
4949
22
50-
} { // error
50+
} {
5151
(ex: Exception) => () => 22
5252
}

tests/neg/multiLineOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ val x = 1
55
val b1 = {
66
22
77
* 22 // ok
8-
*/*one more*/22 // error: end of statement expected // error: not found: *
8+
*/*one more*/22 // error: end of statement expected
99
}
1010

1111
val b2: Boolean = {

tests/pos-custom-args/captures/list-encoding.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
package listEncoding
2+
13
type Top = Any retains *
2-
class Cap extends Retains[*]
4+
class Cap
35

46
type Op[T <: Top, C <: Top] =
57
((v: T) => ((s: C) => C) retains *) retains *
68

79
type List[T <: Top] =
8-
([C <: Top] => (op: Op[T, C]) => ((s: C) => C) retains op.type) retains T
10+
([C <: Top] => (op: Op[T, C]) => ({op} (s: C) => C))
911

1012
def nil[T <: Top]: List[T] =
1113
[C <: Top] => (op: Op[T, C]) => (s: C) => s
1214

1315
def cons[T <: Top](hd: T, tl: List[T]): List[T] =
1416
[C <: Top] => (op: Op[T, C]) => (s: C) => op(hd)(tl(op)(s))
1517

16-
def foo(c: Cap) =
18+
def foo(c: {*} Cap) =
1719
def f(x: String retains c.type, y: String retains c.type) =
1820
cons(x, cons(y, nil))
1921
def g(x: String retains c.type, y: Any) =

0 commit comments

Comments
 (0)