https://kotlinlang.org logo
Title
a

Abhinav

04/09/2023, 12:11 PM
Hey everyone! I am trying to fix this issue. How do we get the function declarations and know if a particular parameter is required not null? I did go through the PSI documentation but couldn't find an appropriate article / example on how to identify if a parameter is required as not null I tried going to the parent declaration by using
parent.context.reference.resolve()
From there on I can get the valueParameters of the function but I am not sure how to check they are nullable or not Any help will be appreciated thanks
d

dmitriy.novozhilov

04/10/2023, 12:07 AM
IIRC resolve call will return you function descriptor from which you extract parameters as ValueParametrDescriptor This descriptor contains its type in returnType property (or so) from which you can extract nullability of the type
a

Abhinav

04/12/2023, 6:29 AM
Thanks
Hi @dmitriy.novozhilov Do we have any common place wiki or any blog or anything where I can look into common functions working and their responsibilities. I checked out the documentation but it's not exhaustive.
d

dmitriy.novozhilov

04/16/2023, 9:32 AM
No, there is no such documentation for the kotlin compiler The one your linked is about intellij idea
a

Abhinav

04/16/2023, 9:34 AM
Yes actually I am focusing on plugins right now. So that's why Any tips which I can follow? Right now I am navigating through the codebase and trying to understand the functionality.
d

dmitriy.novozhilov

04/16/2023, 9:35 AM
But you can check Kdocs for analysis api, AFAIK it more or less documented AA is a new API for interacting with kotlin compiler from ide for a new K2 IDE plugin (and it supports K1 too) https://github.com/JetBrains/kotlin/tree/master/analysis/analysis-api
I can suggest to find parts of code in the main plugin which more or less similar to what you are trying to achieve and check how some things are done here
a

Abhinav

04/16/2023, 9:40 AM
Got it. Will try that. Thanks @dmitriy.novozhilov