Commit Graph

1555 Commits

Author SHA1 Message Date
Tianyu Geng f6078b24df FIR IDE: AddToString quickfix 2021-06-15 20:19:53 +02:00
Tianyu Geng 4bedf41f9c FIR IDE: RemoveNulalbleFix quickfix 2021-06-15 20:19:52 +02:00
Mark Punzalan 9b5f754e75 FIR IDE: Enable add accessors quickfix for MUST_BE_INITIALIZED.
Also added diagnosticFixFactoriesFromIntentionActions() to share
quickfix-creation across multiple diagnostics with the same PSI.
2021-06-12 23:53:44 +03:00
Mark Punzalan cd6dbd2515 FIR IDE: Assert that the action to invoke in
AbstractHighLevelQuickFixTest is of type QuickFixActionBase.
2021-06-12 23:53:43 +03:00
Mark Punzalan a497dd1d31 FIR IDE: Enable add accessor intentions in plugin. 2021-06-12 23:53:39 +03:00
Ilya Kirillov c4b1fa8ec0 Fix FE1.0 plugin testdata after adding // IGNORE_FIR directive 2021-06-10 19:05:33 +02:00
Tianyu Geng 90a0c9bb25 FIR IDE: quickfix to add override keyword
Also enables more tests that covers previous quickfixes
2021-06-10 19:05:33 +02:00
Mark Punzalan befa8aaac7 FIR IDE: Enable add initializer quickfix for MUST_BE_INITIALIZED. 2021-06-09 22:49:56 +03:00
Mark Punzalan 2773506f4c FIR IDE: Don't offer AddExclExclCallFix when expression is definitely
null.
2021-06-09 22:49:52 +03:00
Mark Punzalan c6427d57f1 FIR IDE: Enable AddExclExclCallFix for ASSIGNMENT_TYPE_MISMATCH and
INITIALIZER_TYPE_MISMATCH.
2021-06-09 22:49:50 +03:00
Mark Punzalan d1531f9cdd FIR: Choose a resolved candidate for augmented assignment when both
assign and operator candidates are unsuccessful.
2021-06-03 20:18:04 +03:00
Mark Punzalan 32bb64a225 FIR: Report UNSAFE_OPERATOR_CALL for augmented assignments (was
reporting UNSAFE_CALL).
2021-06-03 20:18:03 +03:00
Mark Punzalan ef923d4cfe FIR IDE: Enable ReplaceInfixOrOperatorCallFix for
UNSAFE_IMPLICIT_INVOKE_CALL.
2021-06-03 20:18:02 +03:00
Mark Punzalan 6de1000818 FIR: Report UNSAFE_INFIX_CALL for all infix-style calls, even if the
candidate is not an infix function.

This mirrors FE 1.0 (see
`AbstractTracingStrategy.reportUnsafeCallOnBinaryExpression()`) and
allows consistent handling for quickfixes on infix calls.
2021-06-03 20:18:01 +03:00
Mark Punzalan ca7649edbb FIR IDE: Enable ReplaceInfixOrOperatorCallFix for UNSAFE_CALL,
UNSAFE_INFIX_CALL, UNSAFE_OPERATOR_CALL.
2021-06-03 20:17:59 +03:00
Mark Punzalan 5a7f4ffc99 FIR IDE: Enable tests for ReplaceInfixOrOperatorCallFix. 2021-06-03 20:17:58 +03:00
Mark Punzalan afeeec3091 IDE: Move ReplaceInfixOrOperatorCallFix to idea-frontend-independent. 2021-06-03 20:17:57 +03:00
Mark Punzalan 5a6d543fba IDE: Don't do any resolution in ReplaceInfixOrOperatorCallFix.invoke(). 2021-06-03 20:17:56 +03:00
Mark Punzalan af35892007 FIR IDE: Enable RemoveUselessIsCheckFix and
RemoveUselessIsCheckFixForWhen.
2021-05-28 18:21:32 +03:00
Mark Punzalan 639b7537da FIR IDE: Enable RemoveUselessCastFix. 2021-05-28 18:21:31 +03:00
Mark Punzalan d12a24418e FIR IDE: Remove multiple nested params in RemoveUselessElvisFix and
RemoveUselessCastFix.
2021-05-27 19:32:03 +03:00
Mark Punzalan a778cc673e FIR IDE: Enable RemoveUselessElvisFix. 2021-05-27 19:32:01 +03:00
Ilya Kirillov b18d4af37b fix fe1.0 plugin testdata 2021-05-25 20:39:37 +03:00
Tianyu Geng 71c5c9f6c5 FIR IDE: add quickfix to change function return type 2021-05-25 20:39:32 +03:00
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00
Ilya Kirillov c72b2caf3e Fix wrapWithSafeLetCall quickfix testdata 2021-05-21 00:01:20 +02:00
Tianyu Geng e1b542314a FIR IDE: quickfix for WrapWithSafeLetCall
There is some behavior change regarding the new WrapWithSafeLetCall quickfix

1. it now works correctly on binary expressions by wrapping it with `()`
2. it now looks for a nullable position upward and do the modification there,
   if possible. For example, consider the following code

   ```
   fun bar(s: String): String = s

   fun test(s: String?) {
     bar(bar(bar(<caret>s)))
   }
   ```

   After applying this fix, FE1.0 yields

   ```
   bar(bar(s?.let { bar(it) }))
   ```

   while the new implementation yields

   ```
   s?.let { bar(bar(bar(it))) }
   ```

   This behavior aligns with FE1.0 if `bar` accepts nullable values.
