Commit Graph

108827 Commits

Author SHA1 Message Date
Pavel Kunyavskiy 6e8a7d4662 [ObjCInterop] Implement @ObjCSignatureOverride
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
2024-02-14 11:44:01 +00:00
Pavel Kunyavskiy 77eee0d3fc [K/N] Fix platform libraries in K1 native diagnostic tests
K1 setup for diagnostic tests was not able to use
platform libraries. This is required for ObjCSignatureOverride
testing.

We need to test it in both K2 and K1 to make IDE experience better.
2024-02-14 11:44:01 +00:00
Pavel Kunyavskiy d100a07981 [K/N] Move ObjCOverridabilityCondition to proper module
It was not active in diagnostic tests otherwise.
2024-02-14 11:44:01 +00:00
Alexander Udalov 41c6cca689 IR: minor, remove unnecessary isFromJava check
This is an addition to b72effab98. For JVM, this code is not supposed
to affect anything, and for non-JVM, declarations from Java are not
possible.
2024-02-14 11:27:09 +00:00
Artem Olkov 16b985b36e Support for Unsigned Types in swift export #KT-65668 fixed
Merge-request: KT-MR-14300
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-02-14 11:10:51 +00:00
Nikolay Lunyak fa5ae18980 [FIR] Fix a typo in a test data file name
^KT-65337
2024-02-14 09:57:13 +00:00
Nikolay Lunyak fdb2b714c9 [FIR] Remove redundant INITIALIZER_TYPE_MISMATCH introduced earlier 2024-02-14 09:57:12 +00:00
Nikolay Lunyak 389f02b016 [FIR] Let FirErrorExpression have a working type if possible
^KT-65337 Fixed
2024-02-14 09:57:12 +00:00
Nikolay Lunyak 7f42596935 [FIR] Reproduce KT-65337
^KT-65337
2024-02-14 09:57:12 +00:00
Mikhail Glukhikh 6ed7c041b4 K1/K2: add various tests for context receiver tower resolve priority
Related to KT-64531, KT-64488
#KT-64531 As Designed
2024-02-14 09:55:51 +00:00
Kirill Rakhman e88865e4c7 [FIR] Fix methods with erased parameters missing from raw collection scope
#KT-65448 Fixed
2024-02-14 09:55:24 +00:00
Kirill Rakhman 931480b12d [FIR2IR] Fix nullability of converted raw types
#KT-65298 Fixed
2024-02-14 09:55:24 +00:00
Vladimir Sukharev 3b4ca56f74 [K/N][Tests] Migrate test platform_zlib.kt
^KT-61259
2024-02-14 09:55:06 +00:00
Vladimir Sukharev 06a89a0061 [K/N][Tests] Migrate test withSpaces.kt
^KT-61259
2024-02-13 22:14:30 +00:00
Vladimir Sukharev 2bb9b936ac [K/N][Tests] Small cleanup 2024-02-13 22:14:30 +00:00
Vladimir Sukharev 34af80943c [K/N][Tests] Remove obsolete cppInterop tests
^KT-61259
2024-02-13 21:48:40 +00:00
Alexander Udalov b72effab98 IR: remove isFromJava check from isOverridableMemberOrAccessor
This is needed because in case a static member is inherited via a Kotlin
class (class C in the newly added test), its origin becomes
FAKE_OVERRIDE which is technically not Java anymore. After this change,
we'll build fake overrides for static members from superclasses
regardless of whether they come from Java or Kotlin.

Also, move the previous logic of
isOverridableFunction/isOverridableProperty to the only call site at
IdSignatureFactory.

 #KT-65589 Fixed
2024-02-13 21:03:33 +00:00
Dmitriy Dolovov 03418c11c3 [kotlinp] Change the package name in :tools:kotlinp-jvm subproject
Change the package name for all *.kt files inside
the :tools:kotlinp-jvm subproject from "org.jetbrains.kotlin.kotlinp"
to "org.jetbrains.kotlin.kotlinp.jvm"

^KT-62340
2024-02-13 21:01:08 +00:00
Dmitriy Dolovov d30efdb001 [kotlinp] Split :tools:kotlinp into "common" and "jvm" subprojects
The "common" subproject keeps only backend-neutral logic and depends
only on :kotlinx-metadata library. It takes the name of the former
project - :tools:kotlinp

The "jvm" subproject depends on the "common" one and also depends
on :kotlinx-metadata-jvm. It gets the new name - :tools:kotlinp-jvm

There is a lot of touched files in this commit. The majority of them
is just moved files (tests, test data, etc).

Only the following files were actually modified:
  .space/CODEOWNERS
  build.gradle.kts
  libraries/tools/abi-comparator/build.gradle.kts
  libraries/tools/kotlinp/build.gradle.kts
  libraries/tools/kotlinp/jvm/build.gradle.kts
  plugins/kapt3/kapt3-compiler/build.gradle.kts
  settings.gradle

 ^KT-62340
2024-02-13 21:01:08 +00:00
Dmitriy Dolovov eec76865a7 [kotlinp] Refactor to separate common part from JVM-specific part
This refactoring includes the following:
1. Separate backend-neutral part of the metadata printer `Kotlinp`
   from the part that accesses JVM-specifics: `JvmKotlinp`.
2. Introduce `org.jetbrains.kotlin.kotlinp.Printer`: The component
   that renders both individual `Km*` nodes and the whole metadata
   tree, and does so with the proper indentation.

^KT-62340
2024-02-13 21:01:08 +00:00
Dmitriy Dolovov d769328311 [kotlinp] Minor. Remove unnecessary -opt-in=kotlin.RequiresOptIn
This opt-in is no more required in :tools:kotlinp

