-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
Compiler version
3.8.0-RC3
Minimized code
//import java.util.concurrent.TimeUnit.{DAYS, HOURS, MICROSECONDS, MILLISECONDS, MINUTES, NANOSECONDS, SECONDS}
import scala.concurrent.duration.*
object ScalaTest:
def main(args: Array[String]): Unit =
f(3.seconds)
private def f(duration: FiniteDuration) =
duration.unit match
case NANOSECONDS =>
case MICROSECONDS =>
case MILLISECONDS =>
case SECONDS =>
case MINUTES =>
case HOURS =>
case DAYS =>
Output
Compiler emits a exhaustivity warning:
warn] -- [E029] Pattern Match Exhaustivity Warning: /Users/joa/dev/js7/js7-base/shared/src/test/scala/js7/base/utils/ScalaTest.scala:12:13
[warn] 12 | duration.unit match
[warn] | ^^^^^^^^^^^^^
[warn] |match may not be exhaustive.
[warn] |
[warn] |It would fail on pattern case: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS
[warn] |(More unmatched cases are elided)
Expectation
No warning, as with Scalac 3.7.4.
No warning is emitted when importing the TimeUnit values directly from java.util.concurrent.TimeUnit
Maybe scala.concurrrent.duration could export these values?
Metadata
Metadata
Assignees
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label