Phase COMPILER_REQUIRED_ANNOTATIONS causes errors in the kotlinx serialization tests:
org.jetbrains.kotlin.fir.symbols.FirLazyResolveContractViolationException: `lazyResolveToPhase(COMPILER_REQUIRED_ANNOTATIONS)` cannot be called from a transformer with a phase COMPILER_REQUIRED_ANNOTATIONS.
`lazyResolveToPhase` can be called only from a transformer with a phase which is strictly greater than a requested phase;
i.e., `lazyResolveToPhase(A)` may be only called from a lazy transformer with a phase B, where A < B. This is a contract of lazy resolve
If a parameterized type ref is passed during the `FirSupertypeGenerationExtension.TypeResolveService#resolveUserType` call, the `WRONG_NUMBER_OF_TYPE_ARGUMENTS` error occurs.
Added inspections to check:
- custom serializer on class has as many parameters in primary constructor as the serializable class of type arguments
- all parameters in custom serializer has `KSerializer` type
- property in serializable class not parametrized by type parameter
- custom serializer on property of serializable class have no parameters in primary constructor
Before this commit, fir f/o builder was inconsistently
disabled in some places, while it should work only for lazy declarations
Attempt to use it for non-lazy declarations, without maintaining
invariant, that it would also be used for super classes
led to unpredictable results.
This commit introduces opt-in, and marks all related API to three types
* Propagate error to user
* Fine to use, as it's checked if ir f/o builder is enabled
* Fine to use, as it is definitely a lazy class.
Several cases of missing checks was fixed.
^KT-65707
Currently, REDECLARATION is not reported if two conflicting declarations
are in different source sets (KT-59898). However, when it's fixed,
we want this test to keep testing the signature clash diagnostic,
and not fail because of unexpected REDECLARATION error.
For some reason type parameters end up in
`GlobdalDeclarationTable`, and thus we tracked them in
`IdSignatureClashDetector`, which wasn't right and confused the
diagnostic renderer that uses
`org.jetbrains.kotlin.resolve.MemberComparator` for sorting the
declarations to display in diagnostics. That comparator doesn't know
jow to work with type parameters.
Besides, type parameters, like many other types of declarations, are not
considered public wrt KLIB ABI, so there's no need to show
CONFLICTING_KLIB_SIGNATURES_ERROR for them.
^KT-65723 Fixed
Solves a specific issue with Kotlin serialization, and most likely,
similar issues with synthetic classes.
Types with `$` in other positions will be still rendered incorrectly
due to imprecise conversion of such types from Kotlin to Java
in the analysis API.
Merge-request: KT-MR-14235
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
Suggest removing explicit type arguments when the upper bound is a
captured type since the only way to satisfy the upper bounds is
by letting the type variable be inferred to its bound.
#KT-65681 Fixed
- Fix unrelated resolution errors in an existing test
- Add separate test for sealed classes and interfaces in HMPP projects,
located in different source sets
KT-64919
It was supposed to check only function types...
Also note that it's probably impossible
to write a simpler test right now,
because we have a massive problem that
we ignore `FirTypeRef`s with `null`
sources despite having a dedicated
family of checkers for them
specifically. This will be fixed
separately as KT-65647.
^KT-65584 Fixed
^KT-65647
The diagnostic target source element
type was changed to prevent crash due
to `checkPsiTypeConsistency()` in
`duplicateParameterNameSimplified.fir.kt`
^KT-65584
- Handle flexible types in recursion check
- Handle intersected supertypes separately
- Make check when not to approximate captured types in type argument
position more fine-grained.
Only apply it to case when the captured type is replaced by a star
projection.
All other cases are handled by recursive calls to
approximateCapturedType
#KT-65377 Fixed
Copying tree part happens in two stages.
1. Collect all symbols to copy and create new version of them
2. Do copy tree, replacing collected symbols
For f/o builder 1-st stage traversed more nodes, than seconds.
This led to unbound symbols in tree.
^KT-65273 Fixed
There's no issue or tests because it doesn't affect user-visible
behavior. The only effect of this change is that after IR fake override
builder is enabled by default (KT-61360), tests in
`compiler/testData/ir/sourceRanges` will now pass because using class
start/end is the current behavior in K2 and test data checks it.