Commit Graph

98390 Commits

Author SHA1 Message Date
Yan Zhulanow f352f7d5ba [LL API] Recognize scripts in Analysis API
Although the proper support for script resolution is yet to arrive
in K2, some initial steps are required to make LL API understand
such a concept.
2023-02-03 08:59:37 +00:00
Nikolay Lunyak 603b46e531 [FIR] KT-55503: Prefer members-extensions over @HidesMembers extensions
Passing `EXTENSION_RECEIVER` when processing `noReceiver`
looks like a mistake in general. This change is backed
by the `hidesMembers` and
`memberWithHidesMemberAnnotationVsMemberWithout` tests.

The exact reason with `memberWithHidesMemberAnnotationVsMemberWithout`
is that it first checks `@HidesMembers` candidates,
only takes the `kotlin/collections/Iterable<T>.forEach`,
but then yields `InapplicableWrongReceiver`,
because `explicitReceiverKind = EXTENSION_RECEIVER`
(which is strange, because we really don't have an explicit receiver).
Then we visit the same scope once more (now for all candidates)
and take 2 functions:

- `kotlin/collections/Iterable<T>.forEach`
- `kotlin/sequence/Sequence<T>.forEach`

...and they both result in `RESOLVED`,
because this time `explicitReceiverKind = NO_EXPLICIT_RECEIVER`.

This change ensures the first candidate we see
while checking `@HidesMembers` is taken as `RESOLVED`.

^KT-55503 Fixed
2023-02-03 08:26:17 +00:00
Nikolay Lunyak 906b16b41e [FIR] KT-55503: Fix current behavior 2023-02-03 08:26:17 +00:00
Ilya Kirillov 8b286577c7 [Analysis API] do not throw exception when KtCall is improperly resolved
Log the exception instead. This way the analysis of the file will not be stuck after finding an improperly resolved call
2023-02-03 07:06:07 +00:00
Jinseong Jeon 4a872928dd AA standalone: use IJ platform in headless mode 2023-02-03 07:56:37 +01:00
Svyatoslav Kuzmich 2e26b0956e [Wasm] Improve stability of wasm import names across compiler runs
Remove code generation for external fake overrides
Fake overrides are resolved to real declaration on call sites
This also removes generation of unused
"equals", "hashCode" and "toString" methods.
Avoid using hashes of IrType in generated code
because they are unstable

Merge-request: KT-MR-8658
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-02-03 06:55:59 +00:00
Alexander.Likhachev 35e39e9e10 [Gradle] Ignore non-existent directories in compile task outputs backup
#KT-56047 Fixed
2023-02-02 22:27:38 +00:00
Alexander.Likhachev 3cc69f691e [Gradle] Add test for KT-56047 2023-02-02 22:27:38 +00:00
Svyatoslav Kuzmich 81072ac9b4 [Wasm] Fix parsing D8 CLI arguments in kotlin.test
`@JsFun("code")` is now executed inside a JS function which brings its
`arguments` into the scope shadowing D8's CLI `arguments`.
 Accessing arguments through `globalThis` fixes the problem.

Merge-request: KT-MR-8630
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-02-02 16:37:32 +00:00
mvicsokolova bc612fa1c6 Atomicfu-plugin (JVM IR): fix visibility of wrapper classes generated for static atomics.
Fixes https://github.com/Kotlin/kotlinx-atomicfu/issues/272
2023-02-02 16:37:06 +00:00
Ilmir Usmanov 901ff06e90 JVM IR: Copy type parameters from class to suspendImpl
These type parameters where used in function parameters,
but since suspendImpl is static function, it has no access
to class type parameters. Solution is to copy them to
the function itself.

 #KT-55125 Fixed
2023-02-02 15:48:10 +00:00
Alexander Udalov 94f1c579df Kapt+JVM_IR: do not generate SuspendFunction supertypes
#KT-54380 Fixed
2023-02-02 15:01:43 +00:00
Sebastian Sellmair 93e92cbf74 [Gradle] Implement KT37051CInteropArtifactTest
^KT-37051 Verification Pending
2023-02-02 13:14:15 +00:00
Sebastian Sellmair 5a14c11ae7 [Gradle] Implement MppCompositeBuildIT for KT-37051 (with cinterop)
^KT-37051 Verification Pending
2023-02-02 13:14:14 +00:00
Sebastian Sellmair 8a62523ffc [Gradle] Streamline how cinterop artifacts are exposed within a Gradle project
Before:
- The cinterop task's output files were added as file dependency
to the declaring target's apiElementsConfiguration
- A 'copy' task was created for the cinterop artifact that was added
to the apiElements configuration as artifact (and therefore also
to the apiElements-published). This copy task placed the
same klib into the 'libs' folder
- Before passing libraries to the compiler the, all files
that are likely to be the result of the 'copy' task (in any libs dir) were
filtered

After:
- The cinterop task's output files are *not* added as file dependency
- The cinterop task's output is added as artifact directly to
the 'apiElements' configuration
- There is no more need for a copy task
- There is no more need for manually filtering the 'libs' artifacts

Tested:
project to project dependencies,
project to project dependencies (with KGP based dependency resolution)
project to repository
project to repository (with KGP based dependency resolution)

^KT-37051 Verification Pending
2023-02-02 13:14:14 +00:00
Artem Kobzar e401c29c26 [K/JS] Add separate test configuration just for the ES6 test ^KTI-1098 Fixed 2023-02-02 11:35:05 +00:00
Nikita Bobko ae661dd11b Fix :kotlin-native:backend.native compilation on CI
This commit fixes:
```
./gradlew :kotlin-native:backend.native:compileCompilerKotlin -PdeployVersion=1.9.0-dev-900
```

`-PdeployVersion=1.9.0-dev-900` is important for reproducibility (it's
not necessarily `1.9.0-dev-900` any version starting with `1.9.0-dev`
will reproduce the problem)
2023-02-02 10:56:20 +01:00
Mikhail Glukhikh 6d642c88f5 FIR2IR: make enum with abstract members from interfaces abstract
Related to KT-55828
2023-02-02 10:53:20 +01:00
Dmitriy Novozhilov 89c42e20c9 [FIR] Consistently use _function_ instead of _functional_ in names of classes and functions 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov f268ab8858 [FIR plugin prototype] Implement Composable-like extension 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov 1c8587f82d [FIR] Extract functional type kind from annotation on lambda literal 2023-02-02 08:24:51 +00:00
Dmitriy Novozhilov b48751ec9c [FIR] Add ability to extract functional type kind from annotation on functional literal type 2023-02-02 08:24:51 +00:00
Dmitriy Novozhilov d1b797ed97 [FIR] Generify resolution and inference of arguments of functional types 2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov 67aa80562d [FE] Completely replace FunctionClassKind with FunctionalTypeKind
FunctionalTypeKind can be used in FE 1.0 too, so there is no need to
  keep both classes. Also, removal of FunctionClassKind simplifies work
  with FunctionalTypeKind in common code, like Analysis Api
2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov 87a9103cc6 [FIR] Extract SyntheticFunctionsCache from builtins provider into separate one
This is needed because now set of available synthetic functional interfaces
  depends on session, because each module can contain different plugins,
  which provide different kinds of functional types
2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov e0c8f2354a [FIR] Properly implement FirFunctionalTypeKindService
This implementation takes additional functional type kinds from compiler
  plugins into account
2023-02-02 08:24:49 +00:00
Dmitriy Novozhilov c86495dcae [FIR] Introduce ConeFunctionalTypeKind as a replacement of FunctionClassKind
This is needed to provide an ability to extend different kinds of
  functional types

Also, cleanup and rename utilities related to functional types to avoid
  possible confusions
2023-02-02 08:24:49 +00:00
Dmitriy Novozhilov c98c8d3682 [FIR] Introduce utility searching for classifier symbol by ClassId
There were places which created lookupTag from classId just to call
  `lookupTag.toSymbol(session)`
2023-02-02 08:24:48 +00:00
Dmitriy Novozhilov 125b773205 [FIR] Introduce utility for creating ConeClassLikeLookupTagImpl from ClassId
`classId.toLookupTag()` looks much cleaner than `ConeClassLikeLookupTagImpl(classId)`
2023-02-02 08:24:48 +00:00
Sergey Bogolepov 6c449e29cd [K/N] Add a link for the target deprecation message 2023-02-02 08:24:02 +00:00
Anna Kozlova 30fd34c2d7 [CLI] free cached values
^ KTIJ-24447
2023-02-02 08:03:05 +00:00
Svyatoslav Kuzmich abf70a586c [Wasm] stdlib API: make kotlin.assert internal
Being disabled by default
 and not well-documented, these functions cause confusion among early
 adopters as to why their code don't work properly.

Assert APIs need a proper design across Kotlin platforms.
 Since APIs are not available in common code and K/JS, it is premature
  to have such a general feature in a new experimental platform.

Compiler tests:
* Mute tests that rely on assert.
* Replace JVM-specific assert calls with require calls and unmute passed K/JS tests.

Merge-request: KT-MR-8636
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-02-02 07:06:12 +00:00
Dmitrii Gridin a8f547d080 [AA LL] LLFirProvider: avoid index search if class declaration presents
^KT-55669 Fixed
2023-02-01 19:58:12 +00:00
Marco Pennekamp d8671422b1 [FIR] KT-56212 Fix compilation exception caused by type parameter chain
- `FirTypeResolverImpl.resolveSymbol` cannot simply assert that a type
  parameter only has a single qualifier, because code may be fed to the
  compiler where a type parameter is the start of a type chain (see for
  example the added `typeParameterChainInReturnType` test).
- The fix assumes that any multi-qualifier type parameter trivially
  resolves to `null`, because such a chained type cannot exist.

^KT-56212 fixed
^KTIJ-24083 fixed
2023-02-01 17:44:36 +00:00
Artem Daugel-Dauge 70ace38788 [Gradle] Fix library artifacts naming in generated podspec
^KT-56304 Verification Pending
2023-02-01 16:51:49 +00:00
Jake Wharton e821523b90 Implement RandomAccess on NS(Mutable)Array bridges
This communicates to runtime tests that calls to `get` are O(1).
2023-02-01 18:39:53 +02:00
Vladimir Dolzhenko d3fcd965ba Get rid of recordToTrace
recordToTrace is a bad practice as instance could be initialized out of
our control (e.g. in other plugins)

#KTIJ-22182
2023-02-01 15:59:04 +00:00
Vladimir Dolzhenko 79b8954814 Prevent unsafe publication of not fully initialized instance
#KT-54085 Fixed
#EA-757831
2023-02-01 15:59:04 +00:00
Sebastian Sellmair 1c1b6ff92a [Gradle] Implement MppIdeDependencyResolutionIT for platform cinterops and failing cinterops
^KT-56337 Verification Pending
2023-02-01 15:53:06 +00:00
Sebastian Sellmair fec9f9fe62 [Gradle] IdePlatformCinteropDependencyResolver: Retain cinterops for IDE in .gradle
^KT-56337 Verification Pending
2023-02-01 15:53:06 +00:00
Sebastian Sellmair ead2354fb7 [Gradle] IdePlatformCinteropDependencyResolver: Properly list build dependencies
^KT-56337 Verification Pending
2023-02-01 15:53:05 +00:00
Sebastian Sellmair bc98c47caa [Gradle] resolveCInteropDependencies (for ide): Handle non-existing files gracefully
During import, cinterop generation is lenient (as there
might be good reasons why certain hosts can't generate some
cinterop klibs). In this case, the resolution for IDE
should be lenient too. When a cinterop file is resolved, that is
not present on disk, we just send a 'IdeaKotlinUnresolvedBinaryDependency'
instead.

KT-56337
2023-02-01 15:53:05 +00:00
Ilya Goncharov f16eecb012 [Gradle, JS] Legacy deprecation arguments under ir backend disabled flag 2023-02-01 15:40:52 +00:00
Sergey Bogolepov 02c46d17aa [K/N] Add a trivial test coverage for use Foundation 2023-02-01 15:34:26 +00:00
Mark Mann ba4ba27afd Fix regression where was removed from generated modulemaps 2023-02-01 15:34:25 +00:00
Vladimir Sukharev 26b6c0b310 [K2/N] Unlock old testinfra runs with K2 frontend
Merge-request: KT-MR-8552
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-01 15:28:14 +00:00
Aleksei.Glushko b01ef8465a [K/N] Add ring/GenericArrayView bench
also .gitignore cmake-build-debug on all levels

Merge-request: KT-MR-8412
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-02-01 15:16:09 +00:00
Dmitriy Novozhilov 6a343e7bff [FIR] Resolve forks in constraint system after analysis of postponed lambda
When constraint system has forks in it usually we solve all of them before
  starting full completion of corresponding call. But if some call with
  forks was a last statement of postponed lambda, we will never call
  completion for it with FULL mode. Instead of it we complete it in PARTIAL
  mode and then just merge its constraint storage into storage of outer
  call. So all forks from this inner call just remain unresolved inside
  outer system without this fix

^KT-55966 Fixed
2023-02-01 15:02:02 +00:00
Nikita Bobko 770d6a4708 Bump KotlinAbiVersion for Enum.Entries
^KT-55808 Fixed
Review: https://jetbrains.team/p/kt/reviews/8401

If I don't bump `versions.kotlin-native` then locally
`kotlinx.coroutines` & `kotlinx.atomicfu` user projects compilation
fails with message:
```
w: skipping /home/bobko/jb/kotlinx-atomicfu/atomicfu/build/classes/kotlin/metadata/commonMain. Incompatible abi version. The current default is '1.7.0', found '1.8.0'. The library produced by 1.8.255 compiler
e: Could not find "/home/bobko/jb/kotlinx-atomicfu/atomicfu/build/classes/kotlin/metadata/commonMain" in [/home/bobko/jb/kotlinx-atomicfu, /home/bobko/.konan/klib, /home/bobko/.konan/kotlin-native-prebuilt-linux-x86_64-1.8.20-dev-5812/klib/common, /home/bobko/.konan/kotlin-native-prebuilt-linux-x86_64-1.8.20-dev-5812/klib/platform/linux_x64]
```

It worth noticing that we hardcoded "1.9.0-dev-693" on CI
(kotlin-teamcity-build/6693cb229c7485e07241fbc28322344774bcc3e0) to
workaround KTI-1107. 1.9.0-dev-693 also bumps KotlinAbiVersion
2023-02-01 15:13:34 +01:00
Nikita Bobko 711f36675c CompatibilityMode cleanup
Review: https://jetbrains.team/p/kt/reviews/8401

- Drop unused variables
- Replace `assert` with `require` because `assert` isn't reliable which
  makes hard to do any judgements about the code (`-ea` flag must be
  passed to the VM for the `assert` to be active. And it's hard to know
  when we the flag is passed). If `assert` was here for the performance
  reasons then a comment should have been left.
- Add the assert message for clearity

Because I'm evaluating what will break if KotlinAbiVersion is bumped.
And when the code around KotlinAbiVersion is clean it's easier to do the
evaluation.
2023-02-01 15:13:34 +01:00