diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2014-12-16 01:32:13 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2014-12-16 10:15:05 +0100 |
commit | 5fced3a878bc39827f943d1578d63a3626d0f76f (patch) | |
tree | 722c9c3f507a266652649cdb43a84b312aea2a55 /src/dotty/tools/dotc/typer/Checking.scala | |
parent | 21fa5dd1a47727c977848163e2610be745951dbc (diff) | |
download | dotty-5fced3a878bc39827f943d1578d63a3626d0f76f.tar.gz dotty-5fced3a878bc39827f943d1578d63a3626d0f76f.tar.bz2 dotty-5fced3a878bc39827f943d1578d63a3626d0f76f.zip |
Avoid spurious warnings about forward references in refinements
The warning was triggered by cases like:
class A
type F = A { type T = Int; def f: T }
Which is treated differently from the following which did not produce a warning:
type F = A { type T = Int } { def f: T }
Diffstat (limited to 'src/dotty/tools/dotc/typer/Checking.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index 9e13ec13b..56b5100b1 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -162,13 +162,13 @@ object Checking { * This depends also on firming up the DOT calculus. For the moment we only issue * deprecated warnings, not errors. */ - def checkRefinementNonCyclic(refinement: Tree, refineCls: ClassSymbol)(implicit ctx: Context): Unit = { + def checkRefinementNonCyclic(refinement: Tree, refineCls: ClassSymbol, seen: mutable.Set[Symbol]) + (implicit ctx: Context): Unit = { def flag(what: String, tree: Tree) = ctx.deprecationWarning(i"$what reference in refinement is deprecated", tree.pos) def forwardRef(tree: Tree) = flag("forward", tree) def selfRef(tree: Tree) = flag("self", tree) val checkTree = new TreeAccumulator[Unit] { - private var seen = Set[Symbol]() def checkRef(tree: Tree, sym: Symbol) = if (sym.maybeOwner == refineCls && !seen(sym)) forwardRef(tree) def apply(x: Unit, tree: Tree) = tree match { |