Skip to content

Commit dca2541

Browse files
Linyxusolhotak
authored andcommitted
Add test case for scala#18246
1 parent b646a27 commit dca2541

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-glb.scala:7:19 ----------------------------------------
2+
7 | val x2: Foo[T] = x1 // error
3+
| ^^
4+
| Found: (x1 : (Foo[T]^) & (Foo[Any]^{io}))
5+
| Required: Foo[T]
6+
|
7+
| longer explanation available when compiling with `-explain`
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import language.experimental.captureChecking
2+
trait Cap
3+
trait Foo[+T]
4+
5+
def magic[T](io: Cap^, x: Foo[T]^{io}): Foo[T]^{} =
6+
val x1: Foo[T]^{cap} & Foo[Any]^{io} = x
7+
val x2: Foo[T] = x1 // error
8+
x2 // boom, an impure value becomes pure

0 commit comments

Comments
 (0)