Commit Graph

188 Commits

Author SHA1 Message Date
Denis.Zharkov 41933facbb K2: Fix ISE from inference on delegate vars with implicit types
See the test data.
ISE happened because at some point after incomplete `getValue` resolution
of `a` property, we updated in the `transformAccessors` the property type
to the `Variable(Y)` type and then used it as a 3rd argument for
`setValue` call which is incorrect because the variable belongs
to a different constraint system (from `getValue`).

Mostly, the fix is just a repeating K1 behavior, namely postponing
`setValue` resolution until delegate inference is completed.

^KT-59066 Fixed
2023-06-12 11:30:35 +00:00
Mikhail Glukhikh 6e58ba8f33 FE: don't approximate type variable based types for public/local declarations
#KT-58618 Fixed
2023-05-26 11:13:39 +00:00
Mikhail Glukhikh 2cfa3d7e0d K2: reproduce KT-58618 2023-05-26 11:13:39 +00:00
Mikhail Glukhikh 3964ee38be K2: fix handling of synthetic calls in delegate inference
This commit is intended to avoid the second resolve of delegate when
we need to consider provideDelegate() possibility in inference.
Also here we provide correct completion of synthetic calls during
delegate inference.

#KT-58013 Fixed
2023-05-04 11:48:37 +00:00
Mikhail Glukhikh bbee881b5b K1: add separate TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_IN_AUGMENTED_ASSIGNMENT
This is made to have a correct error message for a problem
described in KT-48546
#KT-48546 Fixed
2023-05-02 12:57:15 +00:00
Mikhail Glukhikh c5fe4b53cf FE: add more augmented assignment tests around KT-48546 2023-05-02 12:57:15 +00:00
Denis.Zharkov 555d8eeb25 K2: Fix false-positive DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE
For explanation, see nestedPartiallyResolvedCallsSimple.k

The problem was caused by "select" variable is being leaked to the
inference session of delegate while it should not happen because
it doesn't belong to the common system of `KotlinVal { ..` call,
as we complete it with fixing `E` variable during completion
for `A(select(null, fun(): Int { return 1 }))`.

The root of the problem is that we were adding all the partial
nested calls to the session, while in fact we only need there
the top-level one.

^KT-57543 Fixed
2023-04-28 16:20:06 +02:00
Dmitrii Gridin 6170d83301 [FIR] update reversed testData
^KT-56543
2023-04-19 20:12:41 +00:00
Dmitrii Gridin 1c5aa6c45b [FIR] add reversed testData to update it in the next commit
^KT-56543
2023-04-19 20:12:41 +00:00
Denis.Zharkov 39639e08f9 K2: Fix incorrect inference of delegated property type
It was working incorrectly, because we've been trying to fix
P1 variable to intersectTypes(String?, StubForP2) that should result
to String? because we've got stubEqualsToAnything enabled there,
but nullability was being chosen incorrectly because
`StubForP2.isNullableType()` returned false

NB: The code inside `is ConeTypeVariable` case wasn't working properly
because it always `lookupTag.toSymbol(session)` always returned null,
thus there was effectively five dead lines of code there.

^KT-57814 Fixed
^KT-57921 Related
2023-04-12 11:31:43 +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 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
Denis.Zharkov 9fa0f51a61 K2: Fix false-negative RETURN_TYPE_MISMATCH
^KT-53987 Fixed
^KT-55932 Fixed
2023-02-15 08:13:42 +00:00
Denis.Zharkov fe5adab652 K2: Avoid inference diagnostics when arguments are already error typed
For example, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER

