Commit Graph

106058 Commits

Author SHA1 Message Date
Marco Pennekamp 88d307d52c [AA] Add tests for diagnostics suppression on top-level declarations and class members
- `testConflictingOverloadsAtTopLevel` is currently disabled in FIR
  because it fails with a mismatch between diagnostics from the file and
  the individual elements. It will be enabled in the next commit.

^KT-62899
2023-11-13 10:20:26 +00:00
Pranav 6c7963fe47 fix: Fix memory leak in ZipImplementation with -Xuse-fast-jar-file-system
When using the compiler with `-Xuse-fast-jar-file-system` enabled, the compiler causes memory leak in ZipImplementation class at MappedByteBuffer.contentsToByteArray method since the Inflater used to deflate zip/jar files, isn't released/ended after the task.
2023-11-13 10:04:39 +00:00
Chris Povirk 72c9378500 Fix error message for -Xjspecify-annotations.
The message currently claims that you can pass the value "disable," but
in fact the value it means is "ignore."
2023-11-13 09:59:27 +00:00
Marco Pennekamp d89e29f289 [FIR] FirSymbolNamesProvider: Provide default implementation for mayHaveSyntheticFunctionType
- Composite providers may call `mayHaveSyntheticFunctionType` on *all*
  of their children if *one* child has
  `mayHaveSyntheticFunctionTypes == true`, so
  `mayHaveSyntheticFunctionType` should have a proper default
  implementation to avoid runtime errors.
- The alternative of requiring to check `mayHaveSyntheticFunctionTypes`
  before calling `mayHaveSyntheticFunctionType` at the call-site was
  considered, but deemed too error-prone. Given that
  `mayHaveSyntheticFunctionType` is an optimization and admits false
  positives, an imprecise default implementation of it is allowed.

Thanks to Mikhail Glukhikh for discovering this problem.
2023-11-13 09:47:41 +00:00
Svyatoslav Scherbina 0be566f6b6 Revert "Native: enable K2 for benchmarksAnalyzer"
This workaround is not needed anymore -- bootstrap KGP is now K2.

This reverts commit 096edd8937.
2023-11-13 08:38:24 +00:00
Svyatoslav Scherbina bc41309c31 Revert "Native: enable K2 for benchmarks in performance/"
This workaround is not needed anymore -- bootstrap KGP is now K2.

This reverts commit 4672727bd6.
2023-11-13 08:38:24 +00:00
Dmitriy Dolovov d65fc00578 [KLIB] Introduce isJsStdlib() and isWasmStdlib() checks for KLIBs 2023-11-11 13:33:06 +00:00
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