Rick Clephas
04/21/2024, 2:44 PMFirDeclarationGenerationExtension
documentation to try and understand what source code details are available to plugins inside `generateFunctions`/`generateProperties`.
According to the docs these functions can be called on the STATUS stage. So now I am wondering how much of the declarationSymbols signatures is available to plugins at that stage:
• can we safely access resolvedStatus
?
• how about resolvedReturnType
? The docs (here and here) say it isn’t safe since implicit return types aren’t resolved yet.
• would it be possible to access explicit return types safely?Rick Clephas
04/21/2024, 2:47 PMfir
object. Which is mentioned in the docs as being illegal in most cases.Rick Clephas
04/21/2024, 2:48 PMdmitriy.novozhilov
04/22/2024, 6:43 AMcan we safely accessNot really If extension was called onresolvedStatus
STATUS
phase, then it might be not over and not all statuses are resolved yet
So visibility
, operator
and infix
parts of the status for override
functions might be not inferred yey
how aboutDocs are correct here. You can accessresolvedReturnType
symbol.fir.returnTypeRef
and manually process case if it is already resolved and if it implicit
In IDE it also may be a FirUserTypeRef
, and in this case it's safe to call resolvedReturnType
(but only in this case)Rick Clephas
04/22/2024, 6:49 AMSo visibility, operator and infix parts of the status for override functions might be not inferred yeyI am particularly interested in the
suspend
modifier. Would there be a similar way with fir
to access that (ignoring other parts of the status that still need to be inferred)?
Docs are correct here. You can access symbol.fir.returnTypeRef and manually process case if it is already resolved and if it implicitCool I’ll give that a try.
dmitriy.novozhilov
04/22/2024, 6:50 AMsuspend
is not inheritable, so it cannot be changed during status resolution and it's ok to access it with raw status
There is even special rawStatus
accessor so you don't need to access .fir