Commit Graph

539 Commits

Author SHA1 Message Date
Evgeniy.Zhelenskiy aceab2ac1f [IR] Fix KT-57973
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-57973
2023-04-17 12:33:10 +00:00
Evgeniy.Zhelenskiy 8c748bfea4 [IR] Add more tests for inline/value classes secondary constructors
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
2023-04-17 12:10:14 +00:00
Kirill Rakhman 592baee852 [FIR] When call candidates resolve to errors, select the least bad ones
This fixes a scenario when INVISIBLE_REFERENCE is suppressed, but we
resolved to the wrong overload because when none of the candidates were
applicable, more or less the first one was chosen.

Because we call `fullyProcessCandidate` on the candidates, their
applicability can change which can lead to a situation where the
applicability of a ConeAmbiguityError is different to all its
candidates. The changes in coneDiagnosticToFirDiagnostic.kt account for
that, otherwise code like candidates.first { it.applicability ==
CandidateApplicability.UNSAFE_CALL } can throw NoSuchElementException.

#KT-57776 Fixed
2023-04-12 14:03:39 +00:00
Igor Yakovlev edf4e80165 [Wasm] Fix for ReturnableBlockLowering invalid ir type for converted inlined blocks 2023-04-12 13:24:02 +00:00
Kirill Rakhman aab1959cc4 [FIR2IR] Fix codegen for lambda with dynamic receiver
#KT-57835 Fixed
2023-04-12 13:10:43 +00:00
Vladimir Sukharev 85450c93a6 [K2/N] Add FirInfrastructureTestGenerated
Merge-request: KT-MR-8774
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-04-10 13:40:06 +00:00
Ivan Kylchik 99d47da014 Drop a part of compileTimeConstants.kt that is not serializable in K2
Basically `val a = 10; val b = a + 20` will not be serialized for
`b` property because `a` is not constant
2023-04-07 18:07:12 +00:00
Ivan Kylchik 6909d9a2f9 [K2] Support proper serialization of string concatenation expressions 2023-04-07 18:07:11 +00:00
Ivan Kylchik 8499891756 [K2] Properly serialize constant values
#KT-56190 Fixed
2023-04-07 18:07:10 +00:00
Ivan Kylchik ac480e2285 [K2] Support serialization of complex annotations
#KT-57611 Fixed
2023-04-07 18:07:09 +00:00
Ivan Kylchik 4a50bd9b16 [K2] Fix annotation serialization for simple cases
#KT-57611
2023-04-07 18:07:09 +00:00
Zalim Bashorov 6e3eef7a88 [Wasm] add simple tests to track the size of wasm and mjs files 2023-04-05 20:50:51 +02: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
Dmitriy Dolovov b2e58096c0 [Native][tests] Generate missing codegen/box tests 2023-04-04 23:02:44 +02:00
Dmitriy Dolovov 31ed97e4ad [PL][tests] Mark K/N codegen/box tests with disabled PL with a special tag
Using this tag such tests may be excluded at the buildserver from slow configurations.
2023-04-04 22:24:02 +02:00
Dmitriy Dolovov 846f704713 [PL][tests] Use the proper cache configuration in cache tests 2023-04-04 22:24:02 +02:00
Dmitriy Dolovov f22bbb5a39 [PL][tests] Add K/N codegen test variants to run w/o PL 2023-04-04 22:24:02 +02:00
Dmitriy Dolovov 5db6158b47 [PL][tests] Mark K/N tests that should be executed without PL or with always some predefined mode
#KT-57378
2023-04-04 22:24:02 +02:00
Dmitriy Dolovov cb071028f6 [PL][tests] Run K/N tests (new infra) with PL enabled (where possible)
#KT-57378
2023-04-04 22:24:01 +02:00
Dmitriy Dolovov f1a97ed4b8 Minor. Comment updated 2023-04-04 20:18:18 +00:00
Dmitriy Dolovov 17c5f5d5a2 [Native][tests] Support FIR for KLIB evolution tests 2023-04-04 20:18:17 +00:00
Dmitriy Dolovov 3506e0c20f [Native][tests] Rename KLIB binary compatibility tests to KLIB evolution tests 2023-04-04 20:18:16 +00:00
Igor Yakovlev 44190937b0 [Wasm] Fix generic call return type for functions with default parameters 2023-04-04 18:39:18 +00:00
Vladimir Sukharev 4b289e89c5 [K/N] Remove K1 prefix from native tests
Merge-request: KT-MR-9424
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-31 21:07:26 +00:00
Mark Mann b6f669189b Use protocol name when creating objc protocol wrapper class 2023-03-31 09:50:25 +00:00
Dmitriy Dolovov 46ed6e5766 [PL] Change semantics of CLI parameter -Xpartial-linkage
This parameter accepts the name of the "mode" in which the partial linkage would work. Currently, only two options are supported: 'enable', 'disable'. But the list may be extended in the future as needed.

