Commit Graph

80 Commits

Author SHA1 Message Date
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 d2b9b487c7 [Analysis API] add test for resolution into declarations with the kotlin. package
^KT-63223
2023-11-08 17:32:49 +00:00
Ilya Kirillov 063d73fa73 [Analysis] migrate analysis modules to use cliArgument helper instead of hardcoded CLI argument names
^KT-63294
2023-11-08 17:32:48 +00:00
Dmitrii Gridin 8e623ee73a [LL FIR] support script tests 2023-10-24 19:32:54 +00:00
Dmitrii Gridin 0771b60777 [Analysis API] support multiplatform test cases
^KT-62345
2023-10-17 17:19:40 +00:00
Dmitrii Gridin 2cac922cd0 [FIR] add tests on external annotations
Tests are excluded in COMPILED_JAVA mode because in this
mode external annotations are not present at all

^KT-62310
2023-10-13 12:16:12 +00:00
Brian Norman 365ce2a6a5 [FIR] Implement checker for missing dependency supertypes
#KT-60778 Fixed
2023-10-04 21:57:43 +00:00
Alexander.Likhachev 6eaccc997f [Build] Fix the typo junit jupyter -> jupiter 2023-09-06 22:47:34 +00:00
Alexander.Likhachev 6f96be0b76 [Build] Get rid of the testApiJUnit5 method
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Ilya Kirillov 97a7c0b6ff [Analysis API Standalone] extract functions for getting GlobalSearchScope by roots to utils
^KT-60884
2023-09-06 07:36:11 +00:00
Dmitrii Gridin 2421d3cdf1 [LL FIR] ClassId: add more tests
^KTIJ-26848
^KTIJ-26896
^KTIJ-26902
2023-09-05 12:58:50 +00:00
Yan Zhulanow dbb7e788b2 [LL API] Provide customizable default language version settings 2023-08-30 06:38:44 +00:00
Dmitrii Gridin 5557ea690d [AA] add generated tests for scripts
^KT-61431
2023-08-28 15:02:24 +00:00
Dmitrii Gridin bef5f89f61 [AA] add configurator for scripts
^KT-61431
2023-08-28 15:02:24 +00:00
Ilya Kirillov 1b0034b6e7 [Analysis API] allow AbstractSingleSymbolByPsi to accept <expr>-based section in addition to <caret>-based 2023-08-17 13:01:02 +00:00
Ilya Kirillov 729bae4a2a [Analysis API] refactoring, add utilities to ExpressionMarkersSourceFilePreprocessor which return null in a case caret/selected expression are not found 2023-08-17 13:01:02 +00:00
Dmitrii Gridin d19a23aae5 [LL FIR] implement tests on dependent copy session analyze
^KT-60987
2023-08-09 15:22:57 +00:00
Yan Zhulanow a09c2a485e [LL API] Add basic tests for 'ContextCollector' 2023-08-07 16:22:02 +00:00
Marco Pennekamp 7fd8e4d0fd [AA] Standalone Analysis API: Introduce KtStaticProjectStructureProvider
- `registerServicesForProjectEnvironment` relied on lists of all modules
  and source files, which the standalone project structure providers
  would have already been able to provide with the right interface.
- In `StandaloneAnalysisAPISessionBuilder.build`, to get all modules and
  source files, `projectStructureProvider` had to be hard-casted to
  `KtModuleProviderImpl`.
- This commit introduces `KtStaticProjectStructureProvider`, a shared
  interface for project structure providers with static module
  structures that know about their modules and source files.
2023-07-31 15:58:00 +00:00
Marco Pennekamp 0c94a3131c [AA] KT-58257 Add API for subscription-directed invalidation
- The commit refactors some modification trackers previously provided by
  `KotlinModificationTrackerFactory` to a subscription-directed
  mechanism implemented via `MessageBus` and `KotlinTopics`. The
  following modification trackers are affected:
  - Module out-of-block modification: The FE10 Analysis API doesn't use
    these modification trackers, so the effect is limited to LL FIR.
  - Module state: Likewise, FE10 doesn't use this modification tracker,
    so again the effect is limited to LL FIR.
- Project and library modifications trackers remain, because many small
  objects in e.g. light classes depend on these trackers (making
  listener management unfeasible), and they are not relevant for
  `LLFirSession` invalidation.
