Commit Graph

55 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 0033c9c23a Unmute unsafeAssignmentExtra test #KT-65218
As the result of the latest changes to stdlib, the muted test succeeds.
Thus "java.lang.AssertionError: Test contains MUTE_LL_FIR directive but
no errors was reported. Please remove directive".
It was decided to unmute the test for now until the compiler team
fixes the issue. See KT-65218
2024-02-09 17:20:15 +00:00
Denis.Zharkov fb8cc00d1f Minor. Mention KT-49160 in relevant test data 2024-02-09 13:03:12 +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
Artem Kobzar 8d1a90c23c [K/JS] Support essential Kotlin collections (List, MutableList, Set, MutableSet, Map, MutableMap) for exporting into JS
^KT-34995 Fixed
^KT-44871 Fixed
2024-01-24 11:14:46 +00:00
Denis.Zharkov 8f9c09482b K2: Fix inference from assignment in PCLA
Before this, the order of the constraints being added was incorrect

^KT-64222 Fixed
2024-01-11 13:35:13 +00:00
Denis.Zharkov e359db4111 K2: Set proper source for implicit it/receiver parameter
Previously, error types on those implicit parameters were being lost.

Changed test data is only partly here
(only parts that are considered to be correct).

Other ones (new green-to-red changes) should belong to the next commit
and will be fixed soon (as a part of PCLA).
2024-01-11 10:32:12 +00:00
Denis.Zharkov b9019d3de1 K2: Adjust test data after PCLA implementation [red-to-green]
^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Denis.Zharkov f945dce4c8 K2: Adjust test data after PCLA implementation [green-to-red]
^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Denis.Zharkov 6052e24626 K2: Adjust test data after PCLA implementation [red-to-red]
^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Simon Ogorodnik d46075a9db K2: Use correct position for substitution constrains in builder inference
Before, we were wrapping the original constraint position into
ConeBuilderInferenceSubstitutionConstraintPosition twice during the
constraint substitution in builder inference.

It was causing problems with diagnostic reporting.

Remove TODOs about diagnostic reporting from FirBuilderInferenceSession.
Propagation of errors from the common system is now implemented
Diagnostic reporting in updateCalls isn't needed, since we
report errors after the system completion unlike K1

Relates to KT-53749
2023-12-04 15:27:21 +00:00
Simon Ogorodnik 2f367b013a K2: Don't lose constraint errors in the builder inference session
Pass constraint errors from the integration system into a candidate to
make sure it is reported later.

Related to KT-59426, KT-59437, KT-53749
#KT-55168 Submitted
2023-12-04 15:27:20 +00:00
Mikhail Glukhikh 0ed6256bcc K2: implement BUILDER_INFERENCE_STUB_RECEIVER
#KT-59369 Fixed
2023-12-01 10:54:29 +00:00
Kirill Rakhman fbf68a5bcc [FIR] Narrow down range of NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER
This uses the same approach as
INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION where we use a visitor
to find a call to a symbol that contains the type variable in question.

#KT-56140 Fixed
2023-09-22 13:49:59 +00:00
Denis.Zharkov 033ff38fef K2: Adjust diagnostic test data after delegate inference is rewritten
In all tests, some red-code diagnostics have changed insignificantly
to some other combination or red-code diagnostics

^KT-61060 Related
2023-09-08 07:11:48 +00:00
Mikhail Glukhikh 3e330241b4 K1/K2: add a test to fix state of KT-55168 2023-08-28 09:40:26 +00:00
Kirill Rakhman 8d7c5b375e [FIR] Replace usages of FirExpression.typeRef with coneTypeOrNull
#KT-59855 Fixed
2023-08-24 07:54:57 +00:00
Mikhail Glukhikh f20e2dec31 K2: generate Unit conversion for indexed assignment at raw FIR stage
#KT-59748 Fixed
2023-07-26 06:09:15 +00:00
Simon Ogorodnik 82611ad124 FIR. BI: Fix stub type leakage in builder inference
Previously, updateTypeInBuilderInference was calling
updateTypeFromSmartcast to actually perform type update in
implicit receiver after stub types was inferred
Such action results in creation of following FIR:

FirSmartCastExpression(
    original=FQAE(FirImplicitThisReference, typeRef=R|Inv<Stub>|)
    typeRef=R|Inv<String>|
)

in receiver position during completion of calls

However, it wasn't the case in general situation due to
action of FirStubTypeTransformer, which, in turn visits and updates
type ref inside original expression, but only if there was at
least one call (that was completed) using that implicit receiver
As after such type update updateTypeFromSmartcast function does
nothing

Yet in situation, when there was only partially resolved calls
referencing that implicit receiver we actually create smart-cast
expression and don't update type

The change just removes usage of updateTypeFromSmartcast and
replaces is with direct type update
We still mutate state of implicit receiver, potentially
improperly, it should be addressed in future

