Commit Graph

104705 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 97cf240450 [FIR] Reuse enhancement storage during creation of synthetic properies
^KT-61972 Fixed
2023-09-18 15:09:07 +00:00
Jinseong Jeon cec299ac0a K2 UAST: Improve performance of PSI declaration provider
When it comes to finding regular class (of `PsiClass`) from the given
`ClassId`, we've reinvented the wheel in a worse way. `JavaFileManager`
is there to find `PsiClass`, and we already build/populate index for
that while initializing AA standalone mode's own project environment.
We can simply load that manager and send a query, that's it.

However, our efforts so far on binary PSI declaration providers are not
entirely useless. `JavaFileManager` can't handle top-level declarations
and search for all callables/classes in a given package in general. So,
we can still use existing logic for non-ClassId queries. We just need to
cache the intermediate results: fq name to `VirtualFile`s.

To fully utilize the aforementioned cache, we also need to cache an
instance of `KotlinPsiDeclarationProvider`.

Combing these three ideas, now running K2 UAST on a very large module is
"on par", e.g.,
K1:
//tools/adt/idea/android:intellij.android.core_lint_test PASSED in 112.8s
  Stats over 7 runs: max = 112.8s, min = 104.3s, avg = 107.9s, dev = 3.6s
K2 (before):
//tools/adt/idea/android:intellij.android.core_lint_test PASSED in 303.0s
  Stats over 7 runs: max = 303.0s, min = 286.8s, avg = 294.4s, dev = 5.0s
K2 (after):
//tools/adt/idea/android:intellij.android.core_lint_test PASSED in 112.8s
  Stats over 7 runs: max = 112.8s, min = 105.7s, avg = 108.9s, dev = 2.4s
2023-09-18 14:55:11 +00:00
Ilya Goncharov 6a514c3209 [Gradle, Wasm] Binaryen to wasm targets
^KT-62024 fixed
^KT-62025 fixed
2023-09-18 14:42:20 +00:00
Alexander Udalov bb381e7aef IR: check visibility when building fake overrides
This fixes the difference at least in the IR text test
testFakeOverridesForJavaNonStaticMembers. There's no fake override
created anymore for `packagePrivateMethod` in Test2.

 #KT-61366 Fixed
2023-09-18 12:33:07 +00:00
Roman Efremov a23f2894b2 [K2] Support reporting of EXPECTED_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER
^KT-59982 Fixed
2023-09-18 12:22:42 +00:00
Roman Efremov 5623427c6d [Test] Extract test for EXPECTED_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER
...to separate file. Also, add 3 cases with true-negative reporting:
annotation class, value class and secondary constructor.

^KT-59982
2023-09-18 12:22:42 +00:00
Roman Efremov 489371219f [K2] Support reporting of EXPECTED_ENUM_CONSTRUCTOR
^KT-59980 Fixed
2023-09-18 12:22:42 +00:00
Roman Efremov 6112c4ab2c [K2] Rewrite condition for EXPECTED_PRIVATE_DECLARATION
...without `isTopLevelOrInsideClass` property. Behavior stays the same,
because in fact we require all `expect` member declarations to be non-private
except constructors and property setter.
Enhance already existing test.

^KT-59899
2023-09-18 12:22:41 +00:00
Roman Efremov 1fdc607898 [K2] Fix EXPECTED_DECLARATION_WITH_BODY not reporting on property accessors
We don't want any `expect` function to have body. So we're sure no
new false-positive reports are introduced because of removal of
`isTopLevelOrInsideClass` condition.

^KT-59899 Fixed
2023-09-18 12:22:41 +00:00
Roman Efremov 4404e5f036 [K2] Refactor: extract conditions in FirExpectConsistencyChecker
...to separate methods.

After the change each diagnostic report has its own condition,
independent from others, so you don't have to keep in mind
"we're in else branch, so this is already not a FirConstructor
and also it either top-level or inside classs".
This makes changes in next commits more clear and verifiable.

