diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-06-06 13:34:18 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-06-06 13:34:18 +1000 |
commit | 3bb735823f6815002895b1a335c6d105ddbe3e9e (patch) | |
tree | 5136e824612af0aa0a11675845713fd8a5101a70 /test/files/run/t9390d.scala | |
parent | 361f3f1540c755e36aaed22484924bb44eabc83b (diff) | |
parent | f07019ffa56ec2dfab8ab0d9a83133005761a877 (diff) | |
download | scala-3bb735823f6815002895b1a335c6d105ddbe3e9e.tar.gz scala-3bb735823f6815002895b1a335c6d105ddbe3e9e.tar.bz2 scala-3bb735823f6815002895b1a335c6d105ddbe3e9e.zip |
Merge pull request #5099 from retronym/ticket/9390
SI-9390 Emit local defs that don't capture this as static
Diffstat (limited to 'test/files/run/t9390d.scala')
-rw-r--r-- | test/files/run/t9390d.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/run/t9390d.scala b/test/files/run/t9390d.scala new file mode 100644 index 0000000000..3c5de3abf7 --- /dev/null +++ b/test/files/run/t9390d.scala @@ -0,0 +1,12 @@ +class C { // C is not serializable + def foo: () => Any = { + { () => class UseOuterInConstructor { C.this.toString }; new UseOuterInConstructor : Any} + } +} +object Test { + def main(args: Array[String]): Unit = { + val c = new C + val f = c.foo + f() // Doesn't NPE, as we didn't elide the outer instance in the constructor call. + } +} |