Skip to content

Commit 6b61b01

Browse files
committed
Update test
1 parent e4a9f06 commit 6b61b01

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

tests/neg-custom-args/captures/i23207.check

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,21 @@
55
| Required: A
66
|
77
| 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`

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ def leak(io: AnyRef^): A =
1313
val b = new B
1414
val box = b.getBox
1515
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

0 commit comments

Comments
 (0)