Fixed the incremental compilation issue,
which had prevented enabling const inlining during constant
evaluation and folding a constant expression with JS code.
^KT-62425
Adding or removing a method or property with
a default implementation to an interface should
invalidate all children: we must regenerate JS code for them
^KT-56237 Fixed
Enabled Partial Linkage may replace entire IR expressions with a stub
during klib linking and loading. This may break the incremental cache
dependency graph. Dropping incremental cache files after updating klibs
(e.g. update klib version) covers almost all cases which
could not be tracked due to a broken dependency graph.
This patch could be reverted after fixing KT-57347
During a translation of the code from js() call to statement list,
the compiler folds the code string. For that it uses property bodies.
However the bodies can not be loaded in an incremental rebuild.
The patch uses the backing field initializers of constant properties.
The initializers are always loaded.
^KT-57002 Fixed
The IR linker is responsible for detecting unbound symbols,
if it skips them for some reason, IC infrastructure must not fail
with unbound symbols exceptions. Anyway, the IR validator
verifies later if there are unbound symbols in
reachable IR and generates the corresponding error.
^KT-56602 Fixed
JS IR BE incremental compilation infrastructure uses
LanguageVersionSettings::toString method to detect if any
compiler features or flags were enabled or disabled.
It is important that the features and flags order are stable
in the result string.
^KT-56580 Fixed
The dependency signature may refer to function type interface properties
(e.g. name) or methods. It is impossible to detect (without hacks)
which binary symbol for loading is required. However, when loading
a property or a method the entire function type interface is loaded.
And vice versa, a loading of function type interface loads
properties and methods as well. Therefore, load the top level signature only,
it must be the signature of function type interface.
^KT-56582 Fixed
The patch removes logic of generating extra IrFiles (fake file) into
IrModuleFragment for the function type interfaces during klib deserialization,
because IC infrastructure can not process files which do not exist in klib.
Instead of adding extra IrFiles during deserialization, the empty files
with required packages are added into Kotlin/JS stdlib physically.
These files are used as containers for function type interface declarations.
Since Kotlin/WASM uses the same klib loading infrastructure as Kotlin/JS,
the the empty files are added into Kotlin/WASM stdlib as well.
The patch also adds a check that IrModuleFagment has files only from klib.
^KT-55720 Fixed
Optimization: often we don't need all hashes for all available symbols.
This patch allows the calculation of the symbol hash only on demand.
This patch also allows cycles for the inline function dependency
graph in the IC infrastructure. Note that the inline function cycles
may crash the inliner, however it is not the IC infrastructure
responsibility to check the cycles.
We do not need to check a default implementation of the interface during
the translation to JS because it must be checked before.
Moreover, this check breaks the produced JS code
if IR is partial loaded, e.g. during the incremental rebuild.
^KT-55716 Fixed
Generally, the library order doesn't matter.
However, after lowering we need to post process
lowered klibs in topological order:
- commit incremental cache artifacts,
- produce JS AST.
The patch uses an ability of the Kotlin library resolver to load klibs
in topological order and drops its reimplementation from IC infrastructure.
There is one side effect:
klibs which are not reachable from the main module, will produce their JS.
This should be more correct than just ignoring them.
A suspend stub for the abstract function
may be created in the context of the child function.
If on an incremental rebuild the stub is created from
the parent context (e.g. a file with the child is not modified),
the resulting LoweredDeclarationSignature will be different.
It will lead to a broken cross-module reference and broken JS code.
Therefore it is required to wrap the creation routine
into StageController::restrictTo() explicitly.
^KT-54934 Fixed