Commit Graph

6172 Commits

Author SHA1 Message Date
Mikhail Glukhikh 06ce57ea56 K2: report MISSING_DEPENDENCY_CLASS for lambda parameters if needed
#KT-62525 Fixed
2023-12-05 18:16:52 +00:00
Mikhail Glukhikh 254bcdc80a [tests] Change builder inference tests in accordance with KT-53749 changes 2023-12-05 18:15:53 +00:00
Stanislav Ruban 7515efc52c [tests] Change builder inference tests in accordance with new K2 BI diagnostics
Related to KT-59369, KT-59390
2023-12-05 18:15:53 +00:00
Stanislav Ruban c0bf67af22 [tests] Add test data for KT-63841 2023-12-05 18:15:52 +00:00
Stanislav Ruban 4f38d77fae [tests] Add test data for KT-63840 2023-12-05 18:15:52 +00:00
Stanislav Ruban 2bcaa3eb8f [tests] Add test data for KT-63733 2023-12-05 18:15:52 +00:00
Stanislav Ruban a836e94619 [tests] Add test data for KT-63648 2023-12-05 18:15:52 +00:00
Stanislav Ruban 4671a9612a [tests] Add test data for KT-61310 2023-12-05 18:15:52 +00:00
Stanislav Ruban 7dc3ed61c0 [tests] Add test data for KT-60447 2023-12-05 18:15:52 +00:00
Stanislav Ruban 7a254cab9a [tests] Add test data for KT-60291 2023-12-05 18:15:51 +00:00
Stanislav Ruban e5642d83aa [tests] Add test data for KT-59798 2023-12-05 18:15:51 +00:00
Stanislav Ruban 4676b8a2ca [tests] Add test data for KT-59426 2023-12-05 18:15:51 +00:00
Stanislav Ruban f90bd8821c [tests] Add test data for KT-57834 2023-12-05 18:15:51 +00:00
Stanislav Ruban e3fce848b4 [tests] Add test data for KT-57709 2023-12-05 18:15:51 +00:00
Stanislav Ruban 55485a8fd6 [tests] Add test data for KT-57707 2023-12-05 18:15:51 +00:00
Stanislav Ruban 2226486152 [tests] Add test data for KT-56949 2023-12-05 18:15:51 +00:00
Stanislav Ruban 4021e022b7 [tests] Add test data for KT-55281 2023-12-05 18:15:51 +00:00
Stanislav Ruban 6532eb4c60 [tests] Add test data for KT-55057 2023-12-05 18:15:51 +00:00
Stanislav Ruban bb054f75b5 [tests] Add test data for KT-55056 2023-12-05 18:15:51 +00:00
Stanislav Ruban ddb7c6cff8 [tests] Add test data for KT-54767 2023-12-05 18:15:51 +00:00
Stanislav Ruban f600e1f591 [tests] Add test data for KT-54664 2023-12-05 18:15:51 +00:00
Stanislav Ruban 205d568545 [tests] Add test data for KT-54400 2023-12-05 18:15:51 +00:00
Stanislav Ruban 126022a80d [tests] Add test data for KT-53740 2023-12-05 18:15:51 +00:00
Stanislav Ruban 7d040af24c [tests] Add test data for KT-53639 2023-12-05 18:15:51 +00:00
Stanislav Ruban 9dd3cf7bfc [tests] Add test data for KT-53553 2023-12-05 18:15:51 +00:00
Stanislav Ruban 982e8133ba [tests] Add test data for KT-53422 2023-12-05 18:15:50 +00:00
Stanislav Ruban 96e12584a1 [tests] Add test data for KT-53109 2023-12-05 18:15:50 +00:00
Stanislav Ruban 385b29f9c2 [tests] Add test data for KT-52838 2023-12-05 18:15:50 +00:00
Stanislav Ruban f6a3f999c3 [tests] Add test data for KT-52757 2023-12-05 18:15:50 +00:00
Stanislav Ruban 50e58c00ea [tests] Add test data for KT-50827 2023-12-05 18:15:50 +00:00
Stanislav Ruban de8f0c157e [tests] Add test data for KT-50453 2023-12-05 18:15:50 +00:00
Stanislav Ruban 9de8d020f1 [tests] Add test data for KT-49263 2023-12-05 18:15:50 +00:00
Stanislav Ruban 2a257091fb [tests] Add test data for KT-49160 2023-12-05 18:15:50 +00:00
Stanislav Ruban cef44cfa7d [tests] Add test data for KT-47989 2023-12-05 18:15:50 +00:00
Stanislav Ruban 04b05f7912 [tests] Add test data for KT-43710 2023-12-05 18:15:50 +00:00
Nikita Bobko da8a8cc492 Revert "K2/Java: add private enum constructor for MPP matching"
Review: https://jetbrains.team/p/kt/reviews/13368/timeline

This reverts commit 2cea2b9098.

Motivation:
KT-62961 was fixed independently by two different commits:
- ac3d8ad3ac
- 2cea2b9098

If possible, it's better not to introduce implicit declarations.
That's why it was agreed to keep
ac3d8ad3ac and revert
2cea2b9098
2023-12-05 17:49:18 +00:00
Kirill Rakhman 8496722603 [FIR] Make UNSAFE_INFIX_CALL and UNSAFE_OPERATOR_CALL parameter nullable
This fixes an NPE in the IDE in presence of a syntax error when the
argument expression has no source.

