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

Enable experimental K2 #3087

Merged
merged 30 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dd6b60c
Update all dependencies
renovate[bot] Jul 6, 2023
371db19
Update API files
renovate[bot] Jul 6, 2023
1321870
Retrigger CI
nomisRev Jul 7, 2023
34ab332
Upgrade yarn.lock
serras Jul 7, 2023
43fa850
Remove wrong versions in yarn.lock
serras Jul 7, 2023
37c0d45
Merge branch 'main' into renovate/all
serras Jul 7, 2023
79dffa3
kotlin.mpp.enableCompatibilityMetadataVariant is deprecated
serras Jul 7, 2023
8fba688
Update yarn.lock in Action
serras Jul 7, 2023
f0eded0
Merge branch 'main' into renovate/all
serras Jul 10, 2023
b9dc1b6
Merge branch 'main' into renovate/all
serras Jul 10, 2023
7692238
Merge branch 'main' into renovate/all
serras Jul 14, 2023
187e963
Merge branch 'main' into renovate/all
serras Jul 15, 2023
824bd32
Temporarily disable tests
nomisRev Jul 19, 2023
a4e24d8
Merge branch 'main' into renovate/all
nomisRev Jul 19, 2023
04bec26
Enable experimental K2
serras Jul 19, 2023
bb55020
Merge branch 'main' into k2-compilation-take2
nomisRev Jul 20, 2023
75f446c
Switch to 1.9.20-dev version
serras Jul 21, 2023
d74e573
Messages in @Deprecated must be @PublishedApi
serras Jul 21, 2023
7fa4fa9
API dump
serras Jul 21, 2023
3818cbc
Fix some problems visible in K2
serras Jul 21, 2023
8777dde
Merge branch 'main' into k2-compilation-take2
serras Jul 21, 2023
1ee4bb7
Update API files
serras Jul 21, 2023
3622a7e
Run K2 into its own workflow job
serras Jul 21, 2023
739dbbe
Use dev version only in K2
serras Jul 21, 2023
5b3d031
Try flaky race test 10 times
serras Jul 21, 2023
93f98ad
Merge branch 'main' into k2-compilation-take2
serras Aug 2, 2023
a6b829b
Update Kotlin dev version
serras Aug 23, 2023
6574887
Update Kotlin dev version
serras Aug 23, 2023
ef16dc9
Merge branch 'main' into k2-compilation-take2
serras Aug 23, 2023
a3a0c14
Merge branch 'main' into k2-compilation-take2
serras Aug 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,36 @@ jobs:
name: 'reports-jvmTest'
path: '**/build/reports/**'

jvmTestK2:
runs-on: ubuntu-latest
timeout-minutes: 60

env:
KOTLIN_OVERRIDE: 1.9.30-dev-1098

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11

- name: jvmTest (K2 enabled)
uses: gradle/gradle-build-action@v2
with:
arguments: jvmTest -Pkotlin.experimental.tryK2=true

- name: Upload reports
if: failure()
uses: actions/upload-artifact@v3
with:
name: 'reports-jvmTest'
path: '**/build/reports/**'

js:
runs-on: ubuntu-latest
timeout-minutes: 60
Expand Down
15 changes: 8 additions & 7 deletions arrow-libs/core/arrow-annotations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
id(libs.plugins.kotlin.multiplatform.get().pluginId)
alias(libs.plugins.arrowGradleConfig.kotlin)
alias(libs.plugins.arrowGradleConfig.publish)

alias(libs.plugins.spotless)
}

Expand Down Expand Up @@ -37,12 +36,14 @@ kotlin {
}
}
}
}

apply(from = property("ANIMALSNIFFER_MPP"))

tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.annotations"
jvm {
tasks.jvmJar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.annotations"
}
}
}
}

apply(from = property("ANIMALSNIFFER_MPP"))
11 changes: 6 additions & 5 deletions arrow-libs/core/arrow-atomic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ kotlin {
runtimeOnly(libs.kotest.runnerJUnit5)
}
}

}
}

tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.atomic"
jvm {
tasks.jvmJar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.atomic"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public class arrow/continuations/generic/ControlThrowable : java/lang/Throwable
public fun fillInStackTrace ()Ljava/lang/Throwable;
}

public final class arrow/continuations/generic/ControlThrowableKt {
public static final field deprecateArrowContinuation Ljava/lang/String;
}

