Commit Graph

210 Commits

Author SHA1 Message Date
Roman Efremov 02b5fed389 Fix inaccurate report of DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM
It can be reported not only from within the enum, but also from
top-level functions. Add separate diagnostic for such cases.

^KT-64488
2024-02-27 11:22:35 +00:00
Kirill Rakhman f231338cd6 [FIR] Render list of symbols with linebreaks as separators
#KT-61823 Fixed
2024-02-21 12:25:22 +00:00
Mikhail Glukhikh 6ed7c041b4 K1/K2: add various tests for context receiver tower resolve priority
Related to KT-64531, KT-64488
#KT-64531 As Designed
2024-02-14 09:55:51 +00:00
Evgeniy.Zhelenskiy 7eab4b672d [K1, K2, CLI] Mark whole position range of compiler diagnostics in CLI
#KT-64989
2024-02-08 12:59:31 +00:00
anzhela.sukhanova 7587f73846 [Test] KT-61937: add tests with context functions and naming clash
Update tests for ^KT-61937


Merge-request: KT-MR-13678
Merged-by: Anzhela Sukhanova <anzhela.sukhanova@jetbrains.com>
2024-01-18 08:27:31 +00:00
Tomas Husak 91465d7110 [FIR] KT-59421 add checker context receiver property backing field 2023-12-13 07:12:11 +00:00
Tomas Husak d7eb67a436 [FIR] KT-59368 context receiver subtyping checker 2023-12-06 17:34:05 +00:00
Nikolay Lunyak c69c34ff8b [FIR] Properly set isReceiver for implicit invoke on function types 2023-11-28 15:37:09 +00:00
Nikolay Lunyak 427c067cd8 [FIR] Forbid typeRef-named labels without +ContextReceivers
^KT-63068 Fixed
2023-11-22 13:22:45 +00:00
Anastasia.Nekrasova fb0461f422 [K2] Disappeared UNSUPPORTED_FEATURE (3)
Added a check for the enabled context receivers feature flag for @ContextFunctionTypeParams.

^KT-59913
2023-11-22 06:04:13 +00:00
Anastasia.Nekrasova c04767f1f4 [K2] Disappeared UNSUPPORTED_FEATURE (2)
Added a check for the enabled context receivers feature flag for declaration.

^KT-59913
2023-11-22 06:04:13 +00:00
Anastasia.Nekrasova 685c8e4fe7 [K2] Disappeared UNSUPPORTED_FEATURE (1)
Added a check for the enabled context receivers feature flag for typeRef.

^KT-59913
2023-11-22 06:04:13 +00:00
Nikolay Lunyak 425d5e808b [FIR] Link some tests with issues
Just in case.

^KT-59874
2023-11-14 15:19:33 +00:00
Nikolay Lunyak d03039b949 [FIR] Don't generate property fields when context receivers are present
^KT-59874
2023-11-14 15:19:32 +00:00
Kirill Rakhman 0682a1f76d [FIR] Remove line breaks after context receivers in diagnostic messages
#KT-62944 Fixed
2023-11-02 08:58:28 +00:00
Ilya Chernikov 268d058bbb Implement missing invoke resolution branch with context receivers
#KT-61937 fixed
Note: the current implementation only resolves for a single receiver
in each group. See KT-62712 and KT-62709 for the followup.
2023-10-19 19:39:31 +00:00
Nikolay Lunyak a68a2409d3 [FIR] Remove the applicability filtering when reporting diagnostics
In case we don't want to introduce any new
abstractions like "user relevance for
applicability", we can just remove the
filtering.

