diff options
Diffstat (limited to 'test-nsc/files/run/ctor-order.scala')
-rw-r--r-- | test-nsc/files/run/ctor-order.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test-nsc/files/run/ctor-order.scala b/test-nsc/files/run/ctor-order.scala new file mode 100644 index 0000000000..b21ae27658 --- /dev/null +++ b/test-nsc/files/run/ctor-order.scala @@ -0,0 +1,26 @@ + +/** Test that constructor operations are reordered correctly. */ +class Outer { + + object global { + val x = 10; + } + + class X extends AnyRef with M1 { + /* The constructor of X should set this.$outer to the outer instance + * *before* calling the super constructors. This is tested by + * mixin M1, which tries to access global from the enclosing class. + */ + } + + trait M1: X { + Console.println(global.x); + } + +} + +object Test extends AnyRef with Application { + val o = new Outer; + + new o.X; +} |