^KT-54708
^KT-58365 Fixed
2023-05-04 12:46:28 +00:00
Mikhail Glukhikh 94c94d0605 K1: add a language feature to negate new errors from DiagnosticReporterByTrackingStrategy
Related to KT-55055, KT-55056, KT-55079, KT-57854
2023-05-01 11:47:01 +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
Mikhail Glukhikh 9374202ebc FirCallResolve: disable property resolve optimization in builder inference
#KT-57889 Fixed
2023-04-18 17:05:01 +00:00
Mikhail Glukhikh f9a7a7fda2 K2: reproduce KT-57889 2023-04-18 17:05:00 +00:00
Mikhail Glukhikh 50f82c9094 FirBuilderInferenceSession: fix calculation of effectivelyEmptyCommonSystem
#KT-57873 Fixed
2023-04-18 09:23:20 +00:00
Mikhail Glukhikh 7bd5491498 K2: reproduce KT-57873 2023-04-18 09:23:20 +00:00
Mikhail Glukhikh bd27ec840c K1: report swallowed diagnostic about receiver type mismatch
#KT-55056 Fixed
2023-04-03 16:35:55 +00:00
Mikhail Glukhikh 930237b60e K1: report swallowed diagnostic about upper bound violation
#KT-55055 Fixed
2023-03-24 14:27:03 +00:00
Mikhail Glukhikh 2fb79bf0b1 K1: don't report InferredIntoDeclaredUpperBound on non-physical element
#KT-56169 Fixed
2023-03-17 12:08:37 +00:00
Mikhail Glukhikh 980ab41ef1 FE: split one more test "buildList type argument is inferred into upper bound"
Related to KT-48445, KT-56169
2023-03-17 12:08:37 +00:00
Mikhail Glukhikh 97bec59bc9 K1: add forgotten INFERRED_INTO_DECLARED_UPPER_BOUNDS for incorporation case
#KT-56169 Fixed
2023-03-17 12:08:36 +00:00
Mikhail Glukhikh ba2d896c01 FE: split test "buildList type argument is inferred into upper bound"
Related to KT-50520, KT-56169
2023-03-17 12:08:35 +00:00
Kirill Rakhman 3b9724d20e [FIR] Desugar increment/decrement in body resolve phase
The expression needs to be resolved first to determine if there is a
receiver that needs to be extracted to a temporary variable. Also, the
special case for prefix increment/decrement on local variable without
delegates requires resolution to check if the variable is local.

^KT-56771 Fixed
^KT-56659 Fixed
2023-03-02 10:19:57 +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 2fddb15539 [Test] Move some builder inference tests from codegen to diagnostics
^KT-56169
2023-01-30 09:29:58 +00:00
Mikhail Glukhikh 50cd560d09 K1: add more tests for BI assignment checker, fix corner cases
Related to KT-54004
2022-10-26 09:21:49 +00:00
Mikhail Glukhikh 8e48636b29 K1: don't report assignment TYPE_MISMATCH in BI under feature ON
Related to KT-54004
2022-10-26 09:21:48 +00:00
Mikhail Glukhikh 0080f16cc2 K1: report TYPE_MISMATCH for incorrect assignments in builder
#KT-54004 Fixed
2022-10-12 08:21:13 +00:00
Mikhail Glukhikh 0940707fd4 FE: add reproducer for KT-54004 2022-10-12 08:21:12 +00:00
Mikhail Glukhikh 591992dc12 K1: mute failing test with slow assertions
Note: in this test, we create a flexible type from two captured types
during substitution, which provokes exception from
FlexibleTypeImpl.runAssertions() (they are run only in test mode)

Related to KT-54198
2022-09-28 15:29:44 +00:00
Mikhail Glukhikh e9bb0f4fda Resolution: extract projections from captured flexible type properly
#KT-54100 Fixed
Related to KT-54196, KT-54198
2022-09-28 15:29:43 +00:00
Victor Petukhov fa7809cd80 [FE] Remove BuilderInference annotation from tests 2022-06-21 15:01:56 +02: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
Mikhail Glukhikh e8be9d4861 FIR: support don't use builder inference if possible
In this commit we upgrade FIR builder inference logic from
the compiler version to 1.7. FIR-based compiler now works with
"don't use builder inference" flag always ON and supports switching
the flag "use builder inference only if needed". To do it,
ContraintSystemCompleter (FIR) and KotlinConstraintSystemCompleter (FE 1.0)
are made similar with extracting some common parts into
ConstraintSystemCompletionContext.

Test status: one BB test fails after this commit (KT-49285).
Also we have a crush in DFA logic in FIR bootstrap test and somehow
questionable behavior in FIR diagnostic test. However,
two BB tests were fixed, the 3rd case from KT-49925 were also fixed.

#KT-49925 Fixed
2022-01-20 23:46:36 +03:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
Mikhail Glukhikh 8f1d07084b FIR: introduce ILLEGAL_SUSPEND_FUNCTION_CALL & PROPERTY_ACCESS diagnostics 2021-07-30 19:06:46 +03:00
Victor Petukhov 95492f7370 [FE 1.0] Fix some diagnostic tests 2021-07-29 19:45:55 +02:00
Mikhael Bogdanov cc5ba4c0af Update diagnostic tests 2021-07-29 19:45:54 +02:00
Mikhail Glukhikh 82f268d611 FIR: add EXPERIMENTAL_API_USAGE reporting 2021-07-23 23:58:55 +03:00
Victor Petukhov 6a1ec92d39 Introduce specific error for calls which could be resolved only with unrestricted builder inference
^KT-47747 Fixed
2021-07-16 19:32:36 +03:00
Denis.Zharkov 592256976e FIR: Fix inference of builder-inference function from expect type
Previously, such calls were being completed with FULL mode and incorrect
INFERENCE_NO_INFORMATION_FOR_PARAMETER has been reported
2021-06-07 15:25:57 +03:00
Denis.Zharkov 0aca3a3737 FIR: Adjust test data after introduction of INFERENCE_NO_INFORMATION_FOR_PARAMETER
See previous commits for details
2021-06-07 15:25:47 +03:00