File tree 2 files changed +16
-1
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,13 @@ object SpaceEngine {
578
578
if (arity > 0 )
579
579
productSelectorTypes(resTp, unappSym.srcPos)
580
580
else {
581
- val getTp = resTp.select(nme.get).finalResultType.widenTermRefExpr
581
+ val getTp = resTp.select(nme.get).finalResultType match
582
+ case tp : TermRef if ! tp.isOverloaded =>
583
+ // Like widenTermRefExpr, except not recursively.
584
+ // For example, in i17184 widen Option[foo.type]#get
585
+ // to Option[foo.type] instead of Option[Int].
586
+ tp.underlying.widenExpr
587
+ case tp => tp
582
588
if (argLen == 1 ) getTp :: Nil
583
589
else productSelectorTypes(getTp, unappSym.srcPos)
584
590
}
Original file line number Diff line number Diff line change
1
+ class Foo
2
+ trait Bar :
3
+ val foo : Int
4
+ val f : Option [foo.type ] = Some (foo)
5
+
6
+ def g : Boolean =
7
+ f match
8
+ case None => false
9
+ case Some (_) => true
You can’t perform that action at this time.
0 commit comments