Commit Graph

3994 Commits

Author SHA1 Message Date
Ilya Gorbunov bd6607c860 Drop kotlin-stdlib-wasm project
Its tasks are no longer used as build entry points
2023-10-20 16:27:30 +00:00
Ilya Gorbunov 892719171b Disable wasm-wasi stdlib tests execution unless kotlin.stdlib.wasi.tests property is specified
Reason: unstable on CI
KT-62694
2023-10-20 16:27:30 +00:00
Nikita Bobko 14029b0ebc [STDLIB] 1/2 Drop AllowDifferentMembersInActual from stdlib
^KT-62656 Fixed

I blindly converted all `@AllowDifferentMembersInActual` to suppresses.
But some suppresses in stdlib are redundant. I'm too lazy properly
annotate only the necessary places. All these suppresses will go away
after the bootstrap update anyway

I drop allowDifferentMembersInActual_class and
allowDifferentMembersInActual_typealias tests because their only purpose
was to check that `@AllowDifferentMembersInActual` works as expected

Note: some tests are failing in the compiler because of that. I will fix
them in the next commit
2023-10-20 14:37:09 +00:00
Ilya Gorbunov aedc704e77 [stdlib] Further merge js-ir specific sources 2023-10-19 03:11:54 +00:00
Ilya Gorbunov 911fa3bbbb [stdlib] Merge js-ir specific sources into common js sources 2023-10-19 03:11:54 +00:00
Ilya Gorbunov f00d4022c4 [stdlib] Use common js sources in js-ir compilation without copying 2023-10-19 03:11:54 +00:00
Ilya Gorbunov 1d232c69d6 [stdlib] Move location of generated sources for js-IR compilation 2023-10-19 03:11:53 +00:00
Ilya Gorbunov 5f0a930ea3 [stdlib] Delete js-v1 sources 2023-10-19 03:11:53 +00:00
Dmitriy Novozhilov 5602fcdf76 [Build] Handle renderDiagnosticNames build property in stdlib and dom-api-compat modules 2023-10-18 07:59:27 +00:00
Ilya Gorbunov 469ca237db Remove the previous approach to build wasm stdlib variants 2023-10-17 16:30:41 +00:00
Ilya Gorbunov d4b245615a Build wasm stdlib artifacts in kotlin-stdlib project 2023-10-17 16:30:41 +00:00
Ilya Gorbunov 53681a33d9 Add required opt-ins in wasm stdlib sources 2023-10-17 16:30:41 +00:00
Ilya Gorbunov 735a97245d Remove forgotten ExperimentalStdlibApi in wasm sources 2023-10-17 16:30:41 +00:00
Ilya Goncharov 6de4d99706 [JS] Drop publishing JAR artifact of kotlin-stdlib-js
^KT-62067 fixed
2023-10-16 13:34:37 +00:00
Ilya Gorbunov 785d6858ea KT-62004 Drop legacy JS build of kotlin-stdlib
- preserve kotlin-stdlib-js.jar in dist and maven
- change packaging to klib in .pom
- fix manifest attributes of kotlin-stdlib-js
2023-10-06 00:46:08 +00:00
Mahdi Hosseinzadeh d803e0e31c Fix a grammatical issue in String::isNotBlank docs
"except of ..." is wrong.
Instead, it should be either of the following:
  - "except ..."
  - "except for ..."
  - "with the exception of ..."

See https://www.merriam-webster.com/dictionary/except%20for
and https://ell.stackexchange.com/q/148197
2023-10-05 03:56:05 +00:00
Filipp Zhinkin e803977924 KT-58588 Optimize Sequence::flatten
Rewrite FlatteningSequence to use
the same optimization technique as AbstractIterator.
Didn't extend AbstractIterator as storing and reloading a value
from a field is slightly slower compared to the implemented approach.
2023-10-02 08:03:13 +00:00
Filipp Zhinkin 7ca506870a KT-58588 Optimize Sequence::distinct
Use integer constants instead of enum to track AbstractIterator's state:
- for switches with a few cases, integer constants are
faster as there's no need to load ordinal value from
enum and map it into tableswitch index;
- on JVM, JIT-compiler can optimize away state-tracking code if it uses
integer constants, but when it comes to enums and tableswitches,
it can't apply a same set of optimizations to it.
2023-10-02 08:03:13 +00:00
Mikhail Glukhikh a77b758efa LV 2.0: drop reporting FIR_COMPILED_CLASS and relevant stuff
#KT-62056 Fixed
Related to KT-59171, KT-61951
2023-09-21 11:14:09 +00:00
Ilya Gorbunov 93b107000a [stdlib-mpp] Remove stdlib projects no longer included in build 2023-09-20 01:07:59 +00:00
Mikhail Glukhikh 5fb38008b7 Switch Kotlin version to 2.0
#KT-59171 In Progress
2023-09-19 15:46:26 +00:00
Zalim Bashorov 86e854a980 Revert "[Wasm] Don't use the new br_on_cast* instructions since they are not supported in Node.js yet"
This reverts commit 2d728727

