Currently, compiler pipelines are heavily couples with
NamedCompilerPhase. Unfortunately, NamedCompilerPhase uses the same
type for Input and Output, thus it is not applicable to phases that
try to transform some data purely.
Thus, we separate this class into two, allowing to have a new
inheritor of NamedCompilerPhase with different Input and Output types.
CommonBackendContext is a complex interface that
actually requires many things to be instantiated.
We don't need it for many parts of compilation pipeline:
frontend or object files phases in native backend would
work just fine without CommonBackendContext.
PhaseConfig is tied to some root `compoundPhase` that
defines the whole compilation pipeline. To lift this restriction
and allow dynamically-defined compilation pipelines, let's move
parts of PhaseConfig interface that do not depend on `compoundPhase`
to an interface.
- Remove unused params from compilerWithIC wrapper.
- Move JsIrBackendContext creation logic into separate function
- Introduce and use compiler interface for IC infrastructure
On dirty rebuild we may reload IR from stdlib,
such reloading may affect files with intrinsics and builtins.
As soon as we load only exported symbols, we must track dependencies
for files with intrinsics or builtins as for others.
This patch implements the logic which updates dependencies for
the stdlib files after loading of intrinsics and builtins.
^KT-54323 Fixed
See KT-49404 for details
In K1, within SubstitutingScope we approximate almost all the types
containing captured types are being approximated to either a lower or
an upper bound.
While mostly, it's being done correctly there are some problems with
approximations for flexible types
So, the parameter's type of A<in Any>::foo is approximated to Inv<in Any!>,
thus allowing to use Inv<*>, while it's obviously unsound.
NB: For the similar example, in B, there are regular TYPE_MISMATCH
because parameter for B<in Any>::foo is approximated to Nothing
Also, it's important to say that
- in K2 everything works because we don't use type approximation there
- approximation algorithm that works incorrectly is only being used in K1
^KT-54332 Fixed
Consider `class A : suspend () -> Unit {}`. Type checks such as `is A`
are now performed via a regular `instanceof` check instead of the special
checks for suspend lambdas.
Expanding macros such as __FILE__ or __TIME__ exposes
arbitrary generated filenames and timestamps from the compiler
pipeline which are not useful for interop and makes the klib
generation non-deterministic. This patch instead redefines
the macros to just map to their name in the properties
available from Kotlin.
Co-authored-by: Johan Bay <jobay@google.com>
- divide adapter.js into different files, which frameworks could load separately
- possibility to inject something to kotlin-test adapter by user
^KT-54418 fixed
Remove annotations, kotlin-stdlib-common, kotlin-stdlib.
Packing those libraries is wrong and probably unexpected. It leads to
artifacts size increase. Can be dangerous because of bad classpath.
And also have a reproducibility issue because of caching tricks around
KotlinVersionCurrentValue class.
KTI-942
#KT-54297 Fixed
Properly substitute surrogate UnitSerializer in the Companion.serializer()
function generated on classes that use polymorphic or sealed serializer
by default. (Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1692)