File tree Expand file tree Collapse file tree 4 files changed +19
-27
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 4 files changed +19
-27
lines changed Original file line number Diff line number Diff line change @@ -2453,7 +2453,7 @@ class Typer extends Namer
24532453 */
24542454 protected def checkEqualityEvidence (tree : tpd.Tree , pt : Type )(implicit ctx : Context ) : Unit = {
24552455 tree match {
2456- case _ : RefTree | _ : Literal
2456+ case _ : RefTree | _ : Literal | _ : Apply
24572457 if ! isVarPattern(tree) &&
24582458 ! (tree.tpe <:< pt) (ctx.addMode(Mode .GADTflexible )) =>
24592459 val cmp =
Original file line number Diff line number Diff line change 1+ object Test {
2+ def main (args : Array [String ]): Unit = {
3+ val x = 42
4+ val Y = " h"
5+
6+ x match { case { 42 } => 42 } // ok
7+ x match { case { 42 .toString } => 42 } // error
8+ x match { case { 42 }.toString => 42 } // error
9+ x match { case { " h" }.toString => println(42 ) } // error
10+ x match { case { " h" .toString } => println(42 ) } // error
11+ x match { case Y => println(42 ) } // error
12+ x match { case Y .toString => println(42 ) } // error
13+
14+ Y match { case Y .toString => println(42 ) } // ok
15+ Y match { case { Y .toString } => println(42 ) } // ok
16+ Y match { case { Y }.toString => println(42 ) } // ok
17+ }
18+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments