From 62131749d08657a0103c922c626a0b918cf385b5 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 19 Aug 2013 16:19:03 +0200 Subject: Several fixes and refactorings for typechecking 1) Refactoring of package loaders that ensures that a package is always loaded before new members are entered. This led to a refactoring of sourceModule in completers into its own trait 2) Refactoring of optSelfType ot selfInfo. Class Infos may now have a reference to a symbol in their selfInfo field, instead of always a type, as it was before. This allows to introduce laziness for self type evaluation. Laziness is needed so that modules can be desugared and the desugared version be compiled without special tricks. 3) and $init members are no longer inherited. 4) Refactoring of createSymbol and enterSym, so that creating symbols and entering them in a scope is decoupled. Renamed the driver operation form `enterSym(s)` to `index`. --- src/dotty/tools/dotc/core/Denotations.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools/dotc/core/Denotations.scala') diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index bfd150999..272b6f505 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -333,11 +333,11 @@ object Denotations { /** An overloaded denotation consisting of the alternatives of both given denotations. */ case class MultiDenotation(denot1: Denotation, denot2: Denotation) extends Denotation { - final def symbol = unsupported("symbol") - final def info = unsupported("info") + final def symbol = multiHasNot("symbol") + final def info = multiHasNot("info") final def validFor = denot1.validFor & denot2.validFor final def isType = false - def signature(implicit ctx: Context) = unsupported("signature") + def signature(implicit ctx: Context) = multiHasNot("signature") def atSignature(sig: Signature)(implicit ctx: Context): SingleDenotation = denot1.atSignature(sig) orElse denot2.atSignature(sig) def current(implicit ctx: Context): Denotation = @@ -364,6 +364,10 @@ object Denotations { def derivedMultiDenotation(d1: Denotation, d2: Denotation) = if ((d1 eq denot1) && (d2 eq denot2)) this else MultiDenotation(d1, d2) override def toString = alternatives.mkString(" ") + + private def multiHasNot(op: String): Nothing = + throw new UnsupportedOperationException( + s"multi-denotation with alternatives $alternatives does not implement operation $op") } /** A non-overloaded denotation */ -- cgit v1.2.3