Commit Graph

569 Commits

Author SHA1 Message Date
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
Kirill Rakhman 1876c8a9ee [AA] Fix getKtExpressionType for augmented array assignment
This previously worked on accident because the get call in an
augmented array assignment wouldn't have a resolved argument list, and
so `argumentsToSubstitutedValueParameters` would return null.
Now, we additionally verify that we're in a `set` call.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 03fc0fd381 [FIR] Remove FirLambdaArgumentExpression
It's not really necessary if the information about if the lambda was a
trailing lambda can be directly saved in FirAnonymousFunctionExpression.

Removing the FIR node uncovered a couple of bugs
(UNINITIALIZED_ENUM_ENTRY, ERROR_IN_CONTRACT_DESCRIPTION) that were
caused by assuming that a lambda is always a trailing lambda.

#KT-66124
2024-03-13 17:05:48 +00:00
Roman Golyshev de75297875 KT-66498 [AA] Add more tests for the isSubClassOf/isDirectSubClassOf
Also, reproduce the difference between the K1 and K2 implementation
of `isSubClassOf` for the same class
2024-03-13 16:31:41 +00:00
Vadim.Mishenev df1d44b15f KT-64051 [AA] Fix resolve of KDoc references to a typealias by full name 2024-03-11 21:38:09 +00:00
Roman Golyshev 83a80a45a9 KT-66411 [AA] Add more tests for resolving compound set operators 2024-03-10 15:35:47 +00:00
Anna Kozlova 943d829fa7 [AA] treat named arguments as write access
^KTIJ-16835 fixed
2024-03-08 22:12:25 +00:00
Yan Zhulanow 690f39b91c [Analysis API] Minor, refactor 'createDumbVirtualFile()'
Pass the file name explicitly, and refine the dumb 'VirtualFile'
implementation.
2024-03-07 12:14:19 +00:00
Jinseong Jeon de4cce8dc8 AA: add support VirtualFile inputs to source module
^KT-65571 fixed
2024-03-07 12:14:19 +00:00
Jinseong Jeon 520ae725d1 Add test about dependsOn dependency and stdlib-common 2024-03-07 12:14:19 +00:00
Jinseong Jeon 6c062b0cea Add test about resolution to klib from non/common platforms 2024-03-07 12:14:19 +00:00
Jinseong Jeon 7f33097634 Fix typo in test input file name 2024-03-07 12:14:19 +00:00
Jinseong Jeon d4d2bae630 AA: add tests about wildcard suppress
^KT-61734
2024-03-07 10:16:58 +00:00
Dmitrii Gridin 805b7bc8f4 [Analysis API] add diagnostic tests on deprecated declarations
^KT-60996
2024-03-06 16:13:09 +00:00
Dmitrii Gridin 9cc2c22116 [Analysis API] drop obsolete tests
They were renamed during 2ce324f1fc,
but old wasn't dropped
2024-03-06 16:09:43 +00:00
Dmitrii Gridin 1ba81fca57 [Analysis API] add tests on incomplete function type parameter symbol
^KT-65858 Obsolete
2024-03-06 16:09:43 +00:00
Marco Pennekamp 708ed81eb2 [Test] Avoid importing unused @Nested annotations in generated tests
- Unused `Nested` imports frequently cause unused import warnings in the
  IDE, which are especially annoying in after-commit warning/error
  analysis.
2024-02-27 20:30:06 +00:00
Anna Kozlova e650ba9855 [AA] return expect declaration for "implicit" actual
If actual declaration is broken (missing explicit `actual` keyword),
expect declaration still makes sense.
This way, we allow refactorings on broken code

^KT-65191 fixed
2024-02-27 18:49:02 +00:00
Marco Pennekamp 4ea3de1760 [AA] Refactoring: Rename KtModuleFactory to KtTestModuleFactory
^KT-65960
2024-02-26 21:57:23 +00:00
Marco Pennekamp 78ef58bef4 [AA] Tests: Remove decompiled files from LibraryBinary and add LibraryBinaryDecompiled
- `LibraryBinary` should not contain any decompiled files, as we want
  FIR symbols in tests to be provided from indexed stubs or class files,
  but definitely not from decompiled PSI. This brings `LibraryBinary`
  much closer to the behavior of binary libraries in the IDE.
- Some tests may still require access to a decompiled file, for example
  when trying to test `getOrBuildFir` for some `KtElement` coming from a
  library. This commit introduces `LibraryBinaryDecompiled`, which
  does contain decompiled files.
- We don't really need `LibraryBinary` as a main test module kind
  anymore, since tests generally want to access some main `KtFile`.
  Hence, test configurators for `LibraryBinary` have been turned into
  configurators for `LibraryBinaryDecompiled`.
- An alternative would be decompiling files on demand, but this is not
  currently feasible because the Standalone API doesn't reconcile stubs
  with decompiled PSI, like the IDE does automatically. (For the same
  declaration, the stub and the PSI will have a different identity.) As
  long as there is no support for this, we'll have to rely on a separate
  test module kind.

^KT-65960
2024-02-26 21:57:23 +00:00
Marco Pennekamp 7baaa38b8a [AA] Add KtTestModule.moduleKind
- `TestModule.explicitTestModuleKind` requires a directive to be present
  to get the `TestModuleKind`. But we still want to find out the test
  module kind for test modules without a directive. Hence, we have to
  add this property to `KtTestModule` during its construction.

^KT-65960
2024-02-26 21:57:23 +00:00
Marco Pennekamp 2060709c03 [AA] Turn KtModuleWithFiles into KtTestModule (AA test framework)
- `KtModuleWithFiles` isn't actually used in a production Standalone API
  context, but it was exposed via `analysis-api-standalone-base`. In
  current production usages, the project structure is built with the
  module builder DSL.
- Hence, `KtModuleWithFiles` is only relevant for tests. This commit
  moves `KtModuleWithFiles` to the Analysis API test framework and
  renames it to `KtTestModule`. This removes any risk that an outside
  user could start using `KtModuleWithFiles` and completely uncouples
  the test project structure from production APIs.
- In addition, we can add the `TestModule` to `KtTestModule`, allowing
  tests to quickly access the original test module, for example to check
  the test module kind.
- The commit also removes the data class status of `KtTestModule` and
  `KtTestModuleProjectStructure` to avoid issues with destructuring when
  properties are added or removed.

^KT-65960
2024-02-26 21:57:23 +00:00
Marco Pennekamp 878eba7d52 [AA] Introduce AnalysisApiIndexingConfiguration test service
- The configuration allows the test infrastructure to decide whether to
  index binary libraries to stubs (when stub-based deserialized symbol
  providers are used) or to skip indexing (when class file-based
  deserialization is used).
- The information is needed in `AnalysisApiBaseTestServiceRegistrar`,
  where the `KotlinStaticDeclarationProviderFactory` is created. This
  service registrar shouldn't access `LLFirLibrarySymbolProviderFactory`
  and so checking the library symbol provider factory wasn't an option.
- Another alternative was adding a property to
  `AnalysisApiTestConfigurator`. However, this then requires passing the
  property to `AnalysisApiBaseTestServiceRegistrar`, because it doesn't
  have access to the configurator out of the box. This however goes
  against the design of our service registrars, which generally only
  access test services. So adding a test service seemed like the best
  solution.

^KT-65960
2024-02-26 21:57:23 +00:00
Roman Golyshev c1ea878e52 KT-64808 [stubs] Add extra tests for synthethic declarations from data and value classes
It's not related to the stubs format changes, but there were no tests
for that in symbols resolve tests
2024-02-23 10:51:28 +00:00
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
Jinseong Jeon 7911207734 AA: remove unused jar file system from KotlinStaticDeclarationProviderFactory 2024-02-19 21:54:21 +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
Jinseong Jeon 7e65f125cc Reproduce wrong binary resolution to fun w/ value class
^KT-65653
2024-02-15 17:02:03 +00:00
Ilya Kirillov d925d3be76 [Analysis API] Fix Unexpected FirClassLikeSymbol null for class org.jetbrains.kotlin.fir.types.ConeClassLikeErrorLookupTag exception
on calling `asPsiType` on an unresolved type with type arguments

 ^KT-65550 fixed
2024-02-15 06:38:47 +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
Alexander Shabalin 4468167a64 [K/N] Move kotlin-native/utilities/basic-utils to compiler/utils 2024-02-08 20:43:11 +00:00
Marco Pennekamp 9a4bf0601e [AA] Add KtClass-based KotlinSealedInheritorsProvider
- The compiler's `SealedClassInheritorsProvider` should not be exposed
  outside LL FIR, as it is an internal compiler component and also
  exposes `FirRegularClass`. `KotlinSealedInheritorsProvider` is an
  Analysis API provider for sealed inheritors that accepts a `KtClass`
  instead.

^KT-64718 fixed
2024-01-30 11:48:09 +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 c548bed6f6 [Analysis API] Fix 'getContainingDeclaration()' for code fragments
^KT-65075 Fixed
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
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
Jinseong Jeon 0dfaa91970 K2 UAST: simplify PSI declaration provider
In addition to class lookup (done at cec299ac), we can use
JavaFileManager to search classes in a certain package too.
2024-01-23 09:09:37 +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
Roman Golyshev 1e2f612cbc KTIJ-27841 [AA] Add simple test cases for the classes with same name conflicts 2024-01-17 10:15:28 +00:00