Commit Graph

352 Commits

Author SHA1 Message Date
Marco Pennekamp 32337c8255 [AA] Render types in sealed inheritors tests as fully expanded types
- This avoids discrepancies between Standalone and IDE mode for sealed
  inheritor tests with type aliases from libraries, because in
  Standalone mode, libraries are deserialized with fully expanded types,
  while in IDE mode, libraries are deserialized from stubs, where type
  aliases are currently not expanded.

^KT-66013
2024-03-18 21:14:36 +00:00
Marco Pennekamp 5c8c3020c6 [AA] Add tests for getSealedInheritors
- Previously, the sealed inheritors provider was only tested indirectly
  through diagnostics tests on `when` expressions.

^KT-66013
2024-03-18 21:14:36 +00:00
Sebastian Sellmair 6b98602afc [Analysis Api] Expose klibSourceFile via KtKlibSourceFileProviderMixIn
This `klibSourceFile` information is deserialized from klibs
to retain the information of the original SourceFile location
of a declaration.

^KT-66271 Fixed
2024-03-18 10:13:57 +00:00
Dmitrii Gridin 675bf36049 [FIR] JavaTypeParameterStack: allow nullable return from get
It is not always possible to have the correct mapping,
at least on the Analysis API side

^KT-66530 Fixed
2024-03-14 18:05:15 +00:00
Yan Zhulanow 0fec50135f [kotlin] Provide CFG facade for the extract function refactoring
This is the first implementation of a control flow graph facade for the
extract function IDE refactoring. The exact contents of
'KtDataFlowExitPointSnapshot' will be refined later.

^KT-65762 Fixed
2024-03-14 10:53:11 +00:00
Yan Zhulanow 1f39bc9a18 [Analysis API] Add tests for foreign values 2024-03-14 10:20:29 +00:00
Yan Zhulanow 88a85b8936 [Analysis API] Add reference tests for containing declaration provider 2024-03-14 10:20:29 +00:00
Yan Zhulanow 0147d725fb [Analysis API] Provide type mapping for callable references
Strictly speaking, callable references are not calls. However, type
arguments are still inferred for references, and 'KtCall' is the only
place in Analysis API that exposes call-substituted types.

^KT-66485 Fixed
2024-03-14 06:10:31 +00:00
Anna Kozlova 943d829fa7 [AA] treat named arguments as write access
^KTIJ-16835 fixed
2024-03-08 22:12:25 +00:00
Dmitrii Gridin 150af66b55 [LL FIR] implement diagnostic tests on custom script definitions
it is impossible to declare test data with another output yet
as `myScriptFile.test.ll.kts` won't be treated as custom definition as
it requires `test.kts` extension.

^KT-66232 Fixed
^KT-66276
2024-03-07 12:50:59 +00:00
Marco Pennekamp b5eccd63b1 [AA] Fix compilation facility "multi binary module" test module structure
- The module structure for these tests was set up backwards: We should
  keep the test module kind of the main module flexible (as it is
  configured by test configurators), but keep the module kinds of the
  binary libraries fixed.

^KT-65960
^KT-64994
2024-02-26 21:57:23 +00:00
Marco Pennekamp 47afd37596 [AA] IDE mode tests: Build and index stubs for binary libraries
- Instead of indexing binary library declarations from decompiled PSI,
  the static declaration provider now builds and indexes stubs. As noted
  in KT-65960, this brings IDE mode tests much more in line with
  decompiled stubs indexing in the IDE. It should allow us to catch
  issues with the stub-based deserialized symbol provider outside of IDE
  tests.
- In the Standalone mode, we can skip stub-indexing completely, as we
  provide FIR symbols via class-based deserialization. This also extends
  to shared binary roots.

^KT-65960 fixed
2024-02-26 21:57:23 +00:00
Jaebaek Seo 171ea3571c K2: Use deserialized type annotation for lambda type resolution.
This commit adds code to check whether a deserialized cone type is a
special function type kind or not when resolving the type of a lambda
expression (anonymous function). If it is a special function kind, it
sets the type of lambda based on the special function kind.

^KT-64994 Fixed
2024-02-25 10:10:43 +00:00
Yahor Berdnikau 6b19b8b9d0 [Repo] Don't use kotlinOptions in repo build scripts
^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Dmitrii Gridin 84f3cc9f9c [Analysis API] drop obsolete code 2024-02-19 09:38:18 +00:00
Ilya Kirillov 50d526fe91 [Analysis API] Check all possible combinations of arguments in tests for KtType.asPsiType() 2024-02-15 06:38:47 +00:00
Yan Zhulanow 3cd04a9e9e [Analysis API] Migrate existing code fragment tests to the new API 2024-01-30 11:41:26 +00:00
Yan Zhulanow c548bed6f6 [Analysis API] Fix 'getContainingDeclaration()' for code fragments
^KT-65075 Fixed
2024-01-30 11:41:26 +00:00
Roman Golyshev e5c6a5bac3 [tests] Clean-up AbstractReferenceResolveTest.kt
Extract local `getRenderedReferencesForCaretPosition` function
into a member function for clarity
2024-01-26 10:12:09 +00:00
Roman Golyshev fb225f5f20 [tests] Return caret names from ExpressionMarkerProvider
Render caret names in resolve testData, so that we don't have to guess
the indices of the carets;
it makes the multi-caret testData less error-prone.

Relevant for KT-65152 and KT-62695
2024-01-26 10:12:09 +00:00
Roman Golyshev ec97659462 [tests] Refactor AbstractReferenceResolveTest. Part 4
Allow multiple carets to be used in reference resolve tests.
Adjust the testdata for the only test case which has actually
had multiple carets in it.

