diff options
Diffstat (limited to 'compiler/src/dotty')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Symbols.scala | 2 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 4 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Typer.scala | 15 |
3 files changed, 13 insertions, 8 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala index c0427e320..cfd85c49c 100644 --- a/compiler/src/dotty/tools/dotc/core/Symbols.scala +++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala @@ -428,7 +428,7 @@ object Symbols { final def entered(implicit ctx: Context): this.type = { assert(this.owner.isClass, s"symbol ($this) entered the scope of non-class owner ${this.owner}") // !!! DEBUG this.owner.asClass.enter(this) - if (this.is(Module, butNot = Package)) this.owner.asClass.enter(this.moduleClass) + if (this is Module) this.owner.asClass.enter(this.moduleClass) this } diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 66cfcf453..51f08a295 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -555,8 +555,8 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle val tp = readType() val lazyAnnotTree = readLater(end, rdr => ctx => rdr.readTerm()(ctx)) annots += Annotation.deferredSymAndTree(tp.typeSymbol, _ => lazyAnnotTree.complete) - case _ => - assert(false, s"illegal modifier tag at $currentAddr") + case tag => + assert(false, s"illegal modifier tag $tag at $currentAddr, end = $end") } } (flags, annots.toList, privateWithin) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 64936e106..9f5a942d6 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -120,15 +120,20 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } else false - /** A symbol qualifies if it really exists. In addition, - * if we are in a constructor of a pattern, we ignore all definitions + /** A symbol qualifies if it really exists and is not a package class. + * In addition, if we are in a constructor of a pattern, we ignore all definitions * which are methods and not accessors (note: if we don't do that * case x :: xs in class List would return the :: method). + * + * Package classes are part of their parent's scope, because otherwise + * we could not reload them via `_.member`. On the other hand, accessing a + * package as a type from source is always an error. */ def qualifies(denot: Denotation): Boolean = - reallyExists(denot) && !( - pt.isInstanceOf[UnapplySelectionProto] && - (denot.symbol is (Method, butNot = Accessor))) + reallyExists(denot) && + !(pt.isInstanceOf[UnapplySelectionProto] && + (denot.symbol is (Method, butNot = Accessor))) && + !(denot.symbol is PackageClass) /** Find the denotation of enclosing `name` in given context `ctx`. * @param previous A denotation that was found in a more deeply nested scope, |