Brais Gabin
06/26/2024, 10:18 AMKtFile and KtElement all over the place. For that reason I'm looking for a way to start using FIR but be able to fallback to PSI when needed and then keep refactoring removing those fallbacks until we only use FIR. I'm using this code: https://gist.github.com/handstandsam/9a561fc78b593039d1dd500fae14b355 to get a List<FirFile> and then convert those to `KtFile`s using firFile.psi!! as KtFile (https://github.com/detekt/detekt/pull/7406/files). The problem is that firFile.psi always return null. I saw that the source that I'm getting is a KtLightSourceElement instead of a KtPsiSourceElement that will make psi to return a not-null value. How can I accomplish this? Does it even have sense the approach that I'm taking to move to FIR?dmitriy.novozhilov
06/26/2024, 10:27 AM-Xuse-fir-lt=false to enable PSI parser instead of LT parser
If you are setting up the CompilerConfiguration manually, you need to set CommonConfigurationKeys.USE_LIGHT_TREE to falseBrais Gabin
06/26/2024, 10:52 AMconfiguration.put(CommonConfigurationKeys.USE_LIGHT_TREE, false) but it doesn't change anything. Looking at the code I see that compileModuleToAnalyzedFir calls unconditionally to buildResolveAndCheckFirViaLightTree.dmitriy.novozhilov
06/26/2024, 10:55 AMFirKotlinToJvmBytecodeCompiler.compileModulesUsingFrontendIRAndPsi
sourceBrais Gabin
06/26/2024, 12:54 PMFirKotlinToJvmBytecodeCompiler.FrontendContext and then calling to runFrontend. Well, "working" I still have lots of things to figure it out but at least I get a list of `FirFile`s with working psi property. Thanks!dmitriy.novozhilov
06/26/2024, 12:59 PMBrais Gabin
06/26/2024, 1:06 PMDo I understand correctly that detekt uses the compiler to get some resolve information, like types or resolved symbols?Yes, you understand it correctly. Thanks! To be honest I started yesterday and I'm doing just proves of concept to look which is the better way to take. I'm going to check to that documentation that you link 🙂