Kirill Rakhman
8aa32d9f45
[FIR] Rename DUPLICATE_LABEL_IN_WHEN to DUPLICATE_BRANCH_CONDITION_IN_WHEN
...
... and fix the message
#KT-35289 Fixed
2024-01-02 15:17:02 +00:00
Ivan Kochurkin
d50c6f1b6d
[FIR] Fix missing USELESS_CAST
...
`FirUselessTypeOperationCallChecker` always checks exact types matching for `as` operator
Simplify code of cast checker and utils
^KT-56629 Fixed
^KT-56615 Fixed
^KT-59820 Fixed
2023-10-24 20:59:56 +00:00
Egor Kulikov
b147b7e929
[FIR] Store fir for invalid when branches
...
^KTIJ-25646 fixed
Merge-request: KT-MR-10646
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com >
2023-06-20 16:11:31 +00:00
Nikolay Lunyak
7541732752
[FIR] Fix TEST SPEC tests
...
Ensure the test data contents for both the frontends
are identical. This is needed for proper analysis of
K2-differences.
2023-06-19 07:40:15 +00:00
pyos
f485413cfd
FIR DFA: x !is T? => x != null
...
^KT-22996 tag fixed-in-k2
2022-12-08 10:19:27 +00:00
pyos
6a2d74e211
FIR DFA: generate type implications on all null comparisons
2022-11-22 15:44:28 +00:00
pyos
e7b4927b6c
FIR: don't emit SENSELESS_NULL_IN_WHEN when value is always null
...
This case (value is always null) contradicts the error message which says
"Expression under 'when' is never equal to null".
2022-11-10 13:10:58 +00:00
Victor Petukhov
42e71f8c53
Remove explicit enabling the new type inference from test data
2022-07-22 16:03:52 +00:00
Ilya Chernikov
bb996c1b27
Switch kotlin version to 1.8
...
with appropriate fixes in testdata, tests and other
places.
2022-06-29 10:20:30 +02:00
Ilya Gorbunov
383e814d82
Update FIR spec test data
...
NONE_APPLICABLE instead of UNRESOLVED_REFERENCE_WRONG_RECEIVER
presumably because of the introduction of another `contains` extension overload
2022-06-28 00:08:08 +00:00
Mikhail Glukhikh
53d6ac24e5
Switch kotlin version to 1.7
...
* Change 1.6 to 1.7 constants
* Fix SAFE_CALL_WILL_CHANGE_NULLABILITY for testData
* Change EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_WARNING to EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR
* Change NON_EXHAUSTIVE_WHEN_STATEMENT to NO_ELSE_IN_WHEN
* Fix testData for SafeCallsAreAlwaysNullable
* Change T -> T & Any in test dumps
* Change INVALID_CHARACTERS_NATIVE_WARNING -> INVALID_CHARACTERS_NATIVE_ERROR
* TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING -> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR
2022-02-25 11:46:27 +00:00
Dmitriy Novozhilov
330574cab6
[FIR] Properly support smartcasts on stable when subjects in when conditions
...
^KT-49860 Fixed
2021-11-26 11:26:21 +03:00
Ivan Kochurkin
d0a4ca199d
[FIR] Add UNCHECKED_CAST
...
Regenerate diagnostics code
2021-11-12 15:20:45 +03:00
Dmitriy Novozhilov
94664694df
[FIR] Prohibit confusing syntax inside when branches
...
^KT-48385
2021-10-21 19:39:46 +03:00
Dmitriy Novozhilov
1513e739c6
[FE 1.0] Prohibit confusing syntax inside when branches
...
^KT-48385 Fixed
2021-10-21 19:39:36 +03:00
Tianyu Geng
4915d8dda3
FIR checker: support DUPLICATE_LABEL_IN_WHEN
...
Changes from FE1.0:
1. As discussed previously, no expression evaluation happens during this
check.
2. FE1.0 doesn't check redundant object comparisons.
2021-09-10 07:07:42 +03:00
Ivan Kochurkin
84c5f58cab
[FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER
2021-08-25 21:53:23 +00:00
Tianyu Geng
1679da45ab
FIR checker: COMMA_IN_WHEN_CONDITION_WITHOUT_ARGUMENT
...
FIR simply ignores anything after the first comma if the when expression
doesn't have a subject. Hence, the checker has to rely on PSI structure
instead.
2021-08-12 18:42:26 +03:00
Tianyu Geng
263b876e6e
FIR: extends scope of SENSELESS_COMPARISON
...
FE1.0 only reports SENSELESS_COMPARISON if one of the operand is `null`.
This change makes FIR reports also in case one of the operand has type
`Nothing?`.
In addition, fix handling of type alias in ConeTypeContext#isNullableType
2021-08-06 22:57:17 +03:00
Tianyu Geng
c7272f6986
FIR checker: SENSELESS_(COMPARISON|NULL_IN_WHEN)
...
Currently DFA does not set "definitely equal to null" for access to variables that got assigned `null`. For example, FIR should mark the following line as SENSELESS_COMPARISON due to `s = null` above.
https://github.com/JetBrains/kotlin/blob/d1531f9cdd5852352c0133198706125dc63b6007/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt#L6
The problem is at https://github.com/JetBrains/kotlin/blob/7e9f27436a77de1c76e3705da7aa1fbe8938336b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt#L1104
For null assignment, ideally the type should be `Nothing?`. This is
addressed in a followup commit instead.
2021-08-06 22:57:16 +03:00
Dmitriy Novozhilov
8578f0beea
[FE 1.0] Check for type mismatch for empty when statements
...
^KT-47922 Fixed
2021-08-04 19:33:45 +03:00
Victor Petukhov
ca0b8be53b
[FE 1.0] Fix some diagnostic spec tests
2021-07-29 19:45:55 +02:00
Dmitriy Novozhilov
a710a8d10f
[FE 1.0] Report warning on non-exhaustive when statements only after 1.6
...
^KT-47709
2021-07-21 17:53:05 +03:00
Dmitriy Novozhilov
a6edd852ff
[FIR] Report NON_EXHAUSTIVE_WHEN_STATEMENT/NO_ELSE_IN_WHEN for when's on logical types
...
^KT-47709 In Progress
2021-07-20 13:33:44 +03:00
Dmitriy Novozhilov
ef635f6a96
[FE 1.0] Report NON_EXHAUSTIVE_WHEN_STATEMENT/NO_ELSE_IN_WHEN for when's on logical types
...
^KT-47709 In Progress
2021-07-20 13:33:43 +03:00
Dmitriy Novozhilov
7b5a5f5682
[FE 1.0] Report USELESS_IS_CHECK if is expression is always false
...
^KT-47684 Fixed
2021-07-13 10:35:01 +03:00
Dmitriy Novozhilov
05883afc0a
Deprecate simplification of complex boolean constant expressions in whens and loops
...
^KT-39883 In Progress
2021-06-25 16:37:35 +03:00
Denis.Zharkov
b94335dd1c
FIR: Update diagnostics test data
...
Green code correctly became red
2021-05-20 17:24:30 +03:00
Mikhail Glukhikh
3663884db2
FIR: support CONDITION_TYPE_MISMATCH diagnostic
...
We report CONDITION_TYPE_MISMATCH on
- loop conditions
- when branch conditions
- binary logic arguments
2021-05-20 12:22:20 +03:00
Tianyu Geng
7bb81ef157
FIR: add equality call checker
...
Added checker for FirEqualityOperatorCall. It's surfaced as one of the
following diagnostics depending on the PSI structure and types under
comparison:
* INCOMPATIBLE_TYPES(_WARNING)
* EQUALITY_NOT_APPLICABLE(_WARNING)
* INCOMPATIBLE_ENUM_COMPARISON_ERROR
Comparing with FE1.0, the current implementation is more conservative
and only highlights error if the types are known to follow certain
contracts with `equals` method. Otherwise, the checker reports warnings
instead.
However, the current checker is more strict in the following situations:
1. it now rejects incompatible enum types like `Enum<E1>` and
`Enum<E2>`, which was previously accepted
2. it now rejects incompatible class types like `Class<String>` and
`Class<Int>`, which was previously accepted
3. the check now takes smart cast into consideration, so
`if (x is String) x == 3` is now rejected
2021-05-06 17:50:32 +03:00
Jinseong Jeon
e2dc21da90
FIR checker: warn useless as and is
2021-05-05 18:20:51 +03:00
Mikhail Glukhikh
80a449862e
FIR: implement diagnostics for qualifier as stand-alone expression case
2021-04-30 17:59:45 +03:00
Jinseong Jeon
24d792fb49
FIR checker: warn useless elvis
2021-04-22 13:10:54 +03:00
Ivan Kochurkin
00bc04b3df
[FIR] Implement ELSE_MISPLACED_IN_WHEN diagnostics, fix tests
2021-04-19 15:46:38 +03:00
Dmitriy Novozhilov
3cb17ac2f0
[FIR] Implement FirReturnAllowedChecker
...
Supported diagnostics:
- RETURN_NOT_ALLOWED
- RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
2021-04-06 12:30:41 +03:00
Mikhail Glukhikh
f0ff9ad5a7
FIR: rename AMBIGUITY to OVERLOAD_RESOLUTION_AMBIGUITY to match FE 1.0
2021-04-02 16:22:01 +03:00
Victor Petukhov
b60056f11e
Turn only input type warning to error
...
^KT-45482 Fixed
2021-03-29 16:17:22 +03:00
Dmitriy Novozhilov
d7e3e83251
[FIR] Update testdata of FIR spec tests
2021-02-09 16:04:41 +03:00
Victor Petukhov
b4d8adeeb4
Don't clean type info for containment operator if the resolution was unsuccessful, but all diagnostics were about only input types and non-strict only input types check was enabled
2020-12-25 11:53:09 +03:00
Mikhail Glukhikh
dc46d51d9a
[FIR TEST] Update diagnostic spec test data
2020-08-02 18:19:47 +03:00
anastasiia.spaseeva
4db209648d
[Spec tests] Update spec version
2020-07-28 20:26:26 +03:00
Ivan Kylchik
3c01a39846
[FIR] Update test data after introducing new fir nodes
2020-07-21 13:54:17 +03:00
Ivan Kylchik
307871a050
[FIR] Unmute fir spec tests
...
#KT-38397 Fixed
#KT-38334 Fixed
2020-07-09 23:49:39 +03:00
anastasiia.spaseeva
9d862aaa1d
[Spec tests] Remove spec info from fir tests
2020-05-26 17:27:06 +03:00
anastasiia.spaseeva
c736a1e5b0
[Spec tests] Update testsMap for when-expression section
2020-05-22 02:52:02 +03:00
anastasiia.spaseeva
d9160a26e9
[Spec tests] Add property helpers to testMaps
2020-05-22 02:52:02 +03:00
anastasiia.spaseeva
270972ca1c
[Spec tests] Make main link nullable for case if implementation tests don't have this one
2020-05-22 02:52:00 +03:00
anastasiia.spaseeva
3a46b5a45a
[Spec tests] Add path element at testMaps for main links also
2020-05-22 02:52:00 +03:00
anastasiia.spaseeva
d94c212a60
[Spec tests] Add linkType element to testMaps
2020-05-22 02:51:59 +03:00
anastasiia.spaseeva
3a31150df4
[Spec tests] Metadata refactoring: remove duplicated links in testMaps
2020-05-22 02:51:58 +03:00