Uploaded image for project: '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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: