Commit Graph

1065 Commits

Author SHA1 Message Date
Vladimir Dolzhenko
e088e302ae [kotlin] Port SimplifyComparisonFix to K2
#KTIJ-26913

GitOrigin-RevId: 2f02695cec1e3d973c4cb7a223cdf0bdcddab23e
2024-03-13 14:39:31 +00:00
Vladimir Dolzhenko
f228446583 [kotlin] Fix insert inlay hints for named arguments
#KTIJ-29008

GitOrigin-RevId: 996a3e8e7fceec34a904c64b47fce1977eddfd5d
2024-03-13 13:24:32 +00:00
Roman Golyshev
f9aa32051f KTIJ-22971 [kotlin] Rename LabeledReturnAsLastExpressionInLambdaInspection to RedundantLabeledReturnOnLastExpressionInLambdaInspection
GitOrigin-RevId: a418f4a94a38a050d3f6035f5fb00007a92c9ac8
2024-03-13 12:57:21 +00:00
Bart van Helvert
8137d46441 [kotlin] Add xml for new fixes module
#KTIJ-29086 Fixed

GitOrigin-RevId: 889f180d592a283340a40465be46c782894347c3
2024-03-13 11:24:10 +00:00
Roman Golyshev
bbee37c964 KTIJ-22971 [kotlin] Adjust the applicability range for LabeledReturnAsLastExpressionInLambdaInspection
Now the quick fix would only be applied on the `return@foo`
range, and would not be available on the returned expression

GitOrigin-RevId: a0e6756cdc12543602da11b0d7418c7659fd1f16
2024-03-13 00:32:36 +00:00
Roman Golyshev
fbf7da2525 KTIJ-22971 [kotlin] Transform RemoveLabeledReturnInLambdaIntention into LabeledReturnAsLastExpressionInLambdaInspection
- convert intention to inspection, so it can be executed in the batch mode
- move the inspection to the shared module for both K1 and K2
- move and adjust the testdata where needed

^KTIJ-22971 Fixed

GitOrigin-RevId: e01f190aa70a1f440bb7d8b523b785d249b7e7de
2024-03-13 00:32:32 +00:00
Bart van Helvert
9652c5a2f1 [kotlin] Move K2 fixes into a new module
GitOrigin-RevId: e8001ccd6e80b535ae165acba449d6b16cd27910
2024-03-13 00:27:06 +00:00
andrew.kozlov
6d3ff7512b [kotlin] KTIJ-29028 KotlinQuickFixFactory implementation for Intentions
GitOrigin-RevId: daf38b1714fd31bc895294b7ba9e66da1aa898b8
2024-03-12 20:51:15 +00:00
andrew.kozlov
abd0559ea9 [kotlin] KTIJ-29028 class inlined
GitOrigin-RevId: b2ab96f49055f6685416a5194b392153785cbd58
2024-03-12 20:51:10 +00:00
andrew.kozlov
1d363ca4fd [kotlin] KTIJ-29028 common KotlinQuickFixFactory interface; implementation for ModCommands
GitOrigin-RevId: a805e27ef10f0bc7e9052f0a06aa4c49531e7664
2024-03-12 20:51:05 +00:00
Tagir Valeev
fd50f306c9 [kotlin-dfa] Box/unbox result of try/catch (KTIJ-29010)
GitOrigin-RevId: 40a12cce011a186e1cc730df757d5e5db2ecbef1
2024-03-12 17:35:26 +00:00
Dmitrii Gridin
be928b3473 [kotlin] swallow exceptions from toKtType
This function already has `Error` for some reason,
but it is not enough to catch real problems.
Most likely this `try` should be dropped in the future,
or at least logging should be added here

^KTIJ-29079 Fixed
^KT-66530

GitOrigin-RevId: 62009a8971fe9f78f17cc7a91a46710f0e173c5e
2024-03-12 17:03:37 +00:00
Tagir Valeev
b9d88ce85d [kotlin-dfa] Fixes according to review (KTIJ-27359)
GitOrigin-RevId: 838a5b980591329912a99b2f6121f964b920876b
2024-03-12 16:55:14 +00:00
Tagir Valeev
0ad41db427 [kotlin-dfa] Avoid capturing context in getVariablesChangedInNestedFunctions
Fixes KTIJ-29069 K2: IDE K2: "Incorrect CachedValue in class KtVariableDescriptor"

GitOrigin-RevId: 6b2cf38b2b519a44a4498aae2ba2ece659c22f0f
2024-03-12 16:55:11 +00:00
Anna Kozlova
8c62f85002 [kotlin] k2: migrate UseExpressionBodyInspection inspection
^KTIJ-26906 fixed

GitOrigin-RevId: 70de2dfa5660e5483e28f170990ec7dfa1ad09e8
2024-03-12 16:54:24 +00:00
andrew.kozlov
973c16e195 [kotlin] KTIJ-29028 KotlinApplicatorBasedModCommand, ModCommandBased.ModCommandBased totally replaced with KotlinModCommandAction
GitOrigin-RevId: 17b58dfe86dcf66b10379588a0368c2eb730d988
2024-03-12 16:53:36 +00:00
Vladimir Dolzhenko
467ba55677 [kotlin] Fix navigation for flexible types
#KTIJ-1619

GitOrigin-RevId: 5578d94e5cb08d94f9598c2ff0c0256eb2dd0365
2024-03-12 13:50:10 +00:00
Vladimir Dolzhenko
ffd72c96b0 [kotlin] Address review comments
#KTIJ-28840

GitOrigin-RevId: 5b29c89ba9a163979c013c52a9497383a9367711
2024-03-12 13:50:05 +00:00
Andrey Cherkasov
678f31ee1c [kotlin] Share ConvertLambdaLineIntention between k1 and k2
ConvertLambdaLineIntention includes two inheritors: ConvertLambdaToMultiLineIntention and ConvertLambdaToSingleLineIntention

^KTIJ-22968 fixed
^KTIJ-22969 fixed
^KTIJ-22970 fixed

GitOrigin-RevId: de729d85dc00f5bb26a5abbf464b4a434822923c
2024-03-12 12:45:23 +00:00
Alexander.Danilov
2d252ff519 [kotlin] Add test for navigation from top level function with JvmName file to test #KTIJ-28969
GitOrigin-RevId: 432e59700c1ce19421c07299d511ed4f2c59a7fb
2024-03-12 12:44:44 +00:00
Vladimir Dolzhenko
b5f838fce9 [kotlin] Fix type declaration navigation for platform types
#KTIJ-28840 Fixed

GitOrigin-RevId: fa987b6c39b5c639880abb33c849ec6531753a62
2024-03-11 19:49:48 +00:00
Vladimir Dolzhenko
42f145859c [kotlin] Fix navigation for platform types
#KTIJ-1619

GitOrigin-RevId: 8835adf3961854b78657cff55a564089f193d5a6
2024-03-11 19:49:43 +00:00
Alexey Kudravtsev
499041ac11 K2: implement "create function from usage" for simple cases (part of KTIJ-28926 K2: Create Function From Usage Fix)
GitOrigin-RevId: a5550ad7014ed0596b11bf21a474050d6156ef30
2024-03-11 16:08:52 +00:00
Tagir Valeev
e2e0d20d61 [kotlin-dfa] Minor cleanup in K2 DFA
KTIJ-27359 K2 IDE: migrate KotlinConstantConditionsInspection to K2

GitOrigin-RevId: 8305113ff7066ab354749ea29135152f6b21ffda
2024-03-11 15:53:27 +00:00
Tagir Valeev
41c23e253e [kotlin-dfa] Remove outcommented code
KTIJ-27359 K2 IDE: migrate KotlinConstantConditionsInspection to K2

GitOrigin-RevId: f79e64997ec23ac435093165ab4728a1b013ca15
2024-03-11 15:53:24 +00:00
Tagir Valeev
98478fbe13 [kotlin-dfa] Do not suppress when USELESS_IS_CHECK warning is absent
Reporting DFA warning is useful in this case, and no other inspection/annotator reports the same problem. The DFA warning will disappear automatically if K2 compiler warning is issued here in the future.
Improvement for KTIJ-27359

GitOrigin-RevId: 41163fd79f727cbe0435704a8dc9a736383028ca
2024-03-08 15:16:54 +00:00
Anna Kozlova
232af34a5b [kotlin] k2: guess types by parent for create from usage
- `KtExpressionTypeProviderMixIn.getExpectedType` is used in e.g. completion and it should not be extended with wild guesses:
-- not() can be overloaded and then the type for completion should not be boolean
-- patterns in strings should have Any? type
etc

- `?` is lost during asPsiType + toKtType conversion (KT-61892)

^KT-66189 fixed

GitOrigin-RevId: 72a284aa50acaf4be0ff7f23a68be8cb59df27a4
2024-03-08 10:20:47 +00:00
Andrew Kozlov
1005ba7f68 [kotlin] KTIJ-29028 KotlinApplicators are standalone entities
no need in builders

GitOrigin-RevId: c7d718f6711df389987419b7a1b48cf06e715412
2024-03-07 21:38:40 +00:00
Dmitry Avdeev
d8c858c03a IDEA-345566 Provide icons for gutter-based context actions
using LineMarkerInfo.getIcon() by default

GitOrigin-RevId: b378ffd5a2eece3b8e6dc402afe9cae376284e6b
2024-03-07 18:04:17 +00:00
Tagir Valeev
87867ca4cc [kotlin-dfa] Implemented: KTIJ-27359 K2 IDE: migrate KotlinConstantConditionsInspection to K2
GitOrigin-RevId: d368a05667b066ad625d879ad3081d72bf9696ee
2024-03-07 17:08:46 +00:00
Bart van Helvert
702cf90622 [kotlin] Re-use propertyType variable
#KTIJ-25376

GitOrigin-RevId: 7a5e4d24b02391ec7d1b3f44a5ad0e89b6acefff
2024-03-07 15:57:26 +00:00
Andrew Kozlov
5215bf587a [kotlin] KTIJ-28971 symbols should be analyzed in the same session
GitOrigin-RevId: 302161a137ae65c4308747db699569de1b068caa
2024-03-07 15:21:58 +00:00
Andrew Kozlov
dce2abacf6 [kotlin] KTIJ-28971 marker interface removed from the common quick fix base class
GitOrigin-RevId: 5ee86cb61e94c31d1ab26b5fdca00f84df1b82ed
2024-03-07 15:21:53 +00:00
Frederik Haselmeier
e64ad5a7f1 [Kotlin] Adapted UselessCallOnNotNullInspection and UselessCallOnCollectionInspection quick fixes to use ModCommand API
KTIJ-28416

GitOrigin-RevId: 1f7c276b72276524ca29042eb84cd75ce985c921
2024-03-07 13:55:53 +00:00
Dmitry Avdeev
d130ba5c72 IDEA-345566 Provide icons for gutter-based context actions
kotlin navigation actions

GitOrigin-RevId: dbf018e311f4cfb31b3ad5e1e4a73a5d7d281fb1
2024-03-07 00:42:14 +00:00
Bart van Helvert
a992882886 [kotlin] Don't suggest moving property to constructor when type doesn't match
#KTIJ-25376 Fixed

GitOrigin-RevId: 3a4b3c704b4debc893a83b197506b5406cf8aa57
2024-03-06 23:38:38 +00:00
Bart van Helvert
256d8b382d [kotlin] Correctly retrieve file facade name when finding test of top level function
#KTIJ-28969 Fixed

GitOrigin-RevId: e7542f4541b012770a5507efa615156474566112
2024-03-06 22:49:21 +00:00
Anna Kozlova
093369bcd5 [kotlin] move statements: additional test data and explanation comment
KTIJ-28024