^KT-62340
2024-02-13 21:01:08 +00:00
cristiangarcia e876a42e3d checkRepositories is not configuration cache compatible
Required for KTI-1553
2024-02-13 19:29:47 +00:00
Pavel Kunyavskiy 7e3e9aafa4 [IR] Add kdoc for IrExternalPackageFragment 2024-02-13 17:30:53 +00:00
Marco Pennekamp b24c75d04c [LL] Fix computeIfAbsent contract violation during dangling file session creation
- To avoid recursive updates, we can create sessions which cannot be
  created in isolation outside `computeIfAbsent`. Note that this is the
  current behavior of the default implementation of
  `ConcurrentMap.computeIfAbsent`, which will be replaced soon with
  the stricter behavior of `CleanableSoftValueCache` (see KT-61222).

^KT-65683 fixed
2024-02-13 17:14:20 +00:00
Dmitrii Gridin 2e2e592cc3 [Analysis API] CliTestModuleCompiler: support LANGUAGE_VERSION directive
^KT-64884
2024-02-13 16:07:17 +00:00
Dmitrii Gridin a567793d10 [LL FIR] add workaround for deserialization of data classes
To correctly process old metadata without properly sorted properties

^KT-64884 Fixed
2024-02-13 16:07:17 +00:00
Dmitrii Gridin faebef171d [Analysis API] add regression tests for data class copy arguments usage
This issue is not reproducible against the K2 compiler

^KT-64884
2024-02-13 16:07:17 +00:00
Vladimir Dolzhenko ad119a707c Fix equals/hashCode for LC fake files
#KTIJ-28770 Fixed


Merge-request: KT-MR-14341
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2024-02-13 15:47:09 +00:00
Dmitrii Gridin ab328e76d4 [LL FIR] FirDesignation: update KDoc for collectDesignationWithOptionalFile
^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin ca484fae2c [LL FIR] KtFirReferenceShortener: add order for FirScriptDeclarationsScope
It is similar mostly to FirClassUseSiteMemberScope or NestedClassifier

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 18978ca3f1 [LL FIR] FirDesignation: add toString
^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin cc46b6e3e9 [LL FIR] rename collectDesignationWithFile to collectDesignation
It should have a more simple name as it is the main function now

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 0b4dac9d8d [LL FIR] rename collectDesignation to collectDesignationWithOptionalFile
To make the choice more visible

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 3c26d0e85d [LL FIR] refactor collectDesignation and friends
to simplify code and add KDoc

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 8f987644ab [LL FIR] designation refactoring
Collect `FirDesignation` by default with `FirFile` instead of just
a separate path and additional repeated logic around

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 47e8d987b9 [LL FIR] ContextCollector: optimize collector for file elements
We shouldn't trigger declaration processing if we want to check just
annotations/package/imports.
But currently, we still will iterate over the entire file
if there is an element somewhere inside package/import
(see `fileImportInside.kt` test case)

^KT-65344
^KT-65560 Fixed
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 0c3a1dfd67 [LL FIR] ContextCollector: add tests for file package and imports
It reproduces redundant resolution

^KT-65344
^KT-65560
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 58ad26ee5b [LL FIR] make script initializers independent
Now we can resolve all script declarations independently

^KT-65344 Fixed
2024-02-13 14:58:31 +00:00
Dmitrii Gridin d59b8b3244 [LL FIR] LLFirStatusTargetResolver: add missing branch for FirFile
It is better to explicitly say that we shouldn't do anything in the
case of the file. It worked before because of `needResolveMembers == false`
and `needResolveNestedClassifiers == false` inside
`LLFirStatusTargetResolver.Transformer`

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 697f1477fd [LL FIR] drop forEachDependentDeclaration
Now this function is redundant

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 5de5f70ec9 [LL FIR] LLFirPhaseUpdater: update backing field initializer directly
Instead of the backing field itself as we already update its phase
during `updatePhaseForNonLocals`

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 6415f423a8 [LL FIR] PhaseUpdatingTransformer: drop redundant checks
We shouldn't check the current phase as this condition effectively
always is **false** as we use this updater only once for the phase

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 348c9664c1 [LL FIR] drop isScriptDependentDeclaration
Now this property is redundant

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 4f0bc86ad4 [LL FIR] make result$$ property independent
Now we can resolve this generated property in the same way
as other regular properties.
This is the pre-step for independent script initializers

^KT-65344
^KT-65523
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 6135a98e4e [LL FIR] do not rebuild entire script for lazy calculation of result$$ property
After the previous commit, it is possible to rebuild initializer for
`result$$` property without a full script creation.
Also, this commit fixes anchor symbol for annotations
inside script statements

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin 338c533a58 [FIR] FirScriptConfigurationExtensionImpl: change source element for result$$ property
We should use the source from replaced `FirAnonymousInitializer` as it
is more equivalent. Another point – the previous implementation
duplicated the source between generated FirProperty and initializer

^KT-65344
2024-02-13 14:58:31 +00:00
Dmitrii Gridin f972c8d239 [LL FIR] add more tests for script initializer
^KT-65344
2024-02-13 14:58:31 +00:00
Marco Pennekamp 08332fdc6e Explain issues with local.properties in verification metadata update 2024-02-13 12:54:34 +00:00
Alexander Korepanov 9ff6dcbe0a [JS FIR] Add a test for generic interface inheritance
^KT-65216
2024-02-13 12:19:29 +00:00
Alexander Korepanov c828b924b2 [JS FIR] Fix JS_NAME_CLASH false positive report
Intersections for interfaces and generic interfaces work differently.
`FirIntersectionCallableSymbol.getNonSubsumedOverriddenSymbols()`
does not retrieve the original symbol for a symbol inherited from
generic interfaces.
The patch explicitly obtains original symbols if they exist.

^KT-65216 Fixed
2024-02-13 12:19:29 +00:00