Skip to content

Commit 7cd9e3a

Browse files
committed
Disregard refinements in lifting when checking equality
1 parent 325262f commit 7cd9e3a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ trait Implicits { self: Typer =>
671671
case TypeBounds(lo, hi) if lo ne hi => apply(hi)
672672
case _ => t
673673
}
674+
case t: RefinedType =>
675+
apply(t.parent)
674676
case _ =>
675677
if (variance > 0) mapOver(t) else t
676678
}

docs/docs/reference/multiversal-equality.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ The precise rules for equality checking are as follows.
8989

9090
1. A comparison using `x == y` or `x != y` between values `x: T` and `y: U`
9191
is legal if either `T` and `U` are the same, or one of the types is a subtype
92-
of the other, or an implicit value of type `scala.Eq[T, U]` is found.
92+
of the "lifted" version of the other type, or an implicit value of type `scala.Eq[T, U]` is found.
93+
See the [description on Github](https://github.com/lampepfl/dotty/issues/1247) for
94+
a definition of lifting.
9395

9496
2. The usual rules for implicit search apply also to `Eq` instances,
9597
with one modification: An instance of `scala.Eq.eqAny[T, U]` is

0 commit comments

Comments
 (0)