Skip to content

Commit

Permalink
Fix error from ceylon/ceylon-spec#891
Browse files Browse the repository at this point in the history
The second `if` no longer narrows the type, so use an else instead.
  • Loading branch information
lucaswerkmeister committed Oct 4, 2015
1 parent 48ee43f commit 8b60835
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions source/ceylon/time/DateTimeRange.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,13 @@ shared class DateTimeRange( from, to, step = milliseconds ) satisfies Range<Date
case( is UnitOfMonth ) { return from.plusMonths(jump); }
case( is UnitOfDay ) { return from.plusDays(jump); }
}
if ( is UnitOfTime step ) {
else {
switch( step )
case( is UnitOfHour ) { return from.plusHours(jump); }
case( is UnitOfMinute ) { return from.plusMinutes(jump); }
case( is UnitOfSecond ) { return from.plusSeconds(jump); }
case( is UnitOfMillisecond ) { return from.plusMilliseconds(jump); }
}
throw;
}

"The iteration for each element should always start from same point,
Expand All @@ -163,14 +162,13 @@ shared class DateTimeRange( from, to, step = milliseconds ) satisfies Range<Date
case( is UnitOfMonth ) { return from.minusMonths(jump); }
case( is UnitOfDay ) { return from.minusDays(jump); }
}
if ( is UnitOfTime step ) {
else {
switch( step )
case( is UnitOfHour ) { return from.minusHours(jump); }
case( is UnitOfMinute ) { return from.minusMinutes(jump); }
case( is UnitOfSecond ) { return from.minusSeconds(jump); }
case( is UnitOfMillisecond ) { return from.minusMilliseconds(jump); }
}
throw;
}

}

0 comments on commit 8b60835

Please sign in to comment.