Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Kotlin to 1.6.0 #221

Merged
merged 2 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions core/src/commonMain/generated/io/islandtime/measures/_Days.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.days as kotlinDays
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -191,8 +191,7 @@ public value class Days(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.days(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinDays

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -394,5 +393,4 @@ public operator fun Long.times(days: Days): Days = days * this
/**
* Converts this duration to Island Time [Days].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandDays(): Days = Days(this.toLong(KotlinDurationUnit.DAYS))
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.hours as kotlinHours
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -178,8 +178,7 @@ public value class Hours(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.hours(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinHours

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -377,5 +376,4 @@ public operator fun Long.times(hours: Hours): Hours = hours * this
/**
* Converts this duration to Island Time [Hours].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandHours(): Hours = Hours(this.toLong(KotlinDurationUnit.HOURS))
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.microseconds as kotlinMicroseconds
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -187,8 +187,7 @@ public value class Microseconds(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.microseconds(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinMicroseconds

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -508,6 +507,5 @@ public operator fun Long.times(microseconds: Microseconds): Microseconds = micro
/**
* Converts this duration to Island Time [Microseconds].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandMicroseconds(): Microseconds =
Microseconds(this.toLong(KotlinDurationUnit.MICROSECONDS))
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.milliseconds as kotlinMilliseconds
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -185,8 +185,7 @@ public value class Milliseconds(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.milliseconds(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinMilliseconds

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -472,6 +471,5 @@ public operator fun Long.times(milliseconds: Milliseconds): Milliseconds = milli
/**
* Converts this duration to Island Time [Milliseconds].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandMilliseconds(): Milliseconds =
Milliseconds(this.toLong(KotlinDurationUnit.MILLISECONDS))
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.minutes as kotlinMinutes
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -180,8 +180,7 @@ public value class Minutes(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.minutes(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinMinutes

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -402,6 +401,5 @@ public operator fun Long.times(minutes: Minutes): Minutes = minutes * this
/**
* Converts this duration to Island Time [Minutes].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandMinutes(): Minutes =
Minutes(this.toLong(KotlinDurationUnit.MINUTES))
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.nanoseconds as kotlinNanoseconds
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -189,8 +189,7 @@ public value class Nanoseconds(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.nanoseconds(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinNanoseconds

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -548,6 +547,5 @@ public operator fun Long.times(nanoseconds: Nanoseconds): Nanoseconds = nanoseco
/**
* Converts this duration to Island Time [Nanoseconds].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandNanoseconds(): Nanoseconds =
Nanoseconds(this.toLong(KotlinDurationUnit.NANOSECONDS))
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlin.jvm.JvmInline
import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName
import kotlin.math.absoluteValue
import kotlin.time.ExperimentalTime
import kotlin.time.Duration.Companion.seconds as kotlinSeconds
import kotlin.time.DurationUnit as KotlinDurationUnit
import kotlin.time.Duration as KotlinDuration

Expand Down Expand Up @@ -182,8 +182,7 @@ public value class Seconds(
/**
* Converts this duration to a [kotlin.time.Duration].
*/
@ExperimentalTime
public fun toKotlinDuration(): KotlinDuration = KotlinDuration.seconds(value)
public fun toKotlinDuration(): KotlinDuration = value.kotlinSeconds

/**
* Converts this duration to an ISO-8601 time interval representation.
Expand Down Expand Up @@ -430,6 +429,5 @@ public operator fun Long.times(seconds: Seconds): Seconds = seconds * this
/**
* Converts this duration to Island Time [Seconds].
*/
@ExperimentalTime
public fun KotlinDuration.toIslandSeconds(): Seconds =
Seconds(this.toLong(KotlinDurationUnit.SECONDS))
2 changes: 0 additions & 2 deletions core/src/commonMain/kotlin/io/islandtime/DateTime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ class DateTime(
/**
* Returns this date-time with [duration] added to it.
*/
@kotlin.time.ExperimentalTime
operator fun plus(duration: kotlin.time.Duration): DateTime {
require(duration.isFinite()) { "The duration must be finite" }
return duration.toComponents { seconds, nanoseconds -> this + Seconds(seconds) + Nanoseconds(nanoseconds) }
Expand Down Expand Up @@ -351,7 +350,6 @@ class DateTime(
/**
* Returns this date-time with [duration] subtracted from it.
*/
@kotlin.time.ExperimentalTime
operator fun minus(duration: kotlin.time.Duration): DateTime {
require(duration.isFinite()) { "The duration must be finite" }
return duration.toComponents { seconds, nanoseconds -> this - Seconds(seconds) - Nanoseconds(nanoseconds) }
Expand Down
2 changes: 0 additions & 2 deletions core/src/commonMain/kotlin/io/islandtime/Instant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Instant private constructor(
/**
* Returns this instant with [duration] added to it.
*/
@kotlin.time.ExperimentalTime
operator fun plus(duration: kotlin.time.Duration): Instant {
require(duration.isFinite()) { "The duration must be finite" }
return duration.toComponents { seconds, nanoseconds -> plus(seconds, nanoseconds) }
Expand Down Expand Up @@ -116,7 +115,6 @@ class Instant private constructor(
/**
* Returns this instant with [duration] subtracted from it.
*/
@kotlin.time.ExperimentalTime
operator fun minus(duration: kotlin.time.Duration): Instant {
require(duration.isFinite()) { "The duration must be finite" }
return duration.toComponents { seconds, nanoseconds -> plus(-seconds, -nanoseconds) }
Expand Down
2 changes: 0 additions & 2 deletions core/src/commonMain/kotlin/io/islandtime/OffsetDateTime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ class OffsetDateTime(
/**
* Returns this date-time with [duration] added to it.
*/
@kotlin.time.ExperimentalTime
operator fun plus(duration: kotlin.time.Duration): OffsetDateTime = copy(dateTime = dateTime + duration)

/**
Expand Down Expand Up @@ -267,7 +266,6 @@ class OffsetDateTime(
/**
* Returns this date-time with [duration] subtracted from it.
*/
@kotlin.time.ExperimentalTime
operator fun minus(duration: kotlin.time.Duration): OffsetDateTime = copy(dateTime = dateTime - duration)

/**
Expand Down
2 changes: 0 additions & 2 deletions core/src/commonMain/kotlin/io/islandtime/OffsetTime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class OffsetTime(
/**
* Returns this time with [duration] added to it.
*/
@kotlin.time.ExperimentalTime
operator fun plus(duration: kotlin.time.Duration): OffsetTime = copy(time = time + duration)

/**
Expand Down Expand Up @@ -110,7 +109,6 @@ class OffsetTime(
/**
* Returns this time with [duration] subtracted from it.
*/
@kotlin.time.ExperimentalTime
operator fun minus(duration: kotlin.time.Duration): OffsetTime = copy(time = time - duration)

/**
Expand Down
2 changes: 0 additions & 2 deletions core/src/commonMain/kotlin/io/islandtime/Time.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class Time(
/**
* Returns this time with [duration] added to it.
*/
@kotlin.time.ExperimentalTime
operator fun plus(duration: kotlin.time.Duration): Time {
require(duration.isFinite()) { "The duration must be finite" }
return duration.toComponents { seconds, nanoseconds -> this + Seconds(seconds) + Nanoseconds(nanoseconds) }
Expand Down Expand Up @@ -176,7 +175,6 @@ class Time(
/**
* Returns this time with [duration] subtracted from it.
*/
@kotlin.time.ExperimentalTime
operator fun minus(duration: kotlin.time.Duration): Time {
require(duration.isFinite()) { "The duration must be finite" }
return duration.toComponents { seconds, nanoseconds -> this - Seconds(seconds) - Nanoseconds(nanoseconds) }
Expand Down
2 changes: 0 additions & 2 deletions core/src/commonMain/kotlin/io/islandtime/ZonedDateTime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class ZonedDateTime private constructor(
/**
* Returns this date-time with [duration] added to it.
*/
@kotlin.time.ExperimentalTime
operator fun plus(duration: kotlin.time.Duration): ZonedDateTime = resolveInstant(dateTime + duration)

/**
Expand Down Expand Up @@ -236,7 +235,6 @@ class ZonedDateTime private constructor(
/**
* Returns this date-time with [duration] subtracted from it.
*/
@kotlin.time.ExperimentalTime
operator fun minus(duration: kotlin.time.Duration): ZonedDateTime = resolveInstant(dateTime - duration)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ class Duration private constructor(
* Converts this duration to a [kotlin.time.Duration]. Since Kotlin's `Duration` type is based on a floating-point
* number, precision may be lost.
*/
@kotlin.time.ExperimentalTime
fun toKotlinDuration(): kotlin.time.Duration {
return seconds.toKotlinDuration() + nanosecondAdjustment.toKotlinDuration()
}
Expand Down Expand Up @@ -584,7 +583,7 @@ fun durationOf(nanoseconds: Nanoseconds): Duration {
}

/**
* Returns the absolute value of [duration].
* Returns the absolute value of a [duration].
*/
fun abs(duration: Duration) = duration.absoluteValue

Expand All @@ -599,7 +598,6 @@ fun Nanoseconds.asDuration(): Duration = durationOf(this)
/**
* Converts this duration to an equivalent Island Time [Duration].
*/
@kotlin.time.ExperimentalTime
fun kotlin.time.Duration.toIslandDuration(): Duration {
return toComponents { seconds, nanoseconds -> durationOf(seconds.seconds, nanoseconds.nanoseconds) }
}
Expand Down
8 changes: 4 additions & 4 deletions core/src/commonTest/kotlin/io/islandtime/BuildersTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BuildersTest : AbstractIslandTimeTest() {
}

@Test
fun `Year_atMonth() creates a YearMonth`() {
fun `Year_atMonth creates a YearMonth`() {
assertEquals(
YearMonth(2018, Month.APRIL),
Year(2018).atMonth(4)
Expand All @@ -40,7 +40,7 @@ class BuildersTest : AbstractIslandTimeTest() {
}

@Test
fun `YearMonth_atDay() creates a Date`() {
fun `YearMonth_atDay creates a Date`() {
assertEquals(
Date(2018, Month.MAY, 30),
YearMonth(2018, Month.MAY).atDay(30)
Expand Down Expand Up @@ -144,7 +144,7 @@ class BuildersTest : AbstractIslandTimeTest() {
}

@Test
fun `Date_startOfDayAt() returns the ZonedDateTime at the start of the day in a time zone`() {
fun `Date_startOfDayAt returns the ZonedDateTime at the start of the day in a time zone`() {
assertEquals(
ZonedDateTime(
DateTime(2019, 5, 20, 0, 0),
Expand All @@ -157,7 +157,7 @@ class BuildersTest : AbstractIslandTimeTest() {
}

@Test
fun `Date_endOfDayAt() returns the ZonedDateTime at the end of the day in a time zone`() {
fun `Date_endOfDayAt returns the ZonedDateTime at the end of the day in a time zone`() {
assertEquals(
ZonedDateTime(
DateTime(2019, 5, 20, 23, 59, 59, 999_999_999),
Expand Down