Skip to content

Kotlin Compiler Bugs

Andrey Kuleshov edited this page Apr 30, 2024 · 2 revisions

Неправильное форматирование:

        it.shortName.toString() == (Suppress::class.simpleName) &&
                it.valueArgumentList
                    ?.arguments
                    ?.any { annotation -> annotation.text.trim('"') == name }
                ?: false // idea formats it in the following way

================== Отсутствие ран конфигурации для MACOSARM64 (M1)

==================

/**

  • [String.]
  • @see String.1 */ fun main() { println("TER") }

=================== Форматирование в идее:

val a = 5 + 5 + 6 +

val a = 5 + 6 + 7 +

=================== Автофиксинг в идее: "Check for instance is always" @Suppress("UnsafeCallOnNullableType") fun KtProperty.getDeclarationScope() = // FixMe: class body is missing here getParentOfType(true) .let { if (it is KtIfExpression) it.then!! else it } .let { if (it is KtTryExpression) it.tryBlock else it } <------- вот тут говорит, что всегда "false", а ставит true as KtBlockExpression?

============================= БАГИ В НАТИВЕ ====================== aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - не падает aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - падает aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - падает aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "this string does not look as float isn't it?"

Что нужно изменить: 1)

================== баги в компиляторе: FAILURE: Build failed with an exception.

  • What went wrong: Project 'kotlin-native' not found in root project 'kotlin'.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

как починить: val isKotlinNativeEnabled: Boolean = getBoolean("kotlin.native.enabled")

Add kotlin.build.isObsoleteJdkOverrideEnabled=true to the local.properties file, so build will only use JDK 1.8+

@Test fun checkOverflowZero() { assertEquals(1.0 / 0.0, "+99999.9e99999999999999999999999999999999999999999999999999999".toDouble()) assertEquals(0.0, "99999.9e-99999999999999999999999999999999999999999999999999999".toDouble()) }

5.5d -> float can be converted? 5.5f -> double?

============================================================================

Regex((.+).huawei.).match("huawei")

=============================================================================

equals for empty lists in Kotlin 1.4-1.5:

    println(listOf(1L) == listOf(1))
    println(emptyList<Int>() == emptyList<Long>())

Strange compilaion error in 1.6, worked previously:

    val a: MutableList<Int>? = mutableListOf<Int>()
    assertEquals(listOf<Int>(), a)

=============================================================================== IDEA autofixes:

public open class TomlFileReader( private val config: KtomlConf = KtomlConf(), override val serializersModule: SerializersModule = EmptySerializersModule ) : Toml(config, serializersModule) {