diff options
-rw-r--r-- | test-nsc/files/run/bugs.check | 1 | ||||
-rw-r--r-- | test-nsc/files/run/ctor-order.check | 1 | ||||
-rw-r--r-- | test-nsc/files/run/ctor-order.scala | 26 |
3 files changed, 28 insertions, 0 deletions
diff --git a/test-nsc/files/run/bugs.check b/test-nsc/files/run/bugs.check index 7ad8f3db8d..1cf55421f8 100644 --- a/test-nsc/files/run/bugs.check +++ b/test-nsc/files/run/bugs.check @@ -45,6 +45,7 @@ ok >>> bug 199 <<< bug 213 +Exception in thread "Thread[main,5,main]" java.lang.ClassCastException >>> bug 213 <<< bug 217 diff --git a/test-nsc/files/run/ctor-order.check b/test-nsc/files/run/ctor-order.check new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test-nsc/files/run/ctor-order.check @@ -0,0 +1 @@ +10 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; +} |