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/Typer.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/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index f6027165b..9ba10d000 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -759,10 +759,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val refineClsDef = desugar.refinedTypeToClass(tpt1, tree.refinements) val refineCls = createSymbol(refineClsDef).asClass val TypeDef(_, Template(_, _, _, refinements1)) = typed(refineClsDef) + val seen = mutable.Set[Symbol]() assert(tree.refinements.length == refinements1.length, s"${tree.refinements} != $refinements1") def addRefinement(parent: Type, refinement: Tree): Type = { typr.println(s"adding refinement $refinement") - checkRefinementNonCyclic(refinement, refineCls) + checkRefinementNonCyclic(refinement, refineCls, seen) val rsym = refinement.symbol val rinfo = if (rsym is Accessor) rsym.info.resultType else rsym.info RefinedType(parent, rsym.name, rt => rinfo.substThis(refineCls, RefinedThis(rt))) |