Skip to content

Commit 0824df5

Browse files
committed
Harmonize types before checking can equals in pattern match
1 parent e9d87e0 commit 0824df5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
19631963
case _: RefTree | _: Literal
19641964
if !isVarPattern(tree) &&
19651965
!(tree.tpe <:< pt)(ctx.addMode(Mode.GADTflexible)) =>
1966-
checkCanEqual(pt, wtp, tree.pos)(ctx.retractMode(Mode.Pattern))
1966+
val tp1 :: tp2 :: Nil = harmonizeTypes(pt :: wtp :: Nil)
1967+
checkCanEqual(tp1, tp2, tree.pos)(ctx.retractMode(Mode.Pattern))
19671968
case _ =>
19681969
}
19691970
tree

0 commit comments

Comments
 (0)