How to "reset" embedded compiler in Idea?

So I seem to hit this or that compiler bug relatively often, causing random errors to be reported within my code (usually related to type inference, but there has been some really weird/undecipherable stuff, too), which I can’t get rid of, making it hard to continue programming.

Usually, things go back to normal if I drop to command line and do something like ./gradlew clean test. But that takes a fairly long time (easily a few minutes), because it involves some subprojects in JS and whatnot.

Anyway, my question is - is there some way to achieve the same from within Idea? Looks like the bugs are related to incremental compilation and the idea is to make the compiler forget everything it knows, as it seems to do when the code is compiled anew externally… The “Rebuild project” action doesn’t seem to work that way…

Try File → Invalidate Caches / Restart…

Thanks for the suggestion… I tried, but that also takes ~2 minutes, as it takes that long for “Indexing…” to finish…

After some more thought, I guess it’s unlikely that there’s a “Reset compiler state” action in Idea, so I’m changing my question - does anyone know under what conditions the internal compiler discards its incremental state and/or what’s the easiest (least time consuming) way to trigger that?

Have you tried killing the Kotlin compile daemon? Here is how to do it with PowerShell:

( ( jps | Select-String KotlinCompileDaemon | Select-Object Line | Select-String '[0-9]+' ).Matches[0].Value | ForEach-Object { Get-Process -Id $_ } ).kill()

No, I didn’t even know it existed :slight_smile:

Will try it out next time I hit the problem and report back… Thanks!