Required for KT-65152 and KT-62695
2024-01-26 10:12:09 +00:00
Roman Golyshev 17c1352d82 [tests] Refactor AbstractReferenceResolveTest. Part 3
Add possibility to `ExpressionMarkerProvider` to get all the carets
from the file.
Use it in `AbstractReferenceResolveTest`, but not check all the carets
yet.

Required for KT-65152 and KT-62695
2024-01-26 10:12:09 +00:00
Roman Golyshev 0c70119637 [tests] Refactor AbstractReferenceResolveTest. Part 2
Extract processing a single caret into a function, so it would be
easier to process multiple carets in the future

Required for KT-65152 and KT-62695
2024-01-26 10:12:09 +00:00
Roman Golyshev 304112cd8a [tests] Refactor AbstractReferenceResolveTest. Part 1
Instead of relying on UNRESOLVED_REFERENCE directive for the whole file,
just render the unresolved reference right in the .txt testdata

This will allow to introduce multi-caret resolve testdata more naturally

Required for KT-65152 and KT-62695
2024-01-26 10:12:09 +00:00
Dmitrii Gridin 052622b862 [Analysis API test] migrate more tests from doTestByModuleStructure to doTestByMainFile
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin cbae92f5c6 [Analysis API test] get rid of AbstractAnalysisApiSingleFileTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 476940c06b [Analysis API test] get rid of AbstractAnalysisApiBasedSingleModuleTest
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin f8d95eceb7 [Analysis API] AbstractAnalysisApiBasedTest: implement test entry points to avoid boilerplate on implementation side
There are three test entry points:
* [doTestByMainFile] – test cases with dedicated main file.
Supports everything from single-file cases to multi-platform multi-module
multi-file cases
* [doTestByMainModuleAndOptionalMainFile] – test cases rather around
modules than files
* [doTestByModuleStructure] – all other cases with fully custom logic

Look at the KDoc of the corresponding method for more details.

^KT-64805 Fixed
2024-01-10 22:07:03 +00:00
Dmitrii Gridin d828a646cf [Analysis API] move allKtFiles util from LL FIR module
^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin a7984c6794 [Analysis API] ExpressionMarkerProvider: do not expose implementation details
And add API for selected expressions

^KT-64805
2024-01-10 22:07:03 +00:00
Dmitrii Gridin 663b7fb76f [Analysis API] AbstractAnalysisApiBasedTest: introduce entry point for tests with main file
Pulled up the implementation from AbstractCompilerFacilityTest

^KT-64805
2024-01-10 22:07:03 +00:00
Ilya Kirillov d5b59c48c2 [Analysis API] fix "Cannot compute containing PSI for unknown source kind 'org.jetbrains.kotlin.KtFakeSourceElementKind$DefaultAccessor'" exception on getContainingSymbol call for default setter parameter
^KT-64825 fixed
2024-01-08 20:06:20 +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 9c91158be6 [Analysis API] Add tests for dangling files 2024-01-05 16:04:14 +00:00
Yan Zhulanow 1a5b9ad79c [Analysis API] Support multi-module projects in compiler facility tests 2024-01-05 16:04:14 +00:00
Dmitrii Gridin 8de9d42b0d [Analysis API] use createSearchScopeByLibraryRoots for test libraries
As it is more similar to production. Also, fixed scope search for klib.
Now we register main binary modules before to avoid duplication with
libraries from createLibrariesByCompilerConfigurators as now we can
have a declared library and regular sources

^KT-62888
^KT-62651
2024-01-03 13:39:42 +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
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 4bd73e4ccd [Analysis API] add diagnostic test for compiler annotation with argument from another module
^KT-63547
2023-12-21 09:34:39 +00:00
Roman Golyshev d5896f20f0 KT-64205 [AA] Add shortening with default settings to the testData 2023-12-15 10:49:24 +00:00
Ilya Gorbunov d2aae67e03 Replace kotlin-test project dependencies in the project
Use dependency helper function that chooses whether to take them
from the bootstrap repository or from a configuration of kotlin-test

KT-61969
2023-12-13 15:40:25 +00:00
Pavel Kirpichenkov 0eb1a63a2f [AA] Add symbol tests for symbols from JS klibs
Use test compiler runner to compile JS libraries. Determine compiler
by the specified TARGET_PLATFORM. Add tests for dynamic type and
JS-specific .proto extensions.

Refactor the code for mock library compilation to make the switch
between platforms more straightforward.

KTIJ-27566
KT-63217
2023-12-01 18:12:23 +00:00
Dmitriy Novozhilov 039baf95fc [Test] Add empty platform module for MPP diagnostic test with only one module
After previous commits IrActualizer runs only there are at least two modules
  in backend input. So to check diagnostics from Actualizer all tests
  should contain at least two modules

Diagnostics in test `extendExpectedClassWithAbstractMember.kt` were
  changed because there is an exception from IrActualizer caused by
  errors from frontend (`ABSTRACT_METHOD_NOT_IMPLEMENTED`), which is
  swallowed by this kind of tests
2023-11-27 10:17:54 +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
Marco Pennekamp 12b6096b67 [LL] Add a test base for PSI-modifying low-level API tests
- To support PSI modification, the test environment requires some
  additional configuration, which is encapsulated in
  `AnalysisApiPsiModificationTestServiceRegistrar`.
- The test also has to allow write access explicitly, which is
  configured in `AnalysisApiFirModifiablePsiSourceTestConfigurator`.
2023-11-16 19:50:51 +00:00
Marco Pennekamp 6189d68c3c [AA] Refactoring: Provide default implementations for functions of AnalysisApiTestServiceRegistrar
- Most inheritors of `AnalysisApiTestServiceRegistrar` only need to
  override one or two functions.
2023-11-16 19:50:51 +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 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