83a4b6396a
Compiler plugins can add new source roots to the next compilation round by using `AnalysisResult.RetryWithAdditionalRoots`. Some plugins added already existing source roots to this list in some cases. For example, this is reproducible with `square/anvil` with incremental compilation (KT-45100, KT-44925). Psi2ir didn't deduplicate the source files before, which resulted in several classes with the same name linked to the same symbol. This led to a "symbol is already bound" exception, and in case of KT-44925, to an additional NPE when we were rendering the class to display it in the message. The solution is to deduplicate classes before psi2ir. Note that this commit has two changes, in CLI and in psi2ir. Any one of these is sufficient for fixing the problem, however both are made just to make it more future-proof against new components and/or changes in existing subsystems (e.g. fir2ir). In the old JVM backend, similar deduplication was happening in `ClassFileFactory.registerSourceFiles`, which is why the problem is not reproducible there. #KT-45100 Fixed