Commit Graph

106151 Commits

Author SHA1 Message Date
Dmitriy Dolovov 4892a81178 [Native] Simplify *.isNativeStdlib() checks as much as possible
...still preserving their reliability.
2023-11-11 13:33:06 +00:00
Alexander Udalov 6a0a64eb6d JVM: remove usages of trove4j
#KTI-1135
2023-11-10 21:56:34 +00:00
Alexander Udalov e0b2f2040b Minor, add regression test for K1 issue KT-61101 2023-11-10 21:51:53 +00:00
Roman Efremov 37b839f2c2 [Tests] Refactor: move one more annotation arguments lazy resolve test
for `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` checker near to
other tests of this diagnostic. It is fine to move it out of
`multiplatformCompositeAnalysis` dir, because, actually, it tests
the case with comparison of FirAnnotationCall and FirAnnotationImpl,
which doesn't require composite analysis mode.

^KT-62559
2023-11-10 19:36:10 +00:00
Roman Efremov 99bf96e747 [Tests] Refactor: move annotation arguments lazy resolve test for
...`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` checker near to
other tests of this diagnostic. This is because now such tests
are run in lazy resolve test suite, so no need to store them
separately.

^KT-62559
2023-11-10 19:36:10 +00:00
Roman Efremov c20a5fc650 [Tests] Fix .ll.kt KMP tests data added in previous commit
It is expected, that in some complex cases
`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` reports in .ll.kt disappeared
at all. This is because FIR checker doesn't catch comlex cases,
which are handled by IR checker.

Also add comments about bugs KT-62886 and KT-63382 found by tests.

^KT-62559
2023-11-10 19:36:09 +00:00
Roman Efremov 29980c6b85 [Tests] Run KMP tests in Analysis API LL FIR test suites
New tests are red in current commit!
All `.ll.kt` files are just copies of `.fir.kt` or `.kt`. This will be
fixed in the next commit to clearly show difference between LL and FIR.

