Commit Graph

73 Commits

Author SHA1 Message Date
Dmitriy Novozhilov dd94de3a34 [FIR2IR] Properly set statement origin for all parts of += calls
^KT-65649 Fixed
2024-02-28 08:28:14 +00:00
Artem Kobzar 02a78051aa [PSI2IR] Sync start and end offsets on PSI and FIR for an implicit return inside lambdas 2024-02-27 19:25:24 +00:00
Artem Kobzar 4f521aa05c [K1] Fix string offsets to include quotes in the same way it's done in FIR 2024-02-02 14:43:46 +00:00
vladislav.grechko 9aa8fb80e7 Set correct IR origins for inc/dec operations
NB: in order to produce correct IR origins, the source element kinds for
some FIR elements has been changed. As a side effect, mapping PSI to FIR
slightly changed: namely, for `a[b]++`, `a[b]` used to be mapped on
`set` call or callable reference, but now it is mapped on `get` call.

^KT-61891: Fixed
^KT-64387: Fixed
2024-01-30 14:26:10 +00:00
Ivan Kylchik a56bebe44e [FIR2IR] Set correct endOffset for the IrBranch
We want to use end offset of branch's result as the end for the whole
branch, not just the end of its condition.

#KT-63779 Fixed
2024-01-18 10:59:01 +00:00
Sergej Jaskiewicz ad9f7bf90e [IR] Don't use the GET_PROPERTY origin on IrGetField expressions.
This origin was set somewhat arbitrarily.
It actually only makes sense for `IrCall`s to property getters.
There were no places in lowerings that checked `IrGetField` expressions
for this origin value.

^KT-62500 Fixed
2024-01-16 09:26:27 +00:00
Roman Efremov 5cf33c3556 [IR] Render different quotes depending on IR constant type
This is needed for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic
message, but also seems to be good improvement for IR dumps in tests.

^KT-62559
2023-11-28 23:17:23 +00:00
Mikhail Glukhikh 3cb9396b20 K2: prefer derived class sources for callable copies (e.g. fake overrides) 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 4b2a122f80 FIR2IR: make delegate field/accessors sources closer to PSI2IR
#KT-59864 Fixed
2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 47fec1a113 K2: use similar sources for if branches (PSI/LT)
Related to KT-59584
2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 21b4ce050c K2: add source range test to ensure #KT-59584 Fixed 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 920b0bfe63 FIR2IR: use SYNTHETIC_OFFSET for data class generated members 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh a9894b1842 K2: use derived class sources for callable copies if base callables have no sources
Related to KT-60155
2023-10-24 17:08:40 +00:00
Mikhail Glukhikh 4ed7504d87 FIR deserializer: apply attributes on type parameter-based types
#KT-62578 Fixed
2023-10-18 10:30:31 +00:00
Mikhail Glukhikh f501c3870d FIR2IR: make source range for implicit invoke call similar to PSI2IR 2023-10-13 15:42:58 +00:00
Mikhail Glukhikh fe979cc822 K2: add source range test with extension lambda call
This test is equivalent to IDE debugger test
testNoParameterExtensionLambdaArgumentCallInInline3,
which changes behavior due to previous commit
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh b7b7dd1000 FIR2IR: make sources of qualified accesses & calls closer to PSI2IR
#KT-60111 Fixed
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh 7c66a3dc65 Add source range test around multi-line calls 2023-10-13 15:42:58 +00:00
Mikhail Glukhikh 0fb4c9b4fe FIR2IR: generate specific sources for property accessors
Related to KT-60111
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh f38b8fd8cb K2: reproduce KT-60111 2023-10-13 15:42:58 +00:00
Mikhail Glukhikh c4ec576a99 FIR2IR: make *Assign call origins closer to PSI2IR
#KT-60261 In Progress
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh 13ae4abe52 FIR2IR: use elvis temporary variable name closer to PSI2IR
Related to KT-61983
2023-10-13 15:42:57 +00:00
Mikhail Glukhikh a5a8f6736b Raw FIR: set source for setter parameter <set-?> access in delegated properties
Related to KT-59864
2023-10-10 13:38:52 +00:00
Mikhail Glukhikh d321fa3fd9 K2: add partial reproduction of KT-59864 2023-10-10 13:38:52 +00:00
Mikhail Glukhikh 162ba59d7f Raw FIR: set source for delegate field references
Related to KT-59864
2023-10-10 13:38:52 +00:00
Mikhail Glukhikh 9d3bf69212 Raw FIR/LT: use similar sources for delegated constructor calls
After this commit all IR source range tests behave in the same way
for FIR/PSI and FIR/LT, test data is now consistent
2023-10-10 13:38:52 +00:00
Mikhail Glukhikh 4ed6ece78b Test: IR source ranges: make line/column -1 for negative offsets
Before this commit, test data for 'synthesizedDataClassMembers' test
was different between PSI and LT, because we had SYNTHETIC_OFFSET = -2
for synthetic functions and NaiveSourceBasedFileEntryImpl calculated
line/column as 0 for LT. In this commit the dumper was edited to
count -1 as line -1 / column -1 independent of a file entry used.
2023-10-10 13:38:51 +00:00
Mikhail Glukhikh 1d631500f5 Test: add K2 version of IR source ranges test
After this commit there are three different versions of
IR source range tests: classic (K1), FIR/PSI (K2), FIR/LT (K2).
Since 5 tests behave differently for FIR/PSI and FIR/LT,
in this commit their test data was set to FIR/LT state,
so relevant 5 tests are failing for FIR/PSI right now.
They will be fixed in two subsequent commits

Related to KT-59864, KT-60111, KT-59584
2023-10-10 13:38:51 +00:00
Mikhail Glukhikh 072757cdde Test: convert IR source ranges test to the new infrastructure
Related to KT-59864, KT-60111, KT-59584
2023-10-10 13:38:51 +00:00
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00
Sergej Jaskiewicz 5e34ae5e0d [IR] Print annotations in source range compiler tests 2022-08-03 16:45:56 +00:00
Kristoffer Andersen 7f531d8426 [IR] Improve stepping/LVT behavior around destructuring 2022-05-13 23:19:27 +02:00
Alexander Udalov 6f6bdd8aec IR: change acceptChildren/transformChildren order in IrClass
Traverse properties of supertypes first, and then handle thisReceiver.
This will simplify transition to auto-generated IR.
2022-01-19 17:50:35 +01:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Svyatoslav Scherbina 2f5706597a IR: fix offsets in irTemporary
The variable generated by IrStatementBuilder.irTemporary doesn't inherit
startOffset and endOffset from the builder. In particular, as a result,
temporary variables generated for elvis operator left operand have
UNDEFINED_OFFSET.

Additionally, ProvisionalFunctionExpressionLowering copies the offsets
of a variable to lowered lambda in the variable initializer. With the
problem described above, this causes invalid debug information in
Kotlin/Native, see KT-49360.

Fix irTemporary by using builder's offsets for the variable.

^KT-49360 Fixed
2021-11-16 11:59:55 +00:00
Pavel Kunyavskiy a40022efcd Generate IR for annotation class constructors. 2021-09-23 06:59:33 +00:00
Alexander Udalov ffe0d9de70 Psi2ir: do not sort descriptors for fake override generation
Descriptors are already supposed to be sorted in scopes. The problem is
that rendering descriptors for sorting takes a lot of time (~1.5% of
total compilation time of intellij with JVM IR), and simple heuristics,
like comparing by names first, don't fully help with it.

 #KT-48233
2021-08-31 20:25:59 +02:00
Steven Schäfer 99a4779c6b JVM IR: Don't produce line numbers in synthetic Enum members 2021-03-16 21:30:18 +01:00
Dmitry Petrov 4e261cc358 JVM_IR KT-24258 fix NPE message for delegated properties 2020-12-23 21:50:10 +03:00
Mads Ager a37f16d7a2 [IR] Do not generate line numbers for synthesized data class members.
Fixes KT-41903.
2020-10-06 19:53:47 +02:00
Dmitry Petrov 5b53663eb8 PSI2IR KT-41181 don't generate deep trees in hashCode 2020-09-07 16:09:42 +03:00
Georgy Bronnikov 4ca98041cd IR: update test data 2020-07-30 11:24:08 +03:00
Georgy Bronnikov c901e82a55 IR: add IrSimpleFunction.isInfix 2020-07-18 11:03:33 +03:00
Dmitry Petrov cb1b9c2ccf IR testData: IrSimpleFunction.isOperator 2019-11-29 13:53:05 +03:00
Jiaxiang Chen 0441e484a6 PSI2IR: For implicit function return, use expression's end offset as start offset of the IrReturn to generarate correct line number. 2019-11-26 17:59:28 +03:00
Dmitry Petrov 82c527c2cc IR: IrProperty.isFakeOverride 2019-11-01 14:55:10 +03:00
Dmitry Petrov 2682057767 IR tests: update testData for IrSimpleFunction.isFakeOverride 2019-11-01 14:55:09 +03:00
Steven Schäfer 76ab631214 psi2ir: Optimize generated data class members
- Access underlying fields directly, instead of using accessors. This is
  safe since data classes are always final.
- Don't generate a temporary variable in hashCode to use as the
  accumulator.

Both optimizations are effectively present in the current JVM backend
and with these changes the generated code is much closer to what the
current backend generates.
2019-09-18 18:56:42 +02:00
Steven Schäfer a90ac2438d Set correct field visibility in psi2ir 2019-08-28 19:41:11 +02:00
Mads Ager 6c7a904663 Psi2Ir: Mark accessors with no bodies as default accessors.
They are currently marked as defined even when they get a
default implementation. That makes it hard to figure out
if the accessor should be removed when introducing a backing
field in the JVM_IR backend.
2019-08-28 19:25:13 +02:00