Hi, I’m not sure if this has been reported. One of...
# compiler
k
Hi, I’m not sure if this has been reported. One of the causes I’ve come across for IR lowering is that when you have some interface method that requires a context receiver A, and then the concrete implementation requires A, B - the compiler shits its pants. This is OK behaviour because you aren’t conforming to the contract of the interface, however, there are zero hints that this is the root cause (it would be nice if IntelliJ highlighted this problem).
Copy code
class A
class B

interface Foo {

    context(A)
    fun getSomething(): Unit
}

class FooImpl : Foo {

    context(A, B)
    override fun getSomething() {
        println("Hello, world!")
    }
}

fun main() {
    with(A()) {
        with(B()) {
            FooImpl().getSomething()
        }
    }
}
If you were to switch the context receiving part from the interface requiring A, and the implementation specifying A, B, it all works fine.