^KT-62541 Fixed
2023-10-19 09:27:45 +00:00
Nikolay Lunyak fedadfb8db [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
K1 reports `ARGUMENT_TYPE_MISMATCH`
and `TOO_MANY_ARGUMENTS` together, and
one way to do it in K2 is to say that
their kinds of inapplicability difference
is not relevant to the user.

Note that K1 doesn't do such filtering,
so this change "makes K2 closer to K1",
but still different.

^KT-62541 Fixed

fixup! [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
2023-10-19 09:27:45 +00:00
Kirill Rakhman fa77e3952d [FIR] Bring equivalent call behavior closer to K1
#KT-61159 Fixed
2023-08-21 12:11:58 +00:00
Kirill Rakhman 5b9c35de2e [Tests] Update test data with error suppression warnings
#KT-61129 Fixed
2023-08-18 13:29:20 +00:00
Nikolay Lunyak 7151e6a41c [FIR] Report UNSUPPORTED_CONTEXTUAL_DECLARATION_CALL
^KT-59969 Fixed
2023-08-04 15:17:21 +00:00
Kirill Rakhman 951b299268 [FIR] Rewrite redeclaration checks
#KT-60124 Fixed
#KT-60573 Fixed
2023-07-27 08:06:20 +00:00
Brian Norman 61acd2b6f5 [FIR] Do not allow context receivers on value classes
#KT-59413 Fixed
2023-07-07 11:41:59 +00:00
Kirill Rakhman 5abab2197b [FIR] Adapt positioning of NO_VALUE_FOR_PARAMETER to match K1 2023-07-04 16:00:45 +00:00
Brian Norman 92cb47a8f9 [FIR] Always report when named arguments are not allowed
#KT-59177 Fixed
2023-06-08 17:25:34 +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
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
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
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
Pavel Mikhailovskii 08767d572b KT-51247 Fix resolution of functional types with context receivers 2022-12-09 15:29:39 +00:00
Evgeniy.Zhelenskiy 0c70b60988 [IR] Add context receiver test on MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:33 +00:00
Dmitriy Novozhilov 0e84bf2053 [FIR] Don't report ARGUMENT_TYPE_MISMATCH on error types 2022-11-22 15:46:19 +00:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Nikolay Lunyak fcd3e4f4c5 [FIR JS] KT-51740: Alter positioning of NO_VALUE_FOR_PARAMETER 2022-09-30 21:39:20 +03:00
Dmitry Khalanskiy 4cbee3cde7 Fix KT-51478
The issue was that, when various context elements were available
to fulfill a need for an extension receiver, but none of them were
applicable to it, the compiler behaved the same way as if there
was no extension receiver at all.

https://youtrack.jetbrains.com/issue/KT-51478/Inapplicable-receiver-diagnostic-expected-when-there-are-two-context-receiver-candidates
2022-09-20 10:32:32 +00:00
Simon Ogorodnik 2a16fe1d0f FIR: Fix overloading by type-arguments
In K1, upper bound violated causes candidate to have lower applicability
due to constraint errors, in K2 however constraint errors has to be
reported explicitly
2022-08-04 22:56:08 +02:00
Anastasia.Shadrina 292c0c4383 [FE] KT-51234 Check subtyping between context receivers 2022-05-17 15:27:27 +00:00
Anastasia.Shadrina d857142514 KT-51243 Fix parameterized contextual lambda
^KT-51243 Fixed
2022-05-17 15:27:26 +00:00
Denis.Zharkov 3d06a92eea K1: Adjust positioning for NO_CONTEXT_RECEIVER 2022-04-06 16:05:41 +00:00
Denis.Zharkov 512446843b FIR: Support typeRef-name label for this 2022-04-06 16:05:37 +00:00
Denis.Zharkov dfc736161a FIR: Fix overload resolution with context receivers 2022-04-06 16:05:35 +00:00
Denis.Zharkov 4349060db1 K1: Support referencing class context receivers in a form of this@Name 2022-04-06 16:05:34 +00:00
Denis.Zharkov 202413c2f4 FIR: Add context receivers from the containing class to constructors 2022-04-06 16:05:33 +00:00
Denis.Zharkov b2d5bf3eae FIR: Adjust diagnostics test data after resolution of context receivers 2022-04-06 16:05:32 +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
Anastasia.Shadrina a86b4d767e [FE] KT-50878 Prohibit using contextual declarations without -Xcontext-receivers 2022-01-21 17:21:59 +03:00
Anastasia.Shadrina ea33da3a8d [FE] Fix: do not report ambiguous label if label map is empty 2021-12-21 10:41:46 +03:00
Anastasia.Shadrina 343a860553 [FE] Make OverloadChecker take CR into account 2021-12-14 15:19:42 +03:00