File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
plugin/src/main/scala/plugin Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -688,16 +688,23 @@ class CustomControlPhase(setting: Setting) extends CommonPhase:
688
688
FromCore .patternSingleton(selectorTree, lit)
689
689
// hacked unapply for enum enumerations
690
690
case Pattern .Enum (arg) =>
691
- val DFEnum (enumTpe) = dfTypeTpe : @ unchecked
692
- if (arg.tpe <:< enumTpe) FromCore .patternSingleton(selectorTree, arg)
693
- else
694
- report.error(
695
- s """ Wrong enum entry type.
696
- |Expecting: ${enumTpe.show}
697
- |Found: ${arg.tpe.show}""" .stripMargin,
698
- arg.srcPos
699
- )
700
- EmptyTree
691
+ dfTypeTpe match
692
+ case DFEnum (enumTpe) =>
693
+ if (arg.tpe <:< enumTpe) FromCore .patternSingleton(selectorTree, arg)
694
+ else
695
+ report.error(
696
+ s """ Wrong enum entry type.
697
+ |Expecting: ${enumTpe.show}
698
+ |Found: ${arg.tpe.show}""" .stripMargin,
699
+ arg.srcPos
700
+ )
701
+ EmptyTree
702
+ case _ =>
703
+ report.error(
704
+ s " Found an enum pattern but the match selector is not an enum. " ,
705
+ patternTree.srcPos
706
+ )
707
+ EmptyTree
701
708
// constant string interpolation
702
709
case Pattern .SI (block, binds, rhs) =>
703
710
dfTypeTpe match
You can’t perform that action at this time.
0 commit comments