- This new API paves the way for a session invalidation service to
  subscribe to out-of-block and module state changes as events. This
  removes the need to iterate through modification trackers.
  - Also note that the out-of-block modification provided by the new
    subscription mechanism is intended to work for _any_ `KtModule`, as
    long as it makes sense to have out-of-block modifications. For
    example, the subscription should work for script modules. The OOB
    modification tracker previously only supported `KtSourceModule`s,
    which required separate single-file modification trackers for script
    and not-under-content-root modules.
- `MessageBus` is a general utility provided by IntelliJ, but usually it
  is retrieved from `project`. To keep these two concerns decoupled,
  `project.messageBus` should not be used directly. Instead, the commit
  adds a `KotlinMessageBusProvider`, which for now just provides the
  project message bus with its standard implementation, but allows
  swapping out the message bus implementation later.
- Global changes are also supported by the new subscription API. Such
  global changes may for example occur during cache invalidation in
  tests, on global PSI tree changes, or when an SDK is removed.
- Test-only invalidation has been moved from
  `KotlinModificationTrackerFactory` to a new
  `KotlinGlobalModificationService`. This creates one central service
  for invalidation between tests, which is easier from an implementation
  and a usage perspective than calling multiple scattered services and
  providers.
2023-07-31 15:58:00 +00:00
Dmitrii Gridin c01c113af4 [AA] implement infrastructure for scripts
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin e5cd674f33 [AA] split KtSourceModuleImpl on separate files
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin c2fd245ca1 [LL FIR] getSelectedElement should return PsiElement
^KT-60518
2023-07-19 10:32:10 +00:00
Dmitriy Novozhilov 73b580572b [FE] Move @PrivateForInline optIn into :core:compiler.common
This is needed to be able to use it in backend modules too
2023-07-17 21:02:40 +00:00
Pavel Kirpichenkov 630c8e9df6 [AA, tests] Limit scopes of test libraries to their roots, add JDK_HOME
Without the fix, all libraries share the global scope for all project
libraries. JDK_HOME was used implicitly for things such as providing
Record support, but was not included as a test library/sdk.

KT-59637
2023-06-27 10:29:22 +00:00
Jinseong Jeon 799aadfacf AA: add an option to create Application env for production v.s. test mode
...and use production mode by default for AA standalone

^KT-59511 Fixed
2023-06-22 11:32:29 +02:00
Nikolay Lunyak 46ea908daf [Tests] Ensure the temporary directories are cleared
This change may prevent OOMs. Context:
https://jetbrains.slack.com/archives/C4U955N6B/p1685000899030279
2023-06-20 13:28:23 +00:00
Ilya Kirillov 1eb0862820 [Analysis, build] replace testApi -> testImplementation in build.gradle.kts where it's possible 2023-06-02 09:16:47 +00:00
Marco Pennekamp bb7625c5b0 [LL FIR] KT-58325 Fix test library discoverability for combined Kotlin symbol providers
- An LL FIR test failed after merging stub-based deserialized symbol
  providers into combined Kotlin symbol providers:
  `DiagnosticCompilerTestFE10TestdataTestGenerated.TestsWithStdLib.Multiplatform.testJvmOverloads`
- Cause: The combined Kotlin symbol provider was able to find a class
  for `JvmOverloads`. However, the `KtModule` of `JvmOverloads` was
  `LibraryByRoots` with just the stdlib, while the registered stub-based
  deserialized symbol provider was known to the combined symbol provider
  with a `LibraryByRoots` containing 6 different paths. Hence, the
  single-root module wasn't found in the provider map.
- The fix creates a `LibraryByRoot` for each root, which leads to a
  separate deserialized symbol provider for each of the six roots,
  solving the discoverability problem.
2023-05-31 18:34:41 +00:00
Ilya Kirillov 89dbc4daec [Analysis API] tests: add possibility to avoid FqName for Kt psi classes in ExpressionMarkerProvider 2023-05-11 20:44:31 +02:00
Ilya Kirillov 176f77c0ef [Analysis API] tests: add possibility to specify LOOK_UP_FOR_ELEMENT_OF_TYPE for all tests 2023-05-11 20:44:31 +02:00
Ilya Kirillov ba3a3915c7 [Analysis API] tests: use tagged caret to find declaration to analyze in the air against
We cannot use a KtFile as analysis context.

