Commit Graph

577 Commits

Author SHA1 Message Date
Anna Kozlova c628382b29 [AA] keep nullability for the recreated type
...when computing receiver type for double colon expression

^KT-65930 fixed
2024-02-20 08:50:04 +00:00
Anna Kozlova a0fef89423 [AA] take resolved type of FirThisReceiverExpression
...when computing receiver type for double colon expression

^KT-65914 fixed
2024-02-19 16:25:21 +00:00
Dmitriy Novozhilov acf2296590 [Test] Regenerate tests after two previous commits 2024-02-16 12:48:24 +00:00
Dmitrii Gridin faebef171d [Analysis API] add regression tests for data class copy arguments usage
This issue is not reproducible against the K2 compiler

^KT-64884
2024-02-13 16:07:17 +00:00
Dmitrii Gridin 31852c6c05 [LL FIR] FileStructure: support dangling modifier list in non-end position
The root cause of the exception is that we missed such an element, and
it led to unresolved declaration during iteration over file declarations

^KT-65562 Fixed
2024-02-12 23:14:12 +00:00
Anna Kozlova 932ad3e2c1 [AA] an expression in delegated super entry is used as expression
^KT-65665 fixed
2024-02-12 20:38:23 +00:00
Yan Zhulanow 57dcd645b1 [kotlin] Reuse applicability checker between extension candidates
Before, auto-completion was based on on-air resolve, and
'FirTowerDataContext' was computed once, during creation of the
dependent analysis session (with using 'FirTowerDataContextCollector').
This allowed to return the context almost instantly, no matter how many
completion candidates there were.

Dangling file resolution doesn't use 'FirTowerDataContextCollector', as
now there is more precise 'ContextCollector'. However,
'ContextCollector' doesn't cache results by itself, and, if asked, it
will compute the same context over and over again. This exact happened
with extension applicability checker.

The optimized implementation maintains a checker object which caches the
computed context. The old end-point is left to give the IDE plugin time
to adapt to the change.

^KTIJ-28445
2024-02-02 15:38:10 +00:00
Yan Zhulanow 892212bdf6 [Analysis API] Add type code fragment test for a local class 2024-01-30 11:41:26 +00:00
Yan Zhulanow ef890e9b76 [Analysis API] Add reference resolution tests for code fragments 2024-01-30 11:41:26 +00:00
Yan Zhulanow 01ca31a061 [Analysis API] Add test infrastructure for code fragments
Now, Analysis API tests can define modules with code fragments.
The preceding module will be used as a context module.
2024-01-30 11:41:26 +00:00
Jinseong Jeon 42e8245007 AA: take into account type arguments if available
...when computing receiver type for double colon expression
2024-01-30 06:57:27 +00:00
Jinseong Jeon 2429d09edd AA: use explicit qualifier type if available
...when computing receiver type for double colon expression

^KT-65150 fixed
2024-01-30 06:57:27 +00:00
aleksandrina-streltsova d935db9e3a [Analysis API] render enhanced types
^KTIJ-28555 Fixed
2024-01-29 09:37:59 +00:00
Ilya Kirillov db7e58ef35 [Analysis API FE1.0] support calling analyze with KtModule in FE10 implementation
^KT-65307 fixed
2024-01-26 16:20:19 +00:00
Roman Golyshev d45662c2c3 KT-62695 [AA] Better resolve ambiguous receiver types in KDocReferenceResolver
When encountering multiple available same named types,
resolve all of them together with corresponding extensions.
This aligns well with the current resolve behavior of classes
with the same name (see `SameNameClassesFromStarImports.kt`)

Also, add extra test for resolving the ambiguous type without
the extension function. The behavior is the same - resolve to the
both classes.
2024-01-26 10:12:09 +00:00
Roman Golyshev f9d4a35d80 KT-62695 [AA] Preliminary set of tests for extensions resolve 2024-01-26 10:12:09 +00:00
Roman Golyshev c0d54f9bbf KT-65152 [AA] Add extra test for package resolution
Make sure that, when ambiguous, both the package
and the callable/class/property are resolved from
KDoc reference.

Do a slight refactoring of `KDocReferenceResolver`

