Using FIR with Context Receivers, I'm getting `jav...
# compiler
y
Using FIR with Context Receivers, I'm getting
java.lang.IllegalArgumentException: No argument for parameter VALUE_PARAMETER name:_context_receiver_1 index:1
. The printed IR shows that the function I'm calling has a dispatch receiver, 2 context receivers, and a normal parameter, but the IR calls it just by providing the dispatch receiver and the parameter:
Copy code
CALL 'public abstract fun display <T1, SubT1> (_context_receiver_0: <root>.Kind<T1 of <root>.Display.display, SubT1 of <root>.Display.display>, _context_receiver_1: <root>.Display<SubT1 of <root>.Display.display, SubT1 of <root>.Display.display>, t1: T1 of <root>.Display.display): kotlin.String declared in <root>.Display' type=kotlin.String origin=null
  <T1>: SubT1 of <root>.ListDisplay.display$lambda-0
  <SubT1>: SubT1 of <root>.ListDisplay.display$lambda-0
  $this: GET_FIELD 'FIELD FIELD_FOR_CAPTURED_VALUE name:$_context_receiver_1 type:<root>.Display<SubT1 of <root>.ListDisplay.display$lambda-0, SubT1 of <root>.ListDisplay.display$lambda-0> visibility:public/*package*/ [final]' type=<root>.Display<SubT1 of <root>.ListDisplay.display$lambda-0, SubT1 of <root>.ListDisplay.display$lambda-0> origin=null
    receiver: GET_VAR '<this>: <root>.ListDisplay.display$lambda-0.<no name provided> declared in <root>.ListDisplay.display$lambda-0.<no name provided>.invoke' type=<root>.ListDisplay.display$lambda-0.<no name provided> origin=null
  _context_receiver_0: TYPE_OP type=SubT1 of <root>.ListDisplay.display$lambda-0 origin=CAST typeOperand=SubT1 of <root>.ListDisplay.display$lambda-0
    GET_VAR 'it: kotlin.Any? declared in <root>.ListDisplay.display$lambda-0.<no name provided>.invoke' type=kotlin.Any? origin=null
Is this even worth reporting? Because it seems like FIR obviously doesn't support the basic functionality of context receivers. Is there anywhere I can see the progress of FIR at least? any specific youtrack issues I should be on the lookout for?
d
AFAIR this issue already fixed, but I didn't found corresponding ticket You can try to use
1.7.20-dev-1687
from bootstrap repo instead of
1.7.0-RC
If it will still appear then please report a ticket with reproducer
y
Yep, it worked! Thank you so so much! I'll definitely be trying FIR out on the dev versions from now on. Is it worth it though to report FIR bugs, especially with context receivers? Since both are rapidly evolving, I have a feeling that some of the bugs I encounter might already be on the radar.
Oh, and very importantly, I've seen mentions of putting the Kotlin IDEA Plugin into "FIR mode". Is that a thing? or is there a dev repo for Kotlin IDEA that's also available?
d
Copy code
Is it worth it though to report FIR bugs, especially with context receivers?
Yes, it will be very helpful. Right now we are at the stage when we fixed all critical places and we're looking for bugs by compiling some opensource projects, which takes a lot of time
There is no simple way to run IDEA plugin with FIR. The only thing you can do is clone idea-community and build our from sources (there is a predefined "Community (Kotlin FIR)" run configuration or something like that)
y
For anyone viewing this thread after the fact: I messed around with the intellij-community repository for longer than I'd want to admit, and my only advice is: don't go crazy. Just follow the build instructions from the readme and then simply run the IDEA FIR task from Intellij. It will open a custom-built intellij idea community instance with support for FIR
👍 1