Commit Graph

2371 Commits

Author SHA1 Message Date
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
Sergej Jaskiewicz c379fd7fa1 [tree generator] Allow adding kDocs to implementation classes 2024-03-14 23:19:40 +00:00
Wojciech Litewka c1266daf73 [tree generator] Remove AbstractField.defaultValueInBase
It is now unneeded, and future needs should be possible to
be resolved otherwise.
Removing it will simplify further changes to tree generator,
especially for IR.
2024-03-14 17:07:02 +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 88a85b8936 [Analysis API] Add reference tests for containing declaration provider 2024-03-14 10:20:29 +00:00
Kirill Rakhman b74dcb77e3 [FIR] Add opt-in to replaceIsTrailingLambda
#KT-66553
2024-03-13 17:05:48 +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 8cc2208c00 [LL FIR] support lazy resolution tests for scripts with custom definition
^KT-66276
^KT-66232
2024-03-07 12:50:59 +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
Artem Kobzar 77f0cba23f [K/JS] Introduce v2015 target 2024-03-06 12:21:38 +00:00
Wojciech Litewka eec14f0054 [tree generator] Remove Suppress("unused") from implementation classes
Those only implement base classes, their members are not supposed
to be referenced directly (those sometimes they are).
So unused code in there can be suspicious.

On the other hand, some generated builders are truly unused, so leave
the suppression for them.
2024-03-05 13:06:03 +00:00
Wojciech Litewka 105ffb15a5 [FIR generator] Remove FirField
To simplify tree generator for further development and align it
with IR and SIR generators.
2024-02-29 15:48:58 +00:00
Yahor Berdnikau 6e874340e9 [Gradle] Deprecate Kotlin*Options types
^KT-63419 In Progress
2024-02-28 21:20:18 +00:00
Marco Pennekamp beb40484dd [LL] Add LLFirSession invalidation tests
- This commit moves all session invalidation tests from the IDE which
  are non-cyclic to the Analysis API. Cyclic session invalidation tests
  cannot be moved because the Kotlin test infrastructure doesn't support
  cyclic module dependencies.
- In fact, these new tests cover more cases, because the IDE tests only
  covered global module state and module out-of-block modification
  events. Crucially, global source modification events are now
  supported, which require libraries to be left alone.
- Module out-of-block modification for libraries is technically
  undefined, but the test still checks this behavior. The current
  session invalidation implementation behaves the same for any kind of
  module-level modification event, so it is possible to publish a module
  OOBM event for libraries. If this changes in the future, we can
  disable those tests. But for now, it's good that these tests run,
  because they will alert us to (accidental) changes to this behavior.

^KT-56288 fixed
^KT-65265 fixed
2024-02-28 21:08:18 +00:00
Kirill Rakhman 5bbec23123 [Test gen] Consolidate file reads for checking directives 2024-02-28 15:20:30 +00:00
Kirill Rakhman 3c23319f70 [Test gen] Remove duplicate checks if file is equal to some string 2024-02-28 15:20:30 +00:00
Kirill Rakhman cba65d7186 [Test gen] Reduce string copying 2024-02-28 15:20:30 +00:00
Kirill Rakhman 7ca6624af4 [Test gen] Reduce Kotlin reflection usage 2024-02-28 15:20:30 +00:00
Wojciech Litewka 6cdddaacb0 [IR] Final preparation to autogenerate IR declaration implementations
IR expressions are left out for now, because unlike declarations,
which are mostly created via IrFactory, expressions' constructors are
widely used, and it's hard to replicate the exact signatures of those
constructors with the tree generator.

Therefore, some other approach is expected to be taken when generating
them in the future.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 4d9d1974ec [IR generator] Better support for fields' default value in base classes
- Allows using those with the incoming IR implementation printer.
- Moves the logic to common tree generator, so other trees can specify
default values in base classes as well, if needed.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 288351d733 [tree generator] Rename AbstractImplementation.fieldsWith(out)Default
to better describe their intended usage, see also next commit.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 6fadc51856 [tree generator] Minor: pass model inside ImplementationConfigurator
Needed for config across many elements in subsequent commits.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka e737320d01 [FIR generator] Specify Field.isChild in base tree configuration
instead of inside implementation configuration.

Whether a field is a child element is a core concept of the tree,
not a matter of particular implementation class.

It is especially visible in IR tree, where the base classes implement the
acceptChildren method. It will also be more relevant in the future.

This also aligns the config style between IR and FIR tree generators.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 6d5b07ebe9 [tree generator] Add AbstractElement#subElements, drop semantic leaves
The notion of IR element class being 'semantically leaf' is rather hacky.
Instead, now we only distinguish whether an element has its
implementation class, which is what this notion was actually trying to
represent.

^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka 7e01fc5906 [IR] Drop "leaf/non-leaf" comment from generated IR classes
As it is not much useful, and the current wording does not represent its
intended wording.
2024-02-28 09:29:56 +00:00
Wojciech Litewka d904ce0939 [tree generator] Merge default and custom implementations 2024-02-28 09:29:56 +00:00
Wojciech Litewka 665bd5153a [tree generator] Make defaultEmptyList#withGetter false by default
to align it with other default* methods.

This will be helpful for configuring IR implementation,
where there are many such empty lists.
2024-02-28 09:29:56 +00:00
Wojciech Litewka 5d7a5245ff [tree generator] Extract printPropertyDeclaration util
analogous to printFunctionDeclaration.

This decouples the printing logic from handling IR elements' fields,
and makes it easier to directly print arbitrary fields.
2024-02-28 09:29:56 +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
Marco Pennekamp 5819f4eaa2 [LL FIR] Test resolve extension disposal after modification events
- These tests simply ensure that a resolve extension is disposed after
  any kind of modification event is raised. It's not meant to test
  complex scenarios, but rather to detect when resolve extension
  disposal isn't invoked *at all*.
- I tried implementing a similar test for resolve extension disposal
  after soft reference garbage collection, but the only way to force the
  GC to collect soft references is to allocate memory until an
  out-of-memory error occurs. That is bad for the test infrastructure,
  because it might allocate A LOT of memory (depending on the max heap),
  which is problematic for running tests locally. Also, our Kotlin tests
  stop on an OOM error altogether (so additional configuration would be
  required) and the heap is dumped into a 20GB file (on my machine),
  which is again problematic for local test runs.

^KT-61222
2024-02-27 16:45:52 +00:00
Alexander.Likhachev d20f31e963 [CLI, Gradle] Fix GradleDeprecatedOption.removeAfter processing
The expected format was Kotlin language version (e.g. `2.0`), however the actual passed values were Kotlin release versions (e.g. `2.0.0`)
^KT-65986 In Progress
2024-02-27 13:07:18 +00:00
Alexander.Likhachev d40d1316d3 [CLI, Gradle] Suppress deprecation errors in generated compiler arguments DSL
^KT-65986 In Progress
2024-02-27 13:07:18 +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 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
Pavel Kirpichenkov 1c1bdae973 [Tests] Add tests for additional stub info in .knm files
KTIJ-28668
2024-02-26 10:18:38 +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
Jaebaek Seo 512efb9649 K2: Support binary library dependencies between test modules
The test infrastructure for analysis supports binary module tests, but
the binary build does not use another binary module as a dependency when
it passes the class path. As a result, each binary module build does not
work when they have dependency on each other.

This commit fixes the issue by
1. Topological sort in the order of dependency graph for test modules.
2. Pass module paths as extra class paths when they have dependency on
   each other.

^KT-64994
2024-02-25 10:10:43 +00:00
Andrey Yastrebov 9d30fb1b1c KT-65741 Fix SIR visitor parameter name & fix typo 2024-02-22 18:46:01 +00:00
Dmitriy Novozhilov 166c88b87c [Build] Add missing runtime dependency for AA Native tests generator 2024-02-21 10:12:07 +00:00
Ilya Chernikov 0d3964f22e Test, scripting: add infra for script tests with customizable def
based on the regular compiler tests infrastructure, but adding
directives that can customize the definition from testdata.
So far only default imports and provided properties are supported, but
the infrastructure is easily extendable to other customizations.
Another limitations that provided properties are not supported for
the black box tests - the constructor parameters computing code
should be adapted to support it.
Note: in order to pick up the customized definition, the script files
should have an extension .test.kts
2024-02-21 07:47:15 +00:00
Dmitrii Gridin 072d191306 [compiler] replace Enum values() with entries
To fix warnings. Also, use of `Enum.entries` may improve the performance

^KT-48872
2024-02-20 17:56:46 +00:00
Dmitriy Novozhilov d9beae0556 [Test] Change indent from four to two spaces in generated tests
This is needed to reduce the size of generated test files, which started
  to exceed default IDE limit
2024-02-16 12:48:24 +00:00
Dmitriy Novozhilov 9b5a9ccba8 [Test] Don't generate throws Exception on methods of generated tests
This is needed to reduce the size of generated test files, which started
 to exceed default IDE limit
Also update some (mostly old) test utilities to remove exceptions from
 java signatures
2024-02-16 12:48:24 +00:00
Vladimir Sukharev bf0150108d [K/N][Tests] Move filecheck and cinterop tests to /native/
^KT-61259
2024-02-14 23:36:34 +00:00
Dmitrii Gridin 898c8c002e [LL FIR] add lazy body calculation tests for scripts
After KT-65344 we can effectively calculate lazy bodies in scripts,
so we can safely add the test

^KT-62840
2024-02-14 16:16:01 +00:00
Nikolay Lunyak 389f02b016 [FIR] Let FirErrorExpression have a working type if possible
^KT-65337 Fixed
2024-02-14 09:57:12 +00:00
Artem Olkov b6c805bbb6 Remove KotlinSirOrigin hierarchy in favour of direct AA usage #KT-65335 Fixed
Merge-request: KT-MR-14229
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-02-09 18:34:52 +00:00
Ilya Goncharov 12cd9c4530 [Gradle, JS] Deprecate only deprecated properties in compiler arguments copy 2024-02-09 18:20:08 +00:00
Ilya Goncharov 2340d59f40 [JS] Get rid of outputFile in compiler args (KT-61116)
^KT-56753 fixed
2024-02-09 18:20:08 +00:00