Commit Graph

439 Commits

Author SHA1 Message Date
Dmitriy Novozhilov f26059a7d3 [FE] Add clear warning about future changes about nullability of safe call with non nullable receiver
^KT-46860
2021-10-27 16:28:37 +03:00
Mikhail Glukhikh b0ec3cb831 Switch off FIR version off REDUNDANT_LABEL_WARNING (performance-related)
This reverts commit 363b2550 (partially)
2021-10-27 12:26:59 +03:00
Tianyu Geng 363b25504d FIR checker: report REDUNDANT_LABEL_WARNING
Since many labels are not present in the FIR tree, this checker is
implemented as a syntax checker. Comparing with FE1.0, this change
reports some REDUNDANT_LABEL_WARNING that FE1.0 has missed, especially
LHS of assignments.
2021-10-25 13:51:01 +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
Denis.Zharkov a0a57581ec FIR: Do not add alias for variables with explicit type 2021-10-20 22:05:24 +03:00
Mark Punzalan 4f0b52b653 FIR: Transform annotations on type arguments during body resolve. 2021-10-12 18:56:32 +03:00
Ivan Kochurkin 7bedb6bca8 [FIR] Propagate not-null info into TypeOperatorCall ^KT-44559 Fixed 2021-10-06 21:56:05 +03:00
Ivan Kochurkin 2e1f455d9c [FIR] Fix type constraint for type parameter ^KT-45345 Fixed 2021-10-06 21:56:04 +03:00
Victor Petukhov ee728b6902 Use the new type inference for top-level callable reference resolution
^KT-47797 Fixed
^KT-47987 Fixed
^KT-45034 Fixed
^KT-48446 Fixed
^KT-13934 Fixed
2021-09-27 16:12:27 +03:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
Tianyu Geng 05fbed68e2 FIR checker: report PROPERTY_AS_OPERATOR 2021-09-10 07:07:43 +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
Dmitriy Novozhilov 1e0878cde0 [FE 1.0] Postpone SafeCallsAreAlwaysNullable till 1.7
^KT-46860 Fixed
2021-09-02 13:34:27 +03:00
Dmitriy Novozhilov 5a5d25d350 [FE 1.0] Postpone ProhibitSimplificationOfNonTrivialConstBooleanExpressions till 1.7
^KT-39883
2021-09-02 13:34:25 +03:00
Denis.Zharkov 62bef48f9d Adjust test data to changed rendering: T!! -> T & Any
^KT-26245 In Progress
2021-08-31 15:41:15 +03:00
Denis.Zharkov cdd8d1c163 Add AND (&) token 2021-08-31 15:41:09 +03:00
Mark Punzalan 580f1d51f6 FIR checker: report LOCAL_VARIABLE_WITH_TYPE_PARAMETERS 2021-08-26 12:25:07 +03:00
Ivan Kochurkin 84c5f58cab [FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER 2021-08-25 21:53:23 +00:00
Andrey Zinovyev 894a446585 [FIR] Add missing messages for jvm diagnostics and fix some tests 2021-08-19 15:25:51 +03:00
Andrey Zinovyev 1cd321a90f [FIR] Add INAPPLICABLE_OPERATOR_MODIFIER diagnostic 2021-08-18 16:03:01 +03:00
Tianyu Geng fb1eac0985 FIR: report SMARTCAST_IMPOSSIBLE on inherited alien properties [KT-48101] 2021-08-18 12:02:02 +03:00
Mikhail Glukhikh a21d281c19 FIR: fix capturing on intersection types #KT-48109 Fixed 2021-08-13 11:14:03 +03: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 280c445783 FIR checker: check super reference
This change touches the following diagnostics to make them behave closer
to FE1.0

* SUPER_NOT_AVAILABLE
* SUPER_IS_NOT_AN_EXPRESSION
* INSTANCE_ACCESS_BEFORE_SUPER_CALL
* NOT_A_SUPERTYPE

Other than tweaking the diagnostics, this change also alters resolution
by consider marking `super` with mismatched type parameter as
errorenous. As a result, the following code no longer resolves.

```
class A: B() {
  fun test() {
    super<String>.length
    //            ^^^^^^ FIR currently resolves this to `String.length`.
    //                   With this change, `length` becomes unresolved
    //                   instead
  }
}
```

Also, now we report `UNRESOLVED_LABEL` on unresolved label on `super`
reference, though FE1.0 reports `UNRESOLVED_REFERENCE`.

All the errors above are reported as ConeDiagnostics and hence some
checkers are deleted.

In addition, it also suppresses more downstream (mostly unresolved)
errors if the receiver has errors. FE1.0 doesn't do it for all the cases
we have here. But it seems nicer to reduce these "redundant" unresolved
errors.
2021-08-10 19:36:43 +03:00
Ivan Kochurkin fd92b851a2 [FIR] Implement PACKAGE_OR_CLASSIFIER_REDECLARATION
Fix REDECLARATION positioning
2021-08-10 15:09:25 +00:00
Dmitriy Novozhilov b9dd73220c [FIR] Update testdata after rebase 2021-08-06 22:57:19 +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
Tianyu Geng 4726dcce40 FIR DFA: smartcast variable to Nothing? on null assignment
In order to make resolution still work for members not available from
`Nothing`, we track the type without `Nothing?` and use that for
resolution instead.
2021-08-06 22:57:15 +03:00
Tianyu Geng e495c722c7 FIR DFA: fix handling of equality operation 2021-08-06 22:57:14 +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
Andrey Zinovyev 015c2d1875 [FIR] Add NOTHING_TO_INLINE diagnostic 2021-08-04 17:33:08 +03:00
Dmitriy Novozhilov b584fed93d [FIR] Migrate warning/error pairs to DiagnosticFactoryForDeprecation 2021-08-03 00:20:11 +03:00
Dmitriy Novozhilov d17f984edf [FE 1.0] Migrate most of warning/error pairs to DiagnosticFactoryForDeprecation 2021-08-03 00:17:33 +03:00
Dmitriy Novozhilov 262c9e88d1 [FE 1.0] Fix remaining codegen spec tests 2021-07-29 19:45:57 +02:00
Victor Petukhov cba224b7b8 Update spec black box tests 2021-07-29 19:45:56 +02:00
Victor Petukhov d2a7434cff Update testdata 2021-07-29 19:45:56 +02:00
Dmitriy Novozhilov b1d17cfd7b [FE 1.0] Force resolve annotations on type arguments
^KT-46173
2021-07-29 19:45:56 +02:00
Victor Petukhov ca0b8be53b [FE 1.0] Fix some diagnostic spec tests 2021-07-29 19:45:55 +02:00
Ivan Kochurkin 2574dc907c [FIR] Implement FUNCTION_EXPECTED 2021-07-28 23:17:31 +03:00
Ivan Kochurkin 2333b1bcf6 [FIR] Implement BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY 2021-07-26 21:13:23 +03: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
Andrey Zinovyev a6984c5198 [FIR] Add NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY diagnostic 2021-07-19 13:40:28 +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 22938522b3 [FIR] Add forgotten updating phase of value parameters 2021-07-13 10:31:27 +03:00
Ilya Kirillov eab1a78d48 FIR IDE: mute failing multimodule tests 2021-07-08 18:25:44 +03:00
Andrey Zinovyev 9452b788bf [FIR] Implement CANNOT_OVERRIDE_INVISIBLE_MEMBER diagnostic 2021-07-08 18:13:46 +03:00