This fixes a compiler crash
IllegalStateException: Captured type for incorporation shouldn't escape
from incorporation
The crash occurs when a captured type with status FOR_INCORPORATION
is two layers deep inside a captured type with status FROM_EXPRESSION.
We first check if approximation is required for the most outer captured
type in AbstractTypeApproximator.approximateCapturedType.
Then we encounter the second captured type with status FROM_EXPRESSION
in AbstractTypeApproximator.approximateParametrizedType.
At this point, we stop checking and miss the third captured type with
status FOR_INCORPORATION.
Unfortunately, we can't check recursively if nested captured types
need to be approximated because of types with recursive super types
(the original reason why the extra check was introduced).
That's why we restrict the second check to types with recursive
super types, effectively restoring the previous behavior for all other
types.
#KT-65050 Fixed
This is necessary to prevent exponential growth of the attribute
structure.
Since we usually care for the most inner value of a
ConeAttributeWithConeType like EnhancedTypeForWarningAttribute, this
shouldn't alter any behavior.
The error-level enhancement is kept as warning-level and a new
LanguageFeature is introduced to turn the warning into an error.
#KT-63208 Fixed
#KT-63209
(cherry picked from commit 371b1eb3d5)
This is required for EnhancedTypeForWarningAttribute because scopes
should not be reused between cone types with different values of
this attribute.
#KT-63208
(cherry picked from commit 9189154cae)
3aa84906 changed native metadata serialization to use proper platform
session, but it caused a new bug: FirKLibSerializerExtension uses
FirProvider from the passed session to get a containing file of
serialized declaration to put some extension into the metadata. And
platform session doesn't contain information about any declarations
except platform ones
So it's needed to use the proper FirProvider in it, which can be
extracted from Fir2IrComponents. This provider contains providers from
all sessions that are being compiled plus providers for top-level
declarations generated by compiler plugins
^KT-65024 Fixed
^KT-59074 Fixed
This solution is not ideal. Ideally, the allopen compiler plugin
shouldn't report `private` properites as `open` KT-64980, but it will
unpredictably break other things.
For some reason, codegen box test was not added in 082c337faa. The main
point of it now is to check that everything works correctly in the
IrFakeOverrideBuilder mode.
Fir-based lazy type alias is required in IR text tests to check that
lazily loaded IR is equivalent to deserialized IR (module bodies)
and does not cause ABI compatibility issues in KLIB-based backends.
^KT-65033
This commit adds support for the Parcelize plugin to generate default
serialization implementation for the kotlin.time.Duration. As Parcelize
already supports serializing some of the kotlin library types it makes
sense to support more common ones for the user convenience.
https://issuetracker.google.com/issues/264614661
Affects IR Evaluator in IDEA.
The problem is happening because
`ReflectiveAccessLowering#fieldLocationAndReceiver` returns the class
the field was called on, not the class the field was declared in.
Then the class is used for obtaining a field by using reflection's
`getDeclaredField` to make the field accessible after.
But `getDeclaredField` doesn't work for field declared in a superclass,
hence the error.
#KT-65012 fixed
Merge-request: KT-MR-13919
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>