Commit Graph

3976 Commits

Author SHA1 Message Date
Mikhail Glukhikh 4d49bdb8ca K2: add a black box test to confirm KT-53718 now works properly (JVM IR only)
Related to: KT-57584, KT-58110
2023-11-15 09:33:05 +00:00
Mikhail Glukhikh 4b1368409d K2: add a black box test to confirm KT-55705 now works properly 2023-11-15 09:33:05 +00:00
Mikhail Glukhikh f2ef41dbbd K2: add a black box test for KT-58874 to confirm work also in runtime 2023-11-15 09:33:03 +00:00
Kirill Rakhman a63ec9efdc [FIR] Implement warnings for java nullability upper bound violation 2023-11-15 08:43:55 +00:00
Kirill Rakhman 2df1e9dde6 [FIR] Implement warnings for java nullability type mismatch on override
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman a6fdeeb7df [FIR] Implement warnings for java nullability type mismatch
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman 1ecbc094ec [FIR] Save warning-level enhanced types to an attribute
#KT-56989
2023-11-15 08:43:55 +00:00
Nikolay Lunyak 9e57aba448 [FIR] Add a test for KT-26045
^KT-26045 Fixed

Merge-request: KT-MR-13023
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-11-15 07:52:11 +00:00
Roman Golyshev d865a44c94 KT-61890 [AA] Add test for ContextCollector at loop variable position
This turns out to be important for conflict resolution in
postfix completion in K2 IDE (see `KotlinDeclarationNameValidator`)
2023-11-14 22:15:05 +00:00
Roman Golyshev 47a00bf97e KT-61890 [AA] Use ContextCollector in KtFirScopeProvider
^KT-61890 Fixed
2023-11-14 22:15:04 +00:00
Roman Golyshev 4f136cde31 KT-61890 [AA] Add testdata to ensure KDoc completion support in IDE
Completion in the IDE relies on correct scopes for KDoc positions.
So we add testData for `KtScopeProvider` and `ContextCollector`
to ensure that there are no regressions
2023-11-14 22:15:04 +00:00
Stanislav Ruban b2fb37043d [tests] Regenerate configurations for diagnostic tests 2023-11-14 17:58:21 +00:00
Nikolay Lunyak 5a1a23afac [FIR] Don't miss annotations on inits
^KT-59874
2023-11-14 15:19:33 +00:00
Mikhail Glukhikh be5a27dd6b K2: add test to confirm KT-56409 now works properly 2023-11-14 14:25:13 +00:00
Mikhail Glukhikh cf9bd44cf7 K2: add test to confirm KT-54139 now works properly 2023-11-14 13:33:18 +00:00
Dmitrii Gridin 28895a2613 [FIR] FirAnnotationArgumentsTransformer: fix scope problem with type parameters
We should wrap outer declaration to avoid FirTowerDataMode.CLASS_HEADER_ANNOTATIONS

^KT-63396 Fixed
2023-11-14 10:46:43 +00:00
Dmitrii Gridin 2ee9fcab9b [FIR] add diagnostic test for annotations inside type parameters
^KT-63396
2023-11-14 10:46:43 +00:00
Aleksandra.Arsenteva 83c90d0e4f Add one more test for KT-61959
Generate FE tests
2023-11-14 10:09:54 +00:00
Alexander Udalov 54705e5afc IR: copy context receiver parameters count in FakeOverrideCopier
#KT-63430 Fixed
2023-11-13 21:36:22 +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
Mikhail Glukhikh 9903b70e0a K2: add test to confirm KT-58874 now works properly
#KT-58874 Obsolete
2023-11-13 12:26:28 +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
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 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
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 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
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 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
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
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
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
Marco Pennekamp 1cc2390af6 [FIR] Add tests for top-level property initialization in scripts
- The test data is missing initialization checks and will be fixed with
  the subsequent commit.
- The test data is originally taken from
  `backingField/TopLevelPropertyInitialization` and has been simplified.
- I didn't add `const val` properties to the test data (compared to the
  original) due to KT-20110.

^KT-63286
2023-11-09 13:09:39 +00:00
Dmitrii Gridin 891e1fb59b [LL FIR] do not render redundant phases during lazy resolution tests
There is no sense to rendering phases which are lower than the base one
because the output will be the same as the baseline

^KT-63042
2023-11-09 13:07:14 +00:00
Dmitrii Gridin b0d72c6292 [LL FIR] add lazy resolve tests for substitution override on function
^KT-63042
2023-11-09 13:07:14 +00:00