Skip to content

Commit 9b087ce

Browse files
committed
add tests
1 parent 6886a96 commit 9b087ce

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/neg/i5083.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class A(a: Int) {
2+
abstract class X {
3+
def f: Int
4+
val x = a + f // NPE: the outer for `Y` is not yet set
5+
}
6+
7+
trait Y {
8+
val y = a
9+
def f: Int = A.this.a // NPE: the outer for `Y` is not yet set
10+
}
11+
12+
trait Z(val o: A) extends o.Y { // error
13+
val z = a
14+
}
15+
16+
class B extends X with Z(new A(4))
17+
}
18+
19+
20+
object Test {
21+
def main(args: Array[String]): Unit = {
22+
val a = new A(3)
23+
new a.B
24+
}
25+
}

tests/neg/i5083b.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class A(a: Int) {
2+
class X {
3+
val x = a
4+
}
5+
6+
trait Y {
7+
val y = a
8+
}
9+
10+
val z: Z = ???
11+
12+
trait Z(val o: A) extends z.o.Y // error: cyclic reference `z`
13+
14+
class B extends X with Z(new A(4))
15+
}

0 commit comments

Comments
 (0)