public abstract interface class arrow/continuations/generic/DelimitedContinuation {
public abstract fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
Expand Down
10 changes: 6 additions & 4 deletions arrow-libs/core/arrow-continuations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ kotlin {
}
}
}
}

tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.continuations"
jvm {
tasks.jvmJar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.continuations"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ package arrow.continuations.generic
@Deprecated(deprecateArrowContinuation)
public expect open class ControlThrowable() : Throwable

internal const val deprecateArrowContinuation: String =
@PublishedApi internal const val deprecateArrowContinuation: String =
"arrow.continuation is being discontinued and will be removed in the next version in favor of the Effect/ EagerEffect Runtime. If you depend on low-level APIs as in arrow.continuation, feel free to write us in the Kotlin Slack channel for guidance."
5 changes: 5 additions & 0 deletions arrow-libs/core/arrow-core-retrofit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,10 @@ dependencies {
testImplementation(libs.squareup.retrofitConverterMoshi)
testImplementation(libs.kotlinx.serializationJson)
testImplementation(libs.jakewharton.retrofitConverterKotlinxSerialization)
}

tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.core.retrofit"
}
}
8 changes: 8 additions & 0 deletions arrow-libs/core/arrow-core-serialization/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,12 @@ kotlin {
}
}
}

jvm {
tasks.jvmJar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.core.serialization"
}
}
}
}
21 changes: 21 additions & 0 deletions arrow-libs/core/arrow-core/api/arrow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,7 @@ public final class arrow/core/PredefKt {
}

