Commit Graph

7804 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda fd4d4f516f Fix data class hashcode generation
It considers Boolean hashCode equal to 1/0 for true/false,
which is different from actual hashCode of the Boolean type.
2023-06-14 08:19:47 +00:00
Abduqodiri Qurbonzoda 36924775c8 Add a compiler box test for Boolean.hashCode() 2023-06-14 08:19:47 +00:00
Mikhail Glukhikh 668157eb41 FirClassAnySynthesizedMemberScope.kt: make it a declared member scope
Related to KT-54844, KT-58926
2023-06-14 07:09:16 +00:00
Pavel Kunyavskiy f67f8c393b K2: Added test for data class metadata
#KT-57622 Fixed
2023-06-14 07:09:16 +00:00
Mikhail Glukhikh f48142a6e6 FIR2IR: fix binding of data class generated members
Related to KT-54844
#KT-54952 Fixed
#KT-54887 Fixed
2023-06-14 07:09:15 +00:00
Mikhail Glukhikh 2a825f8df1 K2: implement FirClassAnySynthesizedMemberScope #KT-54844 Fixed 2023-06-14 07:09:15 +00:00
Mikhail Glukhikh c898b264ba FIR2IR: fix receiver of value classes method references
This commit fixes the receiver of these method in FIR2IR code
by removing a particular hack.
However, as the consequence of it 2 black box tests become broken in K2.
The reason is KT-54952 which is not yet fixed

Related to KT-54887
2023-06-14 07:09:15 +00:00
Alexander Udalov 82af3dd6ae Tests: fix paths of Java sources in codegen tests
To help them run on the old infrastructure, which light analysis tests
are still using.
2023-06-13 17:48:23 +00:00
Alexander Udalov 23fb96378e Tests: remove duplicate LANGUAGE test directives
To help them run on the old infrastructure, which light analysis tests
are still using.
2023-06-13 17:48:23 +00:00
Alexander Udalov be4df35867 Tests: add FILE directives to some multimodule tests
To help them run on the old infrastructure, which light analysis tests
are still using.
2023-06-13 17:48:23 +00:00
Alexander Udalov 70e9245867 Revert "tmp: implement a hack to fix LA test"
This reverts commit 0387ce0365.

This change was not needed because the 'IGNORE_BACKEND_K1: JVM'
directive makes the test generated as ignored, in this case it is the
method named `ignoreSignedToUnsignedConversions` which is not even
recognized as a test.
2023-06-13 16:19:53 +00:00
vladislav.grechko d600d768a6 Do not assert existence of metadata for local delegated properties
Local delegated property may origin from a body of inlined function.
In that case, they contain no metatada - which is ok, as the original
local delegated properties contain it and will be serialized.

^KT-58780: Fixed
2023-06-13 10:04:28 +00:00
Dmitriy Novozhilov c64310a833 [Test] Update tests according to KT-58544
There are some cases for fake-override actualization which become
  prohibited in the new expect/actual model, so few tests start to fail,
  despite the fact that they are checking entirely different things
2023-06-10 07:33:29 +00:00
Dmitriy Novozhilov ba41e8ec38 [IR] Use common expect/actual matching algorithm in IR actualizer
^KT-58578 Fixed
2023-06-10 07:33:29 +00:00
Dmitriy Novozhilov 6409bf2fe8 [FIR] Store expressions of receivers inside candidates instead of ReceiverValue
This is needed because of mutable nature of receiver values: implicit
  receiver values can be modified because of smartcasts, but in candidate
  we need to store snapshot of receiver in the form it was at the beginning
  of the resolution

^KT-58823 Fixed
2023-06-09 22:51:31 +00:00
Dmitriy Novozhilov c55ddab1bf [Test] Reproduce KT-58823 2023-06-09 22:51:31 +00:00
Alexander Udalov b992e698e4 Minor, add regression test for KT-58772
#KT-58772
2023-06-08 15:42:27 +00:00
Alexander Udalov ccf4a6813c Minor, move kt57353 test to a subfolder 2023-06-08 15:42:27 +00:00
Vladimir Sukharev 7aea0af307 [K/N] Enable passed tests for K1/N in involvesInterpreter
^KT-59057

