Commit Graph

7961 Commits

Author SHA1 Message Date
Vladimir Sukharev 604c8edd1c [K/N] Fix kt53261_* tests to be dummy in debug mode
^KT-62157 Fixed


Merge-request: KT-MR-12720
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-25 16:07:01 +00:00
Dmitrii Gridin ec3cfdefcb [LL FIR] add missing file node to control flow graph
The file

^KT-62834 Fixed
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 2eb761adae [LL FIR] generate resolution tests over codegen/box testData
Such testData can contain contract violations and other resolution
problems, so we should check them as well

^KT-62776
^KT-62832
^KT-62834
^KT-62836
2023-10-24 10:30:55 +00:00
Dmitrii Gridin 5a786e25c2 [codegen] testData: move WITH_STDLIB to global scope 2023-10-24 10:30:55 +00:00
Dmitrii Gridin 09a1df9ee5 [codegen] testData: add missing directory structure for Java classes 2023-10-24 10:30:55 +00:00
Vladimir Sukharev e43b634122 [K/N] Migrate most simple filecheck tests to new infra
^KT-62157


Merge-request: KT-MR-12376
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-23 10:07:28 +00:00
Ivan Kylchik 4334ae9da9 [FIR] Add JvmName to the list of REQUIRED_ANNOTATIONS
We need to resolve `JvmName` as soon as possible because
it can be analyzed in `FirJavaElementFinder` to create
the correct class stub.

#KT-57802
2023-10-20 16:33:20 +00:00
Ivan Kylchik a45bb8d92b [FIR] Find the correct FIR file in Java finder for file with JvmName
#KT-57802
2023-10-20 16:33:20 +00:00
Ivan Kylchik 8c7c44f9f5 [FIR] Fix evaluation of Java properties for Char and String types
#KT-57802
2023-10-20 16:33:20 +00:00
Ivan Kylchik 7935b2bdb1 [FIR] Allow to evaluate top level const properties in Java world
#KT-57802
2023-10-20 16:33:20 +00:00
Ivan Kylchik 886ef1a4b4 [FIR] Support the simple case of java field interpretation
#KT-57802
2023-10-20 16:33:20 +00:00
Nikita Bobko 0f82baf841 [FE 1.0] 2/2 Drop AllowDifferentMembersInActual from compiler and testData
The annotation was dropped in the previous commit
2023-10-20 14:37:09 +00:00
Alexander Udalov 931c2ce47a Reflection: fix calling suspend fun returning value class over primitive
#KT-47973 Fixed
2023-10-20 08:50:26 +00:00
Ilya Chernikov 268d058bbb Implement missing invoke resolution branch with context receivers
#KT-61937 fixed
Note: the current implementation only resolves for a single receiver
in each group. See KT-62712 and KT-62709 for the followup.
2023-10-19 19:39:31 +00:00
Evgeniy.Zhelenskiy b89d8a65a1 [Reflection] Fix parsing JVM function descriptors
#KT-60708
2023-10-19 19:09:31 +00:00
Dmitriy Novozhilov 940567978d [FIR2IR] Treat delegated functions as fake-overrides
Delegated callables in FIR are session-dependant (as fake-overrides),
  so it's incorrect to use their FIR as a key for declaration storage.
  Pair of original function and owner lookup tag should be used instead

^KT-62671 Fixed
2023-10-19 13:15:48 +00:00
Pavel Kunyavskiy da488f513f [IR] Fix file modules after actualization
When files from different IrModules are merged in IrActualizer
their IrModule link was not updated. This led to assuming them
as different modules, and incorrect internal visibility handling.

^KT-62623
2023-10-19 10:16:45 +00:00
Vladimir Sukharev 9b9ddb760a [FIR2IR] Coerce last operator in a loop to Unit
One of many fixes for https://youtrack.jetbrains.com/issue/KT-59781/K2-investigate-implicit-cast-generation-in-fir2ir-vs-psi2ir

Merge-request: KT-MR-12629
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-19 09:53:46 +00:00
Dmitriy Novozhilov 847442d547 [Test] Add regression test for KT-60876 2023-10-19 06:58:14 +00:00
vladislav.grechko 897eab6b50 Do not add nullability annotations to the methods of local classes
Nullability annotations are useless for the methods of local classes
due to their restricted scope.

