@@ -71,17 +71,20 @@ object Implicits {
71
71
/** The implicit references */
72
72
def refs : List [ImplicitRef ]
73
73
74
+ private var SingletonClass : ClassSymbol = null
75
+
76
+ /** Widen type so that it is neither a singleton type nor it inherits from scala.Singleton. */
77
+ private def widenSingleton (tp : Type )(implicit ctx : Context ): Type = {
78
+ if (SingletonClass == null ) SingletonClass = defn.SingletonClass
79
+ val wtp = tp.widenSingleton
80
+ if (wtp.derivesFrom(SingletonClass )) defn.AnyType else wtp
81
+ }
82
+
74
83
/** Return those references in `refs` that are compatible with type `pt`. */
75
84
protected def filterMatching (pt : Type )(implicit ctx : Context ): List [Candidate ] = track(" filterMatching" ) {
76
85
77
86
def refMatches (ref : TermRef )(implicit ctx : Context ) = /* trace(i"refMatches $ref $pt")*/ {
78
87
79
- /** Widen type so that it is neither a singleton type nor it inherits from scala.Singleton. */
80
- def widenSingleton (tp : Type ): Type = {
81
- val wtp = tp.widenSingleton
82
- if (wtp.derivesFrom(defn.SingletonClass )) defn.AnyType else wtp
83
- }
84
-
85
88
def discardForView (tpw : Type , argType : Type ): Boolean = tpw match {
86
89
case mt : MethodType =>
87
90
mt.isImplicitMethod ||
@@ -150,7 +153,7 @@ object Implicits {
150
153
val res = adjustSingletonArg(tp.resType)
151
154
if (res `eq` tp.resType) tp else tp.derivedLambdaType(resType = res)
152
155
case tp : MethodType =>
153
- tp.derivedLambdaType(paramInfos = tp.paramInfos.map (widenSingleton))
156
+ tp.derivedLambdaType(paramInfos = tp.paramInfos.mapConserve (widenSingleton))
154
157
case _ => tp
155
158
}
156
159
0 commit comments