Commit Graph

18 Commits

Author SHA1 Message Date
vladislav.grechko 34bac48541 Add JVM ABI K1/K2 consistency tests 2023-12-26 10:18:19 +00:00
Artem Kobzar 878452bd2b [K/JS] Implement file merging for clashed file during per-file compilation 2023-09-14 13:14:15 +00:00
Artem Kobzar 08bd0d6ce1 [K/JS] Generate tests for K2 + ES-classes compilation 2023-08-01 09:16:20 +00:00
Vladimir Sukharev 5c7d321e45 [Test] Convert IGNORE: NATIVE directives in box tests "sealed"
^KT-59057

Merge-request: KT-MR-10763
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-23 13:53:29 +00:00
Sergej Jaskiewicz 3713d95bb1 [klib] Don't deserialize the list of sealed subclasses from klibs
tl;dr the current design of klibs does not allow to properly deserialize
the list of sealed subclasses in a sound way. It is possible that
a subclass of a sealed class is declared in a different file, AND is
private in that file.

A more detailed explanation:

Right now we don't serialize file signatures at all.
However, a private declaration's signature must necessarily include
the file signature.

How do we serialize a private declaration's signature into a klib
and deserialize it later?

**Serialization** is simple: we just serialize the file signature as
an empty protobuf message.

When we are **deserializing** a private declaration, we look at the file
that is being deserialized right now, and construct the file signature
based on that.

This logic, however, doesn't always work. An example is KT-54028.

Basically, if we have a sealed interface with a private implementor
declared in a different file, this breaks:

1. We are deserializing the sealed interface. The deserializer knows
that we are now in the file in which the sealed interface is declared.
2. As part of deserializing the interface, we deserialize its sealed
subclasses.
3. Naturally, we come to deserializing the private implementor that is
declared in another file, but the deserializer still thinks that we are
in the file in which the interface is declared. A wrong signature is
created, which leads to linkage failure.

We *could* fix this by properly serializing the file signature,
i.e. instead of an empty protobuf message we could write the file path
and its package to the klib. However, there a problems with this
approach:

- The current design of signatures allows a situation where two
different files can have the same relative path
(for example, with the help of the `-Xklib-relative-path-base` compiler
flag) *and* the same package, which would introduce ambiguity during
linkage.
- Most importantly, this appoach won't work well with incremental
compilation of klibs. Currently we rely on the assumption that all
cross-file references are handled with public signatures, and private
signatures are only used inside a single file. This allows to move
declarations across files without recompiling it's use sites.

It has been decided to apply the following hacky solution: we just don't
deserialize the list of sealed subclasses from klibs.
The list of sealed subclasses is not used in lowerings, so it should be
safe.

#KT-54028 Fixed
2023-04-05 15:51:54 +00:00
Victor Petukhov fd6500c167 [FE 1.0] Set a fixation priority for self type variables less than any of ready for fixation kinds
^KT-51040 Fixed
^KT-49838
2022-02-14 15:43:53 +03:00
Mikhail Glukhikh 0f4647d95e Black box: update/set FIR status for some new tests 2021-12-09 13:26:37 +03:00
Victor Petukhov 61d40403e7 [FE 1.0] Create captured star projection for self types by replacing type arguments deeply
^KT-49752 Fixed
2021-12-07 11:38:45 +03:00
Dmitriy Novozhilov 490ef210ac [FIR] Support sealed class inheritors in multiple files 2021-02-09 16:04:39 +03:00
Dmitry Petrov 708e6914bd JVM JVM_IR hide sealed class constructors 2021-01-25 17:29:38 +03:00
Dmitriy Novozhilov b6bd7c48f4 [FE] Rename FreedomForSealedClasses feature with more meaningful name 2020-12-09 22:54:38 +03:00
Dmitriy Novozhilov e76acc8ee0 [FE] Collect inheritors of sealed classes from new places in computeSealedSubclasses
#KT-13495
2020-12-09 22:54:24 +03:00
Dmitriy Novozhilov f5f1984a60 [FE] Allow declare sealed class inheritors in different files in one module
#KT-13495
2020-12-09 22:54:21 +03:00
Mikhail Glukhikh 94fe79578e [FIR2IR] Generate unconditional branch in exhaustive whens 2020-03-20 11:55:34 +03:00
Mark Punzalan 9df2f69f09 [FIR] Disable failing blackbox codegen tests for FIR. 2019-11-19 11:00:09 +03:00
Roman Artemev 6ac4fd2e5f [JS IR BE] Update test data 2018-06-14 19:54:30 +03:00
Anton Bannykh 96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Mikhail Glukhikh 6e2395471d Sealed code generation: sealed is considered abstract, correct serialization
A pair of tests provided.
2015-06-25 19:07:23 +03:00