Commit Graph

390 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 8300ad76d0 [FIR2IR] Remember overridden symbols if f/o contains error types
^KT-64837 Fixed
2024-01-12 15:32:25 +00:00
Vladimir Sukharev 9f2558f640 [K/N][Tests] Patch package names also for .def files
To separate interop modules to different packages,
.def files should be treated similarly to .kt files:
1) package directive should be prepended with test-specific synthetic package,
or, if, absent, package directive with synthetic package should be added.
2) in .kt files, import directives and fully-qualified import from interop modules
should be prepended with same test-specific synthetic package.
2024-01-11 23:30:07 +00:00
Vladimir Sukharev bf01cb16b4 [K/N][Tests] Migrate some cinterop tests to new infra
^KT-61259
2024-01-11 23:30:06 +00:00
Denis.Zharkov 72b0372927 K2: Allow PCLA inference when a value parameter has a TV type
^KT-64877 Fixed
2024-01-11 10:32:12 +00:00
Denis.Zharkov 7e4d9d9f64 K2: Add new tests for PCLA implementation
Many of them have been found & minimized at FP tests/user projects

^KT-59791 Fixed
2024-01-10 14:56:31 +00:00
Pavel Kunyavskiy 9374cacdd6 [IrActualizer] Don't actualize expect types
This was never semantically correct, but was not important
before KT-63644, as they were immediately dropped after that anyway.

After KT-63644, they were used to compute fake overrides inside them,
which were later matched against actual class, which can
produce false-positive matching errors.

^KT-64835
2024-01-09 17:53:06 +00:00
Alexander Udalov d08c9ba222 JVM IR: transform fake override properties in SAM adapters
Replace every property with its getter and setter. This is needed
because later on, JVM backend assumes that all properties have been
lowered (by JvmPropertiesLowering) to this state.

 #KT-64116 Fixed
2024-01-08 21:31:13 +00:00
Pavel Kunyavskiy c6e32571d6 [FakeOverrideBuilder] Workaround KT-64743
Because of KT-64743 there is unexpanded type-alias in a place we don't
expect it to occur. To workaround this, we just expand typialiases in
one more place.

^KT-64743
2024-01-08 07:46:07 +00:00
Artem Kobzar 567433cc12 [K/Wasm, K/JS] Unmute explicit backing fields tests 2024-01-05 17:27:31 +00:00
Artem Kobzar e4c244d5db [K/Wasm] Generate source-map for WAT-files 2024-01-05 14:16:32 +00:00
Dmitrii Gridin b6d373d8e5 Update copyright to 2024 2024-01-05 13:43:17 +00:00
Artem Kobzar 327085e026 [K/Wasm] Unmute most of the stepping tests for Wasm in K1 2023-12-28 16:32:10 +00:00
Artem Kobzar 3c04e6af03 [K/Wasm] Remove tmp files for the binaryen runner 2023-12-28 10:01:17 +00:00
Kirill Rakhman 49ae1b8d01 [FIR2IR] Consolidate type approximation
This commit gets rid of the redundant typeApproximatorConfiguration
in Fir2IrTypeConverter and uses the type approximator for captured
types instead of the manual approximation used before.

This fixes the nullability of approximated captured types, which fixes
a runtime error in WASM.

This also brings K2 IR closer to K1 IR in one test.

#KT-64261 Fixed
2023-12-21 15:56:49 +00:00
Artem Kobzar 053bc08626 [K/Wasm] Add Binaryen sizes to Wasm size tests 2023-12-21 14:19:09 +00:00
Kirill Rakhman f47705f123 [Tests] Add box tests for #KT-59904 2023-12-21 12:03:48 +00:00
Mads Ager e41a1247e2 JVM_IR: Generate more line numbers for intrinsic comparisons.
Otherwise, if complex expressions such as when expressions are
used in combination with the intrinsics we get incorrect stepping
behavior.

