Compiler problem in when-expressions

Ranges on the LHS of when-expressions can cause a CompilationException:

fun main(args: Array<String>) {
    val a = Math.abs(-1)
    val c = a..10  // works

    val b = 5
    when (b) {
        in c -> foo()  // works
        in a..10 -> foo()  // compilation exception
        in Math.abs(-1)..10 -> foo()  // compilation exception
    }
}

fun foo() {}

Feels like a compiler bug or am I doing something wrong? Couldn’t find an issue for this in YouTrack.

UPDATE: a) I’m using kotlin-1.1.51. b) Adding parentheses doesn’t seem to help either.

Regards,
Peter

This definitely looks like a bug, could you please submit it to the issue tracker: kotl.in/issue ?

Thanks for the link, I just posted it to YouTrack. Didn’t find the option there before.

In case someone’s interested, it’s this issue