Commit Graph

104571 Commits

Author SHA1 Message Date
Vladimir Sukharev f5bd7cee05 [K/N] Adjust filecheck tests for atomic intrinsics to -opt mode
^KT-60514 Fixed


Merge-request: KT-MR-12179
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-13 17:46:22 +00:00
Alexander Shabalin c637a228eb [K/N] Fix filecheck kt53621 tests on linux arm64.
For aarch64-unknown-linux-gnu clang generates i1 to represent bool.
On our other targets it generates as zeroext i1 instead.
2023-09-13 16:55:09 +00:00
Roman Golyshev 7b50506aea KT-61889 [AA] Migrate KtFirReferenceShortener to ContextCollector
This should make reference shortener considerably faster, since it won't
need to perform redundant extra resolve of the file.

`ContextCollector` more accurately collects the scopes for the scripts,
so some script tests are also fixed.

It should fix the following bugs:

^KTIJ-26714 Fixed
^KTIJ-26727 Fixed

This is also an important part of fixing the following bugs:
- KTIJ-26715
- KTIJ-26734

But those bugs also rely on KT-61890, because completion uses scopes
and snows incorrect elements from them
2023-09-13 16:43:20 +00:00
Dmitrii Gridin ce900063c0 [LL FIR] reduce number of in-block modifications
The idea of optimization is simple – delay in-block modification
until the end of a write action.

Q: Why the end of write action?
A: We have to publish the result of modification somewhere during
write action to be sure that the next read action will see the
updated result. We can't publish the result somewhere later
because we can't guarantee that the modification will be visible
to all customers.

In the case of out-of-block modification, we still have to publish
the result immediately because it is hard to evaluate the consequences
of the opposite decision yet.

If an out-of-block modification happens, we can drop all previous
in-block modifications from the queue because they don't make sense
due to invalidation of the entire KtModule.

A corner case is the analysis under write action. The delay means that
there is no longer any guarantee that all PSI changes will be reflected
into FIR tree immediately. So now we can guaranty only that at
the start of `analyze` block you will have the up-to-date FIR tree.

^KT-60611 Fixed
2023-09-13 16:23:27 +00:00
Alexander.Likhachev 431f4a8bd3 [Build] Remove junit from versions.properties
Now all the JUnit dependencies except the ones provided by `kotlin-test` are moved to the version catalog
#KTI-1349 Fixed
2023-09-13 15:32:15 +00:00
Sergej Jaskiewicz 14e23a7d84 [K/N] Cache FqNames computed from ClassIds in KonanMangler 2023-09-13 14:25:13 +00:00
Sergej Jaskiewicz 904f8706ee [K/N] Don't use reflection in irText tests for obtaining manglers
See KT-61248
2023-09-13 14:25:12 +00:00
Sergej Jaskiewicz 9eba17d631 [K/N] Move Native-specific mangle constants to more suitable places
They shouldn't be mixed with target-independent constants.
2023-09-13 14:25:12 +00:00
Sergej Jaskiewicz 08a9e7eae9 [IR] Outline the main logic in annotation-related helpers
Prefer smaller inline functions, because otherwise if they become
hot spots, they will complicate performance analysis, and actually
might make everything slower because of low inlining threshold in
HotSpot.
2023-09-13 14:25:11 +00:00
Sergej Jaskiewicz 157ab48fde [K/N] Delete unused methods in ObjCInterop.kt 2023-09-13 14:25:11 +00:00
Sergej Jaskiewicz e3b5dc509c [K/N] De-duplicate code for mangling objc interop function names
Extract the duplicated functionality to the
`ObjCFunctionNameMangleComputer` class.
2023-09-13 14:25:11 +00:00
Sergej Jaskiewicz 0fd4f10f6c [K/N] Avoid magic strings in KonanMangler 2023-09-13 14:25:10 +00:00
Sergej Jaskiewicz ddfd94b3b2 [K/N] Move KonanMangler to a new common module
^KT-61248 Fixed
2023-09-13 14:25:10 +00:00
Sergej Jaskiewicz d1127f1a31 [K/N] Move IR-related ObjC interop helpers to a new common module
This is a step towards KT-61248. We need those helpers to be available
in non-Native-specific code.
2023-09-13 14:25:09 +00:00
Sergej Jaskiewicz 5cb252fe49 [descriptors] Move DeclarationDescriptor#findPackage helper to core
There is nothing serialization-specific about this function
2023-09-13 14:25:09 +00:00
Sergej Jaskiewicz dff2d2ed60 [descriptors] Move some annotation-related utilities to the core module
- AnnotationDescriptor#argumentValue is not frontend-specific
- AnnotationDescriptor#getAnnotationStringValue is not Native-specific

