Commit Graph

2251 Commits

Author SHA1 Message Date
Roman Efremov 29980c6b85 [Tests] Run KMP tests in Analysis API LL FIR test suites
New tests are red in current commit!
All `.ll.kt` files are just copies of `.fir.kt` or `.kt`. This will be
fixed in the next commit to clearly show difference between LL and FIR.

The original purpose of this change was to test
`ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic, for which FIR checker
will be run only in IDE (to be changed in next MR), so its reports
a lost from usual KMP tests.
But this looks like a useful change for all KMP tests, not only this
diagnostic.

^KT-62559
2023-11-10 19:36:09 +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 bffbbe6293 [LL FIR] add LL FIR tests based on AbstractFirPsiNativeDiagnosticsTest
^KT-62910 fixed
2023-11-10 06:41:03 +00:00
Ilya Kirillov 68235b978b [Analysis] add test generator for Kotlin/Native tests inside Analysis API
This test generator is enabled only if Kotlin/Native support is enabled in the project

^KT-62910
2023-11-10 06:41:03 +00:00
Jaebaek Seo e80f044847 K2: Update reference shortener to handle import alias
The existing reference shortener does not use import alias when it
shortens a symbol. Instead, it adds a new import directive for the
symbol that is already imported. This commit updates reference shortener
to let it reuse the existing import alias rather than adding a new one:

 1. When shortening a symbol, check whether the symbol is already
    imported.
 2. If it is already imported by an import alias, keep the symbol
    reference expression and the import alias as a string together in
    `ShortenCommand`.

The actual PSI update (shortening) based on the ShortenCommand is done
by IntelliJ.

^KTIJ-27205
2023-11-09 14:34:38 +00:00
Sergej Jaskiewicz 02c12ae26f [FIR generator] Write kDocs for accept & transform methods in FirElement 2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz ed28923282 [IR generator] Don't use kotlinpoet for auto-generating IR tree classes
KT-61970 Fixed
KT-61703 Fixed
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz 63e9dd588c [FIR generator] Factor out element printer to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz 84bd12c667 [FIR generator] Factor out field printer into the common code
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz bca35c0015 [FIR/IR generator] Add default arguments to TypeVariable constructor 2023-11-09 13:30:25 +00:00
Jinseong Jeon 4110a9971a AA: fix KtTypeProvider#getReceiverTypeForDoubleColonExpression
K1 version has used a wrong expression to retrieve the slice.
K2 version mishandled property access as a receiver.

^KT-63195 fixed
2023-11-08 16:18:21 +00:00
Evgenii Mazhukin 20af98c776 [Tests] Re-enable K1 IC tests for expect-actual
^KT-60831 fixed
^KT-60831 next step KT-63183


Merge-request: KT-MR-12855
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-06 19:46:43 +00:00
Sergej Jaskiewicz a84277782a [IR generator] Don't use kotlinpoet for auto-generating IrFactory
KT-61970
2023-11-06 09:47:22 +00:00
Sergej Jaskiewicz 54de11cb58 [FIR/IR generator] Generate kDocs for visitor classes 2023-11-02 23:05:18 +00:00
Sergej Jaskiewicz 570422dbd4 [FIR/IR generator] Print visitor method expression bodies on new line
This helps to avoid long lines in visitor classes.
2023-11-02 23:05:18 +00:00
Sergej Jaskiewicz c5f519f7c7 [FIR/IR generator] Commonize visitor printing logic
This is a step towards commonizing the code generator between
FIR and IR: KT-61970

Also, don't use kotlinpoet for generating IR visitors (KT-61703)
2023-11-02 23:05:18 +00:00
Anna Kozlova 205a125c5f [AA] implement KtFirSimpleNameReference.getImportAlias
^ KT-62980 fixed

Merge-request: KT-MR-12786
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-11-02 21:23:43 +00:00
Alexander Udalov 1cf04916d6 Tests: remove bytecode listing tests for old JVM backend
These tests are mostly used to check ABI in case you're compiling a
library or library-like code, which is no longer possible (since old JVM
backend is only used in the IDE).
2023-11-02 10:59:29 +00:00
Ilya Kirillov 1aa5cf031f [Analysis API FIR] fix "ConeClassLikeTypeImpl is not resolved to symbol for on-error type"
We should not expect builtins to be always available as they are taken from indecies.

For K1 and FIR Standalone implementations, the builtins are always available.

^KT-62010 fixed
2023-10-31 12:24:16 +00:00
Sergej Jaskiewicz 325b152efa [FIR generator] Remove unused class ImplementationWithArg 2023-10-26 17:33:59 +00:00
Sergej Jaskiewicz 7b7bcb8ffa [FIR/IR generator] Introduce ImportCollector
This class enables printing the import list in generated files
in a smarter way.

Also, refactor `Importable` interface hierarchy, namely, don't inherit
`TypeRef` from `Importable`, since we have types like `TypeRef.Star`
which are not really importable.

Replace the `Importable#typeWithArguments` property with
the `TypeRef#render` method to utilize `ImportCollector` while rendering
types.
2023-10-26 17:33:59 +00:00
Roman Golyshev a6668919b0 KTIJ-26423 [AA] Remove FE10 tests for KtImportOptimizer
We don't plan to seriously support the FE10 implementation of
`KtImportsOptimizer` service, since it's not going to be used in IDE
(it has its own old version of import optimization logic)
2023-10-25 20:53:13 +00:00
Dmitrii Gridin 2f8026f335 [LL FIR] add missed diagnostic tests for scripts
^KT-62840
^KT-62841
^KT-62861
2023-10-24 19:32:54 +00:00
Anna Kozlova 5cac013d8c [AA] approximate inplace type parameters bounds
^ KTIJ-27211 fixed
2023-10-24 10:54:15 +00:00
Dmitrii Gridin 2eb761adae [LL FIR] generate resolution tests over codegen/box testData
Such testData can contain contract violations and other resolution
problems, so we should check them as well

