aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/t8002-nested-scope.scala
blob: 78a03ce669403318e8d49e0b4de1c85c90c17525 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
      }
    }
  }
}