Commit Graph

91 Commits

Author SHA1 Message Date
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 8459465177 K2: Adjust test data after PCLA implementation [green-to-red, controversial]
^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
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Mikhail Glukhikh dbca7358af K2: add explicit cast to Any for Any function calls on stub types
This commit solves a stub type inconsistency problem.
As a part of KT-59369 fix we decided (see commit 299d2799),
that ConeStubTypeForChainInference has a scope of Any,
so we can safely resolve only to equals/hashCode/toString.
However, later we can replace a stub type with some inferred type,
which can have its own equals/hashCode/toString implementation,
while the call still refers Any member.
In this situation FIR2IR decides that we are calling a fake override,
which is not true, in fact we are calling an overriding method.
This leads to a crash in Native backend.

To solve this situation, we provide an explicit cast of a dispatch
receiver with a stub type (ConeStubTypeForChainInference) to Any,
thus confirming directly we are calling Any method and nothing else.

#KT-63932 Fixed
2023-12-13 14:56:58 +00:00
Mikhail Glukhikh b317777796 K2: temporarily mute some Native tests around builder inference (KT-63932)
Related to KT-59369
2023-12-01 10:54:29 +00:00
Artem Kobzar 55d41db2ce [K/JS] Include jsFirEs6Test into jsFirCompilerTest tests 2023-11-24 22:09:43 +00:00
Svyatoslav Kuzmich a3e2d2804c [Wasm] Update testData after adding K2 and new test infra support.
- Actualize muted K2 tests
- Actualize muted K1 tests with module systems because legacy Wasm test
  infra had no respect for "// MODULE: ..." test directives
2023-06-25 10:20:40 +02:00
Vladimir Sukharev 67b00f86b7 [K/N] Remove "IGNORE_BACKEND: NATIVE" from tests already ignored due to incompatible language setting found in test
^KT-59057

Merge-request: KT-MR-10587
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-15 19:58:04 +00:00
Simon Ogorodnik 3e6b42083b FIR: Fix leakage of type variables in builder inference for lambdas returning Unit
When BI/incomplete call is present in return argument, it will be
added to the main call-tree, leading to requirement violation in
`ConstraintSystemCompleter.getOrderedAllTypeVariables`
as after `FirBuilderInferenceSession.inferPostponedVariables` it will
be completed, and its type variables couldn't be found anymore

In K1, we actually do the same, but we are able to find type variables
of such calls due to architecture difference:
In K2, `getOrderedAllTypeVariables` uses FIR as the main source to
lookup
In K1, `getOrderedAllTypeVariables` uses resolution atom tree, where
candidate/CS of the call is still available after
`inferPostponedVariables`

In fact, all incomplete calls were analyzed in FULL mode according to
the contract of `FirBuilderInferenceSession.addPartiallyResolvedCall`.
Thus, it means we normally shouldn't add them to the main call-tree, but
accidentally do it as incomplete calls contain non-completed candidate

This particular commit addresses the problem partially, only
in cases when the expected return type for the lambda is Unit and when
the incomplete call is located in the last expression of the lambda

In such cases, we can skip the call from the last expression completely,
since all potential calls there were analyzed in FULL mode,
and couldn't introduce any useful info to the CS of the main call-tree

^KT-54294
2023-05-17 10:50:36 +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
Dmitriy Novozhilov 2fddb15539 [Test] Move some builder inference tests from codegen to diagnostics
^KT-56169
2023-01-30 09:29:58 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Vladimir Sukharev 924898afb7 [K/N] KFC-446: K2 platform: Native alpha
Merge-request: KT-MR-7905
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-01-04 16:10:40 +00:00
Dmitriy Novozhilov 1b27d60307 [FIR] Support @OnlyInputTypes annotation
^KT-54807 Fixed
2022-11-22 15:46:17 +00:00
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01: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
Dmitriy Novozhilov 7af43176ce [FIR] Add optin on API of updating type of receiver values. KT-54708 2022-11-03 08:30:09 +00:00
Simon Ogorodnik 154e53c701 K1: add diagnostic BUILDER_INFERENCE_STUB_RECEIVER
It's reported on receivers in extension function calls with stub type,
as such calls can shadow members of finalized stub types causing
change of resolve when corresponding type argument specified explicitly

It works by checking extension receiver during call resolution parts run
That way we can easily detect if we found an extension applicable to
stub receiver and report call diagnostic for it

