# language-evolution

Dirk Hoffmann

03/13/2023, 4:13 PM
HI, while playing around with context receivers
context(someInstance, someInterface)
I just realized, that if you want to use context receiver declaration on
override fun xyz(...)
methods, then you have to have the context declaration on BOTH, the interface fun definition AND the implementing class fun (correct??). That is ok by itself ... but the compile time error message for this is 2-pages long and really really cryptic with no hint what might be the problem whatsoever ... don't know if this is the correct channel, but I would love to see a bit more "readable and usefull" compiler error for that case.


03/14/2023, 12:21 PM
Yes. You have to use it on both. Compiler currently crashes if there is a mismatch, e.g.

Dirk Hoffmann

03/17/2023, 10:21 PM
@elizarov yes, that's ok ... but are there any plans (e.g. included in the "outcomes" of your linked ticket) to present the user a more meaningful error message? It took me half a day to decrypt the stacktrace and to find the root cause in the missing context() on the interface function.
BTW, right now I have some new finding, and am not sure if I should file a bug for this, maybe you can have a look at it upfront: working version:
Failing version:
context() is Failing when the function is implemented via a delegated interface.