Commit Graph

7923 Commits

Author SHA1 Message Date
Roman Efremov a05b37c652 [K2] Support reporting of SUPERTYPE_INITIALIZED_IN_EXPECTED_CLASS
...on regular classes and enum entries.

^KT-59979 Fixed
2023-10-12 13:01:40 +00:00
Dmitriy Novozhilov c25cde8871 [FIR2IR] Provide correct module data to FirModuleDescriptor
Properly implement friend modules visibility check

^KT-61384 Fixed
^KT-62475 Fixed
2023-10-12 06:47:02 +00:00
vladislav.grechko f71a731b6b Temporary do not check bytecode listings for some tests
Removing nullability directives from the methods of anonymous classes
affects some bytecode listing tests, but the changes will take effect
only after the advancing of the bootstrap compiler version.

See ^KT-62044
2023-10-10 10:34:33 +00:00
vladislav.grechko 29eb1c7a63 Do not add nullability annotations to the methods of anonymous classes
Nullability annotations are useless for the methods of anonymous classes
due to their restricted scope.

^KT-62044: Fixed
2023-10-10 10:34:33 +00:00
Ilmir Usmanov 197f0112b4 Minor. Add regression test for KT-62127
#KT-62127 Fixed
2023-10-09 12:43:27 +00:00
Evgeniy.Zhelenskiy 291d52820c [Reflection] Use reference equality to determine that a callable reference is bound
It helps to avoid problems when receiver object implements structural equals violating the equality contract

#KT-60709
2023-10-05 22:16:39 +00:00
Alexander Udalov 8e7e24cc31 Remove reference to fixed issue in test data
These two tests are now failing with IR fake override builder because
e.g. the fake override `MyMutableList.foo` has two overridden symbols:
`MyList.foo` and `MyMutableCollection.foo`, as opposed to the normal K2
mode which only has the former.

This seems to only affect the printed IR dump. Note that in K1 there
were two overridden symbols as well.
2023-10-05 12:37:55 +00:00
Alexander Udalov 91d6d79cfa IR: remap reflectionTarget in FakeOverrideRebuilder 2023-10-05 12:37:55 +00:00
Brian Norman 365ce2a6a5 [FIR] Implement checker for missing dependency supertypes
#KT-60778 Fixed
2023-10-04 21:57:43 +00:00
Igor Yakovlev 758484a01f [Wasm] Fix generation optimised when expression with Nothing type
Fixed #KT-62147
2023-09-23 10:18:30 +02:00
Ilya Chernikov 141333bdcd K2: Update extension receiver after checking in CheckExtensionReceiver
fixes receiver selection when the candidate has more that one possible
extension receiver
#KT-62129 fixed
2023-09-22 11:33:46 +00:00
Pavel Kunyavskiy cd409abfd8 [Fir2IR] Fix dispatch receiver of fake override lazy function
After the fix, it's at least consistent with what generated
for other fake overrides.

^KT-61386
2023-09-21 13:09:32 +00:00
Mikhail Glukhikh c33a6a665d Revert "Mute a pair of intrinsic trim tests for old BE in LV 2.0"
This reverts commit 876a0768e4.
Related to KT-59171
2023-09-21 12:38:22 +00:00
Ivan Kochurkin 3cd4f7c3aa [FIR] Consider @PlatformDependent annotation everywhere (including JS and Native)
^KT-57858 Fixed

Remove FirEmptyOverridesBackwardCompatibilityHelper since it's not used anymore

Remove overridesMemberWithPlatformDependent.kt test file since it becomes redundant
2023-09-20 17:12:52 +00:00
Kirill Rakhman 5b4409e34c [FIR] Store abbreviated type in deserialized declarations as attribute
#KT-58542 Fixed
2023-09-20 09:31:29 +00:00
Kirill Rakhman 2e4d486131 [FIR] Use enhanced scope to guess array type in annotation loading
Otherwise, we return null for any java annotation because the
unenhanced scope doesn't contain any properties.

#KT-61856 Fixed
2023-09-20 08:02:37 +00:00
Dmitriy Dolovov 249106b23f [KLIB] Drop obsolete tests on serialization of expect IR declarations
These tests are muted for all KLIB-oriented platforms for a long time
and are no more relevant since the removal of ExpectActualTable.