^KT-64341 Fixed
2023-12-20 15:39:03 +00:00
Vladimir Sukharev c09e8909d4 [K/N] Move cinterop tests from standalone to codegen/box
^KT-61259
2023-12-18 18:04:27 +00:00
Dmitriy Dolovov 46081f968d [KLIB Resolver] Report KLIB resolver issues as compiler messages
The reason of this change is to make messages (especially warnings)
that are reported by the KLIB resolver become visible to the end user.
This can be achieved to forwarding such messages to the appropriate
compiler's components such as
`org.jetbrains.kotlin.cli.common.messages.MessageCollector` and
`org.jetbrains.kotlin.ir.util.IrMessageLogger`.

Also: The default `DummyLogger` should be used as minimal as possible.
Because it just forwards messages to the standard output (console)
where they can remain unattended. When the compiler is executed
from the Gradle plugin such messages appear only in DEBUG Gradle's log.

^KT-63573
2023-12-18 13:03:40 +00:00
Igor Chevdar 7907231bf2 [box-tests] Added a reproducer for #KT-64139 2023-12-18 12:55:51 +00:00
Dmitriy Novozhilov 94c46d384a [FIR2IR] Properly calculate the type of delegated function call
```
interface A {
    fun <T> foo(): T
}

class B(val a: A) : A by A {
    generated fun <T'> foo(): T' {
        return a.foo() // <------
    }
}
```

There was a problem that type of generated delegated call used
  an unsubstituted type of the original delegated declaration, which led
  to a situation when (see example) type of call `a.foo()` was not `T'`
  but `T`, which led to incorrect IR and further exceptions on backend

^KT-64257 Fixed
^KT-64284 Obsolete
2023-12-18 12:45:28 +00:00
Dmitriy Novozhilov 7813bb35cf [FIR2IR] Provide remapped f/o symbols to declaration storage
After a generation of fake overrides some code may still to refer old
  symbols from declaration storage (like computation of overridden
  symbols for lazy functions), so we need to remap those symbols using
  information from IR f/o generator
2023-12-15 15:38:10 +00:00
Dmitriy Novozhilov 28f0f1ea88 [FIR2IR] Properly set isAssignable flag for parameters of tailrec functions
^KT-63973 Fixed
2023-12-14 09:58:03 +00:00
Pavel Kunyavskiy 8e047e6d8a [FIR2IR] Make all source sets friends for IrFakeOverrideBuilder
^KT-63644
2023-12-14 08:32:58 +00:00
Dmitriy Novozhilov b4947e6cfe [Test] Exclude K2 MPP codegen box tests from K1 generated suites
Those tests always were muted for K1 because of incompatible module
  structure in testdata, so there is no actual sense to even generate
  them for K1
2023-12-13 16:47:42 +00:00
Ilya Gorbunov 4b2e1240eb Replace kotlin-test-wasm project dependencies in the project
KT-61969
2023-12-13 15:40:25 +00:00
Ilya Gorbunov d2aae67e03 Replace kotlin-test project dependencies in the project
Use dependency helper function that chooses whether to take them
from the bootstrap repository or from a configuration of kotlin-test

KT-61969
2023-12-13 15:40:25 +00:00
Nikita Nazarov 251fdb21c9 [FIR] Generate spread element for unsigned arrays
Previously when unsigned arrays were passed as vararg in a named form the necessary spread element wasn't generated, which resulted in a compilation error.

^KT-63514 fixed
2023-12-13 15:30:27 +00:00
Kirill Rakhman 6d1ca3d379 [FIR] Fix CCE in deserialization of suspend function type with star projection continuation
#KT-64148 Fixed
2023-12-13 14:36:01 +00:00
Svyatoslav Kuzmich 1a644c48b0 Regenerate compiler tests 2023-12-13 13:30:50 +00:00
Yair Morgenstern 88e35fafd9 [Wasm] Use final Wasm structs for types without subtypes
A version of PR https://github.com/JetBrains/kotlin/pull/5175
 contributed by Yair Morgenstern, modified by Slava Kuzmich