This behavior is also true for K1
2024-01-26 10:12:09 +00:00
Roman Golyshev 38e0b154c3 KT-65152 [AA] Add resolve testData for a package with multiple qualifiers resolve 2024-01-26 10:12:09 +00:00
Pavel Kirpichenkov ed8d3092cd [IDE, JS] Add regression test for KTIJ-27571
Reference resolve for kotlin.js.asDynamic
2024-01-22 18:28:24 +00:00
Jinseong Jeon e91e5db0ce AA FIR: build argument mapping for SAM conversion node
^KT-64910 fixed
2024-01-19 17:05:06 +00:00
Yan Zhulanow 9227359256 [Analysis API] Remove components of obsolete on-air analysis
On-air analysis only worked correctly inside declaration bodies, and
required special handling ('analyzeInDependedAnalysisSession()').
Dangling files, the on-air replacement, works seamlessly, and it is
available in all contexts.
2024-01-18 17:12:28 +00:00
Yan Zhulanow adb8b7b252 [Analysis API] Minor, improve naming for 'computeTestDataPath()' 2024-01-18 17:12:28 +00:00
Roman Golyshev 318fd52567 KT-64993 [AA] Add test case for expected type in unsafe call arg 2024-01-16 22:36:59 +00:00
Roman Golyshev 72a0f2023d KT-64988 [AA] Unwrap safe call when resolving named arguments in FirReferenceResolveHelper
^KT-64988 Fixed
2024-01-16 22:36:59 +00:00
Marco Pennekamp eabbe21b66 [AA] Add diagnostics tests for sealed classes/interfaces
- KT-62895 cannot be reproduced on the Analysis API side. Still, it is
  useful to add tests here for better coverage in the future.
- The reason is likely that Analysis API tests specifically use
  `SealedClassesInheritorsCaclulatorPreAnalysisHandler` to compute
  sealed class inheritors (which are usually the breaking point for
  problems in `when` exhaustiveness checking), so the tests do not use
  the production implementation. See KT-64505 for future work on this
  problem.

^KT-62895
2024-01-10 10:13:23 +00:00
Mikhail Glukhikh f5453690a6 K2: prefer base class sources for JVM mapped functions
This commit is a follow-up to 3cb9396b20
"K2: prefer derived class sources for callable copies (e.g. fake overrides)"

#KT-64044 Fixed
2024-01-06 07:11:27 +00:00
Yan Zhulanow 452d22e14f [Analysis API] Add IGNORE_SELF dangling file resolution mode
In the 'IGNORE_SELF' mode, dangling files don't have their own
declarations in providers. As a result, all references there resolve to
declarations of the original file. It is conceptually similar to that we
had in on-air resolve, however, now it's possible to work with the whole
content of the in-memory 'FirFile'.

As it can be seen in 'ProjectStructureProvider.kt'
(KtFile.danglingFileResolutionMode), the 'IGNORE_SELF' mode is
automatically applied for non-physical files with an original file being
set. For other scenarios, now there is a new 'analyzeCopy()' function
that allows to pass the analysis mode explicitly.
2024-01-05 16:04:14 +00:00
Yan Zhulanow 75abae23d8 [Analysis API] Fix WITH_STDLIB for common modules in Analysis API tests
The previous implementation in 'TestModuleStructureFactory' had very
custom and redundant logic for binary dependency collection.
In particular, JDK and kotlin-stdlib were specifically computed,
although both already were in the module classpath, which was handled in
'createLibrariesByCompilerConfigurators()'. In addition, there was no
support for common modules.

