Commit Graph

557 Commits

Author SHA1 Message Date
Ilya Chernikov a045a0a81c FIR: use default getter in serializer if fir contains none
since we generate the default getter in this case in
Fir2IrDeclarationStorage.createIrProperty, so the serialized metadata
should follow the same behavior.
#KT-57373 fixed
2023-04-27 09:14:20 +00:00
Pavel Punegov a8bf83a97e [K/N][test] Wild-card the debugger tests to for with caches
Don't match all non-matching parts instead of excluding
2023-04-26 13:20:21 +00:00
Pavel Punegov 1a9e553013 [K/N][test] Set acceptable values for test class level properties
Adds @AcceptablePropertyValues annotation that accepts comma-separated
property values that could be used. If the value set from the command
line or as an enforced one is not in the list the default value will be
used instead.
2023-04-26 13:20:21 +00:00
Pavel Punegov 3ae9d2e4e8 [K/N][test] Make debugger tests work with caches
With caches (everywhere) Konan_start gets different location
`entryPointOwner:1:1`
2023-04-26 13:20:20 +00:00
Alexander Udalov 3120a35a88 JvmDefault: remove most tests on @JvmDefault
The tests are removed because JvmDefault is going to be deprecated with
error in KT-54746 and removed later in KT-57696.

Many of the removed tests already had existing counterparts with the new
modes `all` and `all-compatibility`. In this change, I've added such
tests where they were missing, and removed tests which were testing
behavior specific to the JvmDefault annotation, such as some
diagnostics.

 #KT-54746
2023-04-25 14:33:00 +00:00
Nikolay Lunyak 931894ab3c [FIR] KT-57655: Add the missing condition
^KT-57655 Fixed
2023-04-25 10:57:08 +00:00
Nikolay Lunyak c4d5332251 [FIR] KT-57655: Ensure the current IR is incorrect
The
`FirPsiBlackBoxCodegenTestGenerated.testImplicitIntegerCoercionNamedArg`
test fails in K2 with "java.lang.Integer
cannot be cast to kotlin.UInt".
2023-04-25 10:57:07 +00:00
Dmitriy Novozhilov 903e969598 [FIR2IR] Correctly calculate offsets for implicit toLong() calls during constant evaluation
^KT-58132 Fixed
2023-04-25 09:36:17 +00:00
Dmitriy Dolovov e85406b561 [PL][tests] Learn PL test infra to work with JS files
^KT-57378
2023-04-25 08:00:14 +00:00
Dmitriy Dolovov b5ad5edc08 [PL][JS] Add test for handling external declarations
^KT-57378
2023-04-25 08:00:14 +00:00
Ivan Kochurkin b72dcf8b37 [K2, MPP] Fix actualization of nullability-based overloads
^KT-58043 Fixed
2023-04-20 17:22:45 +00:00
Kirill Rakhman e80b4c530d [FIR2IR] Properly handle intersection types in interface delegation
The changes to the irText test data result in the fact that we
now unconditionally unwrap substitution overrides of delegation targets
whereas before we built an unsubstituted scope of the type we delegate
to. If we delegate to a class A : B<C>, the unsubstituted scope of
A can still contain substitution overrides for inherited generic methods
from B<T> that we didn't unwrap before but do unwrap now.

#KT-57899 Fixed
2023-04-20 08:12:55 +00:00
Ivan Kylchik 621f5a0fb7 [IR] Reorganize test files in involvesIrInterpreter dir 2023-04-19 13:52:48 +00:00
Ivan Kylchik 8cc8e54a9f [IR] Extract toString interpretation test of float value into new file
We need to distinguish `toString` results for JVM and JS
2023-04-19 13:52:46 +00:00
Ilya Chernikov 8cc9f911d5 FIR: temp: make klib symbol provider know parent packages
Current qualified access resolving algo rely (likely incorrectly,
see #KT-58037) on a providers' "knowledge" about parent packages.
This commit adds this "knowledge" to k-lib based provider.
#KT-57353 fixed
2023-04-19 11:42:03 +00:00
Mikhail Glukhikh c826c7301c K2 JS/Native: reproduce KT-57986 2023-04-17 20:53:30 +00:00
Ivan Kochurkin beaeb405d2 [K2, MPP] Build expect-actual map for type parameters from functions
^KT-57181 Fixed
2023-04-17 19:55:35 +00:00
Ivan Kochurkin b7bb9c317f [K2, MPP] Introduce FunctionDefaultParametersActualizerVisitor and use it in FunctionDefaultParametersActualizer
^KT-57263 Fixed
2023-04-17 19:55:34 +00:00
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