File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -2879,7 +2879,9 @@ class TrackingTypeComparer(initctx: Context) extends TypeComparer(initctx) {
28792879 if (provablyEmpty(scrut))
28802880 NoType
28812881 else
2882- recur(cases)
2882+ val savedConstraint = constraint
2883+ try recur(cases)
2884+ finally constraint = savedConstraint // caseLambda additions are dropped
28832885 }
28842886 }
28852887}
Original file line number Diff line number Diff line change 1+ -- [E057] Type Mismatch Error: tests/neg/6697.scala:6:35 ---------------------------------------------------------------
2+ 6 | type Copy[O <: Off] = Of[Sup[O], Sub[O]] // error
3+ | ^
4+ | Type argument Test.Sub[O] does not conform to upper bound Test.Sup[O]
5+ |
6+ | Note: a match type could not be fully reduced:
7+ |
8+ | trying to reduce Test.Sub[O]
9+ | failed since selector O
10+ | matches none of the cases
11+ |
12+ | case Test.Of[sup, sub] => sub
13+
14+ longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ object Test {
33 case class Of [sup, sub <: sup]() extends Off
44 type Sup [O <: Off ] = O match { case Of [sup, sub] => sup }
55 type Sub [O <: Off ] = O match { case Of [sup, sub] => sub }
6- type Copy [O <: Off ] = Of [Sup [O ], Sub [O ]]
6+ type Copy [O <: Off ] = Of [Sup [O ], Sub [O ]] // error
77}
Original file line number Diff line number Diff line change 1+ trait M [F [_]]
2+ trait Inv [T ]
3+
4+ object Test {
5+ def ev [X ] = implicitly[
6+ (X match { case Inv [t] => Int }) =:=
7+ (X match { case Inv [t] => t })
8+ ] // error
9+
10+ def ev2 [X ] = implicitly[
11+ (M [[t] =>> runtime.MatchCase [Inv [t], Int ]]) =:=
12+ (M [[t] =>> runtime.MatchCase [Inv [t], t]])
13+ ] // error
14+ }
You can’t perform that action at this time.
0 commit comments