^KT-62513: Fixed
2023-10-18 19:48:38 +00:00
Dmitriy Novozhilov 9366847e96 [FIR2IR] Properly approximate intersection types during fir2ir conversion
^KT-62544 Fixed
2023-10-18 13:02:11 +00:00
Mikhail Glukhikh 4ed7504d87 FIR deserializer: apply attributes on type parameter-based types
#KT-62578 Fixed
2023-10-18 10:30:31 +00:00
Dmitriy Novozhilov 3f89f03b54 [IR Actualizer] Set overridden symbols for property accessors 2023-10-17 12:46:28 +00:00
Dmitriy Novozhilov 3b6ad36af1 [Test] Update/unmute tests after previous fixes
It's hard to tell which exact commit fixed each test
2023-10-17 12:46:28 +00:00
Dmitriy Novozhilov 84f41b7d68 [FIR] Use lower bound of supertype in findClassRepresentation for intersection types 2023-10-17 12:46:28 +00:00
Dmitriy Novozhilov c3f3a4192c [FIR] Check supertypes hierarchy for java classes during creation of synhtetic properies
^KT-62394 Fixed
2023-10-17 12:46:28 +00:00
Dmitriy Novozhilov 61ec143b74 [FIR] Don't generate delegated members for java methods with default implementation
^KT-62334 Fixed
2023-10-17 12:46:27 +00:00
Dmitriy Novozhilov 5857e6cc5d [Test] Mute some tests because of KT-62393 and KT-62394 2023-10-17 12:46:27 +00:00
Dmitriy Novozhilov 8bf4d3cbf7 [Test] Mute some tests because of KT-62334 2023-10-17 12:46:27 +00:00
Dmitriy Novozhilov 3d6ec0ec75 [FIR2IR] Automatically store IR declaration in its parent upon creation
Previously, creating a declaration with Fir2IrCallableDeclarationsGenerator/
  Fir2IrClassifiersGenerator didn't guarantee that this declaration will
  be actually added to the list of parent class/file declarations, which
  lead to situations when FIR2IR created some declarations in the air
  (mostly fake-overrides)
2023-10-17 12:46:27 +00:00
Dmitriy Novozhilov 34d0f3dbc2 [FIR2IR] Correctly calculate ir origin for f/o callables in declarations generator
This change uncovers one problem, which causes some MPP tests to fail
This problem will be fixed in further commits

Uncovers KT-62535
2023-10-17 12:46:27 +00:00
Dmitriy Novozhilov 50425e82c5 [FIR2IR] Simplify Fir2IrDeclarationStorage.getIrPropertySymbol
For reasoning refer to the message of the previous commit
It is the same as for `getIrFunctionSymbol`

There is one failing test here, caused by KT-61941
The issue was here before this commit, but it was hidden
2023-10-17 12:46:27 +00:00
Alexander Udalov 6219f7fc0d JVM IR: fix detection of enum entries in the same module
Use the new `IrClass.hasEnumEntries` flag added in the previous commit.

 #KT-61208 Fixed
2023-10-16 20:22:20 +00:00
Alexander Udalov db31f1f926 Tests: update some backend tests on enum entries
The enumEntriesIntrinsicMultipleEnums.kt test was supposed to check that
JVM backend generates 3 `$EntriesIntrinsicMappings` classes: for X, for
Y, and for Z. Mappings classes are generated for enums without
`entries`, i.e. Kotlin enums compiled without `EnumEntries` language
feature, and Java enums. The test incorrectly _enabled_ the language
feature for X though, and `$EntriesIntrinsicMappings` for X was
generated anyway because of KT-61208.

To keep the original intention of the test, I'm disabling the language
feature for X, so that it will be considered as enum without `entries`.
KT-61208 will be fixed in a separate commit (with separate tests).

The boxInline and bytecodeText tests changed their meaning when language
feature EnumEntries started to be enabled by default, so those changes
are a continuation to ebd43fc8c0. The behavior did not change after
enabling the feature, once again because of KT-61208.

Also, remove obsolete error suppressions which are no longer needed
after 64c8ce18a0.
2023-10-16 20:22:20 +00:00
Ivan Kochurkin 498f2e534a [FIR] Don't enhance Int and String Java final static fields
It's effectively a breaking change (^KT-62558)

K2 assigns flexible type to all static fields (from Java) and, for example,
`String? becomes String unlike K1. It affects IR signature generating.
That's why signature dump is disabled for some tests.

^KT-57811 Fixed
^KT-61786 Fixed
2023-10-16 17:16:56 +00:00
Alexander Udalov 2788dcb5ff K2: resolve remove(Int) clash in JavaOverrideChecker
In Kotlin subclasses of `MutableCollection<Int>`, the method
`remove(Int)` has its argument boxed, so that it wouldn't clash with the
method from `java.util.List`. So `JavaOverrideChecker` should understand
that a Java method `boolean remove(java.lang.Integer)` overrides it,
otherwise platform declaration clash was reported.

The code is adapted from `forceSingleValueParameterBoxing` in K1's
`methodSignatureMapping.kt`.

The test has been moved and adapted from diagnostic to codegen box
tests, to check correct backend execution + runtime.

 #KT-62316 Fixed
2023-10-16 11:26:58 +00:00
Mikhail Glukhikh b7b7dd1000 FIR2IR: make sources of qualified accesses & calls closer to PSI2IR
#KT-60111 Fixed
2023-10-13 15:42:58 +00:00
Igor Chevdar c6470a684d [box-tests] Added a reproducer for #KT-62313 2023-10-12 13:34:13 +00:00
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