@@ -105,7 +105,7 @@ trait Namers extends MethodSynthesis {
105105
106106 def enterValueParams (vparamss : List [List [ValDef ]]): List [List [Symbol ]] =
107107 mmap(vparamss) { param =>
108- enterInScope(assignMemberSymbol(param, mask = ValueParameterFlags )) setInfo new MonoTypeCompleter (param)
108+ enterInScope(assignMemberSymbol(param, mask = ValueParameterFlags )) setInfo monoTypeCompleter (param)
109109 }
110110
111111 protected def owner = context.owner
@@ -337,10 +337,8 @@ trait Namers extends MethodSynthesis {
337337 }
338338 }
339339
340- def createImportSymbol (tree : Import ) = {
341- val importNamer = namerOf(tree.symbol)
342- NoSymbol .newImport(tree.pos) setInfo new importNamer.ImportTypeCompleter (tree)
343- }
340+ def createImportSymbol (tree : Import ) =
341+ NoSymbol .newImport(tree.pos) setInfo (namerOf(tree.symbol) importTypeCompleter tree)
344342
345343 /** All PackageClassInfoTypes come from here. */
346344 def createPackageSymbol (pos : Position , pid : RefTree ): Symbol = {
@@ -430,8 +428,7 @@ trait Namers extends MethodSynthesis {
430428
431429 def enterModuleDef (tree : ModuleDef ) = {
432430 val sym = enterModuleSymbol(tree)
433- val mcsNamer = namerOf(sym)
434- sym.moduleClass setInfo new mcsNamer.ModuleClassTypeCompleter (tree)
431+ sym.moduleClass setInfo namerOf(sym).moduleClassTypeCompleter(tree)
435432 sym setInfo completerOf(tree)
436433 validateCompanionDefs(tree)
437434 sym
@@ -684,8 +681,7 @@ trait Namers extends MethodSynthesis {
684681 }
685682
686683 def completerOf (tree : MemberDef ): TypeCompleter = {
687- val treeNamer = namerOf(tree.symbol)
688- val mono = new treeNamer.MonoTypeCompleter (tree)
684+ val mono = namerOf(tree.symbol) monoTypeCompleter tree
689685 val tparams = treeInfo.typeParameters(tree)
690686 if (tparams.isEmpty) mono
691687 else {
@@ -1081,7 +1077,7 @@ trait Namers extends MethodSynthesis {
10811077
10821078 val sym = (
10831079 if (hasType || hasName) {
1084- owner.typeOfThis = if (hasType) new SelfTypeCompleter (tpt) else owner.tpe_*
1080+ owner.typeOfThis = if (hasType) selfTypeCompleter (tpt) else owner.tpe_*
10851081 val selfSym = owner.thisSym setPos self.pos
10861082 if (hasName) selfSym setName name else selfSym
10871083 }
@@ -1175,7 +1171,7 @@ trait Namers extends MethodSynthesis {
11751171 val res = GenPolyType (tparams0, resultType)
11761172 val pluginsTp = pluginsTypeSig(res, typer, cdef, WildcardType )
11771173
1178- // Already assign the type to the class symbol (MonoTypeCompleter will do it again).
1174+ // Already assign the type to the class symbol (monoTypeCompleter will do it again).
11791175 // Allows isDerivedValueClass to look at the info.
11801176 clazz setInfo pluginsTp
11811177 if (clazz.isDerivedValueClass) {
@@ -1189,7 +1185,7 @@ trait Namers extends MethodSynthesis {
11891185
11901186 private def moduleSig (mdef : ModuleDef ): Type = {
11911187 val moduleSym = mdef.symbol
1192- // The info of both the module and the moduleClass symbols need to be assigned. MonoTypeCompleter assigns
1188+ // The info of both the module and the moduleClass symbols need to be assigned. monoTypeCompleter assigns
11931189 // the result of typeSig to the module symbol. The module class info is assigned here as a side-effect.
11941190 val result = templateSig(mdef.impl)
11951191 val pluginsTp = pluginsTypeSig(result, typer, mdef, WildcardType )
@@ -1589,7 +1585,7 @@ trait Namers extends MethodSynthesis {
15891585 // (a val's name ends in a " ", so can't compare to def)
15901586 val overridingSym = if (isGetter) vdef.symbol else vdef.symbol.getterIn(valOwner)
15911587
1592- // We're called from an AccessorTypeCompleter , which is completing the info for the accessor's symbol,
1588+ // We're called from an accessorTypeCompleter , which is completing the info for the accessor's symbol,
15931589 // which may or may not be `vdef.symbol` (see isGetter above)
15941590 val overridden = safeNextOverriddenSymbol(overridingSym)
15951591
@@ -1732,7 +1728,7 @@ trait Namers extends MethodSynthesis {
17321728 }
17331729
17341730 /**
1735- * TypeSig is invoked by MonoTypeCompleters . It returns the type of a definition which
1731+ * TypeSig is invoked by monoTypeCompleters . It returns the type of a definition which
17361732 * is then assigned to the corresponding symbol (typeSig itself does not need to assign
17371733 * the type to the symbol, but it can if necessary).
17381734 */
@@ -1923,6 +1919,11 @@ trait Namers extends MethodSynthesis {
19231919 }
19241920 }
19251921
1922+ @ deprecated(" Instantiate TypeCompleterBase (for monomorphic, non-wrapping completer) or CompleterWrapper directly." , " 2.12.2" )
1923+ def mkTypeCompleter (t : Tree )(c : Symbol => Unit ) = new TypeCompleterBase (t) {
1924+ def completeImpl (sym : Symbol ) = c(sym)
1925+ }
1926+
19261927 // NOTE: only meant for monomorphic definitions,
19271928 // do not use to wrap existing completers (see CompleterWrapper for that)
19281929 abstract class TypeCompleterBase [T <: Tree ](val tree : T ) extends LockingTypeCompleter with FlagAgnosticCompleter
0 commit comments