Commit Graph

105 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich 4be2f53b47 [Wasm] Add @JsFun diagnostics (KT-56944)
JsFun target should be top-level external function
2023-02-24 11:35:16 +00:00
Svyatoslav Kuzmich 1da96213ca [Wasm] Add @WasmImport diagnostics (KT-56943)
WasmImport annotated functions:
* Restricted to top-level external functions
* Only supports primitive numbers, booleans and Unit
  (as return type only) in its signature
* Can't have default parameter values
* Can't have vararg parameters
2023-02-24 11:35:16 +00:00
Svyatoslav Kuzmich f79607d32d [Wasm] Add @JsExport diagnostics test
@JsExport is only allowed on top-level functions in K/Wasm

Restrictions for nested function are handled by reusing K/JS diagnostics
Restrictions for classes and properties are handled by specifying
 annotation target in stdlib
2023-02-24 11:35:16 +00:00
Svyatoslav Kuzmich b4fcfd6719 [Wasm] Add external declaration diagnostics (KT-56940)
Prohibit:
- external enum class
- external tailrec fun
- external suspend fun
- external lateinit var

Add tests for other external diagnostics inherited from K/JS
2023-02-24 11:35:15 +00:00
Svyatoslav Kuzmich 83ba1ac0f7 [Wasm] Diagnostic test: dynamic type is unsupported
Validates the fix for KT-56711
2023-02-24 11:35:15 +00:00
Svyatoslav Kuzmich c9e71985da [Wasm] Stop dumping declarations in diagnostic tests
These tests are meant to check diagnostics, but
having to update .txt dumps adds some friction to development process.
2023-02-24 11:35:14 +00:00
Svyatoslav Kuzmich 321a476898 [Wasm] Add external inheritance checker.
Prohibit non-external types to extend external types.
This type of inheritance is not supported in Wasm backend.
2023-02-24 01:05:23 +01:00
Svyatoslav Kuzmich 54a45c49f8 [Wasm] Add Wasm platform and K1 FE infrastructure 2023-02-24 01:05:23 +01:00
Ilmir Usmanov b3890885c4 JVM: Break infinite loop in finding meaningful instruction
during tail-call optimization.

There can be code, where all next instructions are non-meaningful and
there is a back-edge, for example, while(true){}. Previously, analyzer
incorrectly assumed, that this cannot happen. Now, it keeps track of
visited instructions and says, that there is no meaningful instruction
in such case.
 #KT-56815 Fixed
2023-02-23 17:54:46 +00:00
Igor Chevdar 5d3b61364a Added a test for KT-56500 2023-02-23 15:32:25 +00:00
Alexander Udalov 4ad594a3cd Minor, move tests about Java field and Kotlin property
Because the `fieldRename` directory was originally about cases when
private fields are renamed because of clashes.
2023-02-23 12:54:00 +01:00
Denis.Zharkov 0c9fad87c3 K2: Fix deserialization of upper bound of type parameter in nested class
Previously, containingDeclarationSymbol for V was set to the outer class
BaseRoot, so its upper bounds was computed to the ones from TNested
at org.jetbrains.kotlin.fir.resolve.calls.CreateFreshTypeVariableSubstitutorStageKt.getTypeParameterFromExpandedClass

^KT-56706 Fixed
2023-02-21 12:35:34 +00:00
Ivan Kylchik 477d092bb8 Avoid object's interpretation with nullable type
#KT-56215 Fixed
2023-02-20 15:52:52 +00:00
Ilmir Usmanov e42efe1ee6 JVM IR: Ignore class type parameters if function is static
Otherwise, it leads to type parameters duplication in case of
suspendImpls, since they inherit type parameters from containing class.

 #KT-56407: Fixed
