Commit Graph

106174 Commits

Author SHA1 Message Date
Dmitriy Dolovov 60c88b010d [Native] Add missing dependencies to platform lib DEF files
There are a lot of cases when a DEF file for a K/N platform library
has incomplete set of dependencies in 'depends=' property in
the manifest file. This leads to use of "KLIB resolver" - the
component inside the compiler that is responsible for finding the
missing libraries and implicitly (i.e. invisibly for the end user)
adding them to the set of dependencies of the compiler invocation.

The goal of this commit is to fix 'depends=' in manifest files so that
they should reflect the REAL set of dependencies, and as a result don't
trigger use of "KLIB resolver". This way we could be more prepared to
removed in the "KLIB resolver" in the future.

^KT-61098
2023-11-15 19:38:25 +00:00
Dmitriy Dolovov c3da16a1d8 [Native] Use library paths instead of library names in K/N build infra
Use library paths instead of library names in K/N build infra when
passing a library through `-library` compiler argument.

^KT-61098
2023-11-15 19:38:25 +00:00
Dmitriy Dolovov e7b8f3ecde [Native] Deprecate KLIB repositories in Kotlin/Native compiler
1. Log warnings on usage of KLIB repositories.
2. Don't block using repositories for now.

^KT-61098
2023-11-15 19:38:24 +00:00
Vladimir Sukharev c38a0e10af [K/N] Implement a concept of conditional ignore of K/N blackbox tests
^KT-59288 Fixed
2023-11-15 19:03:07 +00:00
Svyatoslav Scherbina 6ce33e80a5 Native: fix ConcurrentModificationException in test infra
Synchronously copy system properties before iterating over them, because
other thread sometimes tries to modify them in the meantime, which leads
to ConcurrentModificationException otherwise.
2023-11-15 18:52:12 +00:00
Pavel Kirpichenkov cf849835ba [K2, IDE] Don't filter declarations from built-ins in K2 decompiler
Intercept decompiler calls to process files that belong to classpath
builtins from K2 IDE differently. Their content won't be filtered w.r.t.
JVM logic during decompilation.

Split stub versions for .kotlin_builtins with K1 and K2 IDE.

K2 currently uses a single shared symbol provider for builtins of all
platforms. KotlinBuiltInDecompiler filters out duplicated declarations
contained in JVM classfiles as required for K1. For K2 this logic
doesn't fit: non-JVM modules (common, in particular) rely on
.kotlin_builtins, because kotlin-stdlib-common doesn't contain
.kotlin_builtins or .knm files for some of the built-in declarations
(e.g., kotlin.Unit). IDE has to restore the missing declarations using
built-ins from classloader. Filtering declarations from there using K1
logic breaks resolution of these declarations inside common modules in
IDE. The change shouldn't affect JVM modules as are able to resolve
all builtin symbols from the standard library before falling back to
built-ins.

KT-61757
2023-11-15 18:04:58 +00:00
Ivan Kochurkin c38887ae68 [FIR2IR] Add fields to Fir2IrLazyClass.declarations for Java classes
^KT-61362 Fixed
2023-11-15 17:56:03 +00:00
Ivan Kochurkin 7ce0284e81 [FIR] Introduce isRealOwnerOf utility function 2023-11-15 17:56:03 +00:00
Dmitriy Novozhilov bfc0126105 Advance bootstrap to 2.0.0-dev-7674 2023-11-15 17:05:33 +00:00
Alexander.Likhachev 11e0edc124 [Gradle, K/N] Remove the enableEndorsedLibs flag
This is the last stage of the flag's deprecation cycle.
^KT-56455 Fixed
2023-11-15 17:01:40 +00:00
Roman Efremov 722d901d69 [Tests] Decline bug KT-62886 and change comment accordingly
^KT-62886
2023-11-15 16:47:04 +00:00
Pavel Punegov 9f9b4d1981 [K/N][publish] Publish kotlin-native-compiler-embeddable.jar
Add an ability to publish kotlin-native-compiler-embeddable.jar and
sources to maven. Adds necessary for that sourcesJar and javadocJar
tasks. Note that Native distribution uses this jar without a version postfix.
Also cleaned up the obsolete backend.native publication and renamed 
project to match its name.


Merge-request: KT-MR-12974
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-11-15 14:54:04 +00:00
Hung Nguyen 5562c95155 [IC] Refactor IC maps to reuse code and ensure consistency - Part 2
In commit 4e89dcf, we have prepared the API for IC maps in top
interfaces and provide the implementation in abstract classes.

In this commit, we refactor IC maps so that they directly inherit/reuse
the implementation from the superclasses without having to reimplement
the APIs for a map.