GitOrigin-RevId: f32a1efb14db010ae94955c41d15b4dc31a55fd7
2024-03-06 20:10:41 +00:00
Alexey Belkov
2655661ee9 [kotlin] J2K: Remove SortModifiersInspection post-processing
It seems that we mostly maintain the proper order of modifiers in
org.jetbrains.kotlin.nj2k.tree.ModifiersKt#forEachModifier,
but if we support new modifiers in JK Tree (for example, 'const'),
we should make sure to insert them in the correct order as well.

KTIJ-28575

GitOrigin-RevId: 12935d8b4077ce68f967f1a7a06b090cbb4610f4
2024-03-06 09:42:00 +00:00
Vladimir Dolzhenko
059d8cb6b3 [kotlin] Do not insert inlay hints for named arguments
#KTIJ-29008

GitOrigin-RevId: f2860338c46d43626fac6c6991d16b1d7c5718cd
2024-03-05 22:17:16 +00:00
Vladimir Dolzhenko
5e8080c0ca [kotlin] Run postfix template tests in dumb and start modes
#KTIJ-27972

GitOrigin-RevId: 0dfb20e6ed27c5c7f7ba59f4f5abf644d9cd3072
2024-03-05 22:17:12 +00:00
Vladimir Dolzhenko
1a29d39bb9 [kotlin] Fix typo
#KTIJ-28867

GitOrigin-RevId: 31f0a0bec5a174b267e48afe2ed299bb04e97e20
2024-03-05 15:33:06 +00:00
Anna Kozlova
de67db9a3c [kotlin] move statements: don't move functions inside lambda dsl
^KTIJ-28024 fixed

GitOrigin-RevId: e13824748518a9a63821d525129b9d0eb71a916a
2024-03-05 09:23:37 +00:00
Anna Kozlova
e4fcd2f838 [kotlin] KotlinShortClassNameFileIndex updated
- disabled for k2 as it's unused
- reworked to work on light ast to avoid building full psi
- indices which makes sense for k1 only are moved to the corresponding module, with registration for k1 only

^KTIJ-28973 fixed

GitOrigin-RevId: 2f29b2115971f25e98707fc9f2fd9a562b0f273d
2024-03-05 09:23:31 +00:00
Vladimir Dolzhenko
cdd174c179 [kotlin] Fix dumb awareness on postfix templates
And fix PostfixTemplate look up in tests

#KTIJ-27972

GitOrigin-RevId: 92b60e48b65d1a61b8902e686cd22b37fed4c7d6
2024-03-04 21:58:20 +00:00
Vladimir Dolzhenko
3d0d33a32b [kotlin] Clean up
#KTIJ-27972

GitOrigin-RevId: 4bd4929d3946857681d5e05cc6eba091e143d517
2024-03-04 21:58:15 +00:00
Tagir Valeev
c2adee386b [kotlin-dfa] KotlinCallableReferenceInstruction make reusable in K2
Preparatory step for KTIJ-27359 K2 IDE: migrate KotlinConstantConditionsInspection to K2

GitOrigin-RevId: 9db97910ce84944036e5f3c57320b15547afb534
2024-03-04 19:29:45 +00:00
Vladimir Dolzhenko
a377d53227 [kotlin] Specify return type explicitly
#KTIJ-27972

GitOrigin-RevId: 8ecd81965d428eb06e6c1abe3c3754f4bc639dc0
2024-03-02 23:36:08 +00:00
Vladimir Dolzhenko
73228eadd2 [kotlin] Run dumbAware postfix templates in tests in dumb mode
#KTIJ-27972

GitOrigin-RevId: 382c5a60e918c5a6e495794ddb0ea0e7db24e127
2024-03-02 23:36:03 +00:00
Vladimir Dolzhenko
e6051ac129 [kotlin] Make postfix templates available during indexing
#KTIJ-27972 Fixed

GitOrigin-RevId: f6f2327ef00e5f14aff4253094f66793caae4103
2024-03-02 00:18:33 +00:00