Commit Graph

18678 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 4b649cbbe9 [tests] Drop a BI codegen test for should-be-red issue KT-63648 2023-12-05 18:15:53 +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
Mikhail Glukhikh 1f989dce64 K2: add test for KT-56520, case (7), qualifier receivers (4.2)
This commit covers enum entry vs companion member case,
when two companion objects are in the scope.
K1 reports UNRESOLVED_REFERENCE here, probably due to ambiguity.
About K2, while resolving Some.foo it first tries to resolve Some
as a "general" variable access, and gets two candidates with companions.
After that it tries to resolve Some as a qualifier,
but we have no scope with a single qualifier, so no influence here.
With two ambiguous candidates with companions for Some,
OVERLOAD_RESOLUTION_AMBIGUITY is reported.
2023-12-04 21:50:46 +00:00
Mikhail Glukhikh 63ce4ba6b0 K2: add test for KT-56520, case (7), qualifier receivers (4.1)
This commit covers enum entry vs companion member case,
when one companion object is in the scope.
K1 reports UNRESOLVED_REFERENCE here, probably due to ambiguity.
About K2, while resolving Some.foo it first tries to resolve Some
as a "general" variable access, and gets the only candidate with companion.
After that it tries to resolve Some as a qualifier,
but we have no scope with a single qualifier, so no influence here.
Finally during foo resolve it should choose between enum entry and
companion member, and enum entry wins due to KT-37591.
2023-12-04 21:50:45 +00:00
Mikhail Glukhikh 76b2b9fc66 K2: add test for KT-56520, case (7), qualifier receivers (3)
This commit covers object vs static member case,
when no companion objects are in the scope.
K1 reports UNRESOLVED_REFERENCE here, probably due to ambiguity.
About K2, while resolving Some.foo it first tries to resolve Some
as a "general" variable access, and gets two erroneous candidates
without companions. After it tries to resolve Some as a qualifier,
but we have no scope with a single qualifier.
That's why we finally report NONE_APPLICABLE on candidates with companions.
2023-12-04 21:50:45 +00:00
Mikhail Glukhikh 602801dcfd K2: add test for KT-56520, case (7), qualifier receivers (2.2)
This commit covers object vs companion member vs static member case
but now we have two different companions (first is empty) in the scope.
K1 reports UNRESOLVED_REFERENCE here, probably due to ambiguity.
About K2, while resolving Some.foo it first tries to resolve Some
as a "general" variable access, and gets some/Some & some2/Some
because both of them have a companion. This means ambiguity.
After it tries to resolve Some as a qualifier, but we have no scope
with a single qualifier, so finally we prefer to report ambiguity
from variable access resolve.
2023-12-04 21:50:44 +00:00
Mikhail Glukhikh ab161333a7 K2: add test for KT-56520, case (7), qualifier receivers (2.1)
This commit covers object vs companion member vs static member case
in situation with only one companion in the scope.
K1 reports UNRESOLVED_REFERENCE here, probably due to ambiguity.
About K2, while resolving Some.foo it first tries to resolve Some
as a "general" variable access, and gets only some2/Some
because it has a companion. Then it tries to resolve Some as a qualifier,
but here we have an ambiguity, so finally Some with companion is preferred.
2023-12-04 21:50:43 +00:00
Mikhail Glukhikh c2ac9daa7f K2: add test for KT-56520, case (4), callable references (unbound)
Again, both frontends here ignored classifiers from
explicit star imported scope (some.HashMap, java.util.HashMap)
because of their ambiguity. In case of K2, it works so due to logic
in BodyResolveComponents.resolveRootPartOfQualifier.
This function is called to resolve qualifier without receiver.
See also cases (3) and (7).
2023-12-04 21:50:43 +00:00
Mikhail Glukhikh f0058ee0d8 K2: add test for KT-56520, case (4), callable references (bound)
In this test, things work in the similar way as in constructors case (2).
K1 resolves the explicit receiver HashMap<String, String>()
to kotlin.collections.HashMap /* = java.util.HashMap */.
K2 does the similar, but fun processConstructors from ConstructorProcessing.kt
makes a type alias substitution, so in fact constructor of expanded
java.util.HashMap is processed.

Pay attention that both frontends ignore some.HashMap and java.util.HashMap
due to ambiguous classifiers in explicit star importing scope.
See FirScope.processConstructorsByName in ConstructorProcessing.kt
2023-12-04 21:50:42 +00:00
Mikhail Glukhikh 168717b811 K2: add test for KT-56520, case (7), qualifier receivers (1)
Again, both frontends here ignored classifiers from
explicit star imported scope (some.HashMap, java.util.HashMap)
because of their ambiguity. In case of K2, it works so due to logic
in BodyResolveComponents.resolveRootPartOfQualifier.
This function is called to resolve qualifier without receiver
2023-12-04 21:50:42 +00:00
Mikhail Glukhikh 22d083a7a9 K2: add test for KT-56520, case (3), class literals
Again, both frontends here ignored classifiers from
explicit star imported scope (some.HashMap, java.util.HashMap)
because of their ambiguity. In case of K2, it works so due to logic
in BodyResolveComponents.resolveRootPartOfQualifier.
This function is called to resolve qualifier without receiver, in case
it's used as a receiver itself (::class counts as a selector equivalent).
2023-12-04 21:50:41 +00:00
Mikhail Glukhikh 6fb88102a5 K2: add test for KT-56520, cases (1), (5), (6), type references
In both these situations, we have some.HashMap & java.util.HashMap
from explicit star importing scope, and kotlin.collections.HashMap
from implicit star importing scope after it.
K1 ignores both explicitly imported classifiers due to their ambiguity,
and then resolves to kotlin.collections.HashMap at the next level.
In contrast, K2 takes explicitly imported classifiers and
properly reports ambiguity.
2023-12-04 21:50:40 +00:00