Commit Graph

106072 Commits

Author SHA1 Message Date
Mikhail Glukhikh e747793e62 FIR2IR: simplify applyAssigningArrayElementsToVarargInNamedForm a bit 2023-11-13 16:23:26 +00:00
Mikhail Glukhikh 4913c38e98 FIR2IR: insert spread for named argument against primitive vararg
#KT-60312 Fixed
2023-11-13 16:23:26 +00:00
Mikhail Glukhikh 4abce54748 K2: reproduce KT-60312 2023-11-13 16:23:26 +00:00
Mikhail Glukhikh 53ab32e0fb Rename: ConeTypeVariableType.lookupTag -> typeConstructor 2023-11-13 15:10:48 +00:00
Mikhail Glukhikh 1ceec4d6d7 K2: make type variable based types not class like
#KT-57921 Fixed
#KT-62420 Fixed
2023-11-13 15:10:48 +00:00
Pavel Punegov 6053c94c8a [K/N][build] Fix KT-56495: improve version manifest merge
Add missing input property to stdlib build task. This task should
consider kotlin/build version change.
Add a version check during the stdlib target task build. This check
should be done here instead of the final merge.

Fixes ^KT-56495


Merge-request: KT-MR-12906
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-13 14:45:06 +00:00
Mikhail Glukhikh 5c56f0ef77 K2: drop obsolete TODO about use-site targeted annotations
See comments in KT-59824
#KT-59824 Obsolete
2023-11-13 13:59:32 +00:00
Mikhail Glukhikh 9903b70e0a K2: add test to confirm KT-58874 now works properly
#KT-58874 Obsolete
2023-11-13 12:26:28 +00:00
Vladimir Sukharev d5e391c401 [K/N] Improve manual testing script for SpecialBackendChecks 2023-11-13 11:41:02 +00:00
Vladimir Sukharev 513738b5fe [K/N] Fix test t51.kt for special backend checks 2023-11-13 11:41:02 +00:00
Ilya Goncharov 87e81d8562 [Gradle, JS] Distribution is copy task, webpack targeting to separate directory
^KT-63040 fixed
2023-11-13 10:56:04 +00:00
Marco Pennekamp dd219cb6e6 [LL] Commit pending diagnostics from file checkers on script declarations
- In addition to file declarations and class members, we also need to
  commit pending diagnostics on declarations in scripts, to honor
  suppressions before the diagnostics are committed indiscriminately.

^KT-62899
2023-11-13 10:20:26 +00:00
Marco Pennekamp c482786bc4 [AA] Add tests for diagnostics suppression on top-level declarations in scripts
- `scriptUninitializedTopLevelProperty` 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
Marco Pennekamp c9cb2062bd [LL] Commit pending diagnostics from file checkers on top-level declarations
- In KT-62899, diagnostics produced by file checkers weren't suppressed
  because the top-level declarations on which the diagnostics are
  reported were never visited by the same reporter.
  `LLFirDiagnosticVisitor` skips nested declarations by design, as
  diagnostics are collected for each structure element separately.
  However, suppression takes effect when diagnostics are committed on
  some element. If the element is not visited, suppression is skipped
  and the diagnostic is committed at the end without a check by
  `FileStructureElementDiagnosticsCollector.collectForStructureElement`.
- The fix ensures that diagnostics are committed on top-level
  declarations, similar to how this was already done for class members.

^KT-62899 fixed
2023-11-13 10:20:26 +00:00
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