It became especially relevant after 0e84bf2053
that together with later commits bring a lot of unnecessary
NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER diagnostic
2023-02-15 08:13:41 +00:00
Dmitriy Novozhilov a1a9a55e1a [Test] Add test for KT-41952
^KT-41952 Obsolete
2023-01-31 07:53:09 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +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
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Dmitriy Novozhilov 06e88b559a [FIR] Consider ConeConstraintSystemHasContradiction as a good reason for DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE error 2022-11-22 15:46:21 +00:00
Dmitriy Novozhilov 0e84bf2053 [FIR] Don't report ARGUMENT_TYPE_MISMATCH on error types 2022-11-22 15:46:19 +00:00
Mikhail Glukhikh 5fcb18ac2b Revert "[FE 1.0] Resolve this and super calls through the new type inference infra"
This reverts commit bab8047bb3.
2022-09-13 09:09:01 +00:00
Mikhail Glukhikh f35cebbc25 Revert "[FE 1.0] Resolve special construct calls through the new type inference infra"
This reverts commit e66cc9a639.
2022-09-13 09:09:01 +00:00
Ivan Kochurkin 80450042c7 [FIR] Ignore KtFakeSourceElementKind in FirRecursiveProblemChecker 2022-07-25 23:30:10 +02:00
Victor Petukhov 42e71f8c53 Remove explicit enabling the new type inference from test data 2022-07-22 16:03:52 +00:00
Victor Petukhov e66cc9a639 [FE 1.0] Resolve special construct calls through the new type inference infra
^KT-48961 In progress
2022-07-22 16:03:48 +00:00
Victor Petukhov bab8047bb3 [FE 1.0] Resolve this and super calls through the new type inference infra
^KT-48961 In progress
2022-07-22 16:03:48 +00:00
Mikhail Glukhikh 4aed9511f6 FIR/FE10: fix false positives described in KT-24643 2022-07-03 19:10:02 +00:00
Mikhail Glukhikh 3223d3c3e9 Add test with false/true positives for KT-24643 2022-07-03 19:10:01 +00:00
Ivan Kochurkin 9f69ea1786 [FIR] Add TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM diagnostics, ^KT-52327 Fixed 2022-06-17 23:26:16 +00:00
Ivan Kochurkin c6f52893fb [FIR] Fix inconsistent RETURN_TYPE_MISMATCH and TYPE_MISMATCH reporting on functions and properties
^KT-51203 Fixed
2022-04-05 15:50:43 +00:00
Victor Petukhov 57a134c543 [FE 1.0] Report recursive type checker problem as a warning till 1.9
^KT-48546
2022-03-23 21:13:34 +00:00
Victor Petukhov 2307122089 [FE 1.0] Report errors for recursive types from completion as well
Such diagnostics could be missed at least for plus assignment's right side because it wasn't report for the second time of analysis

^KT-48546 Fixed
2022-03-23 21:13:34 +00:00
Victor Petukhov 27fa632630 [FE 1.0] Update test data with new error type representation 2022-03-23 21:13:33 +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
Vladimir Dolzhenko 918a91dbdf Escape special names with backticks in test data
#KT-51248
2022-02-10 21:20:47 +00: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
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
Simon Ogorodnik 26b158bded FIR: Update test-data (Delegate inference) 2021-12-15 22:23:12 +03:00
Mikhail Glukhikh 9aced1c33d FIR: Update test-data (Delegate inference) 2021-12-15 22:23:04 +03:00
Mikhail Glukhikh 40a2837b4c FIR: Update test-data (Delegate inference) 2021-12-15 22:23:02 +03:00
Mikhail Glukhikh 4d9e919f7e FIR: preliminary refactoring of delegate resolve 2021-12-15 22:22:51 +03:00
Ivan Kochurkin 800d594a4f [FIR] Check adding default error messages for all diagnostics ^KT-49973 fixed
Also, check for duplicates
2021-12-09 12:31:23 +00:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Ivan Kochurkin d0a4ca199d [FIR] Add UNCHECKED_CAST
Regenerate diagnostics code
2021-11-12 15:20:45 +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
Nikolay Lunyak dbfe3524ce [FIR] Add FirDelegateUsesExtensionPropertyTypeParameterChecker 2021-10-20 16:49:51 +03:00
Victor Petukhov 2bdbbdd1a7 Commit delegation expression's trace with errors if we couldn't extract type info for it
^KT-44843 Fixed
2021-09-30 20:08:39 +03:00
Andrey Zinovyev 1cd321a90f [FIR] Add INAPPLICABLE_OPERATOR_MODIFIER diagnostic 2021-08-18 16:03:01 +03:00