diff options
Diffstat (limited to 'tests/neg/t8002-nested-scope.scala')
-rw-r--r-- | tests/neg/t8002-nested-scope.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/neg/t8002-nested-scope.scala b/tests/neg/t8002-nested-scope.scala new file mode 100644 index 000000000..78a03ce66 --- /dev/null +++ b/tests/neg/t8002-nested-scope.scala @@ -0,0 +1,20 @@ +// This test serves to capture the status quo, but should really +// emit an accessibiltiy error. + +// `Namers#companionSymbolOf` seems too lenient, and currently doesn't +// implement the same-scope checks mentioned: +// +// https://github.com/scala/scala/pull/2816#issuecomment-22555206 +// +class C { + def foo = { + class C { private def x = 0 } + + { + val a = 0 + object C { + new C().x // error: cannot be accessed + } + } + } +} |