Commit Graph

106661 Commits

Author SHA1 Message Date
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
Nikita Bobko 453d871b25 [LL] Run LLFirExpectActualMatchingTargetResolver only for KMP projects
Review: https://jetbrains.team/p/kt/reviews/13244

Motivation: Performance. When I fix KT-59887 in later commits, I will
make actual-to-expect resolve to work not only for actual declarations.
Considering that LLFirExpectActualMatcherLazyResolver worked even for
non-KMP projects that might be a potential performance regression

FirExpectActualMatcherProcessor in the compiler does the same thing (it
checks for MultiPlatformProjects before running the transformer)
2023-12-04 13:08:23 +00:00
Nikita Bobko ac3d8ad3ac [FIR] Expect classes can never have in implicit constructor. enums included
Motivation: If I don't fix it then I will get a false positive
ACTUAL_MISSING in
DiagnosticCompilerTestFE10TestdataTestGenerated.Tests.Multiplatform.Enum.testSimpleEnum
after I fix KT-59887

The commit also fixes false positive diagnostic in
annotationArgTypeAliasWithArray.fir.kt test

Review: https://jetbrains.team/p/kt/reviews/13244
2023-12-04 13:08:23 +00:00
Timofey Solonin 04dec2769b Step through the <compiler-generated> functions via a stop hook in konan_lldb.py
^KT-63598
2023-12-04 10:20:54 +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
Vladimir Sukharev c5248fc5f4 [K/N] Migrate some cinterop tests to new test infra 2023-12-04 08:43:28 +00:00
Timofey Solonin 22b2c1a587 Move konan_lldb.py with from the KMM plugin
This version of the konan_lldb.py has scripted breakpoints to avoid
stepping into <compiler-generated> routines.

^KT-63598
2023-12-04 07:33:21 +00:00
Simon Ogorodnik fd1641ef35 K2, Refactor: Move integrateConstraintToSystem to FirBuilderInferenceSession
integrateConstraintToSystem and substitute functions are only used in
the FirBuilderInferenceSession

Move is needed to specialize implementation for builder inference and
avoid an introduction of accidental usages from other inference sessions
2023-12-01 23:24:25 +00:00
Nikita Nazarov 1df318ff28 [FIR] Remove the redundant isFunctionType check
^KT-63865 fixed
2023-12-01 21:04:41 +00:00
Stanislav Ruban 3a77f39199 [tests] Regenerate test configurations 2023-12-01 19:20:28 +00:00
Stanislav Ruban b275aeb39d [tests] Add test data for KT-63705 2023-12-01 19:20:26 +00:00
Pavel Kirpichenkov fb9bf1782e [AA] Fall back to JVM stdlib dependencies in common test modules
Returns the old test behavior, until KT-63769 is implemented.
2023-12-01 18:12:23 +00:00
Pavel Kirpichenkov 0eb1a63a2f [AA] Add symbol tests for symbols from JS klibs
Use test compiler runner to compile JS libraries. Determine compiler
by the specified TARGET_PLATFORM. Add tests for dynamic type and
JS-specific .proto extensions.

Refactor the code for mock library compilation to make the switch
between platforms more straightforward.

KTIJ-27566
KT-63217
2023-12-01 18:12:23 +00:00
Pavel Kirpichenkov 0736cb3fac [LL] Fix KtDynamicType deserialization
KT-63217
2023-12-01 18:12:23 +00:00
Pavel Kirpichenkov 171a6f1a87 [LL] Add K/J library providers
Note on .kjsm library symbol providers.

It's not clear whether the provider is necessary for K2 IDE and whether
there will be libraries with .kjsm files that we are going to support.
Since there are no tests that can prove the correct work of the symbol
provider right now, it's better add them later if needed.
The existing tests cover only .knm files.

KTIJ-27566
2023-12-01 18:12:23 +00:00
Pavel Kirpichenkov c06e516205 [minor] optimize imports 2023-12-01 18:12:23 +00:00
Leonid Startsev a035533316 Rename JvmMetadataVersion.CURRENT to JvmMetadataVersion.LATEST_STABLE_SUPPORTED. 2023-12-01 17:43:12 +00:00
Leonid Startsev 048802e143 Rework KotlinModuleMetadata to align it with KotlinClassMetadata:
- Public constructor with KmModule and JvmMetadataVersion
- make write() member function
2023-12-01 17:43:12 +00:00
Leonid Startsev 6e9a62c317 Update ReadMe.md in kotlinx-metadata with instructions for new
functions:

How to use readStrict(), transform(), write() and
JvmMetadataVersion.CURRENT
2023-12-01 17:43:12 +00:00
Leonid Startsev 721af75f40 Provide a separate class for representing metadata version in kotlinx-metadata
Separate class allows encapsulating comparison, equality, and structure of version parts.
It also makes more sense from API standpoint than plain `IntArray`.
2023-12-01 17:43:11 +00:00
Leonid Startsev f101e5a336 Unify write() method and make it a member of KotlinClassMetadata
To make sure that the correct version and flags are preserved during metadata transformation,
they are now stored inside KotlinClassMetadata.
Such change also makes it possible to make write() a member function of KotlinClassMetadata, further simplifying API.
Also, it allows tracking whether readStrict or readLenient was used to read metadata and prohibit writing accordingly.

Also provide transform() method as a shortcut for readStrict+write.

Related to: #KT-59441
2023-12-01 17:43:11 +00:00
Leonid Startsev 36703ff9ae Implement strict and lenient modes for Kotlin metadata reading
In strict mode, an exception will be thrown when inconsistent metadata is encountered. In lenient mode, the reader will attempt to handle the inconsistent metadata by ignoring certain inconsistencies. This is a solution to a problem of reading metadata 'from the future' that is not allowed by default, but desired in certain cases. See updated ReadMe for details.