public final class arrow/core/ResultKt {
public static final field deprecateZip Ljava/lang/String;
public static final fun composeErrors ([Ljava/lang/Throwable;)Ljava/lang/Throwable;
public static final fun flatMap (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
public static final fun getUnitResult ()Ljava/lang/Object;
Expand Down Expand Up @@ -2598,6 +2599,8 @@ public final class arrow/core/Validated$Valid$Companion {
}

public final class arrow/core/ValidatedKt {
public static final field DeprAndNicheMsg Ljava/lang/String;
public static final field ValidatedDeprMsg Ljava/lang/String;
public static final fun andThen (Larrow/core/Validated;Lkotlin/jvm/functions/Function1;)Larrow/core/Validated;
public static final fun attempt (Larrow/core/Validated;)Larrow/core/Validated;
public static final fun bisequence (Larrow/core/Validated;)Ljava/util/List;
Expand Down Expand Up @@ -2671,6 +2674,7 @@ public final class arrow/core/computations/EitherEffect$DefaultImpls {
}

public final class arrow/core/computations/EitherKt {
public static final field eitherDSLDeprecation Ljava/lang/String;
public static final fun ensureNotNull (Larrow/core/computations/EitherEffect;Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

Expand All @@ -2695,6 +2699,7 @@ public final class arrow/core/computations/NullableEffect$DefaultImpls {
}

public final class arrow/core/computations/NullableKt {
public static final field nullableDSLDeprecation Ljava/lang/String;
public static final fun ensureNotNull (Larrow/core/computations/NullableEffect;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

Expand All @@ -2709,6 +2714,7 @@ public final class arrow/core/computations/OptionEffect$DefaultImpls {
}

public final class arrow/core/computations/OptionKt {
public static final field optionDSLDeprecation Ljava/lang/String;
public static final fun ensureNotNull (Larrow/core/computations/OptionEffect;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

Expand Down Expand Up @@ -2753,6 +2759,10 @@ public final class arrow/core/computations/ResultEffect {
public final fun bind (Ljava/lang/Object;)Ljava/lang/Object;
}

public final class arrow/core/computations/ResultKt {
public static final field resultDSLDeprecation Ljava/lang/String;
}

public final class arrow/core/computations/either {
public static final field INSTANCE Larrow/core/computations/either;
public final fun eager (Lkotlin/jvm/functions/Function2;)Larrow/core/Either;
Expand Down Expand Up @@ -2938,6 +2948,10 @@ public final class arrow/core/continuations/EffectScopeKt {
public static final fun ensureNotNull (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class arrow/core/continuations/EitherKt {
public static final field eitherDSLDeprecation Ljava/lang/String;
}

public final class arrow/core/continuations/FoldContinuation : arrow/core/continuations/Token, arrow/core/continuations/EffectScope, kotlin/coroutines/Continuation {
public field recover Lkotlin/jvm/functions/Function2;
public fun <init> (Larrow/core/continuations/Token;Lkotlin/coroutines/CoroutineContext;Lkotlin/coroutines/Continuation;)V
Expand Down Expand Up @@ -3007,6 +3021,10 @@ public final class arrow/core/continuations/IorEffectScope : arrow/core/continua
public fun shift (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class arrow/core/continuations/IorKt {
public static final field iorDSLDeprecation Ljava/lang/String;
}

public final class arrow/core/continuations/NullableEagerEffectScope : arrow/core/continuations/EagerEffectScope {
public fun attempt (Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static fun attempt-impl (Larrow/core/continuations/EagerEffectScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down Expand Up @@ -3088,6 +3106,7 @@ public final class arrow/core/continuations/NullableEffectScope : arrow/core/con
}

public final class arrow/core/continuations/NullableKt {
public static final field nullableDSLDeprecation Ljava/lang/String;
public static final fun ensureNotNull-0Rsnnio (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun ensureNotNull-7s8y1X8 (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
Expand Down Expand Up @@ -3171,6 +3190,7 @@ public final class arrow/core/continuations/OptionEffectScope : arrow/core/conti
}

public final class arrow/core/continuations/OptionKt {
public static final field optionDSLDeprecation Ljava/lang/String;
public static final fun ensureNotNull-09sQPHg (Larrow/core/continuations/EffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun ensureNotNull-dxZa7OQ (Larrow/core/continuations/EagerEffectScope;Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun toOption (Larrow/core/continuations/EagerEffect;)Larrow/core/Option;
Expand Down Expand Up @@ -3254,6 +3274,7 @@ public final class arrow/core/continuations/ResultEffectScope : arrow/core/conti
}

public final class arrow/core/continuations/ResultKt {
public static final field resultDSLDeprecation Ljava/lang/String;
public static final fun toResult (Larrow/core/continuations/EagerEffect;)Ljava/lang/Object;
public static final fun toResult (Larrow/core/continuations/Effect;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
Expand Down
14 changes: 8 additions & 6 deletions arrow-libs/core/arrow-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ kotlin {
}
}
}

jvm {
tasks.jvmJar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.core"
}
}
}
}

// enables context receivers for Jvm Tests
tasks.named<KotlinCompile>("compileTestKotlinJvm") {
kotlinOptions.freeCompilerArgs += "-Xcontext-receivers"
}

tasks.jar {
manifest {
attributes["Automatic-Module-Name"] = "arrow.core"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ public sealed class Ior<out A, out B> {
public fun isLeft(): Boolean {
contract {
returns(true) implies (this@Ior is Ior.Left<A>)
returns(false) implies (this@Ior is Ior.Right<B>)
returns(false) implies (this@Ior is Ior.Both<A, B>)
returns(false) implies (this@Ior is Ior.Right<B> || this@Ior is Ior.Both<A, B>)
}
return this@Ior is Ior.Left<A>
}
Expand All @@ -127,8 +126,7 @@ public sealed class Ior<out A, out B> {
public fun isRight(): Boolean {
contract {
returns(true) implies (this@Ior is Ior.Right<B>)
returns(false) implies (this@Ior is Ior.Left<A>)
returns(false) implies (this@Ior is Ior.Both<A, B>)
returns(false) implies (this@Ior is Ior.Left<A> || this@Ior is Ior.Both<A, B>)
}
return this@Ior is Ior.Right<B>
}
Expand All @@ -137,8 +135,7 @@ public sealed class Ior<out A, out B> {
@JvmName("_isBoth")
public fun isBoth(): Boolean {
contract {
returns(false) implies (this@Ior is Ior.Right<B>)
returns(false) implies (this@Ior is Ior.Left<A>)
returns(false) implies (this@Ior is Ior.Right<B> || this@Ior is Ior.Left<A>)
returns(true) implies (this@Ior is Ior.Both<A, B>)
}
return this@Ior is Ior.Both<A, B>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

internal const val deprecateZip: String =
@PublishedApi internal const val deprecateZip: String =
"Prefer using the inline result DSL + bind(). Please, be aware that all the errors are no longer accumulated, just the first error found is considered." +
"In case you think this behaviour should stay, please provide feedback and your use-case on https://github.com/arrow-kt/arrow/issues"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,8 @@ public inline fun <A> A.validNel(): ValidatedNel<Nothing, A> =
public inline fun <E> E.invalidNel(): ValidatedNel<E, Nothing> =
Validated.invalidNel(this)

internal const val ValidatedDeprMsg = "Validated functionality is being merged into Either.\n"
@PublishedApi internal const val ValidatedDeprMsg: String =
"Validated functionality is being merged into Either.\n"

private const val DeprAndNicheMsg =
@PublishedApi internal const val DeprAndNicheMsg: String =
"Validated functionality is being merged into Either, but this API is niche and will be removed in the future. If this method is crucial for you, please let us know on the Arrow Github. Thanks!\n https://github.com/arrow-kt/arrow/issues\n"
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ public object either {
Effect.suspended(eff = { EitherEffect { it } }, f = c, just = { it.right() })
}

private const val eitherDSLDeprecation =
@PublishedApi internal const val eitherDSLDeprecation: String =
"The either DSL has been moved to arrow.core.raise.either.\n" +
"Replace import arrow.core.computations.* with arrow.core.raise.*"
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ public object nullable {
Effect.suspended(eff = { NullableEffect { it } }, f = func, just = { it })
}

private const val nullableDSLDeprecation =
@PublishedApi internal const val nullableDSLDeprecation: String =
"The nullable DSL has been moved to arrow.core.raise.nullable.\n" +
"Replace import arrow.core.computations.* with arrow.core.raise.*"
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ public object option {
Effect.suspended(eff = { OptionEffect { it } }, f = func, just = { Option.fromNullable(it) })
}

private const val optionDSLDeprecation =
@PublishedApi internal const val optionDSLDeprecation: String =
"The option DSL has been moved to arrow.core.raise.option.\n" +
"Replace import arrow.core.computations.* with arrow.core.raise.*"
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ public object result {
kotlin.runCatching { block(ResultEffect) }
}

private const val resultDSLDeprecation =
@PublishedApi internal const val resultDSLDeprecation: String =
"The result DSL has been moved to arrow.core.raise.result.\n" +
"Replace import arrow.core.computations.* with arrow.core.raise.*"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public object either {
effect(f).toEither()
}

private const val eitherDSLDeprecation =
@PublishedApi internal const val eitherDSLDeprecation: String =
"The either DSL has been moved to arrow.core.raise.either.\n" +
"Replace import arrow.core.computations.either with arrow.core.raise.either"
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ public class IorEagerEffectScope<E>(semigroup: Semigroup<E>, private val effect:
override suspend fun <B> shift(r: E): B = effect.shift(combine(r))
}

private const val iorDSLDeprecation =
@PublishedApi internal const val iorDSLDeprecation: String =
"The ior DSL has been moved to arrow.core.raise.ior.\n" +
"Replace import arrow.core.computations.ior with arrow.core.raise.ior"
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ public object nullable {
effect<Nothing?, A> { f(NullableEffectScope(this)) }.orNull()
}

private const val nullableDSLDeprecation =
@PublishedApi internal const val nullableDSLDeprecation: String =
"The nullable DSL has been moved to arrow.core.raise.nullable.\n" +
"Replace import arrow.core.computations.nullable with arrow.core.raise.nullable"
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ public object option {
effect<None, A> { f(OptionEffectScope(this)) }.toOption()
}

private const val optionDSLDeprecation =
@PublishedApi internal const val optionDSLDeprecation: String =
"The option DSL has been moved to arrow.core.raise.option.\n" +
"Replace import arrow.core.computations.option with arrow.core.raise.option"
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public object result {
effect<Throwable, A> { f(ResultEffectScope(this)) }.toResult()
}

private const val resultDSLDeprecation =
@PublishedApi internal const val resultDSLDeprecation: String =
"The result DSL has been moved to arrow.core.raise.result.\n" +
"Replace import arrow.core.computations.* with arrow.core.raise.*"
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ public final class arrow/fx/coroutines/ResourceExtensionsKt {
}

public final class arrow/fx/coroutines/ResourceKt {
public static final field nextVersionRemoved Ljava/lang/String;
public static final fun asFlow (Larrow/fx/coroutines/Resource;)Lkotlinx/coroutines/flow/Flow;
public static final fun release (Larrow/fx/coroutines/Resource;Lkotlin/jvm/functions/Function2;)Larrow/fx/coroutines/Resource;
public static final fun release-zgiIeyo (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)Larrow/fx/coroutines/Resource;
Expand Down
Loading