Commit Graph

39 Commits

Author SHA1 Message Date
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
Victor Petukhov 54b9f39b3a Update tests after rebase 2021-05-28 15:36:24 +03:00
Victor Petukhov 758eb8f851 Fix builder inference tests 2021-05-28 15:36:22 +03:00
Victor Petukhov 0f317b01b4 Rename language feature StableBuilderInference to UnrestrictedBuilderInference 2021-05-28 15:36:19 +03:00
Victor Petukhov 0b37b2be6a Add addtional tests for builder inference 2021-05-28 15:36:19 +03:00
Denis.Zharkov e7669ef9d6 FIR: Fix builder inference case with independent calls inside lambda 2021-02-03 15:05:21 +03:00