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 {
202
202
def matchingDenotation (site : Type , targetType : Type )(implicit ctx : Context ): SingleDenotation =
203
203
if (isOverloaded)
204
204
atSignature(targetType.signature).matchingDenotation(site, targetType)
205
- else if (exists && ! ( site.memberInfo(symbol) matches targetType))
205
+ else if (exists && ! site.memberInfo(symbol).matchesLoosely( targetType))
206
206
NoDenotation
207
207
else
208
208
asSingleDenotation
Original file line number Diff line number Diff line change @@ -544,6 +544,16 @@ object Types {
544
544
this , that, alwaysMatchSimple = ! ctx.phase.erasedTypes)
545
545
}
546
546
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
+
547
557
/** The basetype TypeRef of this type with given class symbol,
548
558
* but without including any type arguments
549
559
*/
You can’t perform that action at this time.
0 commit comments