Also fix problem with Strict Semantics flag.

#KT-57922 Fixed
#KT-59441 Fixed
2023-12-01 17:43:11 +00:00
Alexander Kuznetsov e048d49bf0 [Analysis API] fe10: count value classes in isInline
#KT-63771 fixed


Merge-request: KT-MR-13220
Merged-by: Alexander Kuznetsov <Aleksander.Kuznetsov@jetbrains.com>
2023-12-01 17:33:30 +00:00
Yahor Berdnikau 57bc120daf [Gradle] Add AGP 8.3 into test versions
^KT-58064 Verification Pending
2023-12-01 17:19:20 +00:00
Yahor Berdnikau fc6ef76afe [Gradle] Bump max Gradle version in tests to 8.2.1
^KT-58064 In Progress
2023-12-01 17:19:20 +00:00
Yahor Berdnikau b666e66e19 [Gradle] Fix 3-rd party lombok plugin is non-compatible with Gradle 8.2
^KT-58064 In Progress
2023-12-01 17:19:20 +00:00
Yahor Berdnikau cb64234192 [Gradle] Fix test data using deprecated conventions
^KT-63369 Fixed
2023-12-01 17:19:20 +00:00
Yahor Berdnikau c847d427d8 [Gradle] Fix test data not including test framework dependency
^KT-63368 Fixed
2023-12-01 17:19:20 +00:00
Evgenii Mazhukin befa921fd9 [IC] Multi-module incremental compilation smoke tests for KMP
Part 2. Main multi-module KMP smoke tests for incremental compilation

^KT-56963 Fixed
^KT-63876 Fixed

Merge-request: KT-MR-13193
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-12-01 15:46:51 +00:00
Pavel Kirpichenkov c4fe7e4453 [Raw FIR] don't add an implicit Any super reference to kotlin/Any itself
KTIJ-27966
2023-12-01 14:56:01 +00:00
Marco Pennekamp d7190af72d [AA] FE10 compiler facility: Remove old backend support
- Old backend support is not needed in `KtFe10CompilerFacility` anymore,
  because it has been removed for the bytecode tool window, which was
  the only user. The old backend is slated to be removed entirely.

^KTIJ-24522
2023-12-01 13:22:55 +00:00
Vyacheslav Gerasimov cf3f63ad33 Build: Set Gradle daemon -Xmx to 2200m 2023-12-01 13:37:26 +01:00
Alexander Shabalin 340103098f [K/N][tests] Migrate entry point runtime tests to new testing infra ^KT-61259 2023-12-01 12:07:25 +00:00
Alexander Shabalin 0ab0607bbf [K/N][tests] Allow specifying program args in new test infra ^KT-61259 2023-12-01 12:07:25 +00:00
Sergej Jaskiewicz f46a14522f [FIR generator] Remove unused notNull property 2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz f3016e1dcb [FIR generator] Avoid FIR-specific code in AbstractBuilderPrinter 2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz cae4a9930b [FIR generator] Extract the Builder class to a common module
We want to use it to generate builder classes for other
trees, just like we already do with elements (see `AbstractElement` and
`AbsractImplementation`).
2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz 91b5a71f1a [FIR generator] Extract the Implementation class to a common module
We want to use it to generate implementation classes for other
trees, just like we already do with elements (see `AbstractElement`).
2023-12-01 12:06:06 +00:00
Anastasia.Nekrasova 85cff98a38 [K2] Disappeared UNSUPPORTED
Prohibit Array<Nothing>

^KT-59881
2023-12-01 12:05:12 +00:00
Ivan Kylchik 73a0b4eaf2 [JVM_IR] Don't use irPluginContext at all when compiling code fragment
This is an extended version of the fix in
57d912a5d4. We don't want to use any
plugins in code fragment compilation, but we still get them through
`project` because they are registered in IDEA. So we just fully
exclude `irPluginContext`.

#KT-63695 Fixed
2023-12-01 11:22:21 +00:00
Mikhail Glukhikh 814bf1b80d K2: add TODO issues for ResolutionStages.kt (KT-63958, KT-63959) 2023-12-01 10:54:29 +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
Mikhail Glukhikh 526bc1744a K2: implement BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION
#KT-59390 Fixed
2023-12-01 10:54:29 +00:00
Simon Ogorodnik 299d279915 K2: Don't report BUILDER_INFERENCE_STUB_RECEIVER for members of Any
This commit actually does two things:
- Adds Any scope to stub type
- Makes CheckDispatchReceiver treat stub types
as non-null for the unsafe call check to make such candidates viable

Related to KT-59369
2023-12-01 10:54:29 +00:00
Mikhail Glukhikh 0ed6256bcc K2: implement BUILDER_INFERENCE_STUB_RECEIVER
#KT-59369 Fixed
2023-12-01 10:54:29 +00:00
Nikolay Krasko 5e5e5b8b9f Revert "[FIR] Remove the redundant isFunctionType check"
This reverts commit 1f97c268e1.
2023-12-01 11:27:39 +01:00
Ivan Kylchik 2b6845c032 [JVM_IR] Optimize properties delegated to const val
We can omit `get` call to delegated property and inline
constant value directly. If we are not going to
do that, we can get a runtime exception because
all usages of const property will be inlined and the property
itself will be dropped.

#KT-63567 Fixed
#KT-63580 Fixed
2023-11-30 14:27:36 +00:00
Nikita Nazarov 1f97c268e1 [FIR] Remove the redundant isFunctionType check
^KT-63865 fixed
2023-11-30 14:17:01 +00:00
Artem Kobzar 98186ec283 [K/JS] Add ES6 typescript tests + fix a few bugs for it 2023-11-30 13:37:06 +00:00