The original purpose of this change was to test
`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic, for which FIR checker
will be run only in IDE (to be changed in next MR), so its reports
a lost from usual KMP tests.
But this looks like a useful change for all KMP tests, not only this
diagnostic.

^KT-62559
2023-11-10 19:36:09 +00:00
Roman Efremov 026ad1cebc [Tests] Refactor: move unrelated tests out of annotationMatching dir
It will be used only for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT
diagnostic tests.

^KT-62559
2023-11-10 19:36:09 +00:00
Pavel Punegov 5f7b1761d7 [K/N][build] Add usr subdir to absoluteTargetToolchain path
absoluteTargetToolchain has started to include the usr directory while
tests use a bootstrap version that doesn't have this change.
See commit 3aeca1956e with the change to toolchain path.
2023-11-10 18:25:04 +00:00
Pavel Punegov 707482e738 [K/N][perf] Cleanup build scripts
Remove hack with including sources directories.
shared project directory was removed from native and merged with utils.
Also, remove native/utils inclusion. Bootstrap version is used instead.
2023-11-10 18:25:04 +00:00
Ilya Chernikov 932b5bf8cd Scripting: avoid proguarding of slf4j libs in main-kts
slf4j libs are bundled unshadowed to main-kts jar to avoid annoying
slf4j stderr printout (slf4j is used in the maven dependencies resolver)
Exluding it from proguard processing solves problems with using it
directly from scripts.
#KT-60813 fixed
#KT-54819 fixed
2023-11-10 17:24:12 +00:00
Ilya Chernikov a47ee44e65 Scripting: refactor test infrastructure - add missing stderr handling 2023-11-10 17:24:12 +00:00
Ilya Chernikov e927ac5fc3 Scripting: ignore some diags if artefact is resolved
The failure diagnostics from resolvers are ignored now if followed
by a successful result from a following resolver.
#KT-63352 fixed
the commit is idirectly tested by the test MainKtsIT.testUseSlf4j
from the followin commit "Scripting: ignore some diags if artefact is
resolved", namely without these changes, additional two warnings are
reported in this test.
2023-11-10 17:24:12 +00:00
Alexander Shabalin fa9c620261 [K/N] Migrate some runtime/basic tests to new testing infra ^KT-61259 2023-11-10 15:51:05 +00:00
Leonid Startsev 4fa121071a Update kotlinx-serialization dependency for serialization compiler plugin tests.
Properly set up dom-api-compat dependency for JS IR tests. Since this dependency is added
automatically for every Kotlin/JS library, it should be present during tests just as stdlib.

As a result, tests for serializable enums were changed since 1.6.0 runtime does not require enums to be explicitly serializable.
2023-11-10 14:14:04 +00:00
Pavel Punegov 3d720f9c03 [K/N][test] Add static_everywhere caching as an alias to static
To match the options in the new infrastructure, add the same option
to the old one


Merge-request: KT-MR-12949
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-10 13:11:03 +00:00
aleksandrina-streltsova b694f063ac [FIR] Use callee reference source for resolved callable reference
KTIJ-23906
2023-11-10 12:48:47 +00:00
Sergej Jaskiewicz 918335e12e [IR] Replace error("Should not be called") with shouldNotBeCalled() 2023-11-10 12:31:40 +00:00
Sergej Jaskiewicz 5a86147e9c [JS IR] Remove dead code 2023-11-10 12:31:40 +00:00
Sergej Jaskiewicz 47f8dedfa5 [IR] Remove methods for computing full mangled names from non-IR manglers
A full mangled name of a declaration is a mangled name that includes
the mangled names of all the declaration's parents.

We don't use full mangled names for building `IdSignature`s. We use them
in two places:
- Generating stable names for JavaScript functions in Kotlin/JS
  (see `NameTables.kt`)
- Generating names for LLVM symbols from lowered IR functions in
  Kotlin/Native (see `BinaryInterface.kt`)

In both of these places we run the IR mangler, hence we don't need this
functionality in other manglers.
2023-11-10 12:31:40 +00:00
Sergej Jaskiewicz 69aeddcba8 [IR] In irText tests, test full mangled names only computed from IR
We plan to disable computing full mangled names of declarations in all
manglers except the IR mangler (see the subsequent commits).

From now on, in irText tests we dump only the following mangled names:

- Full mangled names computed using the IR mangler
- Signature mangled names computed using the Descriptor mangler
- Signature mangled names computed using the IR mangler
- Signature mangled names computed using the FIR mangler

Here by a full mangled name we mean the mangled name of a declaration
computed using the `MangleMode.FULL` mode. Those mangled names include
the mangled names of the declaration'a parents.

By a signature mangled name we mean the mangled name of a declaration
computed using the `MangleMode.SIGNATURE` mode.
These mangled names are used to compute an `IdSignature` for
the declaration, hence the name.
2023-11-10 12:31:40 +00:00
Ilya Gorbunov 9ccce52915 Clean up WasExperimental annotation from declarations with SinceKotlin<=1.4
Since it is not possible to use -api-version < 1.4, this annotation has no effect
2023-11-10 12:20:52 +00:00
Mikhail Glukhikh 081e1de5af FE: fix a typo in irrelevantMapGetAbstract.kt diagnostic test
Related to KT-45053
2023-11-10 10:03:58 +00:00
Dmitrii Gridin c1094d8046 [FIR] FirFakeOverrideGenerator: add missed annotations on copied accessors
^KT-63361
2023-11-10 08:56:58 +00:00
Dmitrii Gridin fb087ff7e3 [FIR] CallableCopyTypeCalculator: unify logic about copied type calculation
Add missing type propagation to getter and setter that was missed due
to copy-pasted logic.
`computeReturnTypeRef` should check the session to avoid infinitive
recursion

^KT-63361 Fixed
2023-11-10 08:56:57 +00:00
Dmitriy Novozhilov 4164cecc2d [FIR2IR] Add TODO to fix smartcasted SAM conversions due to KT-62847, KT-63345
Note that `compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt`
  test should be updated after this change
2023-11-10 07:50:01 +00:00
Dmitriy Novozhilov 40f95cd5dd [FIR2IR] Minor: reuse approximateForIrOrNull utility in Fir2IrTypeConverter 2023-11-10 07:50:01 +00:00
Dmitriy Novozhilov 10914eb23f [FIR2IR] Rename Fir2IrImplicitCastInserter.cast method
`cast` name is too generic and doesn't explain the actual
  meaning of this function
2023-11-10 07:50:01 +00:00
Dmitriy Novozhilov 8578a0bf6a [FIR2IR] Properly insert casts for smartcasts in argument position
Previously cast inserter didn't consider expected type for arguments
  of function calls

^KT-63257 Fixed
2023-11-10 07:50:01 +00:00
Dmitriy Novozhilov c70a6425f5 [FIR2IR] Don't insert not-needed upcasts for smartcasted expressions
Related to KT-63257
2023-11-10 07:50:00 +00:00
Dmitriy Novozhilov aa1a997f8a [FIR2IR] Cleanup and reuse utility for creating substitutor from call 2023-11-10 07:50:00 +00:00
Ilya Kirillov 5f5daa0e06 [Decompiler] rename :analysis:decompiled:native -> :analysis:decompiled:decompiler-native
to avoid possible name clashes between different
Gradle subprojects with the same name.

see https://github.com/gradle/gradle/issues/16986
2023-11-10 06:41:03 +00:00
Ilya Kirillov 8fbd6ab02b [LL FIR] do not provide cloneable for non-jvm platforms
It's a jvm-specific thing

^KT-62935 fixed
2023-11-10 06:41:03 +00:00
Ilya Kirillov bffbbe6293 [LL FIR] add LL FIR tests based on AbstractFirPsiNativeDiagnosticsTest
^KT-62910 fixed
2023-11-10 06:41:03 +00:00
Ilya Kirillov a4564351d7 [LL FIR] separate non-reversed/reversed test suppressors
Each compiler-based LL FIR test can:
- fail in both non-reversed and reversed configurations, muted with `// MUTE_LL_FIR`
- fail in non-reversed test only, muted with `// IGNORE_NON_REVERSED_RESOLVE`
- fail in reversed test only, muted with `// IGNORE_REVERSED_RESOLVE`
2023-11-10 06:41:03 +00:00
Ilya Kirillov f26300a43e [LL FIR] allow muting tests with MUTE_LL_FIR directive in all compiler-based tests 2023-11-10 06:41:03 +00:00
Ilya Kirillov 68235b978b [Analysis] add test generator for Kotlin/Native tests inside Analysis API
This test generator is enabled only if Kotlin/Native support is enabled in the project

