File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -534,16 +534,15 @@ class SpaceEngine(using Context) extends SpaceLogic {
534534 val mt : MethodType = unapp.widen match {
535535 case mt : MethodType => mt
536536 case pt : PolyType =>
537- inContext(ctx.fresh.setExploreTyperState()) {
538537 val tvars = pt.paramInfos.map(newTypeVar(_))
539538 val mt = pt.instantiate(tvars).asInstanceOf [MethodType ]
540539 scrutineeTp <:< mt.paramInfos(0 )
541540 // force type inference to infer a narrower type: could be singleton
542541 // see tests/patmat/i4227.scala
543542 mt.paramInfos(0 ) <:< scrutineeTp
543+ instantiateSelected(mt, tvars)
544544 isFullyDefined(mt, ForceDegree .all)
545545 mt
546- }
547546 }
548547
549548 // Case unapply:
Original file line number Diff line number Diff line change 1+ // scalac: -Werror
2+ sealed trait Nat
3+ case class Zero () extends Nat
4+ case class Succ [N <: Nat ](n : N ) extends Nat
5+
6+ class Test :
7+ def foo (n : Nat ): Int = n match
8+ case Zero () => 0
9+ case Succ (Zero ()) => 1
10+ case _ => 2 // was: warning for this line
11+
12+ def test = foo(Succ (Succ (Zero ()))) // evaluates to 2
You can’t perform that action at this time.
0 commit comments