diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts index 24471a9e4..020ef745f 100644 --- a/benchmarks/build.gradle.kts +++ b/benchmarks/build.gradle.kts @@ -1,6 +1,5 @@ @file:Suppress("UNUSED_VARIABLE") -import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile import space.kscience.kmath.benchmarks.addBenchmarkProperties plugins { @@ -81,7 +80,7 @@ benchmark { // Setup configurations targets { register("jvm") - register("js") +// register("js") } fun kotlinx.benchmark.gradle.BenchmarkConfiguration.commonConfiguration() { @@ -152,18 +151,12 @@ benchmark { } } -kotlin.sourceSets.all { - with(languageSettings) { - optIn("kotlin.contracts.ExperimentalContracts") - optIn("kotlin.ExperimentalUnsignedTypes") - optIn("space.kscience.kmath.UnstableKMathAPI") - } -} - -tasks.withType { - kotlinOptions { - jvmTarget = "11" - freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" + "-Xlambdas=indy" +kotlin { + jvmToolchain(11) + compilerOptions { + optIn.addAll( + "space.kscience.kmath.UnstableKMathAPI" + ) } } diff --git a/build.gradle.kts b/build.gradle.kts index d90529e08..57ff022f2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ allprojects { } group = "space.kscience" - version = "0.4.0" + version = "0.4.1-dev" } subprojects { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ba4c391d8..beb2af7f6 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,4 +1,5 @@ plugins { + kotlin("jvm") version "1.9.23" `kotlin-dsl` `version-catalog` } @@ -25,10 +26,8 @@ dependencies { } kotlin { - jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(11)) - } - sourceSets.all { - languageSettings.optIn("kotlin.OptIn") + jvmToolchain(11) + compilerOptions { + optIn.add("kotlin.OptIn") } } diff --git a/gradle.properties b/gradle.properties index 319ce3df0..2b3b0c9ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,7 @@ org.gradle.configureondemand=true org.gradle.jvmargs=-Xmx4096m org.gradle.parallel=true org.gradle.workers.max=4 -toolsVersion=0.15.2-kotlin-1.9.22 + +toolsVersion=0.15.4-kotlin-2.0.0 #kotlin.experimental.tryK2=true #kscience.wasm.disabled=true \ No newline at end of file diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt index cb4da44fe..bf0f9cd22 100644 --- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/base64/base64.kt @@ -4,11 +4,6 @@ */ @file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "ObjectPropertyName", "ClassName", ) diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt index 6380d9b6c..e673130c2 100644 --- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/binaryen/index.binaryen.kt @@ -4,10 +4,6 @@ */ @file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", "PropertyName", "ClassName", "ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING", ) diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/lib.dom.WebAssembly.module_dukat.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/lib.dom.WebAssembly.module_dukat.kt index c3e79c864..2103fcdc9 100644 --- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/lib.dom.WebAssembly.module_dukat.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/lib.dom.WebAssembly.module_dukat.kt @@ -6,10 +6,6 @@ @file:JsQualifier("WebAssembly") @file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "ClassName", ) @@ -22,78 +18,34 @@ import org.w3c.fetch.Response import space.kscience.kmath.internal.tsstdlib.PromiseLike import kotlin.js.Promise -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -internal external interface CompileError { - companion object { - var prototype: CompileError - } -} +internal external interface CompileError -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") internal external interface Global { var value: Any fun valueOf(): Any - - companion object { - var prototype: Global - } } -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") @JsName("Instance") internal external interface Instance1 { var exports: Exports - - companion object { - var prototype: Instance - } } -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -internal external interface LinkError { - companion object { - var prototype: LinkError - } -} +internal external interface LinkError -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") internal external interface Memory { var buffer: ArrayBuffer fun grow(delta: Number): Number - - companion object { - var prototype: Memory - } } -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -@JsName("Module") -internal external interface Module1 { - companion object { - var prototype: Module - fun customSections(moduleObject: Module, sectionName: String): Array - fun exports(moduleObject: Module): Array - fun imports(moduleObject: Module): Array - } -} -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") -internal external interface RuntimeError { - companion object { - var prototype: RuntimeError - } -} +internal external interface RuntimeError + -@Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") internal external interface Table { var length: Number fun get(index: Number): Function<*>? fun grow(delta: Number): Number fun set(index: Number, value: Function<*>?) - - companion object { - var prototype: Table - } } internal external interface GlobalDescriptor { diff --git a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/nonDeclarations.WebAssembly.kt b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/nonDeclarations.WebAssembly.kt index ad97c259d..21e32aeab 100644 --- a/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/nonDeclarations.WebAssembly.kt +++ b/kmath-ast/src/jsMain/kotlin/space/kscience/kmath/internal/webassembly/nonDeclarations.WebAssembly.kt @@ -3,13 +3,6 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", -) package space.kscience.kmath.internal.webassembly diff --git a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/utils.kt b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/utils.kt index f06137c4a..b48a8fdba 100644 --- a/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/utils.kt +++ b/kmath-ast/src/jvmTest/kotlin/space/kscience/kmath/ast/utils.kt @@ -12,8 +12,6 @@ import space.kscience.kmath.expressions.Symbol import space.kscience.kmath.operations.Algebra import space.kscience.kmath.operations.Float64Field import space.kscience.kmath.operations.Int32Ring -import kotlin.contracts.InvocationKind -import kotlin.contracts.contract import space.kscience.kmath.asm.compile as asmCompile import space.kscience.kmath.asm.compileToExpression as asmCompileToExpression @@ -43,7 +41,6 @@ private object PrimitiveAsmCompilerTestContext : CompilerTestContext { internal actual inline fun runCompilerTest(action: CompilerTestContext.() -> Unit) { - contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) } action(GenericAsmCompilerTestContext) action(PrimitiveAsmCompilerTestContext) } diff --git a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShapeND.kt b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShapeND.kt index 2b30d35e4..9a32d3a88 100644 --- a/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShapeND.kt +++ b/kmath-core/src/commonMain/kotlin/space/kscience/kmath/nd/ShapeND.kt @@ -6,7 +6,6 @@ package space.kscience.kmath.nd import space.kscience.kmath.UnsafeKMathAPI -import kotlin.jvm.JvmInline /** * A read-only ND shape diff --git a/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/functions/testUtils/Rational.kt b/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/functions/testUtils/Rational.kt index 0160b2c97..df7dfec79 100644 --- a/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/functions/testUtils/Rational.kt +++ b/kmath-functions/src/commonTest/kotlin/space/kscience/kmath/functions/testUtils/Rational.kt @@ -159,7 +159,7 @@ class Rational { override fun equals(other: Any?): Boolean = when (other) { is Rational -> numerator == other.numerator && denominator == other.denominator - is Int -> numerator == other && denominator == 1L + is Int -> numerator == other.toLong() && denominator == 1L is Long -> numerator == other && denominator == 1L else -> false } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt index 7f6fb2d26..9ba20df1a 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram.kt @@ -33,7 +33,7 @@ public interface Histogram> { /** * Find existing bin, corresponding to given coordinates */ - public operator fun get(point: Point): B? + public operator fun get(point: Point): B? /** * Dimension of the histogram @@ -57,7 +57,7 @@ public interface HistogramBuilder { /** * Increment appropriate bin with given value */ - public fun putValue(point: Point, value: V = defaultValue) + public fun putValue(point: Point, value: V = defaultValue) } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram1D.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram1D.kt index ef72f2630..75f18a5a4 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram1D.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/Histogram1D.kt @@ -42,7 +42,7 @@ public interface Histogram1DBuilder : HistogramBuilder, value: V) { + override fun putValue(point: Point, value: V) { require(point.size == 1) { "Only points with single value could be used in Histogram1D" } putValue(point[0], value) } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogramGroupND.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogramGroupND.kt index 8a914530b..4a53ea1a0 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogramGroupND.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogramGroupND.kt @@ -93,7 +93,7 @@ public class UniformHistogramGroupND>( val hBuilder = object : HistogramBuilder { override val defaultValue: V get() = valueAlgebraND.elementAlgebra.one - override fun putValue(point: Point, value: V) = with(valueAlgebraND.elementAlgebra) { + override fun putValue(point: Point, value: V) = with(valueAlgebraND.elementAlgebra) { val index = getIndexOrNull(point) ndCounter[index].add(value) }