diff options
author | odersky <odersky@gmail.com> | 2017-02-03 09:40:16 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-03 09:40:16 +1100 |
commit | 368366a8242c2839d77931efabdad50b79548f58 (patch) | |
tree | 212067c3424166fdfb125024cbfe532946387b79 /compiler | |
parent | 8408ac9523bbb243556d1a9c8949ea2410003c72 (diff) | |
parent | e53ace1a2dc8d58d99508a5f058b599761a23fa2 (diff) | |
download | dotty-368366a8242c2839d77931efabdad50b79548f58.tar.gz dotty-368366a8242c2839d77931efabdad50b79548f58.tar.bz2 dotty-368366a8242c2839d77931efabdad50b79548f58.zip |
Merge pull request #1933 from dotty-staging/merge-companion
Weaken assumption in mergeCompanionDefs
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Namer.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index 1672512a7..772d9385b 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -491,7 +491,8 @@ class Namer { typer: Typer => if (cdef.isClassDef) { classDef(name) = cdef cdef.attachmentOrElse(ExpandedTree, cdef) match { - case Thicket(cls :: mval :: (mcls @ TypeDef(_, _: Template)) :: crest) => + case Thicket(cls :: mval :: (mcls @ TypeDef(mname, _: Template)) :: crest) + if name.moduleClassName == mname => moduleDef(name) = mcls case _ => } @@ -505,7 +506,8 @@ class Namer { typer: Typer => classDef get name.toTypeName match { case Some(cdef) => cdef.attachmentOrElse(ExpandedTree, cdef) match { - case Thicket(cls :: mval :: TypeDef(_, compimpl: Template) :: crest) => + case Thicket(cls :: mval :: TypeDef(mname, compimpl: Template) :: crest) + if name.moduleClassName == mname => val mcls1 = cpy.TypeDef(mcls)( rhs = cpy.Template(impl)(body = compimpl.body ++ impl.body)) mdef.putAttachment(ExpandedTree, Thicket(vdef :: mcls1 :: rest)) |