^KT-62776
^KT-62832
^KT-62834
^KT-62836
2023-10-24 10:30:55 +00:00
Sergej Jaskiewicz 9eacdb3314 [FIR generator] Print builder property name in generated classes' KDocs
Just like we do when generating the IR tree
2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz 7e7f4811bd [FIR/IR generator] Add kDoc property to AbstractElement & AbstractField 2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz f2bb988e68 [FIR/IR generator] Replace getTypeWithArguments with a property
The `notNull` of that method was never used.
2023-10-20 10:49:20 +00:00
Sergej Jaskiewicz de4e39906c [FIR/IR generator] Use TypeRef for working with types in fields
- Don't inherit `AbstractField` from `Importable`, because it really
  is not
- Remove the `arguments` and `nullable` properties from `AbstractField`.
  Both properties can be derived from the field's `typeRef`.
- Make `AbstractField`'s `typeRef` property of type
  `TypeRefWithNullability` instead of just `TypeRef`, because fields
  can always be nullable.
2023-10-20 10:49:20 +00:00
Dmitrii Gridin 17ab005668 [Analysis API FIR] KtSymbolContainingDeclarationProvider: support script declarations
This commit also fixes a missing symbol for KtScriptInitializer
and some symbol pointers
Many tests marked as 'DO_NOT_CHECK_NON_PSI_SYMBOL_RESTORE'
due to KtFirFileSymbol#createPointer logic – the pointer can
be created only for PSI

^KT-61451
^KT-61887
^KT-62626 Fixed
^KT-62693
2023-10-20 09:27:21 +00:00
Sergej Jaskiewicz 75b509c185 [FIR/IR generator] Share visitor-related properties between FIR & IR 2023-10-20 06:41:12 +00:00
Sergej Jaskiewicz 04c5ac0eb6 [FIR/IR generator] Factor out adding pure abstract element as parent 2023-10-19 12:00:25 +00:00
Sergej Jaskiewicz 5798021e4b [FIR/IR generator] Refactor element parents
- Move `elementParents` and `otherParents` properties
  to `AbstractElement`
- Use `elementParents` instead of `parentRefs` where needed
2023-10-19 12:00:25 +00:00
Ilya Gorbunov 911fa3bbbb [stdlib] Merge js-ir specific sources into common js sources 2023-10-19 03:11:54 +00:00
Sergej Jaskiewicz 417aa236fb [FIR/IR generator] Factor out printing the preamble in generated files 2023-10-18 18:42:40 +00:00
Sergej Jaskiewicz 8c6da9fddb [FIR/IR generator] Deduplicate interface/abstract class configuration 2023-10-18 12:39:39 +00:00
Sergej Jaskiewicz 9a4c28498c [FIR generator] Deduplicate the logic of needPureAbstractElement 2023-10-18 11:12:55 +00:00
Sergej Jaskiewicz 7ab4ca6f51 [IR generator] Inherit Element from AbstractElement
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-16 22:56:36 +00:00
Sergej Jaskiewicz f9d17a2d51 [IR generator] Inherit Field from AbstractField
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-16 22:56:36 +00:00
Sergej Jaskiewicz 15751333e3 [IR generator] Introduce constants for List-like types 2023-10-16 22:56:36 +00:00
Sergej Jaskiewicz df0f86bf8d [FIR generator] Use a single list of parent TypeRefs for elements
(Instead of storing the list of parent elements + the map of parent
arguments)
2023-10-13 10:11:38 +00:00
Svyatoslav Kuzmich 0295057520 Refactor: extract test generation regexp into a common util object 2023-10-12 13:26:58 +00:00
Sergej Jaskiewicz 04ac4b71a3 [FIR generator] Replace AbstractElement with ElemenOrRef
In the FIR generator, the `AbstractElement` class was used to
represent either an element type without type arguments applied
(using the `Element` subclass), or an element type with applied type
arguments (using the `ElementWithArguments` subclass).

Instead, it is more logical to use the `Element` class to always
represent a non-parameterized element type, and for a parameterized
element type use the `ElementRef` class, just like we do
in the IR generator.
2023-10-12 11:36:20 +00:00
Sergej Jaskiewicz a909a28f29 [FIR generator] Use more type-safe field builders 2023-10-12 08:24:12 +00:00
Sergej Jaskiewicz 8be455649c [FIR generator] Use TypeVariable instead of TypeArgument for TPs
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-12 08:24:12 +00:00
Sergej Jaskiewicz 8798fdeb82 [FIR generator] Use TypeRef for denoting types
(instead of `Type` and `Importable`)

This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-11 11:16:08 +00:00
Marco Pennekamp 239cfa6d29 [AA] Add tests for combined declared member scopes
^KT-61800
2023-10-10 13:38:00 +00:00
Marco Pennekamp 1408556511 [AA] Refactoring: Rename AbstractMemberScopeByFqNameTest to AbstractMemberScopeTest
^KT-61900
2023-10-10 13:38:00 +00:00
Marco Pennekamp 21efd6aff3 [AA] Add tests for *static* (declared) member scopes
^KT-61900
^KT-61800
2023-10-10 13:38:00 +00:00
Ilya Kirillov 15e4cbc10d [Analysis API] implement an API to get a substitution based on an inheritance relationship between classes
^KT-62090 fixed
2023-10-06 11:39:33 +00:00