Skip to content

Commit efe28db

Browse files
committed
Add test case for #18246
1 parent 7f20c7f commit efe28db

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
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`
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)