Originally it was an application-level component, which caused non-trivial
logic and cognitive load to carefully handle those extensions to avoid
memory leaks.
6740a596 introduced a way to easily register `DiagnosticSuppressor` to
project, and this commit continues this work, making it a proper
project-level extension
A lot of changes caused by the fact, that this extension is needed to be
obtained from `BindingContext` (see `BindingContextSuppressCache` and
its usages), so almost all changes are introducing `Project` to
`BindingContext`
^KT-66449 Fixed
`DiagnosticSuppressor` didn't contain `ProjectExtensionDescriptor`, which
prevented usages of this extension point with API provided by
`CompilerPluginRegistrar`
See discussion in KT-60952
This diagnostic is reported in rare situations when
StubTypeForBuilderInference is kept as a parameter type
of for loop or lambda. Before this commit, we had in K1
"Could not load module <error module>" from IrLinker instead.
Related to: KT-52757, KT-53109, KT-63841, KT-64066
#KT-53478 Fixed
Create dependency provider able to resolve code from .knm metadata
files to simplify migration from the legacy kotlin-stdlib-common
artifact.
KTIJ-28668
KTI-1457
This annotation leads to conflicting overloads error supression,
in case where several function with the same argument types,
but different argument names are inherited from ObjC class.
We need to implement it in both K1 and K2 to make the IDE experience
better.
But the annotation itself wouldn't be available in K1.
^KT-61323
Review: https://jetbrains.team/p/kt/reviews/14224/timeline
Timeline:
**(1)** Kotlin 1.1.60 https://github.com/JetBrains/kotlin/commit/59efedf610a25b004edf3d19897ce4dfca28ddb2 `header` keyword is introduced (committed on Dec 13, 2016)
**(2)** Kotlin `header`/`impl` has been deprecated (warning) at least since 1.1.60 https://github.com/JetBrains/kotlin/commit/5d251062677e09d607f295189b7978d5833e448f (committed on Sep 15, 2017)
**(3)** 1.1.60 release https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-compiler/1.1.60/ Nov 13, 2017
It sounds stupid but it looks like `header` was introduced and
deprecated right in the same release. Though it may be possible that we
had a release between **(1)** and **(2)** that I couldn't find
Anyway the keywords have been deprecated since basically forever
The fix is not perfect
"The perfect fix" would be:
1. Introduce a separate `DEPRECATED_MODIFIER_ERROR` diagnostic
2. Introduce LanguageVersionSettings for the `DEPRECATED_MODIFIER_ERROR`
diagnostic
But "the perfect fix" requires:
1. Adopting `ReplaceModifierFix` in the IDE to make it work with the new
diagnostic. `ReplaceModifierFix` is only implemented in K1 IDE. So
there are two ways:
1. Create a KTIJ ticket to port the diagnostic to K2 IDE (it needs to
be ported anyway), and **mention** in the ticket that
`DEPRECATED_MODIFIER_ERROR` also needs to be supported in K2 IDE.
It's the ticket that nobody will probably find and fix
2. Go and port `ReplaceModifierFix` to K2 IDE myself. It's fairly
simple task, but I've not worked in intellij for quite a while,
and it will take me too much time to index and compile
Considering that DEPRECATED_MODIFIER diagnostic is used only to report
`header`/`impl`, and there are literally 0 known cases when people use
it. It's just easier to convert the diagnostic to error in K2
Related tests:
- compiler/testData/diagnostics/tests/multiplatform/deprecated/header.kt
^KT-59839 Fixed
If an unused setter parameter was replaced with an underscore ('_'),
it had a special name in the stub ('<anonymous parameter 0>'). The text
version of the stub inserted it as is, leading to an extra
'PsiErrorElement'.
^KTIJ-28194 Fixed
Now, we detect clashing signatures during serialization to KLIB and
report a compiler error if two or more declarations have the same
`IdSignature`
For example, for the following code:
```kotlin
@Deprecated("", level = DeprecationLevel.HIDDEN)
fun foo(): String = ""
fun foo(): Int = 0
```
the compiler will produce this diagnostic:
```
e: main.kt:1:1 Platform declaration clash: The following declarations
have the same KLIB signature (/foo|foo(){}[0]):
fun foo(): String defined in root package
fun foo(): Int defined in root package
e: main.kt:4:1 Platform declaration clash: The following declarations
have the same KLIB signature (/foo|foo(){}[0]):
fun foo(): String defined in root package
fun foo(): Int defined in root package
```
Note that we report this diagnostic during serialization and not earlier
(e.g., in fir2ir) for more robustness, so ensure that we check
exactly the signatures that will be written to a KLIB.
If we later introduce some annotation for customizing a declaration's
signature (e.g., for preserving binary compatibility), this
diagnostic will continue to work as expected.
^KT-63670 Fixed
The trove4j library is licensed under LGPL, and that causes some troubles while working with it. The fastutil library provides the same functionality in the context of our needs, and is licensed under the Apache license.
^KTI-1135 In Progress
Previously when unsigned arrays were passed as vararg in a named form the necessary spread element wasn't generated, which resulted in a compilation error.
^KT-63514 fixed
Motivation: I'm going to drop NonPrivateCallableAdded (KT-62655) in the
next commits. But I don't want to change the existing logic when I drop
it. That's why I have to introduce the "Unknown" case
This commit is a slightly modified revert of 4f29c113.
IS_PRE_RELEASE allows to make LATEST_STABLE version behave as
experimental when this flag is set to true.
The general goal is to prepare fix of KT-62058; after this commit
one can do it by changing IS_PRE_RELEASE flag to true.
The fix of KT-62058 is planned to be done during bootstrapping.
This preparation and the future fix are parts of umbrella KT-61951.
^KT-62027 Fixed
`getCallablesCompatibility` requires parentSubstitutor as a parameter,
but we created a member-level substitutor
`getCallablesCompatibility` will create member-level substitutor itself,
no need to create member-level substitutor on the call site.
IndexOutOfBounds was happening in an attempt of creating member-level
substitutor
I will refactor the `createExpectActualTypeParameterSubstitutor` API in
the following commits later. It will help to avoid problems like that
There is IDE quick fix which suggests to copy mismatched annotation
from `expect` to `actual` (see KTIJ-26633). It needs to find
`actual` PsiElement where to add annotation. Before previous commit, it
was easy - just get source of `Incompatibility.actualSymbol`.
After previous commit, the problem might be in value parameter, while
`actualSymbol` would contain function symbol. This is solved by adding
new field `Incompatibility.actualAnnotationTargetElement`.
`SourceElementMarker` introduced, because it's needed to be used in
abstract checker. Existing `DeclarationSymbolMarker` doesn't fit
because in next PR for this issue annotations set on types will be reported,
and types are not declarations.
^KT-60671
Rename analysis flag `expectActualLinker` to `skipExpectedActualDeclarationChecker`
to better reflect its semantics. This flag isn't used on IDE plugin side, so no
additional changes in `intellij` repo are needed.
^KT-61136
- AnnotationDescriptor#argumentValue is not frontend-specific
- AnnotationDescriptor#getAnnotationStringValue is not Native-specific
We are going to need these functions in the IR code, so it makes
sense to factor them out to the core module.
Collecting all modules takes a lot of time in Evaluate Expression in
IDE, and it's useless because we then invoke JvmIrLinker to load module
headers, but that linker is discarded in the IDE (see `val irProviders`
below).
#IDEA-329915
...not reporting on companion object members as well as other
nested classes.
Annotation classes are accepted because this is how it already worked,
see other tests, for example `annotationsViaActualTypeAlias.kt`.
Test for nested annotation classes will be added in subsequent commit,
because it currently will fail in test
`TreeCompareTest.testCompareDiagnostics` because light-tree2fir
produces different tree due to a bug when converting properties
from expect primary constructor. See subsequent commit for a fix.
Review: KT-MR-12107
^KT-61784
The main idea is getting rid of stub types and using just type variables
See more detailed description at docs/fir/delegated_property_inference.md
The problem with stub types is that they need really special treatment
in many places, and on the other hand, there are no clear contracts on
how they should work (that regularly leads to bugs like KT-59529)
^KT-61060 Fixed
^KT-61075 Fixed
^KT-61077 Fixed
^KT-59529 Fixed
^KT-61633 Related
^KT-61618 Related
^KT-61740 Related
^KT-59107 Related
^KT-61747 Related
^KT-61077 Related
^KT-61781 Related