Commit Graph

107117 Commits

Author SHA1 Message Date
Mikhail Glukhikh 2680c8effd K2: allow/disallow coercion-to-unit for callable references more precisely
Before this commit, K2 always applied coercion-to-unit for
callable references if expected type was Unit, and actual non-Unit.
However, this may not work in case when actual return type is
a type parameter and it must be inferred into Unit.
In this commit we started to disallow coercion-to-unit
for references with synthetic outer call (~ top-level in K1)
AND a type parameter as a return type (both should be true to disallow).
This provides better K1 consistency,
while still keeping some broken K1 cases working in K2.

See also added comment in CallableReferenceResolution.kt.

#KT-62565 Fixed
2023-12-12 13:52:29 +00:00
Mikhail Glukhikh 25c0bd278e CallableReferencesCandidateFactory.kt: minor cleanup for better reading 2023-12-12 13:52:29 +00:00
Mikhail Glukhikh 37789cf7f5 K2: introduce unwrapFlexibleAndDefinitelyNotNull 2023-12-12 13:52:29 +00:00
Bogdan Mukvich b76452e15f Use deployVersion if present for artifacts-tests
^KTI-1476
2023-12-12 12:28:44 +00:00
Ilya Goncharov 2932f49f65 [JS] Use npx instead of yarn in kotlin-test-js-runner 2023-12-12 12:01:04 +00:00
Marco Pennekamp fa3da87401 [LL] Fix rest library symbol providers computing the wrong package sets
- See KT-63718 for a detailed description of the issue. This fix is a
  workaround (see KT-64236).
- It's worth mentioning that it's too expensive to compute package sets
  for "all libraries except one". Package sets are just an optimization.

^KT-63718 fixed
2023-12-12 12:00:41 +00:00
Troels Bjerre Lund f2cb0f1407 [K/N] Fix gep for local array header
This corrects the type given to GEP2 when initializing a stacklocal
array. This issue only cause problems when bitcode gets written before
any of the optimization passes, in which case it will fail on LLVM
validation when reading the bitcode back in on a subsequent pass.
2023-12-12 11:06:26 +00:00
Dmitrii Gridin fab51ff83c [Analysis API FIR] KtSymbolByFirBuilder: simplify call-site substitution override unwrap logic
Not we have separate SubstitutionOverride for declaration and call site,
so this logic can be simplified a lot
2023-12-12 10:46:24 +00:00
Bogdan Mukvich b7d56dea44 Point ArtifactsTests to custom maven repo dir to avoid stale artifacts
^KTI-1345
2023-12-12 10:28:48 +00:00
Ilya Chernikov d9f581c8b5 K2 Scripting: temporary mute test with LL divergence
#KT-64074
2023-12-12 09:58:19 +00:00
Ilya Chernikov db804b7f93 K2 Scripting: fix CFG processing related testdata in LL 2023-12-12 09:58:19 +00:00
Ilya Chernikov 90a7f7beac K2 Scripting: fix CFG processing related testdata in compiler 2023-12-12 09:58:19 +00:00
Ilya Chernikov ff4f30ddc1 FIR: replace receiver in anon initializer with containing decl
This way the abstraction represents the intended use better and
doesn't stay on the way of using FirAnonymousInitializer in scripts
2023-12-12 09:58:19 +00:00
Ilya Chernikov 12da3d2b9f K2 Scripting: add proper CFG processing for scripts
#KT-59683 fixed
#KT-63328 fixed
2023-12-12 09:58:19 +00:00
Ilya Chernikov a69eaa0ea3 K2 Scripting: fix testdata changed after script statements wrapping 2023-12-12 09:58:19 +00:00
Ilya Chernikov eeb723eb01 K2 Scripting: wrap script statements into blocks
(reuse anonymous initializers as block wrappers) so the top-level script
elements are all declarations now. Rename the property accordingly (
together with the previous commit).
It makes script more similar to the class and thus simplify e.g.
control flow analysis and resolve code.
2023-12-12 09:58:19 +00:00
Ilya Chernikov c9aee5bf09 minor: rename FirScript.statements do declarations...
to simplify the following commit that actually convert the types
and wrap statements into blocks.
2023-12-12 09:58:19 +00:00
Ilya Chernikov a29a7e6307 FIR: refactor destructuring declaration building helpers
rename them since they generate variables with initialization, rather
than arbitrary statements, and this fact is used in scripts
and also add initialization helper, used for scripting support too.
2023-12-12 09:58:19 +00:00
Ilya Chernikov b0f44e8f69 K2 Scripting: mark parameters and DD containers with dedicated origins
needed for properly processing script CFG
2023-12-12 09:58:19 +00:00
Ilya Chernikov 8c30f3b2bc K2 Scripting: add FirScript to declaration checkers 2023-12-12 09:58:18 +00:00
Ilya Chernikov b7057eb22f K2 Scripting: make FirScript a CFG owner 2023-12-12 09:58:18 +00:00
Alexander Korepanov 41ebe498f2 [JS IR] Explicitly cast to a string all types except specific ones
^KT-62763 Fixed
2023-12-12 09:53:19 +00:00
Alexander Korepanov 70d99e1964 [JS IR] Add tests for string template with valueOf
^KT-62763
2023-12-12 09:53:19 +00:00
Artem Olkov 6c4a6e2a02 turn on explicitApi for SIR modules
Merge-request: KT-MR-13448
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2023-12-12 09:02:55 +00:00
Leonid Startsev a03fd2e29a Make visibilities of writeSelf and deserialization constructor in FIR
same as they were in K1 (see KSerializerDescriptorResolver): internal for
final classes and public for non-final.

