Commit Graph

98765 Commits

Author SHA1 Message Date
Denis.Zharkov e43d8bbb47 K2: Require resolved type for ResolutionMode.WithExpectedType
Implicit type might have two meaning there:
- noExpectedType
- unknown declaration type where this expression is assigned to

For both cases, we've got ResolutionMode.ContextIndependent that works
just fine
2023-02-15 08:13:48 +00:00
Denis.Zharkov df826f04a7 K2: Generify completion mode computation
Now, it's generated from ResolutionMode, that later allows to define
more granular rules
2023-02-15 08:13:48 +00:00
Denis.Zharkov 28ff276320 K2: Unify completeCall overloads and usages
- Leave only the overload with ResolutionMode parameter
- Get rid of boolean flags that belong to ResolutionMode.WithExpectedType
2023-02-15 08:13:48 +00:00
Denis.Zharkov 73fa41f7fb Minor. Reformat FirExpressionsResolveTransformer.kt 2023-02-15 08:13:47 +00:00
Denis.Zharkov cc1b608661 K2: Merge all expected-type related resolution modes into single class
It looks more natural and allows to combine different properties
of these cases
2023-02-15 08:13:47 +00:00
Denis.Zharkov 33dcbaac16 K2: Change resolution rules of when/if expressions with expected type
When expected type is known, use it as expected type for branch bodies.
While it indeed becomes different from the usual select call resolution,
where expected type is applied only after completion starts,
it helps to support, e.g. callable references resolution just as powerful
as it was in K1.

Also, in some cases where diagnostics have been changed, they become
a bit more helpful since they are reported closer
to the problematic places

cannotCastToFunction.kt test has been removed because it relied
on the case erroneously supported by the hack removed from
the FirCallResolver in this commit.