Merge-request: KT-MR-10524
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-08 14:13:54 +00:00
Ivan Kylchik f74fd947b3 [JVM_IR] Don't add synthetic accessor when processing function reference
The issue appeared after code refactoring. Originally we didn't
save generated accessor for symbols in `IrFunctionReference`. These
symbols will be processed in their own turn.

#KT-59079 Fixed
2023-06-08 11:13:50 +00:00
Pavel Kunyavskiy 456783436c [K/N] Fix cast to NativePtr mis-compilation
^KT-59022
2023-06-08 10:40:29 +00:00
Denis.Zharkov c474c54903 FIR2IR: Fix IAE for case of local override of a method with defaults
It was happening because for MyClass.foo we didn't set overriddenSymbols
properly because in ClassMemberGenerator.convertFunctionContent we
used incorrect containingFirClass that was pointing to anonymous class
instead of MyClass.

^KT-58902 Fixed
2023-06-08 08:04:03 +00:00
Pavel Kunyavskiy 15e5adf2b5 Mark reflection related tests as jvm-only 2023-06-07 14:59:38 +00:00
Nikolay Lunyak 97adb01600 [FIR Native] Don't add Cloneable supertype when it's not present
^KT-58549 Fixed
2023-06-07 13:03:02 +00:00
Ilmir Usmanov 95662234d0 JVM: Support instantiation of annotations with vararg parameters
when they are instantiated without argument.
 #KT-59033 Fixed
2023-06-06 17:27:52 +00:00
Pavel Kunyavskiy 733ca5a358 [K/N] Unmute tests already working on native
Also, add issue references for some tests
2023-06-06 14:29:21 +00:00
Alexander Udalov b8785fbd90 K2: do not support disabling NoSourceCodeInNotNullAssertionExceptions
Disabling of this language feature (see KT-57570) was not supported in
the (default) light tree mode, and after this change it will not be
supported in the PSI mode as well. This makes the behavior more
consistent and allows us to remove the directive
IGNORE_BACKEND_K2_LIGHT_TREE in the future (KT-56757).
2023-06-06 10:06:39 +00:00
Sergej Jaskiewicz f2031ae642 [IR] Don't print multifile/synthetic facade class names in irText tests
This only applies to JVM and fq-names in declaration references
in IR dumps.

This enables us to run more irText tests on platforms other than JVM
(see KT-58605).
2023-06-05 10:40:17 +00:00
Pavel Kunyavskiy f2520a9cb7 [K/N] Rework is checks and as casts codegeneration
^KT-58707
^KT-59022
2023-06-05 08:56:17 +00:00
Artem Kobzar bfd57fd2df [K/JS, K/Wasm] Optimize simple objects declaration and usage ^Fixed KT-58797 2023-06-02 14:23:40 +00:00
Sergej Jaskiewicz 56b729f181 [test] Fix failing IR dump test 2023-06-01 13:22:01 +00:00
Nikita Bobko 4be7ac930b Update KClass.isData KDoc to include info about data objects
^KT-58985 Fixed
Review: https://jetbrains.team/p/kt/reviews/10385

`isData` returns `true` for `data object`s even if kotlin-reflect
version is old (1.2.0), so it looks like we got correct `KClass.isData`
behaviour for "free". That's why this behaviour was never covered with
tests.

This commit updates the documentation and covers the behaviour described
in the KDoc with tests.
2023-06-01 12:09:15 +00:00
Roman Efremov d2eb4a0abf [FE] Prohibit default arguments in expect declarations actualized via typealias
Cases when default argument inhertied from super class are allowed.

Some tests for default arguments already exist and can be found in
`testData/diagnostics/tests/multiplatform/defaultArguments`, for example
`annotationsViaActualTypeAlias.kt`.

^KT-57614 Fixed

Merge-request: KT-MR-10356
Merged-by: Roman Efremov <Roman.Efremov@jetbrains.com>
2023-05-31 13:14:37 +00:00
Igor Yakovlev 78b72efd32 [Wasm] Make Arrays' constructors with size and lambda inline
Fixed #KT-58746
2023-05-31 10:46:24 +00:00
Ilmir Usmanov d7fd2471b8 JVM IR: Remove remains of 1.2 coroutines from tests
Remove CoroutineAdapter and LANGUAGE: +ReleaseContinuation,
which are meaninless now.
Update the tests accordingly.
2023-05-31 05:56:18 +00:00
Sergej Jaskiewicz fd76a34277 [IR] Don't print flags in declaration references in irText tests
This doesn't reduce the quality of tests, because the flags are still
printed for declarations themselves. We only omit them in references.