#KT-64062 Fixed
2023-12-05 17:25:28 +00:00
Nikita Bobko 2a7403a979 [FIR, IR] Run DefaultArgumentsInExpectActualizedByFakeOverride not only in FIR but in IR as well
Review: https://jetbrains.team/p/kt/reviews/13334/timeline

Thanks to the previous commit, it's now possible to run
DefaultArgumentsInExpectActualizedByFakeOverride on both: frontend (FIR)
and backend (IR).

We aim to perform a thorough examination of checks involving
fake-overrides on both FIR and IR, given their distinct implementations
for handling fake-overrides.

The commit decreases scope of influence of hacky
`shouldCheckDefaultParams` flag.
2023-12-05 13:30:14 +00:00
Nikita Bobko 1aeefe6c33 [FIR] Don't traverse expect hierarchy to check DefaultArgumentsInExpectActualizedByFakeOverride
^KT-63860 Fixed
Review: https://jetbrains.team/p/kt/reviews/13334/timeline

The previous code was nonsense (I wrote it). It doesn't make sense to
subtract actualOverriddenDeclarations from expectOverriddenDeclarations.
Default parameters are mentioned on the expect side. So default params
in expect/actual supertypes won't be subtracted from
expectOverriddenDeclarations (but should be)
2023-12-05 13:30:14 +00:00
Roman Golyshev 99c7fab401 KT-59732 [FIR] Adjust test data for the absence of unresolved imports
Now there are no real unresolved imports - all imports are considered
resolved starting from the IMPORTS phase and until they are proven
otherwise in the checkers.

Because of that, some `UNRESOLVED_REFERENCE` diagnostics are gone -
in the cases when such references were actually resolved through
those unsupported imports.

The compilation of incorrect files should not be affected by this,
the checkers would still prevent the compilation of the files with
incorrect imports.
But now the references to the declarations from such imports no longer
will be highlighted as unresolved references.
2023-12-04 16:51:46 +00:00
Kirill Rakhman 476a0b6783 [FIR] Don't capture flexible types that only have projections in one bound
This fixes a false positive NEW_INFERENCE_ERROR.
See the code comment for the rationale.

#KT-63982 Fixed
2023-12-04 15:42:12 +00:00
Simon Ogorodnik c2ddbfc93b K2: Fix false-positive error with captured types in builder inference
Error arises from the fact that type substitution operation isn't
consistent when applied to captured types.

E.g.:
```
substitution = { A => B }
substituteOrSelf(C<CapturedType(out A)_0>) -> C<CapturedType(out B)_1>
substituteOrSelf(C<CapturedType(out A)_0>) -> C<CapturedType(out B)_2>
C<CapturedType(out B)_1> <!:> C<CapturedType(out B)_2>
```

Relates to KT-53749
2023-12-04 15:27:21 +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
Simon Ogorodnik cb3d65f669 [Test] Add test for KT-63996
False-positive TYPE_MISMATCH in builder inference with captured types
2023-12-04 15:27:20 +00:00
Nikita Bobko 8c0cf7d0bc [FIR] Fix disappeared ACTUAL_MISSING
^KT-59887 Fixed

Review: https://jetbrains.team/p/kt/reviews/13244
2023-12-04 13:08:23 +00:00
Nikita Bobko e44e84d1b0 [FIR] Reuse expect/actual matching data of outer declarations during matching of inner declarations
Review: https://jetbrains.team/p/kt/reviews/13244

Motivation:
    ```
    // Module :lib
    class Foo {
        val member: Int = 2
    }

    // Module :app
    // dependencies { implementation(project(":lib")) }
    class Foo {
        val member: Int = 2
    }
    ```

    Before the commit:
        app_Foo.expectForActual is `null`
        app_Foo.member.expectForActual = lib_foo.member
    After the commit:
        app_Foo.expectForActual is `null`
        app_Foo.member.expectForActual is `null`

    If I don't fix this problem then
    `CommonizerHierarchicalIT.testCommonizeHierarchicallyMultiModule`
    becomes red after I fix KT-59887 in the following commits

    `app_Foo.member.expectForActual = lib_foo.member` happens because we
    also need to match fake-overrides (KT-63550)

I didn't measure it, but theoretically, this commit should be a
performance improvement, becuase we reuse `expectForActual` cache

Additionally, The commit breaks some other tests (e.g.
compiler/testData/diagnostics/tests/multiplatform/headerClass/actualMissing.fir.kt).
The tests will become green again, once I fix KT-59887
2023-12-04 13:08:23 +00:00
Anastasia.Nekrasova b83d8595e5 [K2] Disappeared UNSUPPORTED
Forbid prefixes and suffixes for numeric literals and string

^KT-59881
2023-12-04 10:12:43 +00:00
Stanislav Ruban b275aeb39d [tests] Add test data for KT-63705 2023-12-01 19:20:26 +00:00
Mikhail Glukhikh 526bc1744a K2: implement BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION
#KT-59390 Fixed
2023-12-01 10:54:29 +00:00