Unfortunately, there are no Klib API dumps tests in the compiler, so I tested manually.

#KT-64124 Fixed
2023-12-12 09:02:14 +00:00
Leonid Startsev 9933423a0b Add KmVersionRequirementKind.UNKNOWN
for cases when the version requirement cannot be read correctly (missing from the table).

It usually happens when we read the inner class' old metadata, which stored everything
in the outer class' table.

Fixes #KT-60870


Merge-request: KT-MR-13337
Merged-by: Leonid Startsev <leonid.startsev@jetbrains.com>
2023-12-12 08:47:41 +00:00
Kirill Rakhman 8a863e00ba [FIR] Add proper constraint if Unit upper bound leads to Unit lambda return type
#KT-63524 Fixed
2023-12-12 08:36:49 +00:00
Sergey Bogolepov ce4eecebf4 KT-63264: Introduce a new ExportedBridge annotation
Swift Export Frontend generates a Kotlin file/library that contains a
set of simple bridging functions that connect Swift wrappers to their
Kotlin counterparts.
There are certain requirements for these wrappers:
1. They should not be DCEd when compiling a binary library.
In other words, these functions are roots.
2. They should provide a stable simple binary name.
3. Their signatures should be much simpler and restricted comparing to
other Kotlin functions.

Altogether, these requirements should be covered by introducing the new
ExportedBridge annotation.

Note: Frontend checks of ExportedBridge functions are not implemented
yet.
2023-12-12 07:03:25 +00:00
Sergey Bogolepov 8be547b834 KT-63264: Add a compiler flag that disables C interface generation
We can reuse existing static/dynamic library output kinds for
the Swift Export. The only change we have to make is to make generation
of C interface opt-out by moving it under the binary option.
As a side effect, it allows evolving C Export in the future by
introducing new option variants.
2023-12-12 07:03:25 +00:00
Yan Zhulanow c499095382 [Pill] Fix importing after ideaHomePathForTests() signature change
Before, the 'File' was returned. Now, it's 'Provider<Directory>'.
2023-12-11 19:31:57 +00:00
Dmitrii Krasnov 0b31d70ce9 [Gradle IT] Added Integration Test for checking native ic args
#KT-63742
2023-12-11 18:09:29 +00:00
Alexander Udalov d2a0e1dada Update to jline 3.24.1
It fixes the exception when REPL is run on an ARM Mac, as well as not
quitting after interrupting on the first line.

After this change, REPL runs fine on JDK 8, 17, 21. Note that on JDK 11,
it prints a warning during startup (but then also runs fine):

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jline.terminal.impl.exec.ExecTerminalProvider$ReflectionRedirectPipeCreator to constructor java.lang.ProcessBuilder$RedirectPipeImpl()
WARNING: Please consider reporting this to the maintainers of org.jline.terminal.impl.exec.ExecTerminalProvider$ReflectionRedirectPipeCreator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

 #KT-18355 Fixed
 #KT-64013 Fixed