^KT-60505 Fixed
2023-12-12 19:05:57 +00:00
Svyatoslav Kuzmich 2b4d1b0fb1 [Wasm] Bump SpiderMonkey jsshell version
Experimental flags --wasm-function-references --wasm-gc are removed.
GC is enabled by default with final subtype support.
2023-12-12 19:05:57 +00:00
Brian Norman 0881910a1b [FIR] Rewind DFA after call arguments for correct receiver smartcasting
^KT-63709 Fixed
2023-12-08 14:32:22 +00:00
Dmitriy Novozhilov 7d685522ce [IR] Fix calculation of receiver type for properies in expect/actual context
^KT-62926 Fixed
2023-12-08 13:28:27 +00:00
Evgeniy.Zhelenskiy 9cef8a2133 [FIR, Tests] Add box tests to verify that disappeared DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE leads to executable code
#KT-59903


Merge-request: KT-MR-13423
Merged-by: Evgeniy Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
2023-12-08 13:18:59 +00:00
Artem Kobzar 2eb1e65bbf [K/Wasm] Allow to export unsigned numbers 2023-12-08 09:06:19 +00:00
Alexander.Likhachev a19bd2ed2e [Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
2023-12-07 18:31:06 +00:00
Mikhail Glukhikh 4b649cbbe9 [tests] Drop a BI codegen test for should-be-red issue KT-63648 2023-12-05 18:15:53 +00:00
Stanislav Ruban da0c3090a9 [tests] Regenerate test configurations 2023-12-05 18:15:53 +00:00
Stanislav Ruban 3a77f39199 [tests] Regenerate test configurations 2023-12-01 19:20:28 +00:00
Ivan Kylchik 2b6845c032 [JVM_IR] Optimize properties delegated to const val
We can omit `get` call to delegated property and inline
constant value directly. If we are not going to
do that, we can get a runtime exception because
all usages of const property will be inlined and the property
itself will be dropped.

#KT-63567 Fixed
#KT-63580 Fixed
2023-11-30 14:27:36 +00:00
Alexander Udalov fc7de5ab97 IR: check type parameter bounds equality in overrides
The code is exactly the same as in K1's
`OverridingUtil.areTypeParametersEquivalent`.

 #KT-63442 Fixed
2023-11-30 11:04:02 +00:00
Kirill Rakhman 934253878b [Tests] Add regression test for KT-63564
#KT-63564 Fixed
2023-11-30 08:39:05 +00:00
Stanislav Ruban 514ae0c813 [tests] builder inference test-set: regenerate diagnostic & codegen tests 2023-11-30 06:27:00 +00:00
Svyatoslav Kuzmich e901629cf0 [Wasm] Support WASI target in K2
- Support WASI mode in CLI and test infrastructure
- Add external declaration checker
- Split Fir diagnostic lists into Base, JS and WASI

#KT-56849 Fixed
2023-11-28 11:51:53 +00:00
Svyatoslav Kuzmich 6b6353f3b9 [Wasm] Add external file checker to K2
#KT-56849
2023-11-27 16:55:04 +00:00
Svyatoslav Kuzmich 7687b86654 [Wasm] Add JsModule checker to K2
#KT-56849
2023-11-27 16:55:04 +00:00
Stanislav Ruban 269b60b420 [tests] Add a test case for KT-61978
^KT-61978 Obsolete
2023-11-27 15:50:46 +00:00
Dmitriy Novozhilov e38b25c278 [FIR2IR] Make convertAndActualize method the only entrypoint to fir2ir
Fir2Ir conversion consists of multiple steps with complex logic (like
  conversion of each module, actualization, plugins application, constant
  evaluation), and to ensure that they all are executed correctly it's
  convenient to have the single entry point for all this machinery
2023-11-27 10:17:54 +00:00
Dmitriy Novozhilov 075010b14e [Test] Get rid of some properties in IrBackendInput
`fir2IrComponents`, `irActualizerResult` and `dependentIrModuleFragments`
  were used in `IrActualizerAndPluginsFacade`, which was removed in the
  previous commit
2023-11-27 10:17:54 +00:00