Skip to content

Better support for guards in switches #5070

Open
@allanrenucci

Description

@allanrenucci

#4982 Added some support for guards in switches. However this still doesn't work:

import scala.annotation.switch

class Test {
  def succ_guard(c: Int) = (c: @switch) match { // warning: Could not emit switch for @switch annotated match
    case 1 | 2 | 3   => true
    case x if x == 4 => true
    case _           => false
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions