Commit Graph

1427 Commits

Author SHA1 Message Date
Roman Efremov 6611a55a60 [FE] Relax rules of matching @Target annotation on expect and actual
Allow `expect` targets to be subset of `actual`.

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov ad84c83ee9 [FE] Skip more special annotations in KMP annotation matching
Many errors are reported in stdlib with these annotations
(SinceKotlin, Deprecated, so on).
But having them only on expect is a valid case. E.g. SinceKotlin added
if some old platform-specific API becomes commonized.

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 234f453173 [FE, IR] Don't check SOURCE annotations if actual declaration has no source
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 454756a2b5 [IR] Don't check annotations on expect/actual fake overrides
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 2980179bd7 [IR] Implement IR checker for expect actual annotations matching
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 1a4ab9bb4b [FE] Implement FE logic of expect actual annotations matching
This implementation only checks annotations set on expect/actual
declarations and requires further refinement (e.g. checking of other
annotation targets, class scopes within typealiases).

^KT-58551
2023-07-24 09:48:48 +00:00
Ivan Kylchik 17e49fce75 [JVM_IR] Support basic fake var generation for IR inliner
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 286090a1db [IR] Drop inlinePureArguments parameter from FunctionInlining
Replaced its usages with `alwaysCreateTemporaryVariablesForArguments`
2023-07-20 09:01:42 +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
Ivan Kochurkin f4a648aa3e [K2, MPP] Fix NO_ACTUAL_FOR_EXPECT reporting for all modules including the platform ones
^KT-58483 Fixed
2023-07-13 16:01:26 +00:00
Ivan Kylchik 0c6e2f135e [Native] Drop constantInliningPhase
We don't need this lowering anymore because corresponding work is done
by `constEvaluationPhase`
2023-07-10 13:19:52 +00:00
Ivan Kylchik 8e42ccaccb [IR] Drop FoldConstantLowering and StringTrimLowering 2023-07-10 13:19:51 +00:00
Ivan Kylchik abbafc0b2a [IR] Move some inline utils from backend.common into ir.util 2023-07-06 11:00:14 +00:00
Ilya Chernikov 07df03dbec K2 Scripting: fix capturing in scripts created from Fir 2023-07-05 19:46:04 +00:00
Dmitriy Novozhilov 6bb7fc05df [IR] Split implementation of DataClassMembersGenerator to IR based and descriptor based 2023-07-05 14:57:55 +00:00
Kirill Rakhman 04f16d75d2 [K2 MPP] Fix hasStableParameterNames check for fake overrides
This fixes a false positive error regarding different
parameter names in expect actual matching with fake overrides.

#KT-59737 Fixed
2023-07-05 13:30:01 +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 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
Alexander Udalov b75aa9af4e IR: do not copy call in CrossFileCallAdjuster
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:18:59 +00:00
Alexander Udalov 42057b7fe0 IR: do not copy call in ForLoopsLowering
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol is now mutable.
2023-06-22 17:18:59 +00:00
Alexander Udalov bb4d25dfc9 IR: do not copy calls/references in ExpectSymbolTransformer
This is just a refactoring/optimization that makes use of the fact that
IrCall.symbol and other similar fields are now mutable.
2023-06-22 17:18:59 +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
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
Dmitriy Novozhilov 1b24b95cde [FIR] Check for subtyping during actualization of supertypes of expect class
^KT-59356 Fixed
2023-06-22 07:05:31 +00:00
Dmitriy Novozhilov 5717b59f52 [FIR/IR] Introduce an ability to propagate generated IR annotation to metadata
^KT-58638 Fixed
2023-06-21 06:56:59 +00:00
Artem Kobzar 039b5fca7a [K/JS] Use declared upper-bound types for parameters inside inlined functions body, instead of the provided types 2023-06-20 12:01:28 +00:00
Dmitriy Novozhilov d972b78627 [FIR] Allow actualization of expect classes by classes with wider visibility
^KT-59355 Fixed
2023-06-19 11:09:32 +00:00
Abduqodiri Qurbonzoda 295fdc36ce Enum.valueOf throws inconsistent exception across multiple platforms #KT-35116 2023-06-16 22:18:20 +00:00
Ivan Kylchik 0e2b348fa0 [IR] Try to tun IrInterpreterKCallableNamePreprocessor only once
#KT-58923 Fixed
2023-06-14 19:02:39 +00:00
Ivan Kylchik dd264cff50 [IR] Split const folding into necessary one and for optimizations only
In this commit we have a lot of change in test data. This was caused
by the way where we evaluate constants. We split constant evaluation
into two distinct parts: only necessary evaluations for `fir2ir`
(like const val and annotations) and optimizations for lowering.
Now we don't do all constant evaluation on `fir2ir`, but IR
dump is executed after this phase, so test data changed.

#KT-58923
2023-06-14 19:02:39 +00:00
Ivan Kylchik 0021a5f655 [K2] Save inlined java field into special InlineConstTracker 2023-06-14 19:02:39 +00:00
Dmitriy Novozhilov 29afd0dc97 [FIR] Properly match expect fun interfaces with java interfaces 2023-06-10 07:33:30 +00:00
Dmitriy Novozhilov 8b9079d026 [Expect/Actual] Add ability to skip matching of constructors of expect enums
In terms of MPP there are no such thing as `expect constructor` for enums,
  but they are physically exist in FIR and IR, so we need a switch which
  skips matching for them

FE 1.0 implementation did not touch to avoid any hidden changes
2023-06-10 07:33:29 +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
Ilmir Usmanov 95662234d0 JVM: Support instantiation of annotations with vararg parameters
when they are instantiated without argument.
 #KT-59033 Fixed
2023-06-06 17:27:52 +00:00
Ivan Kylchik b9856320cf [IR] Rename fqName to packageFqName for IrPackageFragment 2023-06-02 16:38:04 +00:00
Artem Kobzar bfd57fd2df [K/JS, K/Wasm] Optimize simple objects declaration and usage ^Fixed KT-58797 2023-06-02 14:23:40 +00:00
Ivan Kochurkin 432c781ff7 [K2, MPP] Fix actualization of fake overrides (fixes a set of bugs in coroutines / ktor)
Split MissingFakeOverridesAdder on FakeOverridesActualizer and ActualFakeOverridesAdder

^KT-57984 Fixed
^KT-58003 Fixed
^KT-58124 Fixed
^KT-57833 Fixed
^KT-58153 Fixed
2023-05-24 14:54:51 +00:00
Ivan Kylchik e58e20fc7b [IR] Add special preprocessors for ir interpreter
These preprocessors allow us to modify IR at first and only after that
try to evaluate. With this we can drop `KCallableNamePropertyLowering`.
2023-05-18 18:16:54 +00:00
Ivan Kylchik 104ac4bd69 [IR] Move IR interpreter transformers into separate package 2023-05-18 18:16:53 +00:00
Ivan Kylchik 55cac9caa6 [IR] Separate IrConstTransformer into two distinct classes
The first one `IrConstExpressionTransformer` is responsible for
transforming ordinary expressions and the second one
`IrConstAnnotationTransformer` is responsible for annotations.

#KT-57812
2023-05-11 08:22:13 +00:00
Sergej Jaskiewicz 93d1932ccb [IR] Make IrReturnTargetSymbol a sealed interface 2023-05-10 11:51:26 +00:00
Sergej Jaskiewicz 6c211f3a39 [IR] Make IrFunctionSymbol a sealed interface 2023-05-10 11:51:26 +00:00
Pavel Kunyavskiy 68a68b2763 [K/N] Refactor KonanSymbols to avoid descriptors when built over FIR
^KT-58437
2023-05-08 07:51:56 +00:00
Evgeniy.Zhelenskiy bf5fa61ffb [IR] Unify MFVC bridge redirection, fix related bugs, support MFVC overriding functions with default parameters
#KT-1179
2023-05-04 16:44:18 +00:00
Pavel Kunyavskiy af318fdfb0 [K/N] Fix default arguments in suspend functions
AddContinuationToFunctionsLowering was rewritten in way the order
of this lowering and defaults lowering doesn't matter.

^KT-58214
2023-05-03 12:14:53 +00:00
Dmitriy Novozhilov e9c8be3b64 [FIR] Don't generated fake-overrides for private declarations of actualized super classes
^KT-58252 Fixed
2023-05-02 10:24:53 +00:00
Pavel Kunyavskiy f55fd481e9 [K/N] Refactor default argument lowering to avoid boxing
Current inline classes API is not compatible between different backends.
So implementing common function required for this optimization
was not possible in Native backend.

So, common default arguments lowering was refactored to make bigger
piece of code replaceable in backends.

^KT-57860
2023-05-01 13:04:21 +00:00
Igor Chevdar 4e661a6337 [IR] Liveness analysis
Compute actually used variables for specified IR nodes
2023-04-24 09:57:06 +03:00
Igor Chevdar 6a79163205 [K/N][IR] Extracted a common util function 2023-04-24 09:36:43 +03:00