At the moment the 'disable' option is the default one. This will be changed in #KT-51447, #KT-51443.
2023-03-30 12:38:07 +00:00
Dmitriy Dolovov 5f1c09cc24 [PL][tests] Rename KLIB ABI tests to Partial Linkage tests 2023-03-29 16:20:14 +00:00
Dmitriy Dolovov b677112992 [PL][tests] Add Native K2 ABI compatibility tests 2023-03-29 16:20:14 +00:00
Dmitriy Dolovov 8147aa7dd6 [PL][tests] Don't compile source->binary directly in Native KLIB ABI tests
Avoid using source+KLIB+cache?->binary compilations in KLIB ABI tests. Such compilations are not supported by Native K2 and thus will block migrating ABI tests to K2.
2023-03-29 16:20:14 +00:00
Vladimir Sukharev 639b0cc525 Revert "[K2/N] KT-56190 Serialize simple const property initializers"
This reverts commit 2ace8ba9bd.
2023-03-29 18:00:09 +02:00
Vladimir Sukharev 2ace8ba9bd [K2/N] KT-56190 Serialize simple const property initializers
Merge-request: KT-MR-8623
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-29 13:26:43 +00:00
Kirill Rakhman 32cc28c6cf [FIR] Skip expect-actual rules check when overriding non-expect member
Overriding equals, hashCode, toString and any other member that is not
expect does not require satisfying the rules of expect-actual matching.

#KT-57381 Fixed
2023-03-28 16:21:33 +00:00
Kirill Rakhman ee78c31174 [FIR2IR] Fix generation of Any method call on expect receiver
#KT-57583 Fixed
2023-03-28 12:47:42 +00:00
Vladimir Sukharev 9212464887 Enable tests fixed by KT-56023
Merge-request: KT-MR-9350
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-27 13:21:20 +00:00
Alexander Udalov a962ec4553 Rework tests on Number.toChar with custom Number subclass
Simplify them, move to a subfolder, add a couple of new tests.
2023-03-27 10:46:15 +00:00
Dmitriy Novozhilov a64d8e8a31 [Stdlib] Deprecate and make open Number.toChar()
^KT-46465 Fixed
2023-03-27 10:46:13 +00:00
Alexander Udalov d3be38476a Merge K2 box tests to main box tests 2023-03-27 10:32:19 +00:00
Vladimir Sukharev 5d3ab8371f Enabled fixed tests in FirStdlibTest
Merge-request: KT-MR-9289
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-27 08:56:25 +00:00
Kirill Rakhman 60b227c519 [FIR] Sort HMPP dependencies topologically for symbol providers
This fixes an issue where an actual class from an intermediate module
has more supertypes than its expect declaration which leads to a
false-positive resolution error because a type reference resolves to the
expect class. The fix is to sort the dependencies topologically from
"most actual" to "most expect" when creating the list of symbol
providers.

#KT-57369 Fixed
2023-03-27 07:41:05 +00:00
Ivan Kylchik 63b340651d Add possibility to interpret and fold IrStringConcatenation expression 2023-03-24 15:55:06 +00:00
Ivan Kylchik e981b1f958 [Native] Support evaluation of const intrinsics for K2
#KT-56023
#KT-55469 Fixed
2023-03-24 15:55:03 +00:00
Ivan Kochurkin 4e67d82cd3 [K2, MPP] Make MPP tests from k2/basic target-wide
^KT-57349
2023-03-24 14:48:27 +00:00
Ivan Kochurkin ee73e4774b [K2, MPP] Remove redundant expect declarations from klib metadata
^KT-57250 Fixed

Introduce flat Fir2IrActualizedResult

It contains output from Fir2Ir and IrActualizer
2023-03-24 14:48:26 +00:00
Pavel Kunyavskiy 1c2f34ab4e [K/N] Add test for Annotations on type parameters and update doc
^KT-57404
2023-03-23 10:27:23 +00:00
Dmitriy Dolovov 3e7043e1f5 [PL] Remove filters for PL warnings in NativeTestGroupingMessageCollector
Normally, all PL warning messages should have non-null location. Thus, no need to have a specific filter for them.
2023-03-23 10:24:28 +00:00
Dmitriy Dolovov 4f1155b06f [PL] ABI compatibility tests for reworked partial linkage 2023-03-23 10:24:27 +00:00
Vladimir Sukharev 9407ec35e3 KT-57487: Add codegen test
Merge-request: KT-MR-9300
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-23 10:03:00 +00:00
Pavel Kunyavskiy b01cc1f88c [K2/N] Fix property accessors modality in K2 metadata
^KT-56603
2023-03-22 13:47:01 +00:00
Kirill Rakhman 45d2424ad8 [FIR] Let prefix inc/dec call getter twice for compatibility with K1
#KT-57179 Fixed
2023-03-21 08:48:38 +00:00
Pavel Punegov 40270a9c72 [K/N][test] Update LLDB tests with function references
After the fixes to function inlining tests revealed the problem with
debug info generated for inlined lambdas. See the ^KT-57365

Merge-request: KT-MR-9252
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-03-20 12:03:43 +00:00