diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-02 09:38:57 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-02 09:38:57 +0100 |
commit | 3f053053787b531a8ca2670f4c88ab941629dc50 (patch) | |
tree | dfbdfa6ad9a02eff8232ef4c82dec2efab9990a0 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | b1842f519e8e5ea7a7e5976521f8b6c9f7efeff0 (diff) | |
download | dotty-3f053053787b531a8ca2670f4c88ab941629dc50.tar.gz dotty-3f053053787b531a8ca2670f4c88ab941629dc50.tar.bz2 dotty-3f053053787b531a8ca2670f4c88ab941629dc50.zip |
Better error message for accessibility errors.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index a53a18963..43266163b 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -113,20 +113,20 @@ class Typer extends Namer with Applications with Implicits { checkAccessible(pre.select(name, d2), superAccess, pos) else { val alts = tpe.denot.alternatives.map(_.symbol).filter(_.exists) - val where = pre.typeSymbol val what = alts match { case Nil => name.toString case sym :: Nil => - if (sym.owner == where) sym.show else sym.showLocated + if (sym.owner == pre.typeSymbol) sym.show else sym.showLocated case _ => i"none of the overloaded alternatives named $name" } + val where = if (ctx.owner.exists) s" from ${ctx.owner.enclosingClass}" else "" val whyNot = new StringBuffer val addendum = alts foreach (_.isAccessibleFrom(pre, superAccess, whyNot)) if (!tpe.isError) - ctx.error(i"$what cannot be accessed from $pre.$whyNot", pos) + ctx.error(i"$what cannot be accessed as a member of $pre$where.$whyNot", pos) ErrorType } } |