Commit Graph

317 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 86af01439c [FIR] Allow to access uninitialized member properties in non-inPlace lambdas in class initialization
^KT-56696 Fixed
^KT-56408
2023-02-17 11:26:18 +00:00
Dmitriy Novozhilov c87e489dc9 [FIR] Run CFA for member properties even if they have initializer
^KT-56678 Fixed
^KT-56682 Fixed
2023-02-17 11:26:17 +00:00
Dmitriy Novozhilov a9248569a6 [FIR] Fix reporting of UNINITIALIZED_ENUM_ENTRY in init blocks
^KT-41126 Fixed
2023-02-10 12:30:12 +00:00
Kirill Rakhman 1eb18f13bd FIR: Fix test data after making LHS of assignment an expression
KT-54648
2023-01-31 08:39:43 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
pyos 99e51f6940 FIR: check assignments and references to members in constructors
I.e. emit VAL_REASSIGNMENT on repeated assignments to `this.something`,
UNINITIALIZED_VARIABLE on reads of it before any assignment if there is
no initializer, and CAPTURED_MEMBER_VAL_INITIALIZATION on assignments
inside non-called-in-place functions and named classes.

^KT-55528 Fixed
2023-01-26 13:12:13 +00:00
pyos c42dd0848e FIR: only allow member val initialization through this@T
class C {
    val x: Int
    init {
      // valid ways to initialize:
      x = 1
      this@C.x = 1
      // invalid:
      someOtherC.x = 1
      run { /*this@run.*/x = 1 }
      val self = this
      self.x = 1
    }
  }
2023-01-26 13:12:12 +00:00
pyos 8aa50e9446 FIR CFA: add edges from maybe-throwing statements to catch/finally 2023-01-26 09:50:24 +00:00
Ilya Kirillov 1bbcae5ed2 [FIR] fix resolve contract violation from scopes
We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier

^KT-54890
^KTIJ-23587 fixed
2023-01-13 21:32:51 +00:00
Kirill Rakhman 69f2e8826a FIR: fix a bunch of issues after DiagnosticsReporter refactoring related to reporting diagnostic on null source 2023-01-11 08:30:36 +00:00
pyos 17ee8f3a7b FIR CFA: put primary constructor before other class members 2023-01-10 15:40:50 +02:00
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +00:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Pavel Mikhailovskii 1215ae0fe7 KT-1436 Nicer compiler errors when the feature isn't supported 2022-10-31 13:49:57 +00:00
Dmitriy Novozhilov 09429ff432 [FIR] Fix reporting of UNINITIALIZED_ENUM_COMPANION in all places 2022-09-16 07:12:20 +00:00
Dmitriy Novozhilov a2c12aa711 [FE] Always report UNINITIALIZED_ENUM_COMPANION_WARNING
^KT-54055
2022-09-16 07:12:19 +00:00
Dmitriy Novozhilov 3a5a6e5587 [FE] Add test for KT-54055 2022-09-16 07:12:19 +00:00
Dmitriy Novozhilov b86d5cf21a [FE] Postpone ProhibitAccessToEnumCompanionMembersInEnumConstructorCall till 1.9
^KT-49110
2022-09-16 07:12:19 +00:00
Pavel Mikhailovskii 8ba80b4b7b KT-1436 Allow break/continue in inlined lambdas 2022-08-11 10:38:23 +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
Ivan Kochurkin 9f69ea1786 [FIR] Add TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM diagnostics, ^KT-52327 Fixed 2022-06-17 23:26:16 +00:00
Dmitriy Novozhilov 89b1307e16 [FE 1.0] Don't report UNUSED_* warnings on local properties with delegate
^KT-25527 Fixed
2022-05-19 07:14:23 +00:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Mads Ager 17b5e46547 [FE1.0] Fix CFG for inline function calls in finally blocks.
The body of the InlinedLocalFunctionDeclarationInstruction was
not copied. That confuses the information on the exceptional edge
with the information on the normal edge.

^KT-52131 Fixed
2022-04-28 14:39:59 +03:00
Ivan Kochurkin c7122c1492 [FIR] Fix break/continue in try-finally in loop, ^KT-51759 2022-04-05 15:50:47 +00:00
Dmitriy Novozhilov 078acb1bfe [FE] Fix positioning strategy for SAFE_CALL_WILL_CHANGE_NULLABILITY warning
^KT-46860
2022-03-28 12:37:25 +00:00
Victor Petukhov 27fa632630 [FE 1.0] Update test data with new error type representation 2022-03-23 21:13:33 +00: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
Vladimir Dolzhenko 918a91dbdf Escape special names with backticks in test data
#KT-51248
2022-02-10 21:20:47 +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
Victor Petukhov 72a78eb423 Replace errors with warnings for type checker recursion on delegates
^KT-49477 Fixed
2022-01-17 21:27:14 +03:00
Dmitriy Novozhilov bb6c6dc45d [FE 1.0] Fix reporting of UNINITIALIZED_ENUM_ENTRY on qualified enums
^KT-41124
^KT-50758 Fixed
2022-01-14 14:26:54 +03:00
Dmitriy Novozhilov ecc890efe8 [FE 1.0] Fix reporting of uninitialized parameter in default values of parameters
^KT-25694
^KT-50723 Fixed
2022-01-14 14:26:49 +03:00
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
pyos a1be855d17 FIR: thread control flow through anonymous object init blocks
^KT-39646 Fixed
2021-11-26 14:21:29 +03:00
Dmitriy Novozhilov 877b53201b [FIR] Prohibit access to members of companion of enum from enum entry initializer
^KT-49110
2021-10-29 18:45:23 +03:00
Dmitriy Novozhilov 58889a2b5c [FE 1.0] Prohibit access to members of companion of enum from enum entry initializer
^KT-49461 Fixed
^KT-49110
2021-10-29 18:45:19 +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
Denis.Zharkov 1c16f2f8c9 Fix ClassCastException at FirUninitializedEnumChecker 2021-10-07 17:26:29 +03:00
Ivan Kochurkin 75b40e4b75 [FIR] Add INVISIBLE_SETTER 2021-10-03 17:10:06 +03:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
Andrey Zinovyev 3ec9599bc4 [FIR][CFG] Partial support of postponed Nothing calls
In try blocks, last call won't be completed when building node for it
This is workaround to partially reconstruct nothing stub node for such
calls. Should work for non-local returns in try only.
#KT-48160 Fixed
2021-08-11 21:57:14 +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 015c2d1875 [FIR] Add NOTHING_TO_INLINE diagnostic 2021-08-04 17:33:08 +03:00
Andrey Zinovyev 28344c8530 [FIR] Add NOT_YET_SUPPORTED_IN_INLINE diagnostic 2021-08-04 17:33:07 +03:00
Andrey Zinovyev ec4cbfef59 [FIR] UNREACHABLE_CODE diagnostic (wip)
Implementation for PSI only
2021-08-04 14:42:24 +03:00
Dmitriy Novozhilov d17f984edf [FE 1.0] Migrate most of warning/error pairs to DiagnosticFactoryForDeprecation 2021-08-03 00:17:33 +03:00