^KT-62910
2023-11-10 06:41:03 +00:00
Ilya Kirillov a18c49d795 [LL FIR] retrieve Kotlin/Native KLib dependencies for compiled based tests
Previously, all tests were considered as JVM-only
from the library dependencies point of view.

^KT-62910
2023-11-10 06:41:03 +00:00
Ilya Kirillov 7c6870f8d2 [Analysis API Standalone] index .knm files in KotlinStaticDeclarationProvider
so `FirSymbolNamesProvider` can know about them

^KT-62910
2023-11-10 06:41:03 +00:00
Ilya Kirillov 9c85857b68 [Analysis API Standalone] refactoring, extract stub create to a separate function 2023-11-10 06:41:03 +00:00
Ilya Kirillov b6fdd7cacc [FIR, Native] extract test initialization code to functions from AbstractDiagnosticsNativeTest for further reuse in LL FIR tests
^KT-62910
2023-11-10 06:41:03 +00:00
Roman Golyshev 500dd20277 KT-63096 [LL] Add test for using annotation from other module for compiler plugin 2023-11-09 23:39:32 +00:00
Roman Golyshev 2f50267d3f KT-63096 [LL] Make KotlinStaticAnnotationsResolver more correct
By using `KotlinDeclarationProvider`, it can now check that the
annotation is actually present in the scope
2023-11-09 23:39:32 +00:00
Roman Golyshev a1155204c7 KT-63096 [LL] Remove KtModuleScopeProvider
It has no usages anymore
2023-11-09 23:39:32 +00:00
Roman Golyshev bda677d2ad KT-63096 [LL] Use full module resolution scope to create KotlinAnnotationsResolver
`KotlinAnnotationsResolver` must see everything that is resolvable from
the current module; otherwise it will not work properly.

The previous scope was the module itself + its binary dependencies
(jars).
Now the scope will contain the module itself and ALL its dependencies,
including other modules.

^KT-63096 Fixed
2023-11-09 23:39:31 +00:00
Vladimir Sukharev 296d7153e6 Revert "Use IntelliJ inspection "PublicApiImplicitType""
This reverts commit dd5f6a7619.
2023-11-09 21:59:03 +01:00
Brian Norman 6df97dd199 [FIR] Add test cases to prove resolution of backlog tickets
^KT-41728 Fixed
^KT-46586 Fixed
^KT-49696 Fixed
^KT-51160 Fixed
^KT-53308 Fixed
2023-11-09 19:28:26 +00:00
Nikita Bobko 2b82726f1d Cleanup: rename getSingleExpectForActualOrNull w.r.t. KT-62590
New name makes slightly more sense after KT-6259 is fixed
2023-11-09 17:58:43 +00:00
Jaebaek Seo e80f044847 K2: Update reference shortener to handle import alias
The existing reference shortener does not use import alias when it
shortens a symbol. Instead, it adds a new import directive for the
symbol that is already imported. This commit updates reference shortener
to let it reuse the existing import alias rather than adding a new one:

 1. When shortening a symbol, check whether the symbol is already
    imported.
 2. If it is already imported by an import alias, keep the symbol
    reference expression and the import alias as a string together in
    `ShortenCommand`.

The actual PSI update (shortening) based on the ShortenCommand is done
by IntelliJ.

^KTIJ-27205
2023-11-09 14:34:38 +00:00
Sergej Jaskiewicz 02c12ae26f [FIR generator] Write kDocs for accept & transform methods in FirElement 2023-11-09 13:30:25 +00:00