File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ object Denotations {
202202 def matchingDenotation (site : Type , targetType : Type )(implicit ctx : Context ): SingleDenotation =
203203 if (isOverloaded)
204204 atSignature(targetType.signature).matchingDenotation(site, targetType)
205- else if (exists && ! ( site.memberInfo(symbol) matches targetType))
205+ else if (exists && ! site.memberInfo(symbol).matchesLoosely( targetType))
206206 NoDenotation
207207 else
208208 asSingleDenotation
Original file line number Diff line number Diff line change @@ -544,6 +544,16 @@ object Types {
544544 this , that, alwaysMatchSimple = ! ctx.phase.erasedTypes)
545545 }
546546
547+ /** This is the same as `matches` except that it also matches => T with T and
548+ * vice versa.
549+ */
550+ def matchesLoosely (that : Type )(implicit ctx : Context ): Boolean =
551+ (this matches that) || {
552+ val thisResult = this .widenExpr
553+ val thatResult = that.widenExpr
554+ (this eq thisResult) != (that eq thatResult) && (thisResult matchesLoosely thatResult)
555+ }
556+
547557 /** The basetype TypeRef of this type with given class symbol,
548558 * but without including any type arguments
549559 */
You can’t perform that action at this time.
0 commit comments