^KT-61136
2023-09-20 07:54:36 +00:00
Ilmir Usmanov f7a2da8f82 Minor. Add regression test for KT-41997
#KT-41997 Fixed
2023-09-19 20:11:57 +00:00
Artem Kobzar 94eefba824 [K/Wasm] Optimize range checks 2023-09-19 17:04:41 +00:00
Mikhail Glukhikh 876a0768e4 Mute a pair of intrinsic trim tests for old BE in LV 2.0
We muted tests in this commit because LV 2.0 shouldn't support old BE,
so this behavior is not important
2023-09-19 15:46:27 +00:00
Alexander Udalov 5cae87b263 K2: add package FQ name to ClassId of anonymous objects
This is needed because in order to figure out which declarations are
visible from anonymous objects in terms of overridability (see
`FirVisibilityChecker.isVisibleForOverriding`), we need to get the
package name of that anonymous object, because there's package-private
visibility on JVM.

 #KT-62017 Fixed
2023-09-19 09:32:55 +00:00
Zalim Bashorov eecfc2c6d3 [Wasm] Simplify a message printed in case of WebAssembly.CompileError
#KT-59720
2023-09-19 09:23:26 +00:00
Vladimir Sukharev 9a2eff6487 [FIR2IR] Don't replace while loop and when branch body blocks with single expression. Skip some empty blocks.
https://youtrack.jetbrains.com/issue/KT-60264/K2-while-loop-body-block-sometimes-replaced-with-single-expression

Merge-request: KT-MR-12035
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-18 15:27:19 +00:00
Dmitriy Novozhilov 97cf240450 [FIR] Reuse enhancement storage during creation of synthetic properies
^KT-61972 Fixed
2023-09-18 15:09:07 +00:00
Dmitriy Novozhilov 9a6c6a40a9 [FIR2IR] Allow symbolTable cache lookups for generated Any methods
^KT-61972 Fixed
2023-09-18 09:16:15 +00:00
Alexander Udalov fda47c45ec IR: do not change overrides for lazy IR in FakeOverrideRebuilder
`FakeOverrideBuilder.provideFakeOverrides` recursively changes overrides
for all superclasses in the hierarchy, including lazy IR, which is a lot
of extra work.

Also it leads to some tests failing in the IR fake override builder mode
because it changes correct fake overrides of Java classes to incorrect
ones. Those tests are unmuted but it doesn't mean they are fixed -- most
likely we'll generate fake overrides via IR for lazy IR too, at which
point they'll start to fail again.
2023-09-15 12:55:33 +00:00
Alexander Udalov 019836e9c7 IR: use origin DEFINED for value parameters of fake overrides
Fake overrides created by K1, as well as fir2ir in K2, use DEFINED. So
this gets rid of a lot of differences in IR text dumps between the K2
normal mode and K2 with IR fake overrides, and will ultimately help in
implementing and testing KT-61360.

The change in AddContinuationLowering is needed to fix tests like
kt47549. When creating anonymous classes for SAM implementations, we're
reusing the same fake override building machinery. And since we can't
extract any meaningful information from the fake override parameter's
origin anymore, we have to get the parameter from the original symbol.
2023-09-15 12:52:57 +00:00
Dmitriy Novozhilov 85c2226335 [FIR2IR] Allow symbolTable cache lookups for mapped JVM declarations 2023-09-15 11:51:58 +00:00
Alexander Udalov 9f9287fb2e IR: keep flexible type annotations when building fake overrides
#KT-61751 Fixed
2023-09-15 09:40:45 +00:00
Igor Chevdar 1df93e1611 [box-tests] Added a reproducer for #KT-61924 2023-09-15 09:26:54 +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
Alexander Udalov 21d56d04d6 Tests: reclassify some failures in fake override rebuilder tests
See issues for more information: KT-61751, KT-61804, KT-61805, KT-61370.
2023-09-13 15:01:52 +02:00
Artem Kobzar 7bc521ab92 [K/JS] Reset exceptionState inside coroutines with a finally block ^KT-58685 Fixed 2023-09-12 15:18:16 +00:00
Anastasia.Nekrasova eab6e9bb36 Added tests for all code samples from KT-60523, except 2.3.
Test for 2.3 sample must be added in the context of KT-61792.
2023-09-12 07:03:20 +00:00
Vladimir Sukharev e0e2a57e3d [K/N] Add filecheck tests for atomic intrinsics
https://youtrack.jetbrains.com/issue/KT-60514/Add-llvm-filecheck-tests-for-atomic-intrinsics

Merge-request: KT-MR-12067
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-09-11 21:28:34 +00:00
Alexander Korepanov 6bb939c6cb [FIR JS] Support JS_NAME_CLASH and JS_FAKE_NAME_CLASH diagnostics
^KT-59425 Fixed
^KT-59370 Fixed
2023-09-08 09:55:25 +00:00
Kirill Rakhman 9a2307ad44 [FIR] Fix expression types in java annotations
#KT-61518 Fixed
2023-09-08 07:40:30 +00:00
Denis.Zharkov 034671ad78 K2: Update substituted member candidate if it contains type variables
See the comment at updateSubstitutedMemberIfReceiverContainsTypeVariable

It became necessary after delegate inference is rewritten, since before
that happened, stub types were being left there and FIR2IR handled
them accidentally properly because stub types are equal to anything.

But that wasn't really correct even there because stub types are not
intended to leak out of the FIR

^KT-61060
2023-09-08 07:11:48 +00:00
Denis.Zharkov a02cb16fb2 K2: Rewrite delegate inference
The main idea is getting rid of stub types and using just type variables
See more detailed description at docs/fir/delegated_property_inference.md

The problem with stub types is that they need really special treatment
in many places, and on the other hand, there are no clear contracts on
how they should work (that regularly leads to bugs like KT-59529)

^KT-61060 Fixed
^KT-61075 Fixed
^KT-61077 Fixed
^KT-59529 Fixed
^KT-61633 Related
^KT-61618 Related
^KT-61740 Related
^KT-59107 Related
^KT-61747 Related
^KT-61077 Related
^KT-61781 Related
2023-09-08 07:11:48 +00:00
strangepleasures 88453a05f1 KT-53551 KT-52213 KT-58476 Fix handling of suspend functional types with context receivers 2023-09-07 12:40:01 +00:00
Ilmir Usmanov ae8b896c7b Minor. Add regression test for KT-59051
FIR2IR generates correct IR, unlike PSI2IR.
 #KT-59051 Fixed
2023-09-05 15:11:36 +00:00
Ilmir Usmanov 184b5cebe7 Minor. Add regression test for KT-60136
Spread operator works incorrectly in K1, but correctly in K2.
 #KT-60136 Fixed
2023-09-05 15:11:36 +00:00
Ivan Kylchik abc061e17f [IR] Restore and fix ifConstVal test
It was accidentally dropped after KT-55196 fix.
2023-09-05 11:06:43 +00:00
Alexander Udalov 34f52aaeda Reflection: fix callBy for functions with 32 * N parameters
Optimization in 2439c22ff6 introduced an array `absentArguments` with
default values of all parameter types, which is copied in `callBy`
instead of being recomputed each time. Unfortunately, its size was
computed incorrectly: `maskSize` should only take into account
value parameters (see the `parameter.kind == KParameter.Kind.VALUE`
check in `callBy`).

This led to an issue where if the function had 32 * N value parameters
and 1 receiver parameter, `maskSize` was greater by 1 than expected,
which caused an exception due to mismatching argument array sizes.

 #KT-61304 Fixed
2023-09-05 11:05:29 +00:00
Pavel Kunyavskiy 91e96e9f31 [Fir2Ir] Introduce testing with IrFakeOverrideBuilder
^KT-61514
2023-08-31 13:12:15 +00:00
Brian Norman b55fda0c55 [FIR] Create CFG for files to track top-level property initialization
In order to properly analyze top-level property initialization, a
control-flow graph must be created for FirFiles. This change adds the
foundation for the file CFG and updates body resolve to create the CFG.
Checking the CFG for proper initialization is separated into a following
change to ease code review.

KT-56683
2023-08-31 12:50:52 +00:00
Kirill Rakhman ac102dedac [IR Actualizer] Fix fake-override generation in actual A -> common B -> actual C hierarchy
...  where C defines a member x and A overrides the member x

#KT-61166 Fixed
2023-08-31 07:52:02 +00:00
Ivan Kochurkin c8c25d8b98 [FIR] Fix resolving of overload function with expect and common candidates
^KT-58896 Fixed
2023-08-30 15:58:59 +00:00
vladislav.grechko e9ccc0329c Fix isKotlinFunctionWithBigArity function
fixup! Fix `isKotlinFunctionWithBigArity` function

Fix `isKotlinFunctionWithBigArity` function

Previous implementation could return false positive results, e.g. for
class named `abacaba.kotlin.Function42`

^KT-61548: Fixed


Merge-request: KT-MR-11928
Merged-by: Vladislav Grechko <Vladislav.Grechko@jetbrains.com>
2023-08-30 09:15:00 +00:00
vladislav.grechko 8f2825506a Don't do full type parameters erasure in PromisedValue::materializeAt
The only case when erasure matters in a context of materialization of
`PromisedValue` is when the type is a type parameter which upper bound
is an inline class. Since `PromisedValue::materializeAt` is a hot spot
and `eraseTypeParameters` is an expensive operation, we should not do
type erasure in other cases.
2023-08-29 18:46:53 +00:00