File tree 4 files changed +32
-2
lines changed
compiler/src/dotty/tools/dotc/core
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) {
2879
2879
if (provablyEmpty(scrut))
2880
2880
NoType
2881
2881
else
2882
- recur(cases)
2882
+ val savedConstraint = constraint
2883
+ try recur(cases)
2884
+ finally constraint = savedConstraint // caseLambda additions are dropped
2883
2885
}
2884
2886
}
2885
2887
}
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 {
3
3
case class Of [sup, sub <: sup]() extends Off
4
4
type Sup [O <: Off ] = O match { case Of [sup, sub] => sup }
5
5
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
7
7
}
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