We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e7294c commit 96dd7fdCopy full SHA for 96dd7fd
compiler/src/dotty/tools/dotc/transform/PatMat.scala
@@ -507,7 +507,18 @@ object PatMat {
507
patmatch.println(i"Nodes for $tree:${show(raw)}")
508
val specialized = specialize(raw)
509
patmatch.println(s"Specialized: ${show(specialized)}")
510
- emit(specialized)
+ val result = emit(specialized)
511
+
512
+ tree.selector match {
513
+ case Typed(_, tpt) if tpt.tpe.hasAnnotation(defn.SwitchAnnot) =>
514
+ result match {
515
+ case _: Match | Block(_, _: Match) =>
516
+ case _ => ctx.warning("could not emit switch for @switch annotated match", tree.pos)
517
+ }
518
+ case _ =>
519
520
521
+ result
522
}
523
524
0 commit comments