@@ -355,18 +355,21 @@ class SpaceEngine(using Context) extends SpaceLogic {
355355 def project (pat : Tree ): Space = pat match {
356356 case Literal (c) =>
357357 if (c.value.isInstanceOf [Symbol ])
358- Typ (c.value.asInstanceOf [Symbol ].termRef, false )
358+ Typ (c.value.asInstanceOf [Symbol ].termRef, decomposed = false )
359359 else
360- Typ (ConstantType (c), false )
360+ Typ (ConstantType (c), decomposed = false )
361361
362362 case pat : Ident if isBackquoted(pat) =>
363- Typ (pat.tpe, false )
363+ Typ (pat.tpe, decomposed = false )
364364
365365 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 )
367370
368371 case Ident (_) | Select (_, _) =>
369- Typ (erase(pat.tpe.stripAnnots), false )
372+ Typ (erase(pat.tpe.stripAnnots), decomposed = false )
370373
371374 case Alternative (trees) =>
372375 Or (trees.map(project(_)))
@@ -397,20 +400,20 @@ class SpaceEngine(using Context) extends SpaceLogic {
397400 project(pat)
398401
399402 case Typed (_, tpt) =>
400- Typ (erase(tpt.tpe.stripAnnots), true )
403+ Typ (erase(tpt.tpe.stripAnnots), decomposed = false )
401404
402405 case This (_) =>
403- Typ (pat.tpe.stripAnnots, false )
406+ Typ (pat.tpe.stripAnnots, decomposed = false )
404407
405408 case EmptyTree => // default rethrow clause of try/catch, check tests/patmat/try2.scala
406- Typ (WildcardType , false )
409+ Typ (WildcardType , decomposed = false )
407410
408411 case Block (Nil , expr) =>
409412 project(expr)
410413
411414 case _ =>
412415 // 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 )
414417 }
415418
416419 private def project (tp : Type ): Space = tp match {
0 commit comments