File tree 4 files changed +19
-27
lines changed
compiler/src/dotty/tools/dotc/typer 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
2453
2453
*/
2454
2454
protected def checkEqualityEvidence (tree : tpd.Tree , pt : Type )(implicit ctx : Context ) : Unit = {
2455
2455
tree match {
2456
- case _ : RefTree | _ : Literal
2456
+ case _ : RefTree | _ : Literal | _ : Apply
2457
2457
if ! isVarPattern(tree) &&
2458
2458
! (tree.tpe <:< pt) (ctx.addMode(Mode .GADTflexible )) =>
2459
2459
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