mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
In TopDownAnalyzerFacadeForJVM, we now always use the "load built-ins from module dependencies" behavior that was previously only enabled with the dedicated CLI argument -Xload-builtins-from-dependencies. However, sometimes we compile code without kotlin-stdlib in the classpath, and we don't want everything to crash because some standard type like kotlin.Unit hasn't been found. To mitigate this, we add another module at the end of the dependencies list, namely a "fallback built-ins" module. This module loads all built-in declarations from the compiler's class loader, as was done by default previously. This prevents the compiler from crashing if any built-in declaration is not found, but compiling the code against built-ins found in the compiler is still discouraged, so we report an error if anything is resolved to a declaration from this module, via a new checker MissingBuiltInDeclarationChecker. Also introduce a new CLI argument -Xsuppress-missing-builtins-error specifically to suppress this error and to allow compiling code against compiler's own built-ins. #KT-19227 Fixed #KT-28198 Fixed