File tree Expand file tree Collapse file tree 9 files changed +49
-0
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 9 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,8 @@ object Contexts {
381
381
superOrThisCallContext(owner, constrCtx.scope)
382
382
.setTyperState(typerState)
383
383
.setGadt(gadt)
384
+ .fresh
385
+ .setScope(this .scope)
384
386
}
385
387
386
388
/** The super- or this-call context with given owner and locals. */
Original file line number Diff line number Diff line change
1
+ -- Error: tests/neg/3559.scala:3:9 -------------------------------------------------------------------------------------
2
+ 3 | this(b) // error: forward reference not allowed from self constructor invocation
3
+ | ^
4
+ | forward reference not allowed from self constructor invocation
Original file line number Diff line number Diff line change
1
+ class A (a : Any ) {
2
+ def this () = {
3
+ this (b) // error: forward reference not allowed from self constructor invocation
4
+ def b = new {}
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ -- Error: tests/neg/3559b.scala:3:9 ------------------------------------------------------------------------------------
2
+ 3 | this(b) // error
3
+ | ^
4
+ | b is not accessible from constructor arguments
Original file line number Diff line number Diff line change
1
+ class A (a : Any ) {
2
+ def this () = {
3
+ this (b) // error
4
+ }
5
+
6
+ def b = new {}
7
+ }
Original file line number Diff line number Diff line change
1
+ -- Error: tests/neg/3559c.scala:3:9 ------------------------------------------------------------------------------------
2
+ 3 | this(a) // error
3
+ | ^
4
+ | a is not accessible from constructor arguments
Original file line number Diff line number Diff line change
1
+ class A (a : Any ) {
2
+ def this () = {
3
+ this (a) // error
4
+ }
5
+
6
+ def b = new {}
7
+ }
Original file line number Diff line number Diff line change
1
+ -- [E006] Unbound Identifier Error: tests/neg/3559d.scala:7:9 ----------------------------------------------------------
2
+ 7 | this(f) // error
3
+ | ^
4
+ | Not found: f
5
+
6
+ longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+ class B {
2
+ def f : String = " hello"
3
+ }
4
+
5
+ class A (a : Any ) extends B {
6
+ def this () = {
7
+ this (f) // error
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments