diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Namer.scala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 068ef3e4b..1672512a7 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -498,7 +498,9 @@ class Namer { typer: Typer => } for (mdef @ ModuleDef(name, _) <- stats if !mdef.mods.is(Flags.Package)) { val typName = name.toTypeName - val Thicket(vdef :: (mcls @ TypeDef(_, impl: Template)) :: Nil) = mdef.attachment(ExpandedTree) + // Expansion of object is a flattened thicket with the first two elements being: + // module val :: module class :: rest + val Thicket(vdef :: (mcls @ TypeDef(_, impl: Template)) :: rest) = expanded(mdef) moduleDef(typName) = mcls classDef get name.toTypeName match { case Some(cdef) => @@ -506,7 +508,7 @@ class Namer { typer: Typer => case Thicket(cls :: mval :: TypeDef(_, compimpl: Template) :: crest) => val mcls1 = cpy.TypeDef(mcls)( rhs = cpy.Template(impl)(body = compimpl.body ++ impl.body)) - mdef.putAttachment(ExpandedTree, Thicket(vdef :: mcls1 :: Nil)) + mdef.putAttachment(ExpandedTree, Thicket(vdef :: mcls1 :: rest)) moduleDef(typName) = mcls1 cdef.putAttachment(ExpandedTree, Thicket(cls :: crest)) case _ => @@ -668,13 +670,15 @@ class Namer { typer: Typer => * to pick up the context at the point where the completer was created. */ def completeInCreationContext(denot: SymDenotation): Unit = { + val sym = denot.symbol original match { - case original: MemberDef => addAnnotations(denot.symbol, original) + case original: MemberDef => addAnnotations(sym, original) case _ => } addInlineInfo(denot) - denot.info = typeSig(denot.symbol) - Checking.checkWellFormed(denot.symbol) + denot.info = typeSig(sym) + Checking.checkWellFormed(sym) + denot.info = avoidPrivateLeaks(sym, sym.pos) } } @@ -854,6 +858,7 @@ class Namer { typer: Typer => if (isDerivedValueClass(cls)) cls.setFlag(Final) cls.setApplicableFlags( (NoInitsInterface /: impl.body)((fs, stat) => fs & defKind(stat))) + cls.info = avoidPrivateLeaks(cls, cls.pos) } } |