2021-05-20 20:33:00 +02:00
Mark Punzalan d2b8204fdc FIR/FIR IDE: Use entire FirVariableAssignment when reporting UNSAFE_CALL
(e.g., `nullable.a = b`), and use positioning strategies to locate the
dot in the LHS expression.

Without it, only the callee reference is reported on, which makes the
highlighting of the error and application of quickfixes incorrect in the
IDE.

Also fixed issue with annotated and/or labeled expressions on LHS of
assignment (e.g., `(@Ann label@ i) = 34`).
2021-05-20 20:32:58 +02:00
Mark Punzalan 1d9247ae0f FIR IDE: Offer AddExclExclCallFix for nullable types with an
`iterator()` function that does NOT have `operator` modifier.

This is different from FE1.0. Adding `!!` will then surface the error
that `operator` modifier needs to be added (with corresponding fix).
2021-05-20 20:32:58 +02:00
Mark Punzalan 9e01a608b2 FIR IDE: Add ability in test infra to have a "before" file different in
FIR vs FE1.0, and made file naming convention more consistent.
2021-05-20 20:32:57 +02:00
Mark Punzalan efa3bf9c69 FIR IDE: Consolidate tests for AddExclExclFix in one directory.
I found these tests only _after_ the previous changes, so I needed to
merge and/or remove redundant tests.
2021-05-20 20:32:57 +02:00
Mark Punzalan db82797f58 FIR IDE: Enable AddExclExclCallFix for UNSAFE_CALL,
UNSAFE_OPERATOR_CALL, UNSAFE_INFIX_CALL, ITERATOR_ON_NULLABLE,
ARGUMENT_TYPE_MISMATCH, RETURN_TYPE_MISMATCH.

TODO: Don't offer fix when target is known to be null (from data flow
analysis).
2021-05-20 20:32:56 +02:00
Mark Punzalan 71a8d9c0bb FIR quickfix: Enable addExclExclCall tests for FIR, move typeMismatch
tests for addExclExclCall to addExclExclCall directory.
2021-05-20 20:32:56 +02:00
Mark Punzalan 85cbea70bf IDE: Don't do any resolution in AddExclExclExclFix (i.e., in
isAvailable and in invoke) by moving computation of element to modify
to before instantiation (i.e., to the factories or equivalent).

This lets us to move it to idea-frontend-independent and re-use it FIR.
2021-05-20 20:32:56 +02:00
Mark Punzalan c472c9facd IDE: Don't add this!! in AddExclExclCallFix for nullable member
access in extension function.

^KTIJ-10052 Fixed
2021-05-20 20:32:55 +02:00
Roman Golyshev 9cadd1c8a7 Remove IGNORE_FIR from test data of already green test 2021-05-13 03:22:07 +03:00
Roman Golyshev d7a91cb05e Remove IGNORE_FIR directive from already green tests 2021-05-12 16:28:31 +00:00
Roman Golyshev 4adb291a12 Mute failing AutoImportQuickFix tests 2021-05-12 16:28:30 +00:00
Roman Golyshev 22db894076 FIR IDE: Add Add Import quickfix
This quickfix can import unresolved types and callables

It currently does not support Java types and is not as advanced as in
the old plugin

Also, enable tests that now pass
2021-05-12 16:28:28 +00:00
Roman Golyshev 3ad9e4cb5c Use Import instead of action FQN
This way test data can be used both in the old plugin and in the
FIR plugin
2021-05-12 16:28:27 +00:00
Tianyu Geng 302e0fa46b FIR IDE: add quickfix AddWhenElseBranchFix 2021-05-11 21:42:45 +02:00
Andrei Klunnyi b7eded6e48 KT-46146 no 'protected' for final classes
Intention to change final class constructor visibility to 'protected'
was erroneous. This commit removes it.
2021-05-07 12:47:40 +00:00
Andrei Klunnyi 686368749a KT-46146 'protected' is unavailable for primary constructors
Prior to this commit intention to change primary constructor visibility
to 'protected' was filtered out.
2021-05-07 12:47:38 +00:00
Tianyu Geng 06ba143afe FIR IDE: quickfix to make class abstract if member not implemented 2021-05-07 00:40:37 +03:00
Mark Punzalan 73b796f184 FIR IDE: Enable RemoveExclExclCallFix for UNNECESSARY_NON_NULL_ASSERTION. 2021-04-19 22:29:07 +02:00
Ilmir Usmanov 7b14975740 Add 'value' modifier to modifier order
Otherwise, there will be unfixable 'non-canonical modifier order'
warning
 #KT-46088
 #KTIJ-5636 Fixed
2021-04-16 18:51:44 +03:00
Mark Punzalan 957f6ddafd FIR checker: Enable ReplaceWithDotCallFix for UNNECESSARY_SAFE_CALL. 2021-04-14 22:30:42 +02:00
Mikhail Glukhikh 6ee169c01e Rename EffectiveVisibility.Private to PrivateInClass 2021-04-08 09:41:26 +03:00
Abduqodiri Qurbonzoda b0f1ddc91e Advance max/min(By/With) deprecation level to ERROR 2021-04-07 07:49:23 +03:00
Tianyu Geng 4d505f4393 FIR IDE: add intention to add custom accessor to uninitliazed property 2021-04-06 13:19:00 +02:00