2023-02-07 13:39:25 +00:00
Vladimir Sukharev e75d739c7a Add tests for property const initializers
Merge-request: KT-MR-8661
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-06 15:43:41 +00:00
Denis.Zharkov 6d7096b5e9 IR: Fix StackOverflowError caused by using DNN type in lambda
^KT-54140 Fixed
2023-02-03 14:08:57 +00:00
Svyatoslav Kuzmich bebb9b1392 [Wasm] Move compiler tests to :wasm:wasm.tests module
They don't belong in K/JS test module.
2023-01-31 13:12:12 +00: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 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
Zalim Bashorov 2573201a87 [Wasm] provide "location" for pseudo-instructions using to add comments 2023-01-17 19:37:06 +01:00
Zalim Bashorov ab1cbc49dd [Wasm] Minor: move buildUnreachable* helpers to more specific module 2023-01-17 19:37:05 +01:00
Zalim Bashorov 9e4b2b78e6 [Wasm] Remove unnecessary location from WasmDataMode constructor 2023-01-17 19:37:05 +01:00
Zalim Bashorov 2fa2725012 [Wasm] Add a comment about location into WasmExpressionBuilder 2023-01-17 19:37:05 +01:00
Zalim Bashorov aa8a0fd7d7 [Wasm] Remove LocationHolder and helper functions
It turned out that dedicated scoping function for locations are not so useful.
Now, if you want to scope a location use functions from stdlib, like `let`.
2023-01-17 19:37:05 +01:00
Zalim Bashorov e62add937b [Wasm] Remove SourceLocation.TBDLocation and related things 2023-01-17 19:37:05 +01:00
Zalim Bashorov 0d203d190e [Wasm] Remove buildInstr without location and fix usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 42f2edd282 [Wasm] Require location for buildThrow and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 1244cd1259 [Wasm] Require location for buildBr* and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 95c84d5d3f [Wasm] Require location for buildDrop and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 6eba0392db [Wasm] Require location for buildRefNull and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 12854af0a2 [Wasm] Require location for buildRefTestStatic and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 7bd92bc412 [Wasm] Require location for buildRefCastNullStatic and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov 158a307334 [Wasm] Require location for buildStructSet and fix all usages 2023-01-17 19:37:05 +01:00
Zalim Bashorov e7dc443c18 [Wasm] Require location for buildStructGet and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 530438dfcb [Wasm] Require location for buildStructNew and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 3967bd2755 [Wasm] Require location for buildSetGlobal and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 65e1b53027 [Wasm] Require location for buildGetGlobal and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 00d0c38fc3 [Wasm] Require location for buildSetLocal and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 0b59ef58dc [Wasm] Require location for buildGetLocal and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 9e86ac071d [Wasm] Require location for buildCallIndirect 2023-01-17 19:37:04 +01:00
Zalim Bashorov ce265c049a [Wasm] Require location for buildUnreachable and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 36d4e29253 [Wasm] Require location for buildConstI32Symbol and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov e69bbdd5b4 [Wasm] Require location for buildConstF32 & buildConstF64 and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov 332aca10b0 [Wasm] Require location for buildConstI64 and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov f2f4c63720 [Wasm] Require location for buildConstI32 and fix all usages 2023-01-17 19:37:04 +01:00
Zalim Bashorov cdc1d66b1f [Wasm] Require a description on each usage of SourceLocation.NoLocation 2023-01-17 19:37:04 +01:00
Zalim Bashorov 61440c74d5 [Wasm] Require location for buildCall and fix all usages 2023-01-17 19:37:03 +01:00
Svyatoslav Kuzmich 9bc6b420a9 [Wasm][Stdlib] Add public APIs for linear memory access
Needed for interop with APIs that use linear memory.
2022-12-29 19:25:23 +00:00
Svyatoslav Kuzmich 62217b39ec [Wasm] Rename WasmImportPair -> WasmImportDescriptor 2022-12-28 12:14:16 +01:00
Svyatoslav Kuzmich d788adcbb5 [Wasm] Move non-recursive function types out of rec group
This fixes linking with other wasm modules with non-rec types
2022-12-21 20:20:13 +00:00