#KT-60828 Fixed
2023-09-19 09:23:26 +00:00
Alexander Udalov 909f32ed54 Build: pass -Xexpect-actual-classes to some libraries compile tasks
To suppress the warning introduced in KT-61573.
2023-09-12 11:24:29 +00:00
Abduqodiri Qurbonzoda ba374bb45c Optimize hex formatting and parsing implementation #KT-58218
Merge-request: KT-MR-11702
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-09-08 22:40:56 +00:00
Nikita Bobko 01fc708a0f Mark expect/actual classifiers as experimental
^KT-61573 Fixed
Review: https://jetbrains.team/p/kt/reviews/11969/timeline

Tests:
- MultiPlatformIntegrationTestGenerated
- CliTestGenerated
- MultiPlatformIntegrationTestGenerated
- DiagnosticTestGenerated.Multiplatform
- FirLightTreeOldFrontendDiagnosticsTestGenerated

Also add -Xexpect-actual-classes flag to all necessary ./libraries/* modules
Otherwise compilation of those modules failes because of `-Werror`
2023-09-04 12:21:37 +00:00
Ilya Gorbunov 8ae21c0e1b [Generator] Do not omit public visibility of methods in wasm 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 1c149925b7 [Generator] Always put expression body on a new line 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 68a9b9c312 [Generator] Reference generator class in generated code files 2023-09-04 11:32:39 +00:00
Ilya Gorbunov 60bbd08569 [Generator] Rename additionalDoc, put its content before annotations 2023-09-04 11:32:39 +00:00
Abduqodiri Qurbonzoda 9352e40d54 Wasm Enum.hashCode() is not final #KT-61614
Merge-request: KT-MR-11938
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-08-31 14:31:56 +00:00
Ilya Kirillov 9b114335fb [stdlib] fix stdlib-common highlighting in K2 IDE plugin
K2 IDE Plugin uses only a partial set of built-ins.
It only has declarations which are not present in
the JVM stdlib as classfiles.

Because of that, some major declarations like
`kotlin.Unit` are missing,
so resolution inside kotlin stdlib common modules does not work.

Because of incorrectly resolved stdlib,
highlighting and resolution in other files in the kotlin project does not work.

This commit adds source versions of stdlib declarations
(`/core/builtins/src/kotlin/`) to the common stdlib as a source-set
for IDE import.

This way all declarations in stdlib common module are properly resolved.

The approach might be incorrect as it might introduce possible redeclaration
conflicts between common and platform stdlib sources
as `/core/builtins/src/kotlin/` source-set is also registered as a source-set for
platforms.
2023-08-31 12:51:47 +00:00
Ilya Gorbunov 7d3f080c81 Generate JS Long using builtin generators (step 2) 2023-08-29 16:27:55 +00:00
Ilya Gorbunov 814515964d Move JS Long to generated Primitives.kt file (step 1) 2023-08-29 16:27:55 +00:00
Alex Kuznetsov 35b3a9ec82 [Docs] Samples for 'step' function 2023-08-25 19:34:39 +00:00
Abduqodiri Qurbonzoda 84c6333b23 Introduce Common String.toCharArray(destination) #KT-60657
Merge-request: KT-MR-11340
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-08-25 03:11:13 +00:00
Ivan Kylchik adce2c9a78 [WASM] Replace deprecated Char.toInt() with Char.code 2023-08-24 08:59:49 +00:00
Ivan Kylchik ee973c0ede [Generator] Generate Char class 2023-08-24 08:59:49 +00:00
Ivan Kylchik 38e434bc07 [Generator] Generate Boolean class 2023-08-24 08:59:49 +00:00
Ilya Gorbunov 3f3cd2e87a [Generator] Set up body for rangeTo and rangeUntil by default
Also use expression body formatting for `rangeTo`.
2023-08-24 08:59:49 +00:00
Nikita Bobko ad90c86abe jvm-minimal-for-test: apply module-wise -opt-in=kotlin.ExperimentalMultiplatform
Motivation: Consistency. All other stdlib modules use this module-wise
`-opt-in`
2023-08-21 19:51:08 +00:00
Nikita Bobko 25c082f02b K1: Implement a checker that disallows to have different member scopes for expect open and its actual
^KT-22841 Fixed
Review: https://jetbrains.team/p/kt/reviews/11603/timeline

The commit also introduces `@AllowDifferentMembersInActual` annotation in
stdlib which allows to suppress the diagnostic
2023-08-21 19:51:08 +00:00
Ilya Gorbunov 93b0a90172 Add missing SinceKotlin for new JS annotations, KT-6168 2023-08-21 12:49:21 +00:00
Aleksei.Cherepanov e1c399b353 Fix JPS import after 7ae443ad 2023-08-21 10:11:55 +00:00
Ilya Gorbunov 9640e32483 [stdlib-mpp] Publish wasm artifacts through variants of stdlib KT-60909 2023-08-18 15:36:15 +00:00
Sebastian Sellmair f06a1c89ef [stdlib-mpp] Publish patched/custom kpsm to list 'commonMain' included into 'nativeApiElements'
Native/Shared Source Sets still requires stdlib:commonMain.klib as
dependency for IDE analysis.

See: KT-56278
^KT-60901 Verification Pending
2023-08-11 14:52:02 +00:00
Ilya Gorbunov 3e4cbd6dd2 Publish Gradle metadata for kotlin-stdlib-common, KT-60911
This makes it depend on kotlin-stdlib in all targets
and have no artifacts from Gradle's point of view
2023-08-11 08:49:23 +00:00
Nikita Bobko d39755b578 [FE] Convert specific diagnostic for actual function with default arguments into a common incompatibility
^KT-59665 Fixed
Review: https://jetbrains.team/p/kt/reviews/11039/timeline

It's better to have this logic in common place
(AbstractExpectActualCompatibilityChecker) to avoid missing compilation
errors in the future

This commit fixes:
1. Missing compilation error for actual function with default arguments
   for 'actual typealias' KT-59665
2. Missing compilation error for actual function with default arguments
   for actual fake-override KT-59665

Alternative solution for KT-59665 is to create a special checker.

"incompatibility" vs "special checker":

Arguments for common incompatibility:
- What if we had a rule that expect and actual default params must
  match? If so then it certainly would be an incompatibility.
- Technically, we do the matching of expect and actual params (because
  we allow default params in common ancestors of expect and actual
  declarations).
- It's hard to check that the actual definition doesn't use default
  params because `ExpectedActualResolver.findActualForExpected` filters
  out fake-overrides and doesn't return them. It's not clear logic for
  me, that I'm afraid to touch.
  implicitActualFakeOverride_AbstractMap.kt test breaks if you drop this
  weird logic
- WEAK incompatibilities can be considered as "checkers". So it doesn't
  matter how it's implemented, as a "incompatibility" or a "checker"

Arguments against common incompatibility:
- Although we match expect and actual declarations to allow default
  params in common ancestors of expect and actual declarations, it's
  still can be considered that we check that the actual declaration
  doesn't have default params. And it doesn't feel right that we check
  correctness of the actual declaration in expect-actual matcher.
- ~~It may change the rules of expect actual matching~~ (It's not true,
  because ActualFunctionWithDefaultParameters is declared as WEAK
  incompatibility)
2023-08-10 15:46:46 +00:00
Ilya Gorbunov 0882c645dd [stdlib-mpp] Move dependency constraints to api dependencies, KT-55297
Constrained alignment is also required for compile time dependencies
2023-08-10 10:35:54 +00:00
Aleksei.Cherepanov c8c3565a24 Fix JPS import
Exclude kotlin-stdlib-js project for JPS build. Related to KT-56106

#KT-61059 Fixed


Merge-request: KT-MR-11527
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-08-09 14:37:21 +00:00
Anton Lakotka 7c5dd7c451 [stdlib-mpp] Add dependency constraint on kotlin-stdlib-common for...
...other variants where it can be expected. Such as:

* commonMainMetadataElements (legacy metadata)
* metadataElements (klib metadata)
* nativeApiElements

This would prevent from leaking kotlin-stdlib-common dependencies of
older Kotlin versions. So every KGP configuration where
stdlib dependencies is configured automatically will enforce dependency
constraints on kotlin-stdlib-common.

^KT-61053 Verification Pending
2023-08-09 07:52:35 +00:00