However, this makes the tests more compatible with non-JVM backends
(see KT-58605), because flags of referenced stdlib declarations may
differ among target platforms.
2023-05-30 17:26:30 +00:00
Kirill Rakhman 793e3552e7 [FIR] Add tests for K2-only suspend operators get/set/contains
#KT-57169
2023-05-30 16:48:53 +00:00
Alexander Shabalin aea8bac7d2 [K/N] Do not compile for deprecated targets and legacy MM
^KT-56533
^KT-58853
2023-05-30 16:44:58 +00:00
Kirill Rakhman d1ce55cbd2 [FIR2IR] Fix infinite loop between annotation and annotation parameter
When an annotation constructor value parameter is annotated with the
very same annotation, FIR2IR went in an infinite loop when trying
to generate it.
To fix this, the constructor is added to the Fir2IrDeclarationStorage
cache before generating the value parameters.
To accommodate for the missing parameters, the value arguments count
is determined using the FIR.
2023-05-30 15:53:12 +00:00
Ivan Kylchik fc75402f65 [IR] Add test to specify new logic of enum initialization with name call
#KT-58948
#KT-57538
2023-05-30 15:28:04 +00:00
Kirill Rakhman cf2ef443f4 [FIR] Introduce a feature flag for context-sensitive enum resolution
The feature was previously enabled unconditionally in K2 which
triggered a bug when an enum has an entry with the same name as itself.

#KT-58897 Fixed
#KT-52774
2023-05-30 11:59:56 +00:00
Denis.Zharkov e4480a1c52 K2: Refine mapping of primitive arrays to JVM descriptor
Earlier, it wasn't really important but after the previous commit
when JvmMappedScope semantics has been changed, we erroneously
started loading `toCharArray` as a member to String because
its jvmDescriptor was computed to "toCharArray()Lkotlin/CharArray",
while hardcoded information that prevents it from loading expect
"toCharArray()[C" there.

^KT-57694 In progress
2023-05-30 10:44:41 +00:00
Denis.Zharkov 2e5b783cc6 K2: Refine how JDK members are mapped to built-in classes
Previously, the semantic was more-or-less correct for most of the cases
but some corner one, like `sort` in MutableList didn't work properly.

Namely, `sort` should be marked there in a way to forbid to call it
everywhere beside super-calls.
Also, overriding it should be allowed.

Mostly, the logic was re-written to K2 model from K1-related
JvmBuiltInsCustomizer.

^KT-57694 In progress
^KT-57269 Fixed
2023-05-30 10:44:41 +00:00
Alexander Korepanov 8066f1b7d2 [JS IR] Do not copy interface method if base class inherits it
^KT-58599 Fixed
2023-05-30 08:22:43 +00:00
Kirill Rakhman 9ca9fc9c68 [FIR2IR] Set type arguments on annotation calls
#KT-58553 Fixed
2023-05-30 07:58:03 +00:00
Nikolay Lunyak 83f2c2e1f0 [FIR] KT-58623: Unify FirInlineDeclarationChecker
> Condition 'isSuspendFunctionType' is always false when reached

The change in the native tests is needed, because K2
doesn't support disabling old language features

^KT-58623 Fixed
2023-05-25 12:19:51 +00:00
Kirill Rakhman 4dd1f9f4d6 [FIR] Set type arguments for callable reference in property delegation
#KT-58555 Fixed
2023-05-25 09:27:47 +00:00
Ivan Kochurkin 432c781ff7 [K2, MPP] Fix actualization of fake overrides (fixes a set of bugs in coroutines / ktor)
Split MissingFakeOverridesAdder on FakeOverridesActualizer and ActualFakeOverridesAdder

^KT-57984 Fixed
^KT-58003 Fixed
^KT-58124 Fixed
^KT-57833 Fixed
^KT-58153 Fixed
2023-05-24 14:54:51 +00:00
Dmitriy Novozhilov fdc236296d [FIR2IR] Generate @FlexibleMutability annotation on IR types if needed 2023-05-24 14:07:32 +00:00
Ilmir Usmanov a0484de1a6 JVM_IR: Do not copy static init blocks to inline class's constructor
#KT-58593 Fixed
2023-05-24 13:24:47 +00:00