Commit Graph

99029 Commits

Author SHA1 Message Date
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
Stanislav Ruban 4523535545 Deprecate -Xuse-k2 compiler flag in Gradle DSL
^KT-56239 Fixed
2023-01-27 12:42:50 +00:00
Kirill Rakhman efc957586d FIR: Report EXPLICIT_DELEGATION_CALL_REQUIRED in some missing cases
^KT-55877 Fixed
2023-01-27 12:26:51 +00:00
Ivan Kylchik 91f68f0e17 Fix bug with wrong cast in CommonProxy 2023-01-27 10:52:56 +00:00
Ivan Kylchik bc21753877 Move IR interpreter's tests from ir/loweredIr directory into box 2023-01-27 10:52:56 +00:00
Ivan Kylchik 7d6bac64fb Extract JVM logic of AbstractIrInterpreterTest into separate class 2023-01-27 10:52:54 +00:00
Ivan Kylchik 13cad2a820 Don't save constant value for non-resolved array expression in K1
#KT-55912 Fixed
2023-01-27 09:56:35 +00:00
Yahor Berdnikau 8fcea399f9 Fix double call to get files from FileCollection
^KT-54588 Fixed
2023-01-27 09:29:16 +00:00
Yahor Berdnikau fda4ff177d Add missing javadoc and sources jar publication
That was missed during 92509ad400 on
adding commit.
2023-01-27 09:22:03 +00:00
Anna Kozlova e5b96561e0 [FIR] skip implicit call to enum constructor if super type call exists
otherwise, reference to the super type would be resolved even when it's not
e.g. for interface constructor
^ KTIJ-24437
2023-01-27 08:20:07 +00:00
Aleksei.Cherepanov 07d369998c [Maven] Add test for the fix of illegal reflective access while using jdk17
IJ-203 dependency has illegal reflective access usage, which is prohibited without a special flag since JDK17. Specific reflect usage was fixed on the IntelliJ side (IDEA-31024). After the new IC was present in 1.8.0, this problem shows up on modules with a large number of source files in Maven projects. During the incremental compilation, FileSnapshotMap is filled up with paths to files as keys, so in the test, we generate a lot of source files with long names. If there are a lot of files to compile, a key chunk with paths overflowed and drops the current chunk to the disk, after that PersistentHashMap caches FilterOutputStream and uses illegal reflective access.
Closing caches after the first IC attempt fix this problem:
`63a0660c` IC: Close caches before falling back to non-incremental compile
`908dbf32` IC: Clean up closing caches logic in IncrementalCompilerRunner.kt
authored by Hung Nguyen
This commit should be reverted after the update of IJ dependency (KT-47765)

#KT-55709 Fixed

Merge-request: KT-MR-8359
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-01-27 07:26:17 +00:00
Ilya Gorbunov b558382f17 Cleanup unneeded options in kotlin-stdlib-jdk7/8 compilations 2023-01-26 20:57:00 +00:00
Ilya Gorbunov 5a4eb22961 Move isolated addSuppressed extension test to jvm tests
Conditions for being isolated do not hold anymore:
it tested that addSuppressed extension could work without kotlin-stdlib-jdk7,
but now the latter is merged to kotlin-stdlib and thus always present

#KT-51907
2023-01-26 20:57:00 +00:00