angryziber/kotlin-puzzlers

Windows vs Kotlin

TWiStErRob opened this issue · 0 comments

fun main() {
	doSomething()
	doSomeThing()
}

fun f(block: () -> Unit) {
	block()
}

fun doSomething() {
	f { println("doSomething") }
}

fun doSomeThing() {
	f { println("doSomeThing") }
}

What's the output on Windows?

doSomething
doSomeThing
doSomething
doSomething
doSomeThing
doSomething
doSomeThing
doSomeThing
java.lang.NoClassDefFoundError
Expand
java.lang.NoClassDefFoundError: MainKt$doSomething$1 (wrong name: MainKt$doSomeThing$1)
	at Main.doSomething(Main.kt:11)

Encountered in Kotlin 1.4.32, verified fixed in 1.6.0 (not sure about 1.5.x)
On 1.6.0 two class files are generated: MainKt$doSomething$1 and MainKt$doSomeThing$2
On Unix this is not an issue because most file systems are case sensitive.