`isTopLevelOrInsideClass` condition for
`getConstructorDelegationCall` is not needed, because
constructor is always inside class.

^KT-59899
2023-09-18 12:22:41 +00:00
Kirill Rakhman dda6d20520 [FIR] Add test for WRONG_MULTIPLE_INHERITANCE with typealias
#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 6a2b6e03d4 [FIR] Fix false negative ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 0d279dd652 [FIR] Fix false negative JVM_STATIC_ON_CONST_OR_JVM_FIELD
... in presence of typealias.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 7a65c36bfc [FIR] Add test for CLASS_CANNOT_BE_EXTENDED_DIRECTLY with typealias
#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 2d4646a285 [FIR] Fix false negative sealed diagnostics
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 36c0c2c76b [FIR] Fix false negative TYPE_PARAMETER_AS_REIFIED_ARRAY
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman f5f77d43bf [FIR] Fix false negative NO_REFLECTION_IN_CLASS_PATH
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 5d7e6f2aab [FIR] Use fullyExpandedClassId in FirTypeAliasExpandsToArrayOfNothingsChecker 2023-09-18 12:13:02 +00:00
Kirill Rakhman 98e6c0278a [FIR] Fix false negative REPEATED_BOUND
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 9949de36c9 [FIR] Fix false negative ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:02 +00:00
Kirill Rakhman 9475bc250c [FIR] Fix false negative REDUNDANT_CALL_OF_CONVERSION_METHOD
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:01 +00:00
Kirill Rakhman e788c7166a [FIR] Fix false negative REDUNDANT_SINGLE_EXPRESSION_STRING_TEMPLATE
... in presence of typealiases.

#KT-61921
2023-09-18 12:13:01 +00:00
Kirill Rakhman 373ffbc779 [FIR] Fix false positive CONST_VAL_WITH_NON_CONST_INITIALIZER
... in presence of typealiases.

#KT-61499 Fixed
2023-09-18 12:13:01 +00:00
Kirill Rakhman b72ac4f560 [FIR] Introduce helper method ConeKotlinType.fullyExpandedClassId 2023-09-18 12:13:01 +00:00
Nikolay Lunyak 93958ec73d [FIR] Check conflicts between nested classes' constructors and member functions
For an example of an object with
an implicit primary constructor,
see `FirPsiOldFrontendDiagnosticsTestGenerated.testSingletonAndFunctionSameName`.

^KT-62005 Fixed


Merge-request: KT-MR-12242
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-09-18 11:41:42 +00:00
strangepleasures 777df2d923 KT-60092 Fix suppression logic for EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR 2023-09-18 11:17:10 +00:00
Roman Golyshev a78d631b16 KTIJ-27050 [Analysis API] Correctly handle type parameters in KtFirReferenceShortener
Make `FirShorteningContext` correctly return symbols for type
parameters, so they are not ignored when scopes are inspected

Add additional type of `PartialOrderOfScope` - `TypeParameter`, because
otherwise it would have been classified as `Unclassified`, and that
breaks scopes comparison

Add missing type parameters to the scope of class header in
`ContextCollector`, add testdata for that

There is a bug in the compiler with type parameters leaking to nested
classes headers (KT-61959). After it's fixed, the testData with
incorrect expected shortenings/scopes should be adjusted and fixed too

