@@ -104,7 +104,7 @@ class Definitions {
104104 *
105105 * ImplicitFunctionN traits follow this template:
106106 *
107- * trait ImplicitFunctionN[T0,...,T{N-1}, R] extends Object with FunctionN[T0,...,T{N-1}, R] {
107+ * trait ImplicitFunctionN[T0,...,T{N-1}, R] extends Object {
108108 * def apply(implicit $x0: T0, ..., $x{N_1}: T{N-1}): R
109109 * }
110110 */
@@ -113,27 +113,16 @@ class Definitions {
113113 def complete (denot : SymDenotation )(implicit ctx : Context ): Unit = {
114114 val cls = denot.asClass.classSymbol
115115 val decls = newScope
116- val arity = name.functionArity
117116 val argParams =
118- for (i <- List .range(0 , arity)) yield
119- enterTypeParam(cls, name ++ " $T" ++ i.toString, Contravariant , decls)
120- val resParam = enterTypeParam(cls, name ++ " $R" , Covariant , decls)
121- val (methodType, parentTraits) =
122- if (name.startsWith(tpnme.ImplicitFunction )) {
123- val superTrait =
124- FunctionType (arity).appliedTo(argParams.map(_.typeRef) ::: resParam.typeRef :: Nil )
125- (ImplicitMethodType , ctx.normalizeToClassRefs(superTrait :: Nil , cls, decls))
126- }
127- else (MethodType , Nil )
128- val applyMeth =
129- decls.enter(
130- newMethod(cls, nme.apply,
131- methodType(argParams.map(_.typeRef), resParam.typeRef), Deferred ))
132- denot.info =
133- ClassInfo (ScalaPackageClass .thisType, cls, ObjectType :: parentTraits, decls)
117+ for (i <- List .range(0 , name.functionArity)) yield
118+ enterTypeParam(cls, name ++ " $T" ++ i.toString, Contravariant , decls).typeRef
119+ val resParam = enterTypeParam(cls, name ++ " $R" , Covariant , decls).typeRef
120+ val methodType = if (name.isImplicitFunction) ImplicitMethodType else MethodType
121+ decls.enter(newMethod(cls, nme.apply, methodType(argParams, resParam), Deferred ))
122+ denot.info = ClassInfo (ScalaPackageClass .thisType, cls, ObjectType :: Nil , decls)
134123 }
135124 }
136- newClassSymbol(ScalaPackageClass , name, Trait | NoInits , completer)
125+ newClassSymbol(ScalaPackageClass , name, NoInitsTrait , completer)
137126 }
138127
139128 private def newMethod (cls : ClassSymbol , name : TermName , info : Type , flags : FlagSet = EmptyFlags ): TermSymbol =
@@ -822,7 +811,7 @@ class Definitions {
822811 * trait gets screwed up. Therefore, it is mandatory that FunctionXXL
823812 * is treated as a NoInit trait.
824813 */
825- lazy val NoInitClasses = PhantomClasses + FunctionXXLClass
814+ def isNoInitClass ( cls : Symbol ) = PhantomClasses .contains(cls) || (cls eq FunctionXXLClass ) || isFunctionClass(cls)
826815
827816 def isPolymorphicAfterErasure (sym : Symbol ) =
828817 (sym eq Any_isInstanceOf ) || (sym eq Any_asInstanceOf )
0 commit comments