@@ -125,8 +125,9 @@ object Denotations {
125
125
126
126
/** Resolve overloaded denotation to pick the one with the given signature
127
127
* when seen from prefix `site`.
128
+ * @param relaxed When true, consider only parameter signatures for a match.
128
129
*/
129
- def atSignature (sig : Signature , site : Type = NoPrefix )(implicit ctx : Context ): SingleDenotation
130
+ def atSignature (sig : Signature , site : Type = NoPrefix , relaxed : Boolean = false )(implicit ctx : Context ): SingleDenotation
130
131
131
132
/** The variant of this denotation that's current in the given context, or
132
133
* `NotDefinedHereDenotation` if this denotation does not exist at current phase, but
@@ -221,7 +222,7 @@ object Denotations {
221
222
*/
222
223
def matchingDenotation (site : Type , targetType : Type )(implicit ctx : Context ): SingleDenotation =
223
224
if (isOverloaded)
224
- atSignature(targetType.signature, site).matchingDenotation(site, targetType)
225
+ atSignature(targetType.signature, site, relaxed = true ).matchingDenotation(site, targetType)
225
226
else if (exists && ! site.memberInfo(symbol).matchesLoosely(targetType))
226
227
NoDenotation
227
228
else
@@ -398,8 +399,8 @@ object Denotations {
398
399
final def validFor = denot1.validFor & denot2.validFor
399
400
final def isType = false
400
401
final def signature (implicit ctx : Context ) = Signature .OverloadedSignature
401
- def atSignature (sig : Signature , site : Type )(implicit ctx : Context ): SingleDenotation =
402
- denot1.atSignature(sig, site) orElse denot2.atSignature(sig, site)
402
+ def atSignature (sig : Signature , site : Type , relaxed : Boolean )(implicit ctx : Context ): SingleDenotation =
403
+ denot1.atSignature(sig, site, relaxed ) orElse denot2.atSignature(sig, site, relaxed )
403
404
def currentIfExists (implicit ctx : Context ): Denotation =
404
405
derivedMultiDenotation(denot1.currentIfExists, denot2.currentIfExists)
405
406
def current (implicit ctx : Context ): Denotation =
@@ -469,9 +470,12 @@ object Denotations {
469
470
def accessibleFrom (pre : Type , superAccess : Boolean )(implicit ctx : Context ): Denotation =
470
471
if (! symbol.exists || symbol.isAccessibleFrom(pre, superAccess)) this else NoDenotation
471
472
472
- def atSignature (sig : Signature , site : Type )(implicit ctx : Context ): SingleDenotation = {
473
+ def atSignature (sig : Signature , site : Type , relaxed : Boolean )(implicit ctx : Context ): SingleDenotation = {
473
474
val situated = if (site == NoPrefix ) this else asSeenFrom(site)
474
- if (sig matches situated.signature) this else NoDenotation
475
+ val matches =
476
+ if (relaxed) sig.matches(situated.signature)
477
+ else sig.matchesFully(situated.signature)
478
+ if (matches) this else NoDenotation
475
479
}
476
480
477
481
def matches (other : SingleDenotation )(implicit ctx : Context ): Boolean =
0 commit comments