:kotlin_emoji::kotlin_emoji: <https://blog.jetbrai...
# announcements
a
KK Introducing Kotlin 2.0! KK With the release of Kotlin 2.0, which features the stable K2 compiler, we are now entering a new era of Kotlin. This update isn’t just about speed; it’s a comprehensive upgrade to improve your development experience across all platforms. Here’s what you can look forward to: • Twice as fast compilations • Enhanced code analysis • Improved IDE performance • First-party support for multiplatform projects • Seamless migration Explore how Kotlin 2.0 can elevate your projects and get started with it today. Check out our latest blog post for more details. ➡️ Learn more about Kotlin 2.0 ⬅️
kodee happy 9
2️⃣ 23
0️⃣ 23
👌 6
godmode 7
🐕 5
🦜 30
🔥 37
kodee greetings 65
K 184
kodee loving 33
🎉 70
K 159
m
Very nice. Thanks a lot. The gradle plugin also already exists -> https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm See you at #KotlinConf
thank you color 2
m
Congrats to the team, and well done! Such a significant accomplishment.
🙌 9
🙌🏾 1
1
s
👍
👍🏼 1
m
First Spring Boot app already migrated without any findings/problems. kodee happy
a
I have a question. In your K2 compiler migration guide, is the below code correct? I think this is wrong. Here, Tau interface doesn't implements any other interfaces, then how this if block executes?
Copy code
interface Rho {
    operator fun inc(): Sigma = TODO()
}

interface Sigma : Rho {
    fun sigma() = Unit
}

interface Tau {
    fun tau() = Unit
}

fun main(input: Rho) {
    var unknownObject: Rho = input

    // Check if unknownObject inherits from the Tau interface
    if (unknownObject is Tau) {

        // Use the overloaded inc() operator from interface Rho,
        // which smart-casts the type of unknownObject to Sigma.
        ++unknownObject

        // In Kotlin 2.0.0, the compiler knows unknownObject has type
        // Sigma, so the sigma() function can be called successfully.
        unknownObject.sigma()

        // In Kotlin 1.9.20, the compiler thinks unknownObject has type
        // Tau, so calling the sigma() function throws an error.

        // In Kotlin 2.0.0, the compiler knows unknownObject has type
        // Sigma, so calling the tau() function throws an error.
        unknownObject.tau()
        // Unresolved reference 'tau'

        // In Kotlin 1.9.20, the compiler mistakenly thinks that 
        // unknownObject has type Tau, so the tau() function can be
        // called successfully.
    }
}
s
Hi team, why we have not added all the changes in official docs link of whats new in kotlin 2.0, like union type for errors, backing field etc, Or may be more but i came across these two as i got to know about them from twitter and some other places but didnt found them in official docs.
a
Hey @Ahsan Ullah Rasel The code is 100% correct. The question was raised before, so we added a note about it. Refer to this PR for details: https://github.com/JetBrains/kotlin-web-site/pull/4224
a
Hello @Andrey Polyakov [JB] Thank you for adding the note, as this now clears up the confusion.
🫡 1
a
> Hi team, why we have not added all the changes in official docs link of whats new in kotlin 2.0, like union type for errors, backing field etc, Or may be more but i came across these two as i got to know about them from twitter and some other places but didnt found them in official docs. Hey @Sunil Kumar Could you add some details about features you are talking about? Backing fields update is still in progress (it is still a prototype, not even Experimental status) https://youtrack.jetbrains.com/issue/KT-14663 Union types for errors are not implemented yet.
s
Ok Got it, thanks @Andrey Polyakov [JB] for clarification, that was my confusion if they are released or not as i missed the KotlinKonf online so i was not aware.
🙌 1