Test: Existing tests (refactoring change)
^KT-63456: In progress

Authored-by: Hung Nguyen <hungnv@google.com>

Merge-request: KOTLIN-MR-801
Merged-by: Evgenii Mazhukin <evgenii.mazhukin@jetbrains.com>
2023-11-15 12:22:40 +00:00
Egor Kulikov c0a05e435c [FIR] Correctly process invalid implicit invoke
^KT-60170 fixed


Merge-request: KT-MR-12926
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-15 11:43:48 +00:00
Dmitrii Gridin 061b1238fc [FIR] PsiRawFirBuilder: add explicit conversion from KtTypeReference to FirTypeRef
^KT-63042
2023-11-15 11:41:05 +00:00
Dmitrii Gridin 41998ae8ae [FIR] PsiRawFirBuilder: cleanup code
^KT-63042
2023-11-15 11:41:05 +00:00
Yahor Berdnikau 580c2a490d [Gradle] Apply attribute disambiguation rules conditionally
Not all Kotlin disambiguation rules are required for non-MPP projects.
On the other hand, they lead to increased memory consumption in Gradle
daemon especially notable on big multimodule projects.

To address this memory increase, we start to apply these rules
conditionally based on the applied plugin.

^KT-63005 Fixed
2023-11-15 11:18:41 +00:00
Ilya Gorbunov 26183237ab Make :core:builtins:serialize more remote build cache friendly
On CI when populating build cache, the build runs
with --info logging level causing an additional jvm argument
provided to the task.
This argument is usually not provided in local builds.
The argument only affects task printout and not its outputs.
2023-11-15 10:32:09 +00:00
Yahor Berdnikau 6eca282e9a [Gradle] Bump minimal supported AGP version to 7.1.3
^KT-62939 Fixed
2023-11-15 10:31:03 +00:00
Artem Kobzar f4d088a886 [K/JS] Don't add nested classes generated by plugins into ExportModel for interfaces ^KT-63184 Fixed 2023-11-15 10:21:22 +00:00
Artem Kobzar 82bca7a04f [K/JS] Rework member-exportability check in a right way ^KT-61957 Fixed 2023-11-15 10:18:05 +00:00
Mikhail Glukhikh 9279aab97f K2: simplify getOwnSinceKotlin version
Related to KT-59824, KT-59825
2023-11-15 09:36:06 +00:00
Mikhail Glukhikh a2dc4f155f K2: drop obsolete TODO about multiple WasExperimental
In certain situations like constructor calls, it's possible
to have different WasExperimental/SinceKotlin pairs associated
with one use-site, e.g. a constructor call is associated both
with a constructor declaration and a class declaration.
However, looks like it make no sense to handle this situation
in FirSinceKotlinHelpers, because FirOptInUsageBaseChecker already
handles them.

#KT-59825 Fixed
2023-11-15 09:36:06 +00:00
Mikhail Glukhikh 4d49bdb8ca K2: add a black box test to confirm KT-53718 now works properly (JVM IR only)
Related to: KT-57584, KT-58110
2023-11-15 09:33:05 +00:00
Mikhail Glukhikh 4b1368409d K2: add a black box test to confirm KT-55705 now works properly 2023-11-15 09:33:05 +00:00
Mikhail Glukhikh f2ef41dbbd K2: add a black box test for KT-58874 to confirm work also in runtime 2023-11-15 09:33:03 +00:00
Kirill Rakhman ed53d45307 [FIR] Add TODO for deprecation and fix of error-level nullable arguments of warning-level annotated Java type
#KT-56989
#KT-63208
2023-11-15 08:43:55 +00:00
Kirill Rakhman 2005446296 [FIR] Preserve enhanced mutability when nullability was enhanced for warning
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman a63ec9efdc [FIR] Implement warnings for java nullability upper bound violation 2023-11-15 08:43:55 +00:00
Kirill Rakhman 2df1e9dde6 [FIR] Implement warnings for java nullability type mismatch on override
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman a6fdeeb7df [FIR] Implement warnings for java nullability type mismatch
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman 1ecbc094ec [FIR] Save warning-level enhanced types to an attribute
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman ef96912573 [FIR] Apply withNullability to attributes with cone types
#KT-56989
2023-11-15 08:43:55 +00:00
Kirill Rakhman 7910e8ad24 [FIR] Implement a special type of attribute that contains a cone type that can be transformed 2023-11-15 08:43:55 +00:00
Kirill Rakhman 8ebd2fd1b7 [FIR] Implement add in AbbreviatedTypeAttribute 2023-11-15 08:43:55 +00:00
Kirill Rakhman ad4d021cbf [FIR] Reformat AbbreviatedTypeAttribute 2023-11-15 08:43:55 +00:00
Kirill Rakhman 51a3fe367c [Tests] Fix deadlock caused by eager initialization in JspecifyMarksCleanupPreprocessor 2023-11-15 08:43:55 +00:00
Yahor Berdnikau 59f544cb7c [Gradle, Kapt] Don't immediately check if kaptClasspath dependencies are empty
Now sub-plugins are applied to compilation before users `afterEvaluate`
closure execution, which could lead to unexpected by the user state.
For example, when a user adds dependencies to 'kaptClasspath' in
'afterEvaluate'.

