This implementation only checks annotations set on expect/actual
declarations and requires further refinement (e.g. checking of other
annotation targets, class scopes within typealiases).
^KT-58551
Cases when default argument inhertied from super class are allowed.
Some tests for default arguments already exist and can be found in
`testData/diagnostics/tests/multiplatform/defaultArguments`, for example
`annotationsViaActualTypeAlias.kt`.
^KT-57614 Fixed
Merge-request: KT-MR-10356
Merged-by: Roman Efremov <Roman.Efremov@jetbrains.com>
Review: https://jetbrains.team/p/kt/reviews/9967
This commit fixes:
Cause 2: java.lang.IllegalStateException: Not reachable case. We can always suggest making `open val` property `final`
at org.jetbrains.kotlin.resolve.DeclarationsChecker.reportMustBeInitialized(DeclarationsChecker.kt:845)
at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkPropertyInitializer(DeclarationsChecker.kt:778)
at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkProperty(DeclarationsChecker.kt:614)
at org.jetbrains.kotlin.resolve.DeclarationsChecker.process(DeclarationsChecker.kt:106)
at org.jetbrains.kotlin.resolve.BodyResolver.resolveBodies(BodyResolver.java:258)
Reproducible in K1 & K2
From user point of view it's an improvement in compilation message.
From technical point of view it's an introduction of new compilation
diagnostic.
Review: https://jetbrains.team/p/kt/reviews/9967
I'm going to deprecate `open val` case in the next few commits KT-57553.
But it is always possible to suggest using `final` for `open val` case.
^KT-58587 Fixed
Review: https://jetbrains.team/p/kt/reviews/10136
This commit is important in scope of KT-57553. It makes the migration
more smooth.
Other related tests:
- testUninitializedOrReassignedVariables
- testAugmentedAssignmentInInitializer
Leaking of a reference (via publishing to binding trace) of not fully
initialized object could lead to unpredicted and unexpected NPEs
iff some exception (like PCE or InvalidPsiAccess) happens between
the publishing and initialization.
#KT-57514
#KT-56388
#KT-56364
Merge-request: KT-MR-10052
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
Revert "Create SimpleFunctionDescriptorImpl under nonCancelableSection"
This reverts commit d959b3a289b24487dba2e36da94a34a0dbb4661e.
Revert "Create PropertyDescriptorImpl under nonCancelableSection"
This reverts commit 362e8c2151c8e18009463fd51b995cce27ac8eb5.
Merge-request: KT-MR-9772
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
The problem results in broken import quick fix and import optimizer on
the IDE side [1].
`AssignResolutionAltererExtension` introduced a possibility to override
resolution of assignment statements. The inconsistency though is
that `KtSimpleNameReference.getResolvesByNames` doesn't return a name
for the overridden `=`. Kotlin as a language doesn't support this [2].
This commit eliminates the drawback above:
1. It fixes the name `assign` the `=` can be resolved to [3].
This eliminates the need to search for the name, bypassing the
plugins.
2. `KtSimpleNameReference.getResolvesByNames` returns `assign` among
other names in case it deals with binary `=` and assignment is
resolved.
3. `KtCompilerPluginsProvider` was extended to check plugins' presence.
K1 implementation added.
----------------------------------------------------------------
[1]: https://youtrack.jetbrains.com/issue/KTIJ-24390
[2]: OperatorConventions.getNameForOperationSymbol
https://kotlinlang.org/docs/operator-overloading.html#augmented-assignments
[3]: OperatorConventions#ASSIGN_METHOD + AssignmentPluginNames
Generate a declaration for each delegated member without body. If we
don't generate delegated declarations, subclasses will have incorrect IR
with unbound symbols in fake overrides.
#KT-58027 Fixed
KtNamedFunction, KtClass etc are KtAnnotated.
Annotation recursion could happen within onTheFlyDiagnosticsCallback if
KtAnnotated has some annotations.
#KTIJ-25219
Merge-request: KT-MR-9652
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
The issue is that during binding fake overrides, the compiler doesn't
differ setters from its properties, so the compiler uses the same
visibility for setter and entire property.
Changing logic at the binding stage can cause some unpredictable consequences so
the fix is to do this differentiation right at the reporting stage
^KT-56662 Fixed
Merge-request: KT-MR-9565
Merged-by: Michail Zarečenskij <Mikhail.Zarechenskiy@jetbrains.com>
In K1 .isFun is always false for Java classes, so extra check
is added for that. This is not needed for K2, because .isFun is
true for all Java classes. Here it is not necessary to check
that interface has only one method, because such check will be
done in the place where interface implementation is created.
^KT-39362 Fixed