Commit Graph

54 Commits

Author SHA1 Message Date
Brian Norman 17a1871b83 [FIR] Make sure the primary constructor is first in class CFG
The primary constructor of a class needs to be the first subgraph of the
class control-flow graph. Based on the Kotlin specification, class
initialization order goes first primary constructor, in-place
declarations (properties and init blocks), and then secondary
constructors. If the class doesn't have a primary constructor, then it
is just skipped in the order.

Unfortunately, the class control-flow graph had in-place declarations
first and then all constructors. Instead, we should treat the primary
constructor as the first in-place declaration, and then continue with
the existing processing as secondary constructors. This will guarantee
that super constructor calls have the correct property initialization
information.

^KT-65093 Fixed
2024-01-23 23:16:00 +00:00
Brian Norman 6df97dd199 [FIR] Add test cases to prove resolution of backlog tickets
^KT-41728 Fixed
^KT-46586 Fixed
^KT-49696 Fixed
^KT-51160 Fixed
^KT-53308 Fixed
2023-11-09 19:28:26 +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
Dmitriy Novozhilov 31d046e8cd [Test] Add test for KT-40851 2023-07-05 06:56:15 +00:00
Dmitriy Novozhilov ca25610756 [Test] Add test for KT-47567 2023-07-05 06:56:11 +00:00
pyos 17ee8f3a7b FIR CFA: put primary constructor before other class members 2023-01-10 15:40:50 +02:00
Dmitriy Novozhilov ade2307345 [FIR] Fix exponential analysis of augmented array access calls
^KT-50861 Fixed
2022-03-11 15:36:05 +03: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
Denis.Zharkov adb9dfb256 FIR: Rework processing AugmentedArraySetCall
Previously (few commits earlier), it contained two versions
of receiver (lhs) generated separately for each desugaring version
that looked a bit redundant.

Now, at FIR building stage we just don't create desugaring sub-trees,
instead they are being built during bodies transformation and that seems
to be much convenient there, since we don't need to reverse-engineer
get-set-operator version to check if containing calls are successful
(as we just built those calls and retain them)

Semantically, this changes may only change how data flow works
for such statements (see changed compatibilityResolveWithVarargAndOperatorCall.kt)

^KT-50861 Relates
2022-02-01 13:12:49 +03:00
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
Andrey Zinovyev 06b23d5937 [FIR] Improve the control flow graph around try expressions
1. throw goes to catches instead of main exist block
2. return goes via finally (single level only supported atm)
3. collect non-direct return to retrieve all return expressions easier
2021-08-06 11:49:34 +03:00
Andrey Zinovyev ec4cbfef59 [FIR] UNREACHABLE_CODE diagnostic (wip)
Implementation for PSI only
2021-08-04 14:42:24 +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
Jinseong Jeon 03f85bea8f FIR checker: report VAL_REASSIGNMENT on value parameter 2021-06-21 20:58:01 +03:00
Mikhail Glukhikh e85d97b894 FIR: introduce separate THROWABLE_TYPE_MISMATCH 2021-05-20 12:22:20 +03:00
Jinseong Jeon 24d792fb49 FIR checker: warn useless elvis 2021-04-22 13:10:54 +03:00
vldf 57d2eb5da2 Introduce FirFunctionReturnTypeMismatchChecker 2021-04-13 21:36:33 +03:00
Jinseong Jeon 5a0b75bd89 FIR checker: warn unnecessary safe calls 2021-04-09 12:32:45 +03:00
Jinseong Jeon 2ecb6733ed FIR checker: warn unnecessary non-null assertions 2021-04-09 12:32:45 +03:00
eugenpolytechnic 9ad88a5a0d FIR: introduce parameter type is Throwable check 2021-02-01 15:07:21 +03:00
Mikhail Glukhikh 5c6341b4e4 [FIR] Handle fully qualified expressions separately in tower resolver 2020-01-13 13:26:13 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
victor.petukhov 46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Dmitry Petrov df6d4f358a KT-22274 report warning on labels that can't be referenced
Labels are meaningful only if they can be referenced by 'break',
'continue', or 'return' expressions.
2018-07-25 12:08:20 +03:00
Denis Zharkov 1f9d56439a Fix KNPE caused by optimizations in control-flow analysis
The problem is that when performing full analysis we do it in
a backward order while result for trivial vals is filled
in a forward one.

It turns out that reversedInstuctions might return a superset of
forward traversed instructions, e.g. in case of dead code in lambda.

At the same time result for trivial vals is constant
for any instruction, thus we can just return its constant value
and use it in the full analysis

 #KT-20895 Fixed
2017-11-14 16:38:28 +03:00
Mikhail Glukhikh b975b7d26e More accurate CFG for local class constructors (now they are not considered unconditionally executed) #KT-10042 Fixed 2016-03-23 15:04:05 +03:00
Mikhail Glukhikh 99a32b93fb Implemented missed checks for local functions #KT-10449 Fixed
Relevant code/test fixes
2015-12-23 18:22:32 +03:00
Alexey Tsvetkov 1e2256207c Update test data 2015-10-19 20:45:02 +03:00
Mikhail Glukhikh 64543e3f52 Implicit Nothing return type is now deprecated 2015-10-12 13:30:16 +03:00
Yan Zhulanow e6c0d4692a Fix operator warning on 'Constr()()' 2015-10-08 18:31:04 +03:00
Yan Zhulanow 6db9344659 Fix compiler tests 2015-09-25 19:20:20 +03:00
Denis Zharkov 4850fd10f0 Regenerate test data containing rendered descriptors
Introduced '@' after each annotation
2015-09-18 10:14:39 +03:00
Michael Nedzelsky bc5c9065d2 fix tests in org.jetbrains.kotlin.checkers 2015-09-08 02:04:32 +03:00
Valentin Kipyatkov aefe0dd192 Changed highlighting range and attributes of useless elvis operator 2015-06-02 14:35:19 +03:00
Denis Zharkov 44a55e5bf6 Adjust testData to new labels syntax 2015-04-29 14:03:11 +03:00
Stanislav Erokhin 43e24f6b0d Fixed test data for new lambda syntax 2015-03-18 16:06:44 +03:00
Andrey Breslav 0eee83b6ec Lazy logs removed 2014-11-21 18:59:45 +03:00
Svetlana Isakova 2a83053355 Updated lazy log tests 2014-11-21 14:02:45 +03:00
Stanislav Erokhin b7c473f59e Update lazy.log files 2014-11-17 17:45:01 +03:00
Alexander Udalov 4f0d83a7fe Update lazy logs after field rename 2014-11-11 18:35:39 +03:00
Andrey Breslav 4892369cf4 Diagnostic tests are logging their lazy activity 2014-11-10 17:24:04 +02:00
Alexander Udalov 3a8ad45dec Append newline to EOF for .txt test data files
Reverts and fixes 102f0d3
2014-10-21 03:18:27 +04:00
Nikolay Krasko e796f88b38 Regenerate test data with constructed descriptors for diagnostics tests 2014-09-18 17:58:23 +04:00
Alexey Sedunov 9fee8600cb Pseudocode: Do not generate implicit return instruction inside of
Unit-typed lambdas
 #KT-5549 Fixed
2014-08-05 18:14:40 +04:00
Alexey Sedunov 9cbcabffa4 Control-Flow Analysis: Reuse pseudo-value information for unused expression analysis 2014-07-28 13:07:37 +04:00
Alexey Sedunov 1c75a5f642 Pseudocode: Generate instructions for superclass constructor calls. Consume value of delegate expression in the by-clause 2014-07-11 19:13:21 +04:00
Svetlana Isakova 0673dc51d6 Test for KT-3162 More precise try-finally error marking
#KT-3162 Obsolete
2014-06-24 16:14:07 +04:00