Skip to content

Commit 5e09d2d

Browse files
committed
#435 Fix conflict between package object and case class with same name
1 parent 880a6f5 commit 5e09d2d

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ trait Checking {
232232

233233
/** Check that type `tp` is stable. */
234234
def checkStable(tp: Type, pos: Position)(implicit ctx: Context): Unit =
235-
if (!tp.isStable) ctx.error(d"$tp is not stable", pos)
235+
if (!tp.isStable)
236+
ctx.error(d"$tp is not stable", pos)
236237

237238
/** Check that type `tp` is a legal prefix for '#'.
238239
* @return The type itself

src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ class Namer { typer: Typer =>
411411
case _ =>
412412
}
413413
}
414-
for (mdef @ ModuleDef(name, _) <- stats) {
414+
for (mdef @ ModuleDef(name, _) <- stats if !mdef.mods.is(Flags.Package)) {
415415
val typName = name.toTypeName
416416
val Thicket(vdef :: (mcls @ TypeDef(_, impl: Template)) :: Nil) = mdef.attachment(ExpandedTree)
417417
moduleDef(typName) = mcls

src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ object RefChecks {
395395

396396
for (member <- missing) {
397397
val memberSym = member.symbol
398-
def undefined(msg: String) = abstractClassError(false, member.showDcl + " is not defined" + msg)
398+
def undefined(msg: String) =
399+
abstractClassError(false, member.showDcl + " is not defined" + msg)
399400
val underlying = memberSym.underlyingSymbol
400401

401402
// Give a specific error message for abstract vars based on why it fails:

test/dotc/tests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class tests extends CompilerTest {
149149

150150
@Test def dotc_printing = compileDir(dotcDir + "tools/dotc/printing")
151151

152-
@Test def dotc_reporting = compileDir(dotcDir + "tools/dotc/reporting", twice)
152+
@Test def dotc_reporting = compileDir(dotcDir + "tools/dotc/reporting")
153153

154154
@Test def dotc_typer = compileDir(dotcDir + "tools/dotc/typer", failedOther)
155155
// error: error while loading Checking$$anon$2$,

0 commit comments

Comments
 (0)