diff options
author | Martin Odersky <odersky@gmail.com> | 2013-01-29 09:44:37 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-01-29 09:44:37 +0100 |
commit | bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98 (patch) | |
tree | 36537cd033d5e37a489839f2970245df9db5e544 /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 9770566c50baff03a7e61344c203b29db8750e8f (diff) | |
download | dotty-bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98.tar.gz dotty-bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98.tar.bz2 dotty-bbc4f7a3234937e5f79e8310e6fff2f9b4af0f98.zip |
New Context architecture based on cloning
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 0a1138e46..0748cf42d 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -232,16 +232,13 @@ object SymDenotations { /** Is protected access to target symbol permitted? */ def isProtectedAccessOK = { - def fail(diagnostics: () => String): Boolean = { - ctx match { - case ctx: DiagnosticsContext => ctx.diagnostics = diagnostics - case _ => - } + def fail(str: => String): Boolean = { + ctx.diagnose(str) false } val cls = owner.enclosingSubClass if (!cls.exists) - fail(() => + fail( s"""Access to protected $this not permitted because |enclosing ${ctx.enclClass.owner.showLocated} is not a subclass of |${owner.showLocated} where target is defined""".stripMargin) @@ -249,7 +246,7 @@ object SymDenotations { pre.widen.typeSymbol.isSubClassOrCompanion(cls) || cls.isModuleClass && pre.widen.typeSymbol.isSubClassOrCompanion(cls.linkedClass))) - fail(() => + fail( s"""Access to protected ${symbol.show} not permitted because |prefix type ${pre.widen.show} does not conform to |${cls.showLocated} where the access takes place""".stripMargin) @@ -449,7 +446,7 @@ object SymDenotations { to } baseClassesVar = symbol :: addParentBaseClasses(parents, Nil) - superClassBitsVar = ctx.root.uniqueBits.findEntryOrUpdate(seen.toImmutable) + superClassBitsVar = ctx.uniqueBits.findEntryOrUpdate(seen.toImmutable) } def superClassBits(implicit ctx: Context): BitSet = { |