File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
tests/neg-custom-args/captures Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 5
5
| Required: A
6
6
|
7
7
| longer explanation available when compiling with `-explain`
8
+ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i23207.scala:18:13 ---------------------------------------
9
+ 18 | val _: A = c // error
10
+ | ^
11
+ | Found: (c : B^{b})
12
+ | Required: A
13
+ |
14
+ | longer explanation available when compiling with `-explain`
15
+ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i23207.scala:23:2 ----------------------------------------
16
+ 23 | class B extends A: // error, now we see the error for the whole block since there are no nested errors
17
+ | ^
18
+ | Found: A^{io}
19
+ | Required: A
20
+ 24 | val hide: AnyRef^{io} = io
21
+ 25 | val b = new B
22
+ 26 | val c = b.getBox.x
23
+ 27 | c
24
+ |
25
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change @@ -13,6 +13,16 @@ def leak(io: AnyRef^): A =
13
13
val b = new B
14
14
val box = b.getBox
15
15
val a : A = box.x // error
16
- val c = b.getBox.x // now OK
17
- val _: B ^ {b} = c
18
- c
16
+ val c = b.getBox.x
17
+ val _: B ^ {b} = c // ok
18
+ val _: A = c // error
19
+ c // no error here since we don't propagate expected type into the last expression of a block
20
+ // and the whole block's span overlaps with previous errors
21
+
22
+ def leak2 (io : AnyRef ^ ): A =
23
+ class B extends A : // error, now we see the error for the whole block since there are no nested errors
24
+ val hide : AnyRef ^ {io} = io
25
+
26
+ val b = new B
27
+ val c = b.getBox.x
28
+ c
You can’t perform that action at this time.
0 commit comments