File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1484,6 +1484,11 @@ class Typer extends Namer
14841484 case defn.MatchCase (patternTp, _) => tpt.tpe frozen_=:= patternTp
14851485 case _ => false
14861486 }
1487+ case (id @ Ident (nme.WILDCARD ), pt) =>
1488+ pt match {
1489+ case defn.MatchCase (patternTp, _) => defn.AnyType frozen_=:= patternTp
1490+ case _ => false
1491+ }
14871492 case _ => false
14881493 }
14891494
Original file line number Diff line number Diff line change @@ -7,7 +7,17 @@ object Test0 {
77 def m [X ](x : X ): M [X ] = x match { case _ : String => 1 case _ : Any => " s" }
88}
99
10+ object Test1 {
11+ type M [X ] = X match { case String => Int case Any => String }
12+ def m [X ](x : X ): M [X ] = x match { case _ : String => 1 case _ => " s" }
13+ }
14+
1015object Test2 {
1116 type M [X ] = X match { case String => Int case _ => String }
1217 def m [X ](x : X ): M [X ] = x match { case _ : String => 1 case _ : Any => " s" }
1318}
19+
20+ object Test3 {
21+ type M [X ] = X match { case String => Int case _ => String }
22+ def m [X ](x : X ): M [X ] = x match { case _ : String => 1 case _ => " s" }
23+ }
You can’t perform that action at this time.
0 commit comments