diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-06-21 00:26:39 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-06-21 00:26:39 -0700 |
commit | 320a32b0b5902781b9fb13ad83083574a36f3e46 (patch) | |
tree | 3155d95602e4d4012f3aaab3abd931bb68b293f0 /test/files/pos | |
parent | 6aea0ae85f72594798ec6c96e30cc1aef48c3a99 (diff) | |
parent | 6aa5762fa0333625ec93378e2147649a8bafde34 (diff) | |
download | scala-320a32b0b5902781b9fb13ad83083574a36f3e46.tar.gz scala-320a32b0b5902781b9fb13ad83083574a36f3e46.tar.bz2 scala-320a32b0b5902781b9fb13ad83083574a36f3e46.zip |
Merge pull request #735 from retronym/ticket/4842-2
SI-4842 Forbid access to in-construction this in self-constructor args
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t4842.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/pos/t4842.scala b/test/files/pos/t4842.scala new file mode 100644 index 0000000000..17ff684833 --- /dev/null +++ b/test/files/pos/t4842.scala @@ -0,0 +1,26 @@ +class Foo (x: AnyRef) { + def this() = { + this(new { } ) // okay + } +} + + +class Blerg (x: AnyRef) { + def this() = { + this(new { class Bar { println(Bar.this); new { println(Bar.this) } }; new Bar } ) // okay + } +} + + +class Outer { + class Inner (x: AnyRef) { + def this() = { + this(new { class Bar { println(Bar.this); new { println(Bar.this) } }; new Bar } ) // okay + } + + def this(x: Boolean) = { + this(new { println(Outer.this) } ) // okay + } + } +} + |