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

spurious dead code warning with an irrefutable extractor in withFilter

    Details

      Description

      class A
      object A {
        def unapply(a: A): Some[A] = Some(a) // Change return type to Option[A] and the warning is gone
      }
      
      object Test {
        for (A(a) <- List(new A)) yield a // spurious dead code warning.
      }
      
      // List(new A()).withFilter(((check$ifrefutable$2) => check$ifrefutable$2: @scala.unchecked match {
      //  case A((a @ _)) => true
      //  case _ => false // this is dead code, but it's compiler generated.
      // }))
      
      

      I'm pretty sure the regression is explained by the combination of:

      https://github.com/scala/scala/commit/cbd02059
      and
      https://github.com/scala/scala/commit/dfbaaa17

        Activity

        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/2168
        Hide
        Jason Zaugg added a comment -

        If you want to defer this change, we must at least revert cbd02059 in 2.10.1 IMO.

        Show
        Jason Zaugg added a comment - If you want to defer this change, we must at least revert cbd02059 in 2.10.1 IMO.
        Hide
        Grzegorz Kossakowski added a comment -

        Elevated to blocker as it blocks 2.10.1 release.

        Show
        Grzegorz Kossakowski added a comment - Elevated to blocker as it blocks 2.10.1 release.

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Jason Zaugg
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development