This fix removes check in Kapt plugin if dependencies are present on
'kaptClasspath' and moves it into KaptTask.onlyIf spec. So the task
will still have SKIPPED state if there are no AP provided.

^KT-63366 Fixed
2023-11-15 08:42:28 +00:00
Nikolay Lunyak 80cccce8d0 [FIR] Use the proper processAll* functions for CONFLICTING_OVERLOADS
The `*leaf*` functions were
introduced due to my false
assumption. The normal processing
functions only collect leafs
already. `*leaf*`s are bad, because
they don't cache anything.

The change in
AbstractFirOverrideScope reflects
KT-63290, and is needed to avoid
duplicate `CONFLICTING_OVERLOADS`
and `VIRTUAL_MEMBER_HIDDEN`.
2023-11-15 07:56:32 +00:00
Nikolay Lunyak 008703c1dc [FIR] Fix parameters constraints in FirDeclarationCollector<D>.collect 2023-11-15 07:56:32 +00:00
Nikolay Lunyak 44d6d10233 [FIR] Only check conflicting callables that may clash with declared ones
This change improves performance, as
checking callables via scopes in
`4e587157` turns out to be quite
slow, and it also prevents some redundant
diagnostics.
2023-11-15 07:56:32 +00:00
Nikolay Lunyak 9e57aba448 [FIR] Add a test for KT-26045
^KT-26045 Fixed

Merge-request: KT-MR-13023
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-11-15 07:52:11 +00:00
Anton Lakotka 951830fcef [Gradle] Use source set name for Cinterop configurations
This will ensure that source set have isolated Cinterop configurations.
With proper extendsFrom relations.
And prevent from dependencies i.e. from linuxMain to nativeMain if they
both have the same set of underlying targets.

^KT-63338 Verification Pending
2023-11-14 22:26:27 +00:00
Anton Lakotka 645d263474 [Gradle] Test that source set have own Cinterop configurations
It is necessary to prevent leaking dependencies in source set hierarchy
i.e. if linuxMain depends on some project with cinterops and
nativeMain also have the same set of underlying targets it is important
that nativeMain should not see any dependencies from linuxMain!

And vice versa, if linuxMain should see own + parents dependencies.

^KT-63338
2023-11-14 22:26:26 +00:00
Roman Golyshev d865a44c94 KT-61890 [AA] Add test for ContextCollector at loop variable position
This turns out to be important for conflict resolution in
postfix completion in K2 IDE (see `KotlinDeclarationNameValidator`)
2023-11-14 22:15:05 +00:00
Roman Golyshev 47a00bf97e KT-61890 [AA] Use ContextCollector in KtFirScopeProvider
^KT-61890 Fixed
2023-11-14 22:15:04 +00:00
Roman Golyshev 4f136cde31 KT-61890 [AA] Add testdata to ensure KDoc completion support in IDE
Completion in the IDE relies on correct scopes for KDoc positions.
So we add testData for `KtScopeProvider` and `ContextCollector`
to ensure that there are no regressions
2023-11-14 22:15:04 +00:00
Vladimir Sukharev 1b1df9f0db [K/N] Create test model for building/executing C-Interop tests
^KT-63287 Fixed
2023-11-14 19:35:52 +00:00
Svyatoslav Scherbina 8d20d5b16c Native: support objcExportReportNameCollisions=true binary option
This binary option makes the compiler emit a warning whenever it mangles
a name emitted by ObjCExport.

^KT-63153 Fixed
2023-11-14 19:24:43 +00:00
Yahor Berdnikau 656b61b945 [Gradle] Restore writing errors into <project_dir>/.gradle directory
This is required for compatibility with older IDEA releases where it
expects errors only in <project_dir>/.gradle/kotlin/errors directory.

It is possible to disable such behaviour via
"kotlin.project.persistent.dir.gradle.disableWrite" property.

^KT-58223 Fixed
2023-11-14 18:38:12 +00:00