Commit Graph

104675 Commits

Author SHA1 Message Date
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
Dmitriy Novozhilov 85c2226335 [FIR2IR] Allow symbolTable cache lookups for mapped JVM declarations 2023-09-15 11:51:58 +00:00
Dmitriy Novozhilov 0e92f98031 [FIR2IR] Allow symbolTable cache lookups if IR f/o builder mode is enabled
Without this change, the following test is failing:
- FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.Collections.testInheritFromHashtable

^KT-58861
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 9a109e98ce [FIR2IR] Raise an exception if declaration is found in symbol table but not in Fir2IrDeclarationStorage
^KT-61637 Fixed
^KT-61774
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 3f3c839c48 [FIR] Cache deserialized builtin functions
Apparently `FirBuiltinSymbolProvider` cached deserialized classes but
  created new fir functions for each invocation

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 36cb869ac2 [FIR2IR] Create fake one-time use properties for callable reference to synthetic properies
Previously fir2ir created real IR properties some getter and setter for
  such references, which lead to the situation that there might be a
  unbound fake override for synthetic property which wasn't stored in
  declaration storage (and code in FakeOverrideGenerator was a hack
  to cover this case)
In the same time K1 creates fake property for such cases, which is stored
  in IrPropertyReference along with original get... and set... functions
  as getter and setter of reference. And in this commit K2 does the same thing

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 7ea54ee87f [FIR2IR] Properly compute parent for fake overrides
^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 954ef58d35 [FIR2IR] Don't create calls to members of Nothing for data/value generated members
Without this change, the following tests will fail:
- `FirLightTreeBlackBoxCodegenTestGenerated.InlineClasses#testJavaPrimitiveTypeIC`
- `FirLightTreeBlackBoxCodegenTestGenerated.InlineClasses#testJavaPrimitiveTypeICGeneric`
- `FirPsiJvmIrTextTestGenerated.Classes.DataClasses#testKt31649`

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 9cf1d43465 [FIR2IR] Properly treat synthetic properties in Fir2IrDeclarationStorage
There is a difference in how FIR and IR treat synthetic properties (properties built upon java getter + optional java setter)
For FIR they are really synthetic and exist only during call resolution, so FIR creates a new instance of FirSyntheticProperty
  each time it resolves some call to such property
In IR synthetic properties are fair properties that are present in IR Java classes

This leads to the situation when synthetic property does not have a stable key (because FIR instance is new each time) and the only
  source of truth is a symbol table. To fix it (and avoid using symbol table as a storage), a pair of original getter and setter is
  used as a key for storage IR for synthetic properties. And to avoid introducing special cache of FirSyntheticPropertyKey -> IrProperty
  additional mapping level is introduced

- FirSyntheticPropertyKey is mapped to the first FIR synthetic property which was processed by FIR2IR
- this property is mapped to IrProperty using regular propertyCache

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov a3498bdd91 [FIR2IR] Cache generated IR functions for data/value classes in declarations storage
Previously, DataClassMembersGenerator saved generated functions only in
  symbol table, which led to the situation when there is a FIR function
  in scopes, IR function in symbol table but no record about their relation
  in Fir2IrDeclarationStorage

^KT-61637
2023-09-15 11:51:57 +00:00
Dmitriy Novozhilov 58e8dfc23b [FIR2IR] Remove or approve some of left usages of IrSymbol.owner 2023-09-15 11:51:57 +00:00
strangepleasures 8fb7ea1126 [KAPT4] KT-61333 Support REPORT_OUTPUT_FILES
Add extra logging
2023-09-15 11:05:05 +00:00
Pavel Kunyavskiy 9a9598c16b [Klib] Run prerelease checker in all backends
The checker also checks the metadata version, which
would be handled separately. Now it would never
emmit this error for klib-based backends.

^KT-61773
^KT-61596
^KT-55809
2023-09-15 09:48:42 +00:00
Alexander Udalov 9f9287fb2e IR: keep flexible type annotations when building fake overrides
#KT-61751 Fixed
2023-09-15 09:40:45 +00:00
Igor Chevdar 2b8bcfda94 [K/N][codegen] Build trampolines for abstract fake overrides
#KT-61924 Fixed
2023-09-15 09:26:54 +00:00
Igor Chevdar 1df93e1611 [box-tests] Added a reproducer for #KT-61924 2023-09-15 09:26:54 +00:00
Dmitrii Gridin 1b1e1d5b3f [Analysis API] DebugSymbolRenderer: unify error types
They are still can be different in the case of error inside
type argument (e.g. `kotlin/Array<out ERROR CLASS: Incomplete code>`)
2023-09-14 18:53:25 +02:00
Dmitrii Gridin 2d83509200 [Analysis API Fe10] add missing initializer for properties 2023-09-14 18:53:25 +02:00
Dmitrii Gridin bb470b5504 [Analysis API Fe10] fix isFromPrimaryConstructor 2023-09-14 18:53:25 +02:00
Alexander Udalov cadbc87dfd JVM IR: add flag to avoid loading dependency module headers
This is an addition to d16f33cf5b. Apparently there's another call site
of JvmIrCodegenFactory in intellij besides Evaluate Expression, namely
Android LiveEdit plugin, where it seems needed to collect all dependency
modules and resolve them via linker. LiveEdit also uses
shouldStubAndNotLinkUnboundSymbols = true, so we need to differentiate
between it and Evaluate Expression, hence the new flag. This new flag
will be set to true only for Evaluate Expression in intellij.

 #IDEA-329915
2023-09-14 15:45:47 +00:00
Ilmir Usmanov f16ea9dfbb JVM: Reduce number of comparison on bytecode analysis merge
operations. Since these methods are hot - they are call on each branch,
even such primitive optimizations should give measurable speedup.
2023-09-14 15:35:51 +00:00
Ilmir Usmanov 5e2d3737f5 JVM: Do not traverse all suspension point when looking for end label
when extending local variable range.
2023-09-14 15:35:51 +00:00
Ivan Kylchik 95872bd13c [JVM] Reuse findMergeNodes in FastStoreLoadAnalyzer 2023-09-14 15:02:03 +00:00
Ivan Kylchik 617e7d1a36 [JVM] Store VarInsnNode in StoreData instead of AbstractInsnNode
This way we can avoid some casts.
2023-09-14 15:02:03 +00:00