Context-sensitive resolution in Kotlin 2.2

Write the same code with fewer qualifiers

View at original site


Kotlin 2.2 makes the compiler even smarter by introducing context-sensitive resolution as an experimental feature. This improvement lets you use enum entries and similar “static” values, as well as types from sealed hierarchies without having to qualify them with the containing type, whenever that’s already obvious from the context.

Related Resources

Your First AI Agent in Kotlin
Your First AI Agent in Kotlin
Get started with Koog today!
Exposed inline value classes for Java
Exposed inline value classes for Java
Use value classes from Java code with Kotlin 2.2
Nested type aliases in Kotlin 2.2
Nested type aliases in Kotlin 2.2
Use type aliases inside other structures