KT-53739
2022-08-30 10:19:26 +00:00
Simon Ogorodnik 4227fd012f Fix test for two builder inference lambdas 2022-08-30 10:19:24 +00:00
Victor Petukhov fa7809cd80 [FE] Remove BuilderInference annotation from tests 2022-06-21 15:01:56 +02:00
Victor Petukhov b411eb36e8 [FE 1.0] Take care standalone lambdas during updating types in the builder inference
^KT-50520 Fixed
2022-05-27 13:56:32 +00:00
Victor Petukhov 7675361380 [FE 1.0] Continue completion of calls inside that builder inference call postponed type variables of which has already been inferred 2022-05-09 12:38:39 +00:00
Victor Petukhov b8030ec1de [FIR] Substitute lambda implicit receivers with builder inference stub types
^KT-51988 Fixed
2022-05-09 12:38:38 +00:00
Victor Petukhov 6027c2a9aa [FE] Substitute fixed type variables with inferred stub types
Actually, a type variable might be fixed into a stub type. Such stub type should be substituted before sub calls completion

^KT-51988 Fixed
2022-05-09 12:38:37 +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 f53cd22253 FIR: copy builder inference session when creating snapshot for locals
This commit fixes one builder inference case from KT-49925
2021-12-23 17:28:01 +03:00
Victor Petukhov b3943f5ab6 [FE 1.0] Process builder inference stub types with different nullability properly
^KT-49887 Fixed
2021-12-15 22:23:18 +03:00
Mikhail Glukhikh 2338281889 FIR: Add test for get class + let in delegation 2021-12-15 22:23:07 +03:00
Mikhail Glukhikh 9aced1c33d FIR: Update test-data (Delegate inference) 2021-12-15 22:23:04 +03:00
Mikhail Glukhikh 1e41ec7d22 FIR: replace ConeComposedSubstitutor with ChainedSubstitutor 2021-12-15 22:23:03 +03:00
Igor Yakovlev ea060dcf8a [WASM] Implement lazy with UnsafeLazyImpl 2021-12-07 21:33:34 +03:00
Mikhail Glukhikh cf104c8433 FIR: add status line to all failing black box tests 2021-11-20 03:37:31 +03: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
Igor Yakovlev ce360bb10b [WASM] Implementation of Class references 2021-11-15 19:53:46 +03:00
Igor Yakovlev d9f2bd7963 Revert "[Wasm][Temporary] Stubs for typeOf and ::class constructs"
This reverts commit 8dc81b6c57.
2021-11-15 19:53:45 +03:00
Alexander Udalov 1071919706 Remove backend tests on old inference
Also remove any mentions of NewInference, and rename some tests.
2021-11-09 20:07:33 +01:00
Igor Laevsky 8dc81b6c57 [Wasm][Temporary] Stubs for typeOf and ::class constructs 2021-11-03 16:23:01 +03:00
Victor Petukhov 64c682f465 Remove constraints containing stub types after completion of the common system of a builder inference call
^KT-49285 Fixed
2021-10-26 19:37:59 +03:00
Victor Petukhov d50eba62bd Propagate inference session from local context into property resolvers
^KT-48633 Fixed
2021-10-26 19:37:56 +03:00
Abduqodiri Qurbonzoda a3755a8e94 @UseExperimental -> @OptIn in compiler testData 2021-10-17 21:14:37 +00:00
Igor Laevsky 50ca86838f [WASM] Fix build 2021-10-14 17:24:07 +03:00
Igor Laevsky e331a52e75 [Wasm] Mute/unmute box tests after kotlin.test support 2021-10-14 17:24:05 +03:00
Svyatoslav Kuzmich 15acc412ba [Wasm] Update testdata after coroutines support 2021-10-12 08:42:00 +03:00
Svyatoslav Kuzmich 9ef899ef10 [Wasm] Reuse Callable reference and SAM lowerings from JS 2021-10-08 07:24:41 +03:00
Svyatoslav Kuzmich aa5f98f919 [JS] Remove KJS_WITH_FULL_RUNTIME for tests that already have WITH_RUNTIME 2021-10-07 22:36:18 +03:00
Svyatoslav Kuzmich 6eb81517a0 [Wasm] Unmute passed Wasm tests 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich c88cde2f8b [Wasm] DONT_TARGET_WASM_BACKEND => IGNORE_BACKEND in testdata 2021-10-02 06:14:35 +00:00
Svyatoslav Kuzmich ab9a23cbfa [Wasm][Stdlib] Reuse K/N collections and StringBuilder 2021-10-01 17:18:49 +03:00
Mikhail Glukhikh 11459aced6 Replace UseExperimental with OptIn in BB builder inference tests 2021-09-29 19:39:26 +03:00