2023-12-11 11:34:05 +00:00
Yahor Berdnikau 400137e80d [Gradle] Fix usaged of deprecated buildDir in Kapt3KotlinGradleSubplugin.kt
^KT-62527 In Progress
2023-12-11 11:32:02 +00:00
Yahor Berdnikau 366d097c92 [Gradle] Suppress internal deprecation in Kapt3KotlinGradleSubplugin.kt
^KT-56904 In Progress
2023-12-11 11:32:02 +00:00
Yahor Berdnikau 78edc45ded [Gradle] Remove unused method in Kapt3KotlinGradleSubplugin.kt
^KT-56904 In Progress
2023-12-11 11:32:01 +00:00
Yahor Berdnikau 8028e2a42d [Gradle] Suppress package directory mismatch in Kapt3KotlinGradleSubplugin.kt
^KT-56904 In Progress
2023-12-11 11:32:01 +00:00
Yahor Berdnikau 56c7309fad [Gradle] Suppress Android deprecations in Kapt3KotlinGradleSubplugin.kt
^KT-56904 In Progress
2023-12-11 11:32:01 +00:00
Ilya Goncharov 7b409d0505 [Gradle, JS] Migrate onto usage of layout.buildDir provider in NPM infrastructure.
Api which previously used buildDirectory now migrated to Provider as well, previous properties are deprecated.

^KT-61294 fixed


Co-authored-by: Alexander Likhachev <Alexander.Likhachev@jetbrains.com>
2023-12-11 10:56:28 +00:00
Wojciech Litewka ef53bd9548 [IR generator] Add missing isChild = false
Those fields were effectively marked as child elements after refactor.
However, because of the current (to possibly be changed) configuration,
the generator did not write accept methods for them.
2023-12-11 10:48:43 +00:00
Yahor Berdnikau f016e8efda [Gradle] Fix deprecations in configureReporing.kt
^KT-62527 In Progress
2023-12-09 16:00:28 +00:00
Ivan Kylchik c902e5f565 [JVM_IR] Allow to use irPluginContext when compiling for android
This problem is extensively described in
`cadbc87dfd1ce3e63481ab90874ca8858878c55f` commit message.
TLDR: compiler is also called from Android LiveEdit plugin where
we want to be able to use compiler plugins. For that reason, we have two
different flags in the compiler. One is only for "evaluate expression"
(`doNotLoadDependencyModuleHeaders`) and the other for both LiveEdit
plugin and "evaluate expression" (`shouldStubAndNotLinkUnboundSymbols)`.
We want to forbid using compiler extensions for "evaluate expression"
and allow for LiveEdit plugin.

#KT-63695
2023-12-08 18:34:36 +00:00
Aleksei.Glushko 569d37028f [K/N] Mark barriers implementation
Merge-request: KT-MR-13409
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-12-08 17:52:14 +00:00
Alexey Belkov f53f92cdd6 K2: Add KtDiagnosticRenderers.CLASS_ID to render ClassId FQNs with dots
KT-MR-13391
2023-12-08 17:26:59 +00:00
Alexey Belkov 1766d0e86a K2: Use ClassId instead of FqName in FIR diagnostics
IJ-CR-118828
KT-MR-13391
2023-12-08 17:26:59 +00:00
Dmitrii Gridin 061734d84b [FIR] do not transform type annotations from function parameter during implicit type phase
We shouldn't treat them as local and transform during the implicit type
phase as they are visible from outside the function

^KT-64164 Fixed
2023-12-08 17:17:36 +00:00
Dmitrii Gridin 3d43dff8b5 [LL/FIR] add tests on function parameter as implicit return type
^KT-64164
2023-12-08 17:17:36 +00:00
Ivan Kochurkin 145958e284 [K2] Disable constants evaluation with native metadata compilation
^KT-63835 Fixed
2023-12-08 16:38:04 +00:00
Ivan Kochurkin ec4edbfcf2 [K2] Enable copyEnsuringK2 for all K2Tests by default 2023-12-08 16:38:04 +00:00
Vladimir Sukharev dd0cc7089a Add unittests for FqNameUnsafe.startsWith(FqNameUnsafe) 2023-12-08 16:27:18 +00:00
Vladimir Sukharev 1387e077e9 Improve unittests for FqNameUnsafe.startsWith(Name) 2023-12-08 16:27:18 +00:00