Skip to content

Commit a682252

Browse files
committed
Add test
1 parent 90b0c78 commit a682252

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- Error: tests/init/neg/super-resolution2.scala:19:6 ------------------------------------------------------------------
2+
19 | val n = 40 // error
3+
| ^
4+
| Access non-initialized value n. Calling trace:
5+
| -> class N extends A with B: [ super-resolution2.scala:9 ]
6+
| ^
7+
| -> new Inner [ super-resolution2.scala:16 ]
8+
| ^^^^^^^^^
9+
| -> class Inner: [ super-resolution2.scala:12 ]
10+
| ^
11+
| -> N.super[A].foo() [ super-resolution2.scala:13 ]
12+
| ^^^^^^^^^^^^^^^^
13+
| -> def foo(): Int = n [ super-resolution2.scala:3 ]
14+
| ^
15+
-- Error: tests/init/neg/super-resolution2.scala:18:6 ------------------------------------------------------------------
16+
18 | val m = 30 // error
17+
| ^
18+
| Access non-initialized value m. Calling trace:
19+
| -> class N extends A with B: [ super-resolution2.scala:9 ]
20+
| ^
21+
| -> new Inner [ super-resolution2.scala:16 ]
22+
| ^^^^^^^^^
23+
| -> class Inner: [ super-resolution2.scala:12 ]
24+
| ^
25+
| -> N.super.foo() [ super-resolution2.scala:14 ]
26+
| ^^^^^^^^^^^^^
27+
| -> def foo(): Int = m [ super-resolution2.scala:7 ]
28+
| ^
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
abstract class A:
2+
val n: Int
3+
def foo(): Int = n
4+
5+
trait B:
6+
val m: Int
7+
def foo(): Int = m
8+
9+
class N extends A with B:
10+
override def foo(): Int = 10 * super.foo()
11+
12+
class Inner:
13+
N.super[A].foo()
14+
N.super.foo()
15+
16+
new Inner
17+
18+
val m = 30 // error
19+
val n = 40 // error

0 commit comments

Comments
 (0)