^KTIJ-27050 Fixed
2023-09-18 10:23:30 +00:00
Roman Golyshev e2019ceb95 KTIJ-27050 [Analysis API] Refactor FirShorteningContext
Use `AvailableSymbol<FirClassLikeSymbol<*>>` instead
of `AvailableSymbol<ClassId>`
2023-09-18 10:23:29 +00:00
Roman Golyshev 020f8c0742 KTIJ-27050 [Analysis API] Refactor FirShorteningContext
Remove duplication from `findFirstClassifier*` functions
2023-09-18 10:23:29 +00:00
Dmitriy Novozhilov 9a6c6a40a9 [FIR2IR] Allow symbolTable cache lookups for generated Any methods
^KT-61972 Fixed
2023-09-18 09:16:15 +00:00
Ilya Goncharov afbfc9ce8e [Gradle, wasm] add checker about changed wasm source sets
^KT-61950 fixed
2023-09-15 20:56:31 +00:00
strangepleasures c31a3869c6 [KAPT] Fix package names org.jetbrains.kotlin.base.kapt3 -> org.jetbrains.kotlin.kapt3.base 2023-09-15 19:36:30 +00:00
Roman Golyshev b4209a4196 KT-61889 [Analysis API] Remove last usage of onAirResolve from Reference shortener
Add factory function `create` to
`FirTowerContextProviderByContextCollector`

^KT-61889 Fixed
2023-09-15 19:18:09 +00:00
Evgenii Mazhukin 7d762c9754 [KGP] Drop link to removed documentation 2023-09-15 18:26:42 +00:00
Vladimir Sukharev 56b951152f [FIR] K2: Fix introduced diagnostic UNDERSCORE_USAGE_WITHOUT_BACKTICKS
^KT-60105 Fixed


Merge-request: KT-MR-12214
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-15 16:37:50 +00:00
Mikhail Glukhikh 5e8741db1a K2: deal with callable copy return type update more accurately
Related to KT-61443
2023-09-15 15:21:10 +00:00
Mikhail Glukhikh f8ada456e4 K2: rename FakeOverrideTypeCalculator to CallableCopyTypeCalculator
This commits performs a rename.
According to KT-61443 this calculator is applicable not only to
fake (substitution/intersection) overrides.
2023-09-15 15:21:10 +00:00
Mikhail Glukhikh 53e4e2f6b1 K2: update return type properly for delegated members #KT-61443 Fixed 2023-09-15 15:21:10 +00:00
Mikhail Glukhikh 1b9197dd17 K2: reproduce KT-61443 2023-09-15 15:21:10 +00:00
Roman Efremov e79851910e [FE, IR] Check annotations compatibility on expect and actual getters and setters
^KT-60671
2023-09-15 14:41:38 +00:00
Roman Efremov 8fb2935ef6 [FE, IR] Check annotations compatibility on expect and actual type parameters
^KT-60671
2023-09-15 14:41:37 +00:00
Roman Efremov 420dceb7d8 [FE, IR] Store PsiElement for mismatched annotation's actual target
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
2023-09-15 14:41:37 +00:00
Roman Efremov 5c95f69aef [FE, IR] Check annotations compatibility on expect and actual value parameters
Comment was added to make it clear why whole declarations reported
in diagnostic instead of value parameter symbols (same will be done
with other targets in subsequent commits).

^KT-60671
2023-09-15 14:41:37 +00:00
Nikolay Krasko 4686a73c3b Minor: refactorings in preparePublication
KTI-1377
2023-09-15 13:50:12 +00:00
Nikolay Krasko af7610a5bd Do signing only if it's explicitly stated so in parameters
KTI-1377
2023-09-15 13:50:11 +00:00
Nikolay Krasko bd16d09d5e Add additional alias for signingRequired
KTI-1377
2023-09-15 13:50:11 +00:00
Nikolay Krasko f56167726d Register a new deploy server in maven instead of forgotten one
KTI-1377
2023-09-15 13:50:11 +00:00
Nikolay Krasko fabd5f6231 Remove old aliases for publishing parameters and prepare new
KTI-1377
2023-09-15 13:50:11 +00:00
Nikolay Krasko 3ddbf04fc8 Stop creating a staging repository inside the build
It's stopped working recently after bad rewriting anyway.

KTI-1377
2023-09-15 13:50:11 +00:00
Nikolay Krasko d7fadcbab5 Fix preparePublication.kt for empty repository-url 2023-09-15 13:50:11 +00:00