File tree 2 files changed +15
-2
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -836,7 +836,7 @@ object SpaceEngine {
836
836
/** Return the underlying type of non-module, non-constant, non-enum case singleton types.
837
837
* Also widen ExprType to its result type, and rewrap any annotation wrappers.
838
838
* For example, with `val opt = None`, widen `opt.type` to `None.type`. */
839
- def toUnderlying (tp : Type )(using Context ): Type = trace(i " toUnderlying( $tp) " )(tp match {
839
+ def toUnderlying (tp : Type )(using Context ): Type = trace(i " toUnderlying( $tp ${tp.className} ) " )(tp match {
840
840
case _ : ConstantType => tp
841
841
case tp : TermRef if tp.symbol.is(Module ) => tp
842
842
case tp : TermRef if tp.symbol.isAllOf(EnumCase ) => tp
@@ -847,7 +847,7 @@ object SpaceEngine {
847
847
})
848
848
849
849
def checkExhaustivity (m : Match )(using Context ): Unit = trace(i " checkExhaustivity( $m) " ) {
850
- val selTyp = toUnderlying(m.selector.tpe).dealias
850
+ val selTyp = toUnderlying(m.selector.tpe.stripNull() ).dealias
851
851
val targetSpace = trace(i " targetSpace( $selTyp) " )(project(selTyp))
852
852
853
853
val patternSpace = Or (m.cases.foldLeft(List .empty[Space ]) { (acc, x) =>
Original file line number Diff line number Diff line change
1
+ //> using options -Yexplicit-nulls -Yno-flexible-types
2
+
3
+ import scala .language .unsafeNulls
4
+
5
+ import java .util .concurrent .CompletableFuture
6
+ import scala .jdk .CollectionConverters ._
7
+
8
+ class Test1 :
9
+ def m1 =
10
+ val fut : CompletableFuture [Either [String , List [String ]]] = ???
11
+ fut.thenApply:
12
+ case Right (edits : List [String ]) => edits.asJava
13
+ case Left (error : String ) => throw new Exception (error)
You can’t perform that action at this time.
0 commit comments