Commit Graph

336 Commits

Author SHA1 Message Date
Nikolay Lunyak 57908eba77 [FIR] Prevent replacing UNNECESSARY_SAFE_CALL with UNEXPECTED_SAFE_CALL
UNNECESSARY_SAFE_CALL is a warning,
UNEXPECTED_SAFE_CALL is an error, thus
it's a breaking change.

Also see KT-60695.

^KT-59860 Fixed


Merge-request: KT-MR-11210
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-07-25 13:16:37 +00:00
Mikhail Glukhikh 51e8a72f47 K2: expand return type properly in FirReturnTypeChecker
#KT-60229 Fixed
2023-07-14 16:38:47 +00:00
Mikhail Glukhikh 402e1de5fe K2: reproduce KT-60229 2023-07-14 16:38:47 +00:00
Brian Norman d2ad426350 [FIR] Fix node ordering for delegating constructor graph
Inject delegated constructor and other in-place initializer sub-graphs
after the delegated constructor call node. This ensures property
initialization and use is calculated correctly when there are complex
calculations for the arguments to the delegated constructor.

#KT-59708 Fixed
#KT-59832 Fixed
2023-07-14 13:42:29 +00:00
Dmitriy Novozhilov 31d046e8cd [Test] Add test for KT-40851 2023-07-05 06:56:15 +00:00
Dmitriy Novozhilov eb041d5d6d [Test] Add test for KT-42995 2023-07-05 06:56:14 +00:00
Dmitriy Novozhilov a35b3bfd17 [Test] Add test for KT-41198 and KT-59860 2023-07-05 06:56:13 +00:00
Dmitriy Novozhilov 2ad441f6c8 [Test] Add test for KT-47494 2023-07-05 06:56:13 +00:00
Dmitriy Novozhilov ca25610756 [Test] Add test for KT-47567 2023-07-05 06:56:11 +00:00
Dmitrii Gridin 7c8f7bdbfb [FIR] FirDelegatedMemberScope: add missing resolve
^KT-56543
2023-04-19 20:12:40 +00:00
Dmitrii Gridin 72def186a3 [LL FIR] rework transformers, so transformers resolve only a specific set of declarations
The change is needed for the parallel resolution (^KT-55750), so we can resolve the declaration
under a lock that is specific to this declaration.
Previously, if LL FIR was resolving some FirClass, LL FIR  resolved all its children too, and it had no control over what parts of the FIR tree were modified.
The same applied to the designation path, sometimes the classes on the designation path
might be unexpectedly (and without lock) modified.

This commit introduces LLFirResolveTarget, which specifies which exact declarations should be resolved during the lazy resolution of the declaration.
All elements outside the declarations specified for resolve in LLFirResolveTarget, should not be modified.

The logic of lazy transformers is the following:
- Go to target declaration collecting all scopes from the file and containing classes
- Resolve only declarations that are specified by the LLFirResolveTarget, performing the resolve under a separate lock for each declaration

^KT-56543
^KT-57619 Fixed
2023-04-19 20:12:38 +00:00
Dmitriy Novozhilov ef51cf9083 [AA] Ignore tests due to KT-57619 2023-03-28 15:35:12 +00:00
Dmitriy Novozhilov e02194b461 [FIR] Properly prohibit access to enum companion in enum entry initialization section
^KT-57456 Fixed
KT-57608
2023-03-28 15:35:12 +00:00
Dmitriy Novozhilov a9c1091140 [Test] Add test for KT-57456 2023-03-28 15:35:11 +00:00
Dmitrii Gridin 9a4a3d1f49 [LL FIR] introduce test with reversed resolve order
^KT-56543

Merge-request: KT-MR-9299
Merged-by: Dmitrii Gridin <dmitry.gridin@jetbrains.com>
2023-03-22 17:34:07 +00:00
Dmitriy Novozhilov d5e6102ed9 [FIR] Properly check is some setter function is applicable for synthetic property
^KT-56506 Fixed
2023-03-09 12:32:49 +00:00
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00
Dmitriy Novozhilov 2a022ca9e0 [FIR] Properly propagate deadness from try main block throw finally block
^KT-56476 Fixed
2023-02-28 09:17:39 +00:00
Nikolay Lunyak 72823657c9 [FIR] Assume SafeCallsAreAlwaysNullable is always on 2023-02-27 15:00:30 +00:00
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