Commit Graph

1694 Commits

Author SHA1 Message Date
marat.akhin 8eabaff29e [IR] Support IrStarProjection in TypeArgumentMarker.replaceType 2023-07-24 12:15:41 +00:00
marat.akhin a2dda9e25b [IR] Transfer type annotations when substituting via IR substitutor
Other type substitutors (classic, cone-based) respect the type
annotations and copy them to the resulting type for all
cases, including type parameters.

Without this change we cannot correctly match expect/actuals
when we replace actual type parameters with expect ones in case
the actual type parameter has type enhancement annotations
(e.g., `@FlexibleNullability`).

We transfer all annotations (and not conservatively copy only type
enhancement annotations), as 1) other substitutors do that 2) other
IR type substitution utilities (e.g., `IrType.substitute`) do that.
As we will attempt reimplementing all IR type substitution utilities
via IrTypeSubstitutor, it also makes sense to completely align
the behavior.
2023-07-24 12:15:41 +00:00
Roman Efremov 59f1a0dd8e [FIR, IR] Refactor: move annotation retention helper functions
Will be needed in subsequent commit to be accessible in
ExpectActualMatchingContext implementations.

^KT-58551
2023-07-24 09:48:48 +00:00
Alexander Udalov f7ba1b4a7a IR: minor, improve assertion error message
KT-60502
2023-07-21 20:57:41 +00:00
Sergej Jaskiewicz f061215ee9 [IR] Reorder parameters in IrFactory#createFunctionWithLateBinding
This is to prepare for IrFactory auto-generation (KT-59308).
2023-07-21 13:12:37 +00:00
Sergej Jaskiewicz 3828552a1c [IR] Make IrFunctionWithLateBinding a subclass of IrSimpleFunction 2023-07-21 13:12:37 +00:00
Sergej Jaskiewicz b4335c86c8 [IR] Add a new parameter to IrFactory#createPropertyWithLateBinding
This is to prepare for IrFactory auto-generation (KT-59308).
2023-07-20 19:58:47 +00:00
mvicsokolova 5c5367d377 [atomicfu-JVM] Preparation for commonization of JVM and K/N transformers
The following updates in the JVM/IR plugin were made:
* Lots of refactoring with preparation for K/N support: commonization of transformations.
* Improved error handling (checks for visibility constraints, appending message about usage constraints in case of an error).
* Explicit requirements for the visibility of atomic properties: to prevent leaking they should be private/internal or be members of private/internal classes.
* Fixed visibility of generated properties: volatile properties are always private and atomic updaters have the same visibility as the original atomic property.
* Volatile fields are generated from scratch and original atomic properties are removed.
* Delegated properties support is fixed (only declaration in the same scope is allowed).
* Non-inline atomic extensions are forbidden.
* For top-level atomics: only one wrapper class per file (with corresponding visibility) is generated.
* Bug fixes.

The corresponding tickets: 
https://github.com/Kotlin/kotlinx-atomicfu/issues/322
KT-60528



Merge-request: KT-MR-10579
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-20 13:59:23 +00:00
Sergej Jaskiewicz 212c10e674 [IR] Restore source compatibility for IrFactory methods
Previous commits:
c2fde1a915,
0b7db067e6,
0ae95b39c3,
f46761a241,
b1f7b5e982,
2b4a08524d,
5b8b3644fc,
7b77ec9930,
30cd2c3025,
9fcdc10019

have reordered parameters in IrFactory methods.

Restore and deprecate the original methods to
preserve source compatibility for compiler plugins.

KTIJ-26314
^KT-59772 Fixed
2023-07-20 09:36:05 +00:00
Ivan Kylchik ca8db7d0b8 [IR] Move toIrConst method into common IrUtils file
This method is used not only in IR interpreter, so it makes sense to
move it.
2023-07-19 15:12:54 +00:00
Ivan Kylchik 4f92e7c48c [IR] Rename IrTypeTransformerVoid to IrTypeTransformer
This naming is more consistent with already existing
`IrElementTransformerVoid` and `IrElementTransformer`
2023-07-18 15:42:11 +00:00
Dmitriy Novozhilov 0b502f08d5 [IR] Provide default implementations of symbol factories in SymbolTableExtension 2023-07-18 11:51:29 +00:00
Dmitriy Novozhilov c2f9961d4f [IR] Get rid of parameter name descriptor from methods of SymbolTableExtension 2023-07-18 11:51:29 +00:00
Sergej Jaskiewicz e6c4a8957d [IR] Make IrPropertyWithLateBinding a subclass of IrProperty 2023-07-18 10:19:27 +00:00
Dmitriy Novozhilov 01661da7aa [IR] Mark SymbolTable.descriptorExtension with @ObsoleteDescriptorBasedAPI 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 11974c14d8 [IR] Fix various TODOs in SymbolTable 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 899e95ea04 [IR] Include signature into error messages about symbols binding 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 4ec65ace1c [IR] Update inheritors of SymbolTable which override some descriptor-related methods 2023-07-17 21:02:40 +00:00
Dmitriy Novozhilov 8ad202eb8b [IR] Remove descriptor-related methods from SymbolTable
Replace them with calls to SymbolTableExtension
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov b886b7488d [IR] Remove descriptor-related methods from ReferenceSymbolTable
Replace them with calls to ReferenceSymbolTableExtension
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov 4986cb14aa [IR] Extract descriptor part from SymbolTable into separate component
After this change SymbolTable (and ReferenceSymbolTable) contains only
  methods with IdSignatures. All descriptors-related methods are moved
  into DescriptorSymbolTableExtension, which automatically delegates to
  the SymbolTable if needed

