@@ -355,18 +355,21 @@ class SpaceEngine(using Context) extends SpaceLogic {
355
355
def project (pat : Tree ): Space = pat match {
356
356
case Literal (c) =>
357
357
if (c.value.isInstanceOf [Symbol ])
358
- Typ (c.value.asInstanceOf [Symbol ].termRef, false )
358
+ Typ (c.value.asInstanceOf [Symbol ].termRef, decomposed = false )
359
359
else
360
- Typ (ConstantType (c), false )
360
+ Typ (ConstantType (c), decomposed = false )
361
361
362
362
case pat : Ident if isBackquoted(pat) =>
363
- Typ (pat.tpe, false )
363
+ Typ (pat.tpe, decomposed = false )
364
364
365
365
case Ident (nme.WILDCARD ) =>
366
- Or (Typ (erase(pat.tpe.stripAnnots), false ) :: constantNullSpace :: Nil )
366
+ if pat.tpe.classSymbol.isNullableClass then
367
+ Or (Typ (erase(pat.tpe.stripAnnots), decomposed = false ) :: constantNullSpace :: Nil )
368
+ else
369
+ Typ (pat.tpe, decomposed = false )
367
370
368
371
case Ident (_) | Select (_, _) =>
369
- Typ (erase(pat.tpe.stripAnnots), false )
372
+ Typ (erase(pat.tpe.stripAnnots), decomposed = false )
370
373
371
374
case Alternative (trees) =>
372
375
Or (trees.map(project(_)))
@@ -397,20 +400,20 @@ class SpaceEngine(using Context) extends SpaceLogic {
397
400
project(pat)
398
401
399
402
case Typed (_, tpt) =>
400
- Typ (erase(tpt.tpe.stripAnnots), true )
403
+ Typ (erase(tpt.tpe.stripAnnots), decomposed = false )
401
404
402
405
case This (_) =>
403
- Typ (pat.tpe.stripAnnots, false )
406
+ Typ (pat.tpe.stripAnnots, decomposed = false )
404
407
405
408
case EmptyTree => // default rethrow clause of try/catch, check tests/patmat/try2.scala
406
- Typ (WildcardType , false )
409
+ Typ (WildcardType , decomposed = false )
407
410
408
411
case Block (Nil , expr) =>
409
412
project(expr)
410
413
411
414
case _ =>
412
415
// Pattern is an arbitrary expression; assume a skolem (i.e. an unknown value) of the pattern type
413
- Typ (pat.tpe.narrow, false )
416
+ Typ (pat.tpe.narrow, decomposed = false )
414
417
}
415
418
416
419
private def project (tp : Type ): Space = tp match {
0 commit comments