diff --git a/build.gradle.kts b/build.gradle.kts index fd332b2..5d96a9c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,6 +44,15 @@ kotlin { jvmToolchain(8) } +// backward compat for users on older versions of Kotlin +// we use "data objects" in test code, so limit this to production code +tasks.named("compileKotlin") { + compilerOptions.apply { + apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6) + languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_6) + } +} + allprojects { val varintName = project.name @@ -119,4 +128,4 @@ allprojects { sign(publishing.publications["mavenJava"]) } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/io/exoquery/fansi/Fansi.kt b/src/main/kotlin/io/exoquery/fansi/Fansi.kt index 7459c72..3decd4c 100644 --- a/src/main/kotlin/io/exoquery/fansi/Fansi.kt +++ b/src/main/kotlin/io/exoquery/fansi/Fansi.kt @@ -755,8 +755,8 @@ final class Trie(val strings: List>){ when { list.isEmpty() -> { val allChildChars = continuations.map{ (a, _) -> a[0] } - val minVal = allChildChars.min() - val maxVal = allChildChars.max() + val minVal = allChildChars.minOrNull() ?: error("No chars") + val maxVal = allChildChars.maxOrNull() ?: error("No chars") val arrVal = Array?>(maxVal - minVal + 1, { null }) for( (char, ss) in continuations.groupBy { (a, _) -> a[0] } ){