@@ -125,8 +125,9 @@ object Denotations {
125125
126126 /** Resolve overloaded denotation to pick the one with the given signature
127127 * when seen from prefix `site`.
128+ * @param relaxed When true, consider only parameter signatures for a match.
128129 */
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
130131
131132 /** The variant of this denotation that's current in the given context, or
132133 * `NotDefinedHereDenotation` if this denotation does not exist at current phase, but
@@ -221,7 +222,7 @@ object Denotations {
221222 */
222223 def matchingDenotation (site : Type , targetType : Type )(implicit ctx : Context ): SingleDenotation =
223224 if (isOverloaded)
224- atSignature(targetType.signature, site).matchingDenotation(site, targetType)
225+ atSignature(targetType.signature, site, relaxed = true ).matchingDenotation(site, targetType)
225226 else if (exists && ! site.memberInfo(symbol).matchesLoosely(targetType))
226227 NoDenotation
227228 else
@@ -398,8 +399,8 @@ object Denotations {
398399 final def validFor = denot1.validFor & denot2.validFor
399400 final def isType = false
400401 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 )
403404 def currentIfExists (implicit ctx : Context ): Denotation =
404405 derivedMultiDenotation(denot1.currentIfExists, denot2.currentIfExists)
405406 def current (implicit ctx : Context ): Denotation =
@@ -469,9 +470,12 @@ object Denotations {
469470 def accessibleFrom (pre : Type , superAccess : Boolean )(implicit ctx : Context ): Denotation =
470471 if (! symbol.exists || symbol.isAccessibleFrom(pre, superAccess)) this else NoDenotation
471472
472- def atSignature (sig : Signature , site : Type )(implicit ctx : Context ): SingleDenotation = {
473+ def atSignature (sig : Signature , site : Type , relaxed : Boolean )(implicit ctx : Context ): SingleDenotation = {
473474 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
475479 }
476480
477481 def matches (other : SingleDenotation )(implicit ctx : Context ): Boolean =
0 commit comments