Are i understand something wrong or it's kotlin bu...
# announcements
j
Are i understand something wrong or it's kotlin bug? I have : data class Foo ( val initializationType: InitializationType) { val isInitDefault = initializationType == InitializationType.Default } and when i call this val it's working incorrect, but when i transform it to fun or just add custom get() = initializationType == InitializationType.Default it start working like it should what the problem? P.S. InitializationType it's enum
h
What do you see? What do you expect? This seems to work fine:
Copy code
enum class InitializationType {
    TypeA,
    TypeB,
    Default
}

data class Foo(val initializationType: InitializationType) {
	val isInitDefault = initializationType == InitializationType.Default
}

fun main(args: Array<String>) {
    val bar = Foo(InitializationType.Default)
    println(bar.isInitDefault) // prints "true"

    val baz = Foo(InitializationType.TypeA)
    println(baz.isInitDefault) // prints "false"
}