Is it possible to check `is` and `as` expressions?...
# compiler
t
Is it possible to check
is
and
as
expressions? Is there
DeclarationChecker
analog for such checks?
y
If you're asking about FIR there's
ExpressionCheckers
t
Is FIR used for IR?
d
FIR is not directly related to IR FIR (aka K2) is a new compiler frontend, which works before backend IR stage If you want to report diagnostics on
is
and
as
from compiler plugin then there are two options: 1. Create
DeclarationChecker
in your plugin for old frontend (it's the one with PSI and BindingContext) and manually traverse body with some visitor 2. Write frontend part of your plugin for FIR and create your own
FirTypeOperatorCallChecker
(it will be called only for
is
and
as
expression) First option can be used in production plugin right now (because current frontend is stable) Second option will require to completely rewrite fronted part of your plugin, but it provide more powerful and nice API, so it's great option for some research And if you choose first option you will still require to rewrite your plugin to FIR when it becomes stable and default
2