At this moment there are cross-references between SymbolTable, because
  descriptor API is still actively used across backends. So SymbolTable
  is accessible in some place then descriptor extension will be accessible
  too

DescriptorSymbolTableExtension is an implementation of abstract SymbolTableExtension
  which allows to implement different kinds of storages, e.g. FIR based
  (it probably will be needed for FIR2IR)
2023-07-17 21:02:39 +00:00
Dmitriy Novozhilov 0067eb85da [IR] Drop unused methods of ReferenceSymbolTable 2023-07-17 21:02:39 +00:00
Sergej Jaskiewicz 5e63f7627f [klib] Test signature descriptions in irText tests
KT-59486
2023-07-14 20:26:45 +00:00
Sergej Jaskiewicz 6142d75bb4 [klib] Serialized mangled names of declarations along with signatures
^KT-59486 Fixed
2023-07-14 20:26:45 +00:00
Sergej Jaskiewicz 10aa5fc7ef [mangling] Add kdocs to some KotlinMangler methods 2023-07-14 20:26:45 +00:00
Dmitriy Dolovov b7bd078a31 [PL] Lower the default PL engine messages log level down to INFO
^KT-59136
2023-07-11 11:37:35 +00:00
Sergej Jaskiewicz 341f61428b [klib] Restore compatibility for IdSignature.CommonSignature constructor
^KT-59771 Fixed
2023-07-10 16:27:47 +00:00
Ivan Kylchik abbafc0b2a [IR] Move some inline utils from backend.common into ir.util 2023-07-06 11:00:14 +00:00
Dmitriy Novozhilov 6bb7fc05df [IR] Split implementation of DataClassMembersGenerator to IR based and descriptor based 2023-07-05 14:57:55 +00:00
Sergej Jaskiewicz 6281faa063 [IR] Move IrFactory#createBlockBody overloads to extension methods
This is to prepare for IrFactory auto-generation (KT-59308).
2023-07-04 15:19:28 +00:00
Sergej Jaskiewicz 9fcdc10019 [IR] Reorder parameters in IrFactory#createValueParameter
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-30 12:41:02 +00:00
Sergej Jaskiewicz 3f6420c5b9 [IR] Move IrFactory#createExpressionBody overloads to extension methods
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-30 11:06:09 +00:00
Sergej Jaskiewicz f14a713e49 [mangling] Remove the unused fqnString method from KotlinMangler 2023-06-29 13:04:25 +00:00
Sergej Jaskiewicz 30cd2c3025 [IR] Reorder parameters in IrFactory#createProperty
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-28 13:21:55 +00:00
Pavel Kunyavskiy cd3237295b [K/N] Remove module-wide ObsoleteDescriptorBasedApi opt-in 2023-06-28 13:18:09 +00:00
Sergej Jaskiewicz 7b77ec9930 [IR] Reorder parameters in IrFactory#createFunction
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-28 10:13:09 +00:00
Sergej Jaskiewicz 5b8b3644fc [IR] Reorder parameters in IrFactory#createLocalDelegatedProperty
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-27 10:22:54 +00:00
Dmitriy Dolovov 4c0583e415 [IR] Two modes of signature rendering
^KT-59486
2023-06-26 15:59:31 +00:00
Sergej Jaskiewicz 1ac3355a41 [FIR] Don't mangle FirFields as properties
The correct way to mangle a field is to just use its name.

This is a step towards fixing KT-57754. It will be fixed in
the next commit.
2023-06-26 12:39:37 +00:00
Sergej Jaskiewicz 2b4a08524d [IR] Reorder parameters in IrFactory#createTypeParameter
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-26 09:52:11 +00:00
Sergej Jaskiewicz b1f7b5e982 [IR] Reorder parameters in IrFactory#createTypeAlias
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-26 09:34:41 +00:00
Sergej Jaskiewicz f46761a241 [IR] Reorder parameters in IrFactory#createClass
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-23 13:25:34 +00:00
Alexander Udalov 978553c513 IR: make call symbols mutable
This will help in some lowerings which need to change the callee of a
call. Instead of creating a new call and copying everything (type
arguments, value arguments, receivers, annotations, attributes, ...),
it's easier to modify the `symbol`. In a way, this is a continuation of
22b4b29292.
2023-06-22 17:18:59 +00:00
Alexander Udalov 3744192806 IR: minor, remove redundant override IrSetValue.symbol 2023-06-22 17:18:59 +00:00
Sergej Jaskiewicz 0ae95b39c3 [IR] Reorder parameters in IrFactory#createConstructor
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-22 16:31:17 +00:00
Sergej Jaskiewicz 0b7db067e6 [IR] Reorder parameters in IrFactory#createField
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-22 15:55:02 +00:00
Sergej Jaskiewicz 3a30d74096 [IR] Add the description field to CommonIdSignature
This field shall be used for storing a human-readable representation
of the declaration, that would be a mangled name for now.

This field is not yet serialized. Serialization will be implemented in
follow-up commits.

See KT-59486
2023-06-20 15:31:45 +00:00
Sergej Jaskiewicz c2fde1a915 [IR] Reorder parameters in IrFactory#createEnumEntry
This is to prepare for IrFactory auto-generation (KT-59308).
2023-06-20 14:12:58 +00:00
Ivan Kylchik 6f4f06757a [IR] Add KType to IrBuiltins 2023-06-14 19:02:39 +00:00
Dmitriy Novozhilov ba41e8ec38 [IR] Use common expect/actual matching algorithm in IR actualizer
^KT-58578 Fixed
2023-06-10 07:33:29 +00:00