diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 8d869b669c..8d6e0c3b85 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1041,88 +1041,6 @@ trait Implicits { infoMap } - /** The parts of a type is the smallest set of types that contains - * - the type itself - * - the parts of its immediate components (prefix and argument) - * - the parts of its base types - * - for alias types and abstract types, we take instead the parts - * - of their upper bounds. - * @return For those parts that refer to classes with companion objects that - * can be accessed with unambiguous stable prefixes, the implicits infos - * which are members of these companion objects. - - private def companionImplicits(tp: Type): Infoss = { - val partMap = new LinkedHashMap[Symbol, Type] - val seen = mutable.HashSet[Type]() // cycle detection - - /** Enter all parts of `tp` into `parts` set. - * This method is performance critical: about 2-4% of all type checking is spent here - */ - def getParts(tp: Type) { - if (seen(tp)) - return - seen += tp - tp match { - case TypeRef(pre, sym, args) => - if (sym.isClass) { - if (!((sym.name == tpnme.REFINE_CLASS_NAME) || - (sym.name startsWith tpnme.ANON_CLASS_NAME) || - (sym.name == tpnme.ROOT))) - partMap get sym match { - case Some(pre1) => - if (!(pre =:= pre1)) partMap(sym) = NoType // ambiguous prefix - ignore implicit members - case None => - if (pre.isStable) partMap(sym) = pre - val bts = tp.baseTypeSeq - var i = 1 - while (i < bts.length) { - getParts(bts(i)) - i += 1 - } - getParts(pre) - args foreach getParts - } - } else if (sym.isAliasType) { - getParts(tp.normalize) - } else if (sym.isAbstractType) { - getParts(tp.bounds.hi) - } - case ThisType(_) => - getParts(tp.widen) - case _: SingletonType => - getParts(tp.widen) - case RefinedType(ps, _) => - for (p <- ps) getParts(p) - case AnnotatedType(_, t, _) => - getParts(t) - case ExistentialType(_, t) => - getParts(t) - case PolyType(_, t) => - getParts(t) - case _ => - } - } - - getParts(tp) - - val buf = new ListBuffer[Infos] - for ((clazz, pre) <- partMap) { - if (pre != NoType) { - val companion = clazz.companionModule - companion.moduleClass match { - case mc: ModuleClassSymbol => - buf += (mc.implicitMembers map (im => - new ImplicitInfo(im.name, singleType(pre, companion), im))) - case _ => - } - } - } - //println("companion implicits of "+tp+" = "+buf.toList) // DEBUG - buf.toList - } - -*/ - /** The implicits made available by type `pt`. * These are all implicits found in companion objects of classes C * such that some part of `tp` has C as one of its superclasses. |