Commit Graph

108821 Commits

Author SHA1 Message Date
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
Dmitriy Novozhilov 73b608608a [FIR] Optimize PendingDiagnosticsCollectorWithSuppress
PendingDiagnosticsCollectorWithSuppress is a special diagnostic collector,
  which aggregates diagnostics reported during checking of some specific
  element before actually reporting them, so its workflow looks like this:

- start checking some element;
- all reported diagnostics go to `pendingDiagnosticsByFilePath` map;
- all checkers done their jobs;
- diagnostics from `pendingDiagnosticsByFilePath` go to the resulting map
  of all diagnostics (not all, only ones which lay inside the checked
  according to PSI);
- processed diagnostics removed from `pendingDiagnosticsByFilePath`

This approach works fine, but there was one problem with it:
  `pendingDiagnosticsByFilePath` is not just a list of diagnostic, but
  map of lists, grouped by the containing file. And only those lists
  actually get cleared. But if some list was completely emptied, it still
  remained in the original `pendingDiagnosticsByFilePath` map
This led to the performance problem in case, where there are no actual
  diagnostics in the `pendingDiagnosticsByFilePath`, but the map itself
  is not empty but full of empty lists. So collector iterated over this
  map on each visiting of each element
And after KT-58881 this problem was uncovered, as number of visits of
  elements was twiced (because now we iterate over the whole tree twice,
  with Common and Platform checkers)

The fix is quite trivial -- if some list in `pendingDiagnosticsByFilePath`
  becomes empty, remove it from the map

^KT-65579 Fixed
2024-02-13 12:07:41 +00:00
Dmitrii Gridin 0e16788b0a [FIR] value parameters from data class copy should be marked as resolved
^KT-65763 Fixed
2024-02-13 11:54:04 +00:00
Dmitrii Gridin ab7ae180f9 [LL FIR] add test data for data class from library
^KT-65763
2024-02-13 11:54:04 +00:00
cristiangarcia 15227d655f Builtins serializer logger is not required anymore
...and modifying jvmArguments in doFirst breaks ConfigurationCache
Required for KTI-1553
2024-02-13 11:22:25 +00:00
Pavel Punegov 6b9844705e [K/N] Make InfoPlistBuilder add DT* properties
The Firebase TestLab requires those properties to be present,
otherwise fails with verification errors.

These properties are specific to the Xcode installation or
toolchain used, and should be retrieved from it, not hardcoded.
See also KT-65601.

Part of the ^KT-58928


Merge-request: KT-MR-13964
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2024-02-13 11:14:24 +00:00
Sergey Bogolepov 3d0c9f9edd [Swift export][Tests] Enable K1 version of tests
rrn prefix mostly uses K1, so we need to do so
2024-02-13 10:48:05 +00:00