Skip to content

Commit 33faf67

Browse files
committed
Some unrelated tests
1 parent ca2df73 commit 33faf67

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps2.scala:5:23 ----------------------------------
2+
5 | val _: (x: C) => C = b // error
3+
| ^
4+
| Found: (b : C => C)
5+
| Required: (x: C^) =>² C^²
6+
|
7+
| where: => refers to a fresh root capability in the type of value b
8+
| =>² refers to a fresh root capability in the type of value _$1
9+
| ^ refers to the universal root capability
10+
| ^² refers to a root capability associated with the result type of (x: C^): C^²
11+
|
12+
| Note that the existential capture root in C^
13+
| cannot subsume the capability cap..
14+
|
15+
| longer explanation available when compiling with `-explain`
16+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps2.scala:6:18 ----------------------------------
17+
6 | val _: C => C = a // error
18+
| ^
19+
| Found: (a : (x: C) => C)
20+
| Required: C^ =>² C^²
21+
|
22+
| where: => refers to a fresh root capability in the type of value a
23+
| =>² refers to a fresh root capability in the type of value _$2
24+
| ^ refers to the universal root capability
25+
| ^² refers to a fresh root capability classified as SharedCapability in the type of value _$2
26+
|
27+
| Note that capability cap is not included in capture set {cap}.
28+
|
29+
| longer explanation available when compiling with `-explain`
30+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps2.scala:8:18 ----------------------------------
31+
8 | val _: C => C = (x: C) => a(x) // error
32+
| ^^^^^^^^^^^^^^
33+
| Found: (x: C^) ->{a} C^²
34+
| Required: C^ => C^³
35+
|
36+
| where: => refers to a fresh root capability in the type of value _$4
37+
| ^ refers to the universal root capability
38+
| ^² refers to a root capability associated with the result type of (x: C^): C^²
39+
| ^³ refers to a fresh root capability classified as SharedCapability in the type of value _$4
40+
|
41+
| Note that capability <cap of (x: C^): C^> is not included in capture set {cap}
42+
| because <cap of (x: C^): C^> is not visible from cap in value _$4.
43+
|
44+
| longer explanation available when compiling with `-explain`
45+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps2.scala:14:18 ---------------------------------
46+
14 | val _: C -> C = a // error
47+
| ^
48+
| Found: (a : (x: C) -> C)
49+
| Required: C^ -> C^²
50+
|
51+
| where: ^ refers to the universal root capability
52+
| ^² refers to a fresh root capability classified as SharedCapability in the type of value _$6
53+
|
54+
| Note that capability <cap of (x: C^): C^> is not included in capture set {cap}
55+
| because <cap of (x: C^): C^> is not visible from cap in value _$6.
56+
|
57+
| longer explanation available when compiling with `-explain`
58+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps2.scala:15:23 ---------------------------------
59+
15 | val _: (x: C) -> C = (x: C) => b(x) // error
60+
| ^^^^^^^^^^^^^^
61+
| Found: (x: C^) ->{b} C^²
62+
| Required: (x: C^) -> C^³
63+
|
64+
| where: ^ refers to the universal root capability
65+
| ^² refers to a root capability associated with the result type of (x: C^): C^²
66+
| ^³ refers to a root capability associated with the result type of (x: C^): C^³
67+
|
68+
| Note that capability b is not included in capture set {}.
69+
|
70+
| longer explanation available when compiling with `-explain`
71+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps2.scala:16:29 ---------------------------------
72+
16 | val _: C -> C = (x: C) => a(x) // error
73+
| ^^^^
74+
| Found: C^{x}
75+
| Required: C^
76+
|
77+
| where: ^ refers to a fresh root capability classified as SharedCapability in the type of value _$8
78+
|
79+
| Note that capability x is not included in capture set {cap}
80+
| because (x : C) in enclosing function is not visible from cap in value _$8.
81+
|
82+
| longer explanation available when compiling with `-explain`
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class C extends caps.SharedCapability
2+
def test1(c: C) =
3+
val a: (x: C) => C = ???
4+
val b: C => C = ???
5+
val _: (x: C) => C = b // error
6+
val _: C => C = a // error
7+
val _: (x: C) => C = (x: C) => b(x) // OK
8+
val _: C => C = (x: C) => a(x) // error
9+
10+
def test2(c: C) =
11+
val a: (x: C) -> C = ???
12+
val b: C -> C = ???
13+
val _: (x: C) -> C = b // OK
14+
val _: C -> C = a // error
15+
val _: (x: C) -> C = (x: C) => b(x) // error
16+
val _: C -> C = (x: C) => a(x) // error
17+

0 commit comments

Comments
 (0)