^KT-45989 Fixed
^KT-55936 Fixed
^KT-56445 Fixed
^KT-54709 Related
^KT-55931 Related
2023-02-15 08:13:46 +00:00
Denis.Zharkov a38040680c K2: Do not use KFunctionN as representation type for adapted references
Beside some corner cases, it's already prohibited in K1 because
adaptation have a bit strange nature
(they don't represent any existing real function exactly)

^KT-55137 Fixed
2023-02-15 08:13:45 +00:00
Denis.Zharkov dcdc48a233 K2: Support callable references adaptation on top-level
^KT-45989 In progress
^KT-54709 Related
^KT-55217 Fixed
2023-02-15 08:13:44 +00:00
Denis.Zharkov 8f8ea8c57f K2: Optimize one-branch when-expr case only for independent context
Using independent one where `when` is nested doesn't look correct
2023-02-15 08:13:43 +00:00
Denis.Zharkov 04d3996e68 K2: Resolve non-exhaustive when expressions independently
^KT-55169 Fixed
^KT-55175 Related
2023-02-15 08:13:43 +00:00
Denis.Zharkov 9fa0f51a61 K2: Fix false-negative RETURN_TYPE_MISMATCH
^KT-53987 Fixed
^KT-55932 Fixed
2023-02-15 08:13:42 +00:00
Denis.Zharkov d7399ed1cf K2: Avoid losing diagnostics for synthetic calls
Some of the changed tests may duplicate other existing diagnostics,
but that should not be reason not to report them at all.

There might be another job to be done to avoid diagnostic duplications
2023-02-15 08:13:41 +00:00
Denis.Zharkov fe5adab652 K2: Avoid inference diagnostics when arguments are already error typed
For example, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER

It became especially relevant after 0e84bf2053
that together with later commits bring a lot of unnecessary
NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER diagnostic
2023-02-15 08:13:41 +00:00
Igor Chevdar 564b40f05d [K/N] Fixed resolve order of compiler caches
#KT-56611 Fixed
2023-02-15 07:06:05 +00:00
Igor Chevdar 951ebf4082 [K/N] Added a test for KT-56611 2023-02-15 07:06:05 +00:00
Ilya Gorbunov 3d05565b99 Remove tasks for zipping compiler testdata and stdlib test sources 2023-02-14 23:37:32 +00:00
Sergey.Shanshin 498c1abbc6 [KxSerialization] Fix SERIALIZER_NOT_FOUND diagnostic for enums
If enum class from dependencies is used, which was compiled by a new version of the plugin, which uses a factory and does not create a nested `$serializer` class, then an `SERIALIZER_NOT_FOUND` diagnostic error is thrown for such an enumeration.
This happens if the old serialization runtime is used for the current project - in this case, the serializer is taken from the nested class `$serializer`. Since it is missing, the diagnostics does not work correctly.
It is acceptable for enumerations to ignore this error, because we know that enumerations are always serializable.

Merge-request: KT-MR-8818
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-02-14 22:10:30 +00:00
Sergey.Shanshin c9b8160f1e [kxSerialization] Added diagnostic on useless Serializer annotation
Resolves Kotlin/kotlinx.serialization#2182

Merge-request: KT-MR-8718
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-02-14 22:00:33 +00:00
Vladimir Sukharev 3124154aef [K2/N] Fix false negative interop_objc_kt55938 under K2
Merge-request: KT-MR-8817
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-14 20:32:45 +00:00
Vladimir Sukharev 255d4fa829 [K/N] Don't reuse irGet node in cleanerField tree
Merge-request: KT-MR-8831
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-14 20:31:13 +00:00
Dmitriy Novozhilov 8e3022452e [FIR] Unify diagnostic message in FIR dump for syntax error between PSI and LT 2023-02-14 17:08:55 +00:00
Dmitriy Novozhilov aef9b129d2 [FIR] Add regression tests for number of issues fixed in K2
List of issues:
KT-4113,  KT-6822,  KT-7389,  KT-17817, KT-20223
KT-21463, KT-24503, KT-24737, KT-24779, KT-24901
KT-27261, KT-28668, KT-30497, KT-30756, KT-36958
KT-37365, KT-37490, KT-38288, KT-41038, KT-41721
KT-42136, KT-42169, KT-42449, KT-42715, KT-43553
KT-43603, KT-43846, KT-43936, KT-46288, KT-46301
KT-47373, KT-47484, KT-47490, KT-47495, KT-47750
KT-47815, KT-47870, KT-48975, KT-49024, KT-49045
KT-50134, KT-50160, KT-50550, KT-51045, KT-51143
KT-51796, KT-52262, KT-52424, KT-52860, KT-52934
KT-53086, KT-53494, KT-53671, KT-53752, KT-53819
KT-54478, KT-54518, KT-54931, KT-54990, KT-55138
KT-55379, KT-55555, KT-56243
2023-02-14 17:08:55 +00:00
Dmitriy Novozhilov 8ae5213155 [FIR] Add tests for KT-50386 and KT-50646 2023-02-14 17:08:54 +00:00
Dmitriy Novozhilov 092ebf4c11 [FIR] Add test for KT-49249 2023-02-14 17:08:54 +00:00
Dmitriy Novozhilov 019d7db737 [FIR] Add regression test for KT-44392
Also related to KT-56615
2023-02-14 17:08:53 +00:00
Dmitriy Novozhilov 197f19c627 [FIR] Add test for KT-43619 2023-02-14 17:08:53 +00:00
Roman Golyshev b23aabf6e0 [Analysis API] KTIJ-24610 Ignore qualifiers with fake source in KtFirImportOptimizer
Such qualifiers can appear for extensions imported from objects

^KTIJ-24610 Fixed
2023-02-14 16:08:40 +00:00
Anton Lakotka 515a401b23 [Gradle, Test] separate lib publication and app assemble to different builds
To prevent build failures due to race conditions
with publication and consumption
2023-02-14 15:15:12 +00:00
Anton Lakotka 96ba03a708 [Gradle] Move configureMDConfigurations to resolvableMetadataConfiguration 2023-02-14 15:15:12 +00:00
Sebastian Sellmair 25f6b4c922 [Gradle][Minor] Make collectAllProjectStructureMetadataInCurrentBuild private
^KT-56431 Verification Pending
^KT-56461 Verification Pending
2023-02-14 15:15:11 +00:00
Sebastian Sellmair 8f4dd86788 [Gradle] Move KotlinSourceSet metadata configuration into separate source file
^KT-56431 Verification Pending
2023-02-14 15:15:11 +00:00
Sebastian Sellmair f21e08f6b9 [kotlin-tooling-core] Add extrasNullableLazyProperty API
^KT-56431 Verification Pending
2023-02-14 15:15:11 +00:00
Sebastian Sellmair b646a43dab [Gradle] ResolvableMetadataConfigurationTest: Check ide dependencies
^KT-56461 Verification Pending
2023-02-14 15:15:10 +00:00
Sebastian Sellmair 0a2b873415 [Gradle] GranularMetadataTransformation: Support dependency constraints
^KT-56431 Verification Pending
^KT-56461 Verification Pending
2023-02-14 15:15:10 +00:00
Sebastian Sellmair 380ca95661 [Gradle] resolvableMetadataConfiguration: Ensure consistent resolution across all compile dependencies
^KT-56461 Verification Pending
^KT-56431 Verification Pending
2023-02-14 15:15:10 +00:00
Anton Lakotka 5ec153822a [Gradle] Replace provider by lazy in ProjectData 2023-02-14 15:15:09 +00:00
Anton Lakotka 0bee621b21 [Gradle] Minor: optimize imports 2023-02-14 15:15:09 +00:00
Anton Lakotka 737afcb343 [Gradle] Move creation of GranularMetadataTransformation to source set
Now it is encapsulated to DefaultKotlinSourceSet and is lazily created
upon demand during project import

But metadata configurations still should be created during metadata
target configuration.

^KT-56431 Verification Pending
2023-02-14 15:15:09 +00:00
Anton Lakotka db6c6c736a [Gradle] Cache data that collected from all projects in rootProject 2023-02-14 15:15:08 +00:00
Vladimir Sukharev babd52e27a [K2/N] Fix test on Windows: remove \r from compared strings
Address reviewer's comment

Fix test on Windows: remove \r from compared strings

Merge-request: KT-MR-8799
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-14 14:46:27 +00:00
Yunir Salimzyanov ee32fddbfe KT-55700: fix IDEA import with JPS build enabled 2023-02-14 13:43:58 +00:00
Leonid Startsev 80ad6a4cd7 Support plugin intrinsics for serializer() function in K2.
- Add IrPluginContext to JvmBackendContext, so plugin intrinsics can
reference external functions properly.

- Do not use module.findClassAcrossModuleDependencies as Descriptor API does not work for FIR.

- Add asm listing tests in serialization plugin for K2

- Remove Delegated.kt asm listing test as we have similar test in boxIr group.

#KT-56553 Fixed
2023-02-14 13:43:09 +00:00
Alexander Korepanov 121c920099 [JS IR IC] Load only top level signatures for function type interfaces
The dependency signature may refer to function type interface properties
 (e.g. name) or methods. It is impossible to detect (without hacks)
 which binary symbol for loading is required. However, when loading
 a property or a method the entire function type interface is loaded.
 And vice versa, a loading of function type interface loads
 properties and methods as well. Therefore, load the top level signature only,
 it must be the signature of function type interface.

^KT-56582 Fixed
2023-02-14 13:25:19 +00:00
Alexander Korepanov f367541393 [JS IR] Rename functionalInterface -> functonTypeInterface 2023-02-14 13:25:19 +00:00
Pavel Kunyavskiy 00c900cb49 [K/N] Optimize code generation for function references
In before, each function reference created 5 functions needed only
for equals/hashcode properties. It contributed arround 3.5% of code size
on several sample projects. This is now replaced by passing constant
object to base class constructor.
2023-02-14 13:00:47 +00:00
Mikhail Glukhikh 7d8a1e9c1c Delay EnhanceNullabilityOfPrimitiveArrays to version 2.0
See KT-54521
2023-02-14 11:52:00 +00:00
Nikolay Krasko 2ad567e14c Revert "[K/N][build] Cleanup obsolete build tasks"
This reverts commit a9cae3fe87.
2023-02-14 11:30:17 +00:00
Aleksei.Cherepanov 0470a9568d [Maven] Fix flaky test-plugins
Logging in maven has been slightly changed, so it no longer matches the old patterns. It was flaky because sometimes it loaded the plexus artifact (and sometimes it didn't) and such event was shown in the log with different log message
2023-02-14 10:09:52 +00:00
Igor Chevdar ba172358d8 [K/N] Option to specify IR validation severity 2023-02-14 07:30:47 +00:00
Igor Chevdar 4fd063bd4b [K/N][driver] Some tweaks in IrValidator setup 2023-02-14 07:30:46 +00:00