Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,9 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
if (provablyEmpty(scrut))
NoType
else
recur(cases)
val savedConstraint = constraint
try recur(cases)
finally constraint = savedConstraint // caseLambda additions are dropped
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/neg/6697.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- [E057] Type Mismatch Error: tests/neg/6697.scala:6:35 ---------------------------------------------------------------
6 | type Copy[O <: Off] = Of[Sup[O], Sub[O]] // error
| ^
| Type argument Test.Sub[O] does not conform to upper bound Test.Sup[O]
|
| Note: a match type could not be fully reduced:
|
| trying to reduce Test.Sub[O]
| failed since selector O
| matches none of the cases
|
| case Test.Of[sup, sub] => sub

longer explanation available when compiling with `-explain`
2 changes: 1 addition & 1 deletion tests/pos/6697.scala → tests/neg/6697.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ object Test {
case class Of[sup, sub <: sup]() extends Off
type Sup[O <: Off] = O match { case Of[sup, sub] => sup }
type Sub[O <: Off] = O match { case Of[sup, sub] => sub }
type Copy[O <: Off] = Of[Sup[O], Sub[O]]
type Copy[O <: Off] = Of[Sup[O], Sub[O]] // error
}
14 changes: 14 additions & 0 deletions tests/neg/9107.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
trait M[F[_]]
trait Inv[T]

object Test {
def ev[X] = implicitly[
(X match { case Inv[t] => Int }) =:=
(X match { case Inv[t] => t })
] // error

def ev2[X] = implicitly[
(M[[t] =>> runtime.MatchCase[Inv[t], Int]]) =:=
(M[[t] =>> runtime.MatchCase[Inv[t], t]])
] // error
}