Commit Graph

104698 Commits

Author SHA1 Message Date
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
Yahor Berdnikau d5f4cd72b7 [Gradle] Don't sync freeCompilerArgs second time for the Native link task
Since CompilerOptions and LanguageSettings are synchronized between
each other, we don't need this additional sync that actually duplicates
arguments.

^KT-61700 Fixed
2023-09-15 13:44:19 +00:00
Alexander Udalov fda47c45ec IR: do not change overrides for lazy IR in FakeOverrideRebuilder
`FakeOverrideBuilder.provideFakeOverrides` recursively changes overrides
for all superclasses in the hierarchy, including lazy IR, which is a lot
of extra work.

Also it leads to some tests failing in the IR fake override builder mode
because it changes correct fake overrides of Java classes to incorrect
ones. Those tests are unmuted but it doesn't mean they are fixed -- most
likely we'll generate fake overrides via IR for lazy IR too, at which
point they'll start to fail again.
2023-09-15 12:55:33 +00:00
Alexander Udalov 216d2b50f7 IR: remove FakeOverrideCopier.makeExternal
Make the declaration external at the call site instead of creating two
instances of FakeOverrideCopier. It's possible because IR elements are
mutable, in particular isExternal is a var.

Maybe the same should be done to IrUnimplementedOverridesStrategy, but
that is postponed for another time.
2023-09-15 12:55:33 +00:00
Alexander Udalov 019836e9c7 IR: use origin DEFINED for value parameters of fake overrides
Fake overrides created by K1, as well as fir2ir in K2, use DEFINED. So
this gets rid of a lot of differences in IR text dumps between the K2
normal mode and K2 with IR fake overrides, and will ultimately help in
implementing and testing KT-61360.

The change in AddContinuationLowering is needed to fix tests like
kt47549. When creating anonymous classes for SAM implementations, we're
reusing the same fake override building machinery. And since we can't
extract any meaningful information from the fake override parameter's
origin anymore, we have to get the parameter from the original symbol.
2023-09-15 12:52:57 +00:00
Alexander Udalov 23ceb5d08a K2: do not build fake overrides for substituted package-private members
For example, `java.util.ArrayList.elementData` is a generic
package-private method. Not unwrapping intersection/substitution fake
overrides resulted in incorrect FQ names being compared in the package
visibility check, which led to the fake override always being created in
any subclass of ArrayList.

This change will help in testing IR fake overrides (KT-61360) because in
the current (temporary) mode, IrFakeOverrideRebuilder throws an
exception if initial fake overrides constructed by fir2ir differ from
the ones rebuilt by the IR -- and here they'll be different after fixing
KT-61366.
2023-09-15 14:09:29 +02:00
Roman Efremov 371db10330 Remove IncDecOperatorsInExpectClass test
It is incorrect because has expect and actual in same module,
which results in ACTUAL_WITHOUT_EXPECT reported in FIR.
But there is already same test
`multiplatform/incDecOperatorsInExpectClass.kt`, so there is no need
to fix and maintain test `IncDecOperatorsInExpectClass`.

^KT-60075 Fixed
2023-09-15 12:04:08 +00:00
Evgenii Mazhukin 30e49c0879 [IC] Refactoring - Remove obsolete forceExhaustiveWhen util 2023-09-15 12:03:40 +00:00