The new behavior is much closer to what happens in production.
2024-01-05 16:04:14 +00:00
Dmitrii Gridin b6d373d8e5 Update copyright to 2024 2024-01-05 13:43:17 +00:00
Dmitrii Gridin 7efbcad121 [Analysis API] add diagnostic tests for inner Java class usage
^KT-62892
2024-01-03 21:35:12 +00:00
Dmitrii Gridin a341dc704f [Analysis API] Add symbol tests for properties from libraries
^KT-62888
^KT-62651
2024-01-03 13:39:41 +00:00
Dmitrii Gridin faf33e4fa4 [Analysis API] add diagnostic test of type inference from getValue delegate
^KT-62888
2024-01-03 13:39:41 +00:00
Marco Pennekamp af7eb8b7af [AA] Add reference resolve tests for Java enums with getName function
^KT-62524
2024-01-02 16:41:34 +00:00
Marco Pennekamp c611f1923f [AA] Refactoring: Move Java reference resolve tests to java subfolder 2024-01-02 16:41:34 +00:00
Dmitrii Gridin 06950f57db [Analysis API] add tests for delegate field
^KT-64584
2023-12-28 08:48:08 +00:00
Dmitrii Gridin 3f337bf62d [Analysis API] add diagnostic test for delegate from library
^KT-62896
2023-12-28 08:48:08 +00:00
Dmitrii Gridin 1ec994cd0d [Analysis API] add diagnostic test for FP expose diagnostic from library
^KT-64468
^KT-62891
2023-12-21 19:48:22 +00:00
Marco Pennekamp d3d21b3f34 [AA] Support multi-module tests with mixed KtModule kinds
- This commit adds a `MODULE_KIND` directive to Analysis API tests which
  can be used to change a test module's `KtModule` kind from the default
  determined by the test's registered `KtModuleFactory` (which in turn
  depends on the `moduleKind` configured during test generation).
- The most important use case is the ability to have multi-module tests
  where a main module references symbols from a binary library module.
  This use case requires source configurations to compile libraries,
  which requires additional setup. This will be implemented in a
  following commit.

^KT-64468 Fixed
2023-12-21 19:48:22 +00:00
Dmitrii Gridin 69a2bc9abc [Analysis API] add regression test on error diagnostics for functional interfaces
^KT-63432 Obsolete
2023-12-21 19:36:44 +00:00
Jinseong Jeon 52a1ffb312 AA: better way to filter out non-JVM modules 2023-12-21 15:34:34 +00:00
Jinseong Jeon ea17bbeddc AA: avoid using compiler impl detail as API return type 2023-12-21 15:34:34 +00:00
Jinseong Jeon 797174ee1f AA: introduce new APIs to get containing file (symbol) and JvmClassName
^KTIJ-27686
2023-12-21 15:34:34 +00:00
Dmitrii Gridin e3841a1728 [Analysis API] add test for duplicated callable during implicit type
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin 4bd73e4ccd [Analysis API] add diagnostic test for compiler annotation with argument from another module
^KT-63547
2023-12-21 09:34:39 +00:00
Dmitrii Gridin e033fe5ba1 [Analysis API FIR] more tests for KtSymbolDeclarationOverridesProvider
^KT-64108
2023-12-12 16:13:10 +00:00
Alexander Kuznetsov e048d49bf0 [Analysis API] fe10: count value classes in isInline
#KT-63771 fixed


Merge-request: KT-MR-13220
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2023-12-01 17:33:30 +00:00
Marco Pennekamp d7190af72d [AA] FE10 compiler facility: Remove old backend support
- Old backend support is not needed in `KtFe10CompilerFacility` anymore,
  because it has been removed for the bytecode tool window, which was
  the only user. The old backend is slated to be removed entirely.

^KTIJ-24522
2023-12-01 13:22:55 +00:00
Egor Kulikov 001e9a4489 [FIR] Source for property delegates should not be null
^KT-60327 fixed


Merge-request: KT-MR-13221
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-29 08:27:53 +00:00
Egor Kulikov 43fc4ccf40 [FIR] Source for implicit iterator calls in for should not be null
^KT-62111 fixed


Merge-request: KT-MR-13029
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-22 17:15:24 +00:00
Roman Golyshev 4f5926a88f KT-62675 [AA] Handle labeled this expressions in reference shortener
At the moment, there is no good way to meaningfully filter `this`
expressions. The filters for the reference shortener can work only with
symbols, and it does not make a lot of sense to check any particular
symbol when deciding whether to shorten a labeled `this` expression.

We would probably need a better API for the shortener to be able
to filter more precisely (see KT-63555)

^KT-62675 Fixed
2023-11-20 20:18:18 +00:00