We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fab653e commit 8237d68Copy full SHA for 8237d68
tests/init/neg/secondary-ctor2.scala
@@ -0,0 +1,25 @@
1
+class A(b: B, x: Int) {
2
+ def this(b: B) = {
3
+ this(b, 5)
4
+ class Inner() {
5
+ def foo() = println(b.n)
6
+ }
7
+ Inner().foo() // error: calling method on cold
8
+
9
+ val f = () => new A(b, 3)
10
+ f() // ok
11
12
+}
13
14
+class B(val d: D) {
15
+ val n: Int = 10
16
17
18
+class C(b: B) extends A(b) {
19
+ def this(b: B, x: Int) = this(b)
20
21
22
+class D {
23
+ val b = new B(this)
24
+ val c = new C(b, 5)
25
0 commit comments