Commit Graph

98241 Commits

Author SHA1 Message Date
Sebastian Sellmair ace1bc76a1 [Gradle] IdeProjectToProjectCInteropDependencyResolver: Ensure lenient resolution
^KT-56285 Verification Pending
2023-01-30 12:42:05 +00:00
Marco Pennekamp 2f876a2094 [LL FIR] Pass correct session invalidators to LLFirSessionFactory 2023-01-30 12:39:42 +00:00
Yan Zhulanow fdf515baff [LL API] Add more logging to collectDesignationPathWithContainingClass() 2023-01-30 11:11:27 +00:00
Yan Zhulanow 699f96284a [FE] Add missing 'lazyResolveToPhase()' before recursive bound check
^KTIJ-24087 Fixed
2023-01-30 11:09:42 +00:00
Svyatoslav Scherbina 322a8a443b Native: add included forward declarations into cinterop klib manifest
This allows the compiler to limit imports from "magic" packages like
cnames.structs to forward declarations actually present in dependent
cinterop klibs.

The manifest already had `exportForwardDeclarations` field, but
- it didn't include Objective-C forward declarations (@class, @protocol)
- it has a slightly different meaning (the export list enables importing
  the listed declarations through the interop package of the library,
  while the include list shouldn't do that), so we better avoid mixing
  them.
2023-01-30 11:00:33 +00:00
Svyatoslav Scherbina 86a29a7b07 Native: correct ObjCExport test for forward declarations
The test relies on the fact that any name can be imported from a "magic"
package like `objcnames.classes`.
This was the case for K1, but likely won't be for K2: the compiler
should allow importing only those names that are actually
forward-declared in a cinterop library.

This commit changes the test that way. In particular, moves it to a
different task that has a cinterop dependency.
2023-01-30 11:00:32 +00:00
Svyatoslav Scherbina 445d44b79a K2/Native: simplify forward declarations test to make it work with K2 2023-01-30 11:00:32 +00:00
Svyatoslav Scherbina f3ed006ed9 Native: add a test for forward declarations with two cinterop libs 2023-01-30 11:00:31 +00:00
Svyatoslav Scherbina d4f5d5297f K2/Native: simplify forward declarations test to make it work with K2 2023-01-30 11:00:31 +00:00
Svyatoslav Scherbina 46a85d9729 Native: add a test for cinterop forward declarations 2023-01-30 11:00:30 +00:00
Leonid Startsev 26330133ab Support intrinsifying of serializer() function when it is seen inside multifile class part
It's needed to be able to correctly compile kotlinx-serialization-core itself,
as compiler sees real function, not one from a facade.

#KT-56244 Fixed
2023-01-30 10:49:46 +00:00
Dmitriy Novozhilov 993695a7d0 [Commonizer] Mute tests due to KT-56207 2023-01-30 09:30:00 +00:00
Alexander Udalov 25c600c556 Fix incorrect check for major version in core:metadata
It affected the changed test in the following way: "strict metadata
version semantics" is a flag which is written to the .kotlin_module file
between the version and the protobuf data, see `ModuleMapping:73`. But
flags are written only for Kotlin 1.4+, i.e. if `isKotlin1Dot4OrLater`
returns true. So in the test, the flag was not written, thus we did not
detect that the module actually has incompatible metadata, and thus
incorrectly did not report an error.

It also has an effect that version requirements for nested classes will
now be written correctly to protobuf with metadata version 2.0+.
2023-01-30 09:30:00 +00:00
Dmitriy Novozhilov 71f8cfa193 [Maven] Fix running scripts from maven 2023-01-30 09:29:59 +00:00
Artem Kobzar d58d9a5c77 fix runing legacy js maven tests in integration tests. 2023-01-30 09:29:59 +00:00
Yahor Berdnikau 861563fdb0 [KGP] Fix test fails with LV 1.3
Kotlin compiler now throws error with LV 1.3 meaning KGP could not be
used with Gradle 6.x.
2023-01-30 09:29:59 +00:00
Dmitriy Novozhilov 2988d671f7 [Test] Update CompileKotlinAgainstCustomBinariesTest
We have several tests which tests how compiler with LV = LATEST_STABLE
  can consume binaries compiled with LV = LATEST_STABLE + 1 with
  different CLI flags. For LV = 2.0 we have special rules for those flags,
  so testdata was changed

After switching LV in repository to 2.0 this testdata should be rolled back
2023-01-30 09:29:58 +00:00
Dmitriy Novozhilov e942e87feb [JS CLI] Fix == on strings with equals call 2023-01-30 09:29:58 +00:00
Dmitriy Novozhilov 2fddb15539 [Test] Move some builder inference tests from codegen to diagnostics
^KT-56169
2023-01-30 09:29:58 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Dmitriy Novozhilov 66544a4e00 Switch kotlin version to 1.9
with appropriate fixes in testdata, tests and other
places.
2023-01-30 09:29:55 +00:00
Nikolay Lunyak e2403c801f [FIR] KT-55747: Report error for operator fun mod
^KT-55747 Fixed

Merge-request: KT-MR-8522
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-01-30 08:48:33 +00:00
Ilya Chernikov 37a7044e74 FIR LT: fix line offsets calculations for text files with crlf
#KT-55886 fixed
2023-01-30 08:47:40 +00:00
Kirill Rakhman 836c4fcefd FIR: Report missing cases of TYPE_PARAMETER_IS_NOT_AN_EXPRESSION
^KT-55699 Fixed
2023-01-30 08:24:20 +00:00
Ilya Chernikov e4529f38ac Revert unmuting unfixed test - companionConstantChanged
incorrectly unmuted i the commit "FIR: fix use-site file in supertypes
resolution"
related to #KT-56242
2023-01-30 08:07:24 +00:00
Yahor Berdnikau 45213e1468 Switch @GradleOption params to enum classes.
This should improve developers UX when using this annotation.
2023-01-29 20:59:28 +00:00
Pavel Mikhailovskii f308f33f9f KT-56154 Fix PropertyReferenceLowering for Java synthetic properties
Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-01-28 10:38:09 +00:00
Vladimir Sukharev debbfa8397 [K2/N] Add klib contents serialization tests from old testinfra
Merge-request: KT-MR-8509
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-01-27 23:30:45 +00:00
Mikhail Glukhikh 8bc2aaa295 FE: Add test for KT-56227 (to confirm it's fixed) 2023-01-27 21:38:08 +00:00
Alexander Udalov ba3f21e125 Minor, improve testNoDelegatedPropertiesInKClassAndKProperties
Also consider delegated properties which are optimized since Kotlin
1.7.20 because of KT-23397, where backend doesn't generate a field
`foo$delegate`, but generates a method `getFoo$delegate` instead.
2023-01-27 20:23:23 +00:00
Alexander Udalov 99b38ccb74 Reflection: fix exceptions on concurrent access to some properties
Using `ReflectionProperties.lazy` is incorrect because it allows several
threads to observe different resulting values if they're computing it
simultaneously (unlike `lazy(PUBLICATION)`, which always returns the
value that "won the race").

In the case of property delegates, for example, if we're invoking
`isAccessible = true` and then `getDelegate()` concurrently, it might
happen that when some thread invokes `getDelegate()`, it gets the
underlying Field object which was written by another thread and which
has not yet been made accessible, leading to
IllegalPropertyDelegateAccessException.

 #KT-27585 Fixed
2023-01-27 20:23:23 +00:00
Alexander Udalov e8f95a3376 Add @JvmDefaultWithCompatibility to StorageComponentContainerContributor
This doesn't change behavior, but will hopefully fix a binary
compatibility issue with some IDEA plugins.
2023-01-27 20:02:24 +00:00
Anna Kozlova e54627b309 [FIR] add missed diagnostics for incomplete code
^KT-55053
2023-01-27 18:36:36 +00:00
Ivan Kylchik 706a8a91f6 Move kt55912 test into involvesIrInterpreter dir 2023-01-27 17:15:52 +00:00
Zalim Bashorov 6a73650b35 [Wasm] SpiderMonkey.kt -> WasmVM.kt 2023-01-27 17:57:50 +01:00
Zalim Bashorov b02279de14 [Wasm] Run wasm test using all available VMs: V8 & SpiderMonkey for now
Also, add a new directive, `WASM_FAILS_IN`, to specify VMs where a test is expected to fail for now.

#KT-56166 Fixed
2023-01-27 17:57:50 +01:00
Zalim Bashorov 885381dd63 [Wasm] Change externRefToAny to make it compatible with SpiderMonkey and V8
It's hard to achieve that without implementing part of `externRefToAny` using an intrinsic. It should be rewritten when all VMs and tools update to the latest spec.

Also, stop using (deprecated) instructions unsupported by SpiderMonkey.

#KT-56166 In-Progress
2023-01-27 17:57:50 +01:00
Zalim Bashorov d1855371a0 [Wasm] Don't wrap single null expression into composite in WasmNullCoercingLowering
Otherwise, it breaks check/assert inside DeclarationGenerator::visitField (DeclarationGenerator.kt:458)

#KT-56166 In-Progress
2023-01-27 17:57:50 +01:00
Zalim Bashorov ca79711610 [Wasm] Generate .mjs compatible with other standalone js & wasm VMs: SpiderMonkey and JavaScriptCore in addition to V8
#KT-56166 In-Progress
2023-01-27 17:57:50 +01:00
Zalim Bashorov 802a8ec326 [Wasm] Update SpiderMonkey version
#KT-56166 In-Progress
2023-01-27 17:57:50 +01:00
Zalim Bashorov 1d793f7bec [Wasm] Revert a7ed496a and few fixes to make Kotlin/Wasm compatible with Firefox
Revert changes as soon as the bug is fixed https://bugzilla.mozilla.org/show_bug.cgi?id=1811932

a7ed496a "[WASM] Use wasm bottom types for Nothing?"

#KT-56166 In-Progress
2023-01-27 17:57:49 +01:00
Roman Golyshev 71a368e06e [Analysis API] KTIJ-24107 Fix resolution of qualified invoke calls on objects
^KTIJ-24107 Fixed
^KTIJ-24344 Fixed
2023-01-27 16:49:30 +00:00
Roman Golyshev aab853ad12 [Analysis API] KTIJ-24107 Small cleanup in FirReferenceResolveHelper.kt 2023-01-27 16:49:29 +00:00
Svyatoslav Scherbina f3c29e1707 K2/Native: fix ModuleDescriptor dependencies in fir2ir phase
Previous implementation set Nth ModuleDescriptor dependencies to the
first N modules. This is not always correct: for example, when producing
a metadata klib (-Xmetadata-klib) for HMPP, metadata dependencies might
have inexact or missing depends= in their manifests.

This commit sets ModuleDescriptor dependencies to all other
deserialized modules. The same approach is used for K1. That way, the
implementation is more reliable.

^KT-56071
2023-01-27 16:32:33 +00:00
Svyatoslav Scherbina f6fa78b653 K2/Native: fix builtIns predicate in fir2ir phase
Old implementation expected that builtIns should be based on a library
with no dependencies, usually stdlib. But that doesn't work properly in
some cases, e.g. when producing a metadata klib (-Xmetadata-klib) for
HMPP. In that case, some of the metadata dependencies can have no
depends= in the manifest, leading to the compiler choosing such a module
instead of stdlib.

This commit makes it look for a library that is explicitly stdlib
instead.

^KT-56071
2023-01-27 16:32:32 +00:00
Sergej Jaskiewicz bd18fd40ea [K/N] Remap type args of SAM interfaces in FunctionReferenceLowering
#KT-56188 Fixed
2023-01-27 15:26:32 +00:00
Sergej Jaskiewicz 61fc3e99b1 [K/N] Fix generics in FunctionReferenceLowering for more edge cases
There were still some cases where the generated function reference class
would contain references to generic parameters that were not in scope.
One example of that was `Array<*>::get`. Before this fix the generated
function reference class would still contain a reference to the
type parameter declared in the `Array` class.

Also, the logic of generifying the generated function reference class
was incorrect. For example, for function `fun <A, B> foo()` if we had
a reference `::foo<T, T>` (where `T` comes from the outer scope),
the class would still contain two generic parameter, despite that only
one generic parameter from the outer scope was referenced.
This is also fixed here.
2023-01-27 15:26:30 +00:00
Troels Bjerre Lund 73e420d69d [K/N] custom-alloc: Fix off-by-one in threshold
The existing threshold for determining between medium and large page
does not take the dummy block into account, meaning that an allocation
on the threshold will lead to a loop that only terminates when the
process goes out of memory.


Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-618
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2023-01-27 14:03:55 +00:00
Ilya Goncharov 1150ec6882 [JS] Implementation dependencies for JS klibs
^KT-56158 fixed
2023-01-27 13:31:59 +00:00
Ilya Goncharov ca0b3ffa78 Upgrade yarn.lock file 2023-01-27 13:30:20 +00:00