^KT-55527
2023-05-04 15:26:50 +00:00
Anna Kozlova e28e8ad7b8 [AA] recognize library module by roots
merging `LLFirSelectingCombinedSymbolProvider.selectFirstElementInClasspathOrder`
relies on the fact that a candidate belongs to exactly one module.
This can be not true for libraries, attached to multiple modules.
 In that case we need to accept "wrong module" to retrieve correct provider
2023-04-27 11:37:27 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
aleksandrina-streltsova 4b7164a557 [Analysis API] Allow handling scopes from KtScopeContext separately
^KT-55527
2023-03-20 22:04:48 +00:00
Ilya Kirillov ee1b018c9a [Analysis API] introduce a helper test function to get carets at multimodal tests 2023-02-20 11:01:31 +00:00
Valeriy.Vyrva 9a0e2b08f1 Bump JUnit5 version to 5.9.1 2023-02-06 10:01:52 +00:00
Marco Pennekamp d6cb75ca91 [LL FIR] KT-55329 Support transitive dependsOn dependencies in LL FIR
- In contrast to other kinds of dependencies, `dependsOn` dependencies
  must be followed transitively.
- Add `transitiveDependsOnDependencies` to `KtModule`. These
  dependencies are calculated lazily with a topological sort. They are
  added to the dependency provider when it's built in
  `LLFirSessionFactory`.

^KT-55329 fixed
2023-01-30 17:17:58 +00:00
Marco Pennekamp 7c96124a38 [LL FIR] KT-55329 Rename refinementDependency to dependsOnDependency
- The new Kotlin MPP name for `refinementDependency` is
  `dependsOnDependency`.
2023-01-30 17:17:57 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Yan Zhulanow f6f667c387 [LL API] Adjust services required by LLFirBuiltinsSessionFactory
As 'initialiseVirtualFileFinderServices()' that is run during
test initialization collects transitive dependencies, all of them
must be ready. However, 'KtNotUnderContentRootModuleForTest' has a
built-in dependency provided by 'LLFirBuiltinsSessionFactory'.
2023-01-25 08:04:40 +00:00
Yan Zhulanow f199671c4d [LL API] Make 'KtNotUnderContentRootModuleForTest' depend on built-ins 2023-01-25 08:04:39 +00:00
Yan Zhulanow f1edbc1a14 [LL API] Add tests for 'out of content root' analysis mode 2023-01-25 08:04:36 +00:00
Ivan Kochurkin 5d273ce839 [FIR & FIR2IR] Prepare test and CLI infrastructure to support MPP
- Move out getAnalyzerServices from FirFrontendFacade to TestSetupUtils
- Simplify DependencyListForCliModule. Now it takes BinaryModuleData as input
- FirOutArtifact contains several FirOutputArtifactPart
- Simplify FirFrontendFacade
2023-01-13 12:55:57 +00:00
Dmitrii Gridin c28e9d5253 [LC] add tests for enum classes
^KT-55496
^KTIJ-23530
2022-12-20 19:52:11 +00:00
Dmitrii Gridin b2c0a37050 [SLC] implement infrastructure for light class hierarchy tests 2022-12-13 16:54:25 +00:00
Yan Zhulanow ea3f550b58 [FE] Support analyzable files throughout all 'KtPsiFactory' API
Before, the only way of getting analyzable elements was to create an
analyzable file by using 'createAnalyzableFile()'. So made all utilities
available in 'KtPsiFactory' useless as they delegate to 'createFile()'
that always set the 'doNotAnalyze' flag.

The new behavior is to pass the 'analysisContext' instead if it is
passed to the 'KtPsiFactory' constructor.

The newly appeared API is going to be used in the Kotlin's UAST
implementation.
2022-11-11 11:28:34 +00:00
Jinseong Jeon d98081dce2 AA: introduce MPP tests for PsiTypeProvider 2022-11-02 17:38:16 +01:00
Jinseong Jeon 5bca3c6841 AA: rename test api for better clarification
Many sub tests are implementing the same name, doTestByFileStructure,
which indeed are based on the list of KtFile in a single module.
Rather, this one should be named after "ModuleStructure".
2022-11-02 17:38:15 +01:00
Roman Golyshev 3485d65213 [K2] Ignore failing tests for isUsedAsExpression
Those tests do not pass at the moment because of KTIJ-23143
2022-10-05 15:06:52 +00:00