We are going to need these functions in the IR code, so it makes
sense to factor them out to the core module.
2023-09-13 14:25:08 +00:00
Sergej Jaskiewicz 56cb0bf071 [utils] Move atMostOne to core/util.runtime
There is nothing backend-specific about this helper function.
2023-09-13 14:25:08 +00:00
Nikolay Lunyak fa600a58ac [FIR] Fix analysis of FirScript contents
Running the
`FirScriptCodegenTestGenerated.testSecondLevelFunction` test results
in "Expected is `FirResolvedDeclarationStatus`, but was
`FirDeclarationStatusImpl`. This is similar to the
`FirIdeNormalAnalysisSourceModuleCodeFragmentCollectDiagnosticsTestGenerated.testLocalFunction`
test, but that one was fixed by `9514f8f8`.
Looks like the situation here is the same,
it's just `FirScript` that needs to be
fixed.

The changed regarding the approximation is needed to avoid exposing
the anonymous type in
`FirScriptLazyDeclarationResolveTestGenerated.testDelegatesScript`.

The difference in the
`ScriptInBlockModificationTestGenerated.testRawContractScript`
test appeared because previously
the contract used to be
`FirRawContractDescription`, but
it now resolves to
`FirEmptyContractDescription`.
2023-09-13 14:11:42 +00:00
Nikolay Lunyak a1cb6258bc [FIR] Stop using .fir when checking conflicts
Use the symbols API in the declarations presenter and
conflicts helpers.
2023-09-13 14:11:42 +00:00
Nikolay Lunyak 942bff8a03 [FIR] Take constructors from scopes when checking conflicts
^KT-61243 Fixed
2023-09-13 14:11:41 +00:00
Nikolay Lunyak f719436d1f [FIR] Report top-level conflicts between TA constructors and funs
^KT-59880
2023-09-13 14:11:41 +00:00
Nikolay Lunyak 01d4f25363 [FIR] Move TypeAliasConstructorsSubstitutingScope
It will be needed in the next commit
to check for conflicting declarations
2023-09-13 14:11:41 +00:00
Vladimir Sukharev c4201101ac [K/N] K2/MPP: Move stdlib to the head of dependency list.
^KT-61645 Fixed

Merge-request: KT-MR-12079
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-13 13:56:21 +00:00
Alexander.Likhachev fbeed67931 [Gradle] Mark KotlinTopLevelExtension.useCompilerVersion as experimental
#KT-61895 Fixed
2023-09-13 13:32:33 +00:00
Alexander Udalov f9712597e1 IR: support IrExternalOverridabilityCondition in IrOverrideChecker
The code is analogous to OverridingUtil and
ExternalOverridabilityCondition.
2023-09-13 15:04:53 +02:00
Alexander Udalov 86eb79e095 IR: extract IrOverrideChecker to separate file 2023-09-13 15:03:41 +02:00
Alexander Udalov 57c1df7875 IR: extract FakeOverrideBuilderStrategy to separate file 2023-09-13 15:01:52 +02:00
Alexander Udalov 0afee8685a IR: remove unused parameter of IrOverridingUtil.isOverridableBy
The value of checkReturnType is false at all call sites.
2023-09-13 15:01:52 +02:00
Alexander Udalov 94e1c0e9fe Tests: fix unmute check for fake override rebuilder tests
Assertion thrown in `check` was wrapped into something and ignored at
the call site, for some reason. So the "Looks like this test can be
unmuted..." error was never happening for this test.
2023-09-13 15:01:52 +02:00
Alexander Udalov 21d56d04d6 Tests: reclassify some failures in fake override rebuilder tests
See issues for more information: KT-61751, KT-61804, KT-61805, KT-61370.
2023-09-13 15:01:52 +02:00
Alexander Udalov b650f0ce8e IR: slightly refactor FakeOverrideRebuilder
Deduplicate some code, improve assertion messages, fix grammar in
comments.
2023-09-13 15:01:52 +02:00
Alexander Udalov fd68b9f49c CLI: add -Xuse-ir-fake-override-builder
To be able to test IR fake override builder (KT-61514) outside of
compiler tests.
2023-09-13 15:01:52 +02:00
Alexander Udalov d528faa0fe Minor, add toString to OverrideCompatibilityInfo 2023-09-13 15:01:52 +02:00
Vladimir Sukharev 024fd9e21a [FIR JS] Don't raise diagnostic PROPERTY_AS_OPERATOR for dynamic types.
^KT-60043 Fixed


Merge-request: KT-MR-12161
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-13 12:58:15 +00:00
Dmitrii Gridin 8d5787db12 [Analysis API FIR] KtFirValueParameterSymbol: fix expection
Effectively, it restores the fix from 2f8a64fff2

^KT-61422 Fixed
2023-09-13 12:56:57 +00:00
Ivan Kylchik 1843eeb16b [FIR] Drop visualizer module
This module was created to compare type resolve in K1 and K2. But
overall, these tests contain a lot of bugs, and it is quite hard
to use it.
2023-09-13 12:55:14 +00:00
Ivan Kylchik 2cd504b675 [FIR] Drop old TODO from LightTreeRawFirDeclarationBuilder
There is no description and no information that we suppose
to fix.
2023-09-13 12:55:13 +00:00
Kirill Rakhman ce65d3c7b8 [FIR] Set source on callee reference of implicit invoke receiver
This fixes an IllegalArgumentException when a diagnostic was reported on
it because no source was set.

#KT-61829 Fixed
2023-09-13 12:20:57 +00:00
Alexander Korepanov a224f9db34 [JS Tests] Regenerate tests 2023-09-13 12:19:15 +00:00
Alexander Korepanov be4f6beddb [JS Tests] Prepare JS tests for testing backend diagnostics
- Introducing a backend diagnostic handler.
 - Moving JS diagnostic tests from test-common to
   js.test to avoid circular module dependencies.

^KT-61886 Fixed
2023-09-13 12:19:15 +00:00
Konstantin Tskhovrebov b672ba8eaf KTIJ-25563: Add upToDateWhen condition to CInterop task outputs 2023-09-13 12:18:06 +00:00
Alexander Shabalin 503c1a2eb6 [K/N] Fix kt53261_noinline_NonNullNativePtr.kt with K2 2023-09-13 12:15:57 +00:00
Vladimir Dolzhenko d8c80b0270 Fix parameters matching for suspend functions
#KT-61894 Fixed
2023-09-13 11:59:02 +00:00
Ivan Kochurkin 8e0c2af176 [FIR] Fix overload resolution ambiguity between expect and non-expect in native
^KT-61778 Fixed
2023-09-13 11:44:22 +00:00
Ivan Kochurkin 57357d1995 [FIR] Simplify filterOutActualizedExpectCandidates 2023-09-13 11:44:22 +00:00
Mikhail Glukhikh ffd77850ef K2: add proper catch parameter annotation targeting
In this commit we begin counting a catch parameter as
both a local variable and a value parameter for the purpose
of annotation targeting.

#KT-61691 Fixed
2023-09-13 11:27:14 +00:00
Mikhail Glukhikh 91aa679214 K2: reproduce KT-61691 2023-09-13 11:27:14 +00:00
Nikolay Lunyak aacfc31c90 [FIR] Resolve the continuation type inside createSuspendView()
Normally such types are resolved during enhancement,
but creating the suspend view happens before
enhancement, so the type may have not been resolved.

^KT-59915 Fixed
2023-09-13 11:18:06 +00:00
Nikolay Lunyak 1467e743fd [FIR] Fix incorrect Java code in the test data
There's no point in eliminating K2 differences
between red code.

^KT-59915
2023-09-13 11:18:06 +00:00
Nikolay Lunyak 34cb9aa659 [FIR] Don't miss VIRTUAL_MEMBER_HIDDEN
^KT-59925 Fixed
2023-09-13 11:14:45 +00:00