diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-09 16:36:15 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-09 16:40:31 +0100 |
commit | 98ccfd77c4748487190387c4e8b3646d77116e22 (patch) | |
tree | 32abfb55c0bcb4c6e6affe50655903c814e0203b /src/dotty/tools/dotc | |
parent | 9d924441fdeab3bbe0c6cca8c1ecce6ecf64a608 (diff) | |
download | dotty-98ccfd77c4748487190387c4e8b3646d77116e22.tar.gz dotty-98ccfd77c4748487190387c4e8b3646d77116e22.tar.bz2 dotty-98ccfd77c4748487190387c4e8b3646d77116e22.zip |
Getting rid of some CompleInCreationContexts
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 15 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 4 |
4 files changed, 16 insertions, 17 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala index 8c6e8d72c..801e2cef6 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -37,8 +37,8 @@ class Definitions(implicit ctx: Context) { newTypeParam(cls, suffix.toTypeName.expandedName(cls), ExpandedName, scope) private def specialPolyClass(name: TypeName, paramFlags: FlagSet, parentConstrs: Type*): ClassSymbol = { - val completer = new LazyType with CompleteInCreationContext { - def completeInCreationContext(denot: SymDenotation): Unit = { + val completer = new LazyType { + def complete(denot: SymDenotation)(implicit ctx: Context): Unit = { val cls = denot.asClass.classSymbol val paramDecls = newScope val typeParam = newSyntheticTypeParam(cls, paramDecls, paramFlags) @@ -362,14 +362,14 @@ class Definitions(implicit ctx: Context) { case 1 => "P" } - def varianceFlags(v: Int)= v match { + def varianceFlags(v: Int) = v match { case -1 => Contravariant case 0 => Covariant case 1 => EmptyFlags } - val completer = new LazyType with CompleteInCreationContext { - def completeInCreationContext(denot: SymDenotation): Unit = { + val completer = new LazyType { + def complete(denot: SymDenotation)(implicit ctx: Context): Unit = { val cls = denot.asClass.classSymbol val paramDecls = newScope for ((v, i) <- vcs.zipWithIndex) diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 3169efea0..2214fe562 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -1244,9 +1244,8 @@ object SymDenotations { * Completion of modules is always completion of the underlying * module class, followed by copying the relevant fields to the module. */ - class ModuleCompleter(override val moduleClass: ClassSymbol)(implicit cctx: CondensedContext) - extends LazyType with CompleteInCreationContext { - def completeInCreationContext(denot: SymDenotation): Unit = { + class ModuleCompleter(override val moduleClass: ClassSymbol) extends LazyType { + def complete(denot: SymDenotation)(implicit ctx: Context): Unit = { val from = moduleClass.denot.asClass denot.setFlag(from.flags.toTermFlags & RetainedModuleValFlags) denot.annotations = from.annotations filter (_.appliesToModule) @@ -1260,7 +1259,7 @@ object SymDenotations { } /** A completer for missing references */ - class StubInfo()(implicit cctx: CondensedContext) extends LazyType with CompleteInCreationContext { + class StubInfo() extends LazyType { def initializeToDefaults(denot: SymDenotation)(implicit ctx: Context) = { denot.info = denot match { @@ -1272,19 +1271,19 @@ object SymDenotations { denot.privateWithin = NoSymbol } - def completeInCreationContext(denot: SymDenotation): Unit = { + def complete(denot: SymDenotation)(implicit ctx: Context): Unit = { val sym = denot.symbol val file = sym.associatedFile val (location, src) = if (file != null) (s" in $file", file.toString) else ("", "the signature") - val name = cctx.fresh.withSetting(cctx.settings.debugNames, true).nameString(denot.name) - cctx.error( + val name = ctx.fresh.withSetting(ctx.settings.debugNames, true).nameString(denot.name) + ctx.error( s"""|bad symbolic reference. A signature$location |refers to $name in ${denot.owner.showKind} ${denot.owner.showFullName} which is not available. |It may be completely missing from the current classpath, or the version on |the classpath might be incompatible with the version used when compiling $src.""".stripMargin) - if (cctx.debug) throw new Error() + if (ctx.debug) throw new Error() initializeToDefaults(denot) } } diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index e66f3b190..6da864bf6 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -126,7 +126,7 @@ trait Symbols { this: Context => val mdenot = SymDenotation( module, owner, name, modFlags | ModuleCreationFlags, if (cdenot.isCompleted) TypeRef(owner.thisType, modclsName) withSym modcls - else new ModuleCompleter(modcls)(condensed)) + else new ModuleCompleter(modcls)) module.denot = mdenot modcls.denot = cdenot module @@ -181,7 +181,7 @@ trait Symbols { this: Context => * when attempted to be completed. */ def newStubSymbol(owner: Symbol, name: Name, file: AbstractFile = null): Symbol = { - def stubCompleter = new StubInfo()(condensed) + def stubCompleter = new StubInfo() val normalizedOwner = if (owner is ModuleVal) owner.moduleClass else owner println(s"creating stub for ${name.show}, owner = ${normalizedOwner.denot.debugString}, file = $file") println(s"decls = ${normalizedOwner.decls.toList.map(_.debugString).mkString("\n ")}") // !!! DEBUG diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index deb906417..1a782ac63 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -87,8 +87,8 @@ trait TypeOps { this: Context => } private def enterArgBinding(formal: Symbol, info: Type, cls: ClassSymbol, decls: Scope) = { - val lazyInfo = new LazyType with CompleteInCreationContext { // needed so we do not force `formal`. - def completeInCreationContext(denot: SymDenotation): Unit = { + val lazyInfo = new LazyType { // needed so we do not force `formal`. + def complete(denot: SymDenotation)(implicit ctx: Context): Unit = { denot setFlag formal.flags & RetainedTypeArgFlags denot.info = info } |