From 03b3817a3a4b97e087fdafaf79076a4c3db3dedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Thu, 12 Sep 2024 17:11:32 +0200 Subject: [PATCH] build(dsl): Add the kotlin.internal.OnlyInputTypes annotation It is required to avoid upcasting by the compiler in cases like: ```kotlin Foo::anInt eq "foo" ``` By default, the Kotlin compiler will upcast both values, so it will consider `eq` to be called with the type parameter `Any`. That is barely useful to us, though. Using `OnlyInputTypes` we can refuse upcasting. Instead, the compiler will refuse the above code, which is what we want. --- dsl/build.gradle.kts | 2 ++ .../src/commonMain/kotlin/stdlib}/StandardLibrary.kt | 0 2 files changed, 2 insertions(+) rename {prototype/dsl/src/main/kotlin/annotations => dsl/src/commonMain/kotlin/stdlib}/StandardLibrary.kt (100%) diff --git a/dsl/build.gradle.kts b/dsl/build.gradle.kts index 5c662253..b899fba1 100644 --- a/dsl/build.gradle.kts +++ b/dsl/build.gradle.kts @@ -25,6 +25,8 @@ kotlin { nodejs() } + compilerOptions.freeCompilerArgs.add("-Xallow-kotlin-package") + sourceSets.commonMain.dependencies { api(projects.bson) } diff --git a/prototype/dsl/src/main/kotlin/annotations/StandardLibrary.kt b/dsl/src/commonMain/kotlin/stdlib/StandardLibrary.kt similarity index 100% rename from prototype/dsl/src/main/kotlin/annotations/StandardLibrary.kt rename to dsl/src/commonMain/kotlin/stdlib/StandardLibrary.kt -- 2.51.2