Scala Programming Language
  1. Scala Programming Language
  2. SI-6077

correctly eliminate common subcondition involving irrefutable extractors

    Details

      Description

      class LiteralNode(val value: Any)
      
      object LiteralNode {
        def unapply(n: LiteralNode) = Some(n.value)
      }
      
      object Test extends App {
        ((new LiteralNode(false)): Any) match {
          case LiteralNode(true)  => println("uh-oh")
          case LiteralNode(false) => println("ok")
        }
      }
      

      causes a MatchError because the extractor call is factored out incorrectly

        Activity

        Hide
        Adriaan Moors added a comment -

        caused by SI-4691

        Show
        Adriaan Moors added a comment - caused by SI-4691
        Show
        Adriaan Moors added a comment - https://github.com/scala/scala/pull/904

          People

          • Assignee:
            Adriaan Moors
            Reporter:
            Adriaan Moors
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development