diff options
-rw-r--r-- | src/library/scala/concurrent/duration/Duration.scala | 2 | ||||
-rw-r--r-- | test/files/run/duration-coarsest.scala | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala index 2eded9f060..3697950e2e 100644 --- a/src/library/scala/concurrent/duration/Duration.scala +++ b/src/library/scala/concurrent/duration/Duration.scala @@ -705,7 +705,7 @@ final class FiniteDuration(val length: Long, val unit: TimeUnit) extends Duratio final def isFinite() = true - final def toCoarsest: Duration = { + final override def toCoarsest: FiniteDuration = { def loop(length: Long, unit: TimeUnit): FiniteDuration = { def coarserOrThis(coarser: TimeUnit, divider: Int) = if (length % divider == 0) loop(length / divider, coarser) diff --git a/test/files/run/duration-coarsest.scala b/test/files/run/duration-coarsest.scala index 51cb79287a..81fbb3cc84 100644 --- a/test/files/run/duration-coarsest.scala +++ b/test/files/run/duration-coarsest.scala @@ -25,4 +25,7 @@ object Test extends App { 23 hours, 40 days ) foreach (x => assert(x == x.toCoarsest, x)) -}
\ No newline at end of file + + // toCoarsest on a FiniteDuration should return a FiniteDuration + val finite: FiniteDuration = 1.second.toCoarsest +} |