Commit Graph

364 Commits

Author SHA1 Message Date
Svyatoslav Scherbina 3e1eddcf54 Get rid of unsafe cast function usages in :native:native.tests 2022-10-11 15:11:03 +00:00
vladislav.grechko e0c8142106 Support of custom 'equals' and 'hashCode' in inline classes
'equals' from any made available for overriding in inline classes
'typed' equals made available for definition in inline classes
'typed' equals definition made compulsory if 'untyped' is overridden
'operator' keyword is allowed in 'typed' equals definition

^KT-24874: Fixed
2022-10-10 16:52:34 +00:00
pyos 8d33de4297 JVM: partially reify typeOf and signatures as soon as possible
E.g. when substituting T -> Array<T>, write the bytecode for the
Array<...> part for typeOf.

This fixes various issues where either Array nesting levels, nullability
information (for typeOf), or entire reification markers were missing,
causing incorrect outputs ranging from missing `?`s to missing `[]`s to
just reified types not really being reified.

^KT-53761 Fixed
2022-10-06 00:58:25 +02:00
Leonid Startsev ccdb6fc599 Fix .equals for instantiated annotations with unsigned array types.
#KT-53876 Fixed
2022-10-03 13:54:06 +00:00
Pavel Kunyavskiy 2d4c94a115 [K/N] Add test for inter-module suspend function override 2022-09-30 08:48:59 +00:00
Alexander Udalov 4baa74f396 Add regression tests for obsolete issues
#KT-50909
 #KT-50974
 #KT-51888
2022-09-28 23:18:59 +02:00
Marat Akhin f73897fcea [K/N][KLIB][Tests]: mark klib binary compatibility tests as klib-abi
This is to avoid the need to change all our TC configurations to include
another test task run
2022-09-27 10:03:07 +00:00
Marat Akhin aca390263e [K/N][KLIB][Tests]: regenerate klib binary compatibility tests 2022-09-27 10:03:06 +00:00
Marat Akhin d6230a2e7b [K/N][KLIB][Tests]: support for klib binary compatibility tests on K/N
The impl supports both regular and caching testing modes.
Also add Gradle target for klib binary compatibility tests.
2022-09-27 10:03:06 +00:00
pyos 2dd49e5fb4 JVM_IR: unwrap suspend views when generating SAM wrappers
If the super class is in a file that has already been lowered, the base
method has an extra continuation parameter which breaks things.

Also, SAM wrappers around functional objects are tail-call and do not
need continuations ever, so don't even try.

^KT-50950 Fixed
2022-09-23 21:55:00 +02:00
Nikolay Krasko 1630386712 Move to JDK_X_Y variables 2022-09-21 22:53:19 +00:00
pyos acce055fc4 FIR: fix incorrect handling of suspend function typealiases again
The previous attempt stopped this code from throwing an exception during
serialization, but the arity is still wrong so an exception is now throw
when reading the serialized type.

^KT-50997 Fixed
2022-09-12 17:45:40 +02:00
Vladimir Sukharev c8864369fd Use main class as test generator name
Merge-request: KT-MR-7031
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2022-09-09 12:51:18 +00:00
Pavel Mikhailovskii 0b453ee328 KT-41670 Check for default property accessors in SAM interfaces 2022-09-07 13:37:38 +00:00
Pavel Mikhailovskii a75d5ba4cf KT-53465, KT-53677 Get rid of unnecessary checkcasts to array of reified type 2022-09-06 18:33:38 +00:00
Alexander Korepanov 01507281a2 [Common IR] Forward the extension receiver in the reified wrapper
^KT-53672 Fixed
2022-09-05 07:40:30 +00:00
Dmitriy Dolovov 6b6bc7d6fe [Native][tests] Fix: Pass friend modules to compiler CLI when building static cache
^KT-53723
2022-08-30 07:56:17 +00:00
Pavel Kunyavskiy 895a8ff149 [K/N] Basic support of Enum.entries for Native
No forward compatibility yet, with old klib IR linker will fail.

^KT-53324
2022-08-25 12:40:30 +00:00
Steven Schäfer a90c4d5dd5 JVM IR: Optimize equality on class literals 2022-08-23 00:14:11 +02:00
Nikita Bobko 2a4f3f41aa 2/5 Replace source dependency on kotlin-reflect with binary dependency
Review: https://jetbrains.team/p/kt/reviews/6753

Meaningful semantic change was splitted into 5 commits to simplify the
change review. Sinle commit would be too big.

Why replace source to binary: to get rid of kotlin-reflect in Kotlin
plugin artifact KTIJ-22276

Note: Kotlin Maven artifacts (./gradlew publish) changed their
dependency on kotlin-reflect
2022-08-22 15:43:49 +02:00
Igor Chevdar ccb4b5fd7d Revert "[Native][tests] Temporarily disable String codegen/box tests with "-opt" mode"
This reverts commit b210e24b43.
2022-08-22 06:05:53 +00:00
Pavel Kunyavskiy 5034581788 [K/N] Fix references for inline function
Corresponding lowering creating wrappers from JS Backend was used.

Also, the lowering was changed to create local function, instead of
normal one in outer scope, as a lot of logic from local declarations
lowering should be duplicated otherwise for correct type parameters
handling.

^KT-38535
2022-08-18 13:23:10 +00:00
Vsevolod Tolstopyatov c0f81cbc45 [JVM] Improve code coverage of EntriesMapping
Ensure that when .entries is accessed from an inline function body
or lambda argument, EntriesMapping are properly generated and used
without excessive mappings and duplicated fields

#KT-53236
2022-08-12 09:35:24 +00:00
Pavel Mikhailovskii 8ba80b4b7b KT-1436 Allow break/continue in inlined lambdas 2022-08-11 10:38:23 +00:00
Pavel Kunyavskiy 18cda8844d [K/N] Fix possible data races found by thread sanitizer 2022-08-10 08:36:07 +00:00
Pavel Kunyavskiy 828811a47f [K/N] Support running with thread sanitizer in test infra 2022-08-10 08:36:05 +00:00
Dmitriy Dolovov b507975812 [Native][tests] Make InfrastructureDumpedTestListingTest to be line ending tolerant 2022-08-09 12:32:22 +00:00
Alexander Korepanov bb8da65188 [Common IR] Do inlining of callable references of inline functions
^KT-52805 Fixed
2022-08-08 17:40:45 +00:00
Pavel Kunyavskiy 3424e756ad [K/N] Fix for instantiating annotations from already lowered file
If annotation class is already lowered, it can have more than one
constructor. So we should use primary one, not any one.

^KT-53475
2022-08-08 16:35:22 +00:00
Alexander Korepanov 794229d012 [box-tests] Add tests about anonymous classes uplifting
^KT-50175 Fixed by commits before
2022-08-08 08:39:59 +00:00
Igor Chevdar e38f02b53a [box-tests] Added a bunch of tests on local objects in inline lambdas 2022-08-08 08:39:57 +00:00
Igor Chevdar 03d21d9f79 [K/N][box-tests] Supported running box tests with per-file caches 2022-08-06 17:40:28 +00:00
Igor Chevdar 6799988227 [box-tests] Added a multi-module test on lateinit properties 2022-08-06 17:40:27 +00:00
Vsevolod Tolstopyatov 14b13a2f17 [kotlin.reflect] Introduce ClassValue-based cache for KClassImpl
* Replace pcollections with ClassValue/ConcurrentHashMap-based caches
* Do not store weak references, instead cache strong references and count on ClassValue to unload the corresponding classloader if necessary
* ConcurrentHashMap does not rely on WeakReference as it's only selected on Android where classloader leaks don't exist
* Update reflect/scripting JDK requirement to Java 8 in order to proceed

#KT-53454
#KT-50705


Merge-request: KT-MR-6788
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-05 15:35:34 +00:00
Dmitry Gridin 4ceb170917 regenerate tests 2022-08-05 14:12:41 +02:00
Ilya Gorbunov f91ea4b4d9 Add more tests for 'contains' in ranges #KT-52933
- ranges produced by 'rangeUntil' operator
- ranges of unsigned values
- more elements in ranges produced by `downTo`
2022-08-03 22:18:14 +00:00
Steven Schäfer 03aee58585 JVM IR: Avoid IrComposite in ReturnableBlockLowering (KT-53202) 2022-08-03 00:19:31 +02:00
Svyatoslav Scherbina 1b131332ab [Native][tests] Simplify handling opt-ins in the test launcher
For a box test, the test engine generates a test launcher -- a function
that calls `box` function. The latter might require an opt-in. To deal
with this, the test engine was using some heuristics to detect possibly
used opt-ins and applied them to the test launcher.

This commit provides an alternative solution -- it uses
`@Suppress("OPT_IN_USAGE_ERROR")` annotation for the test launcher. This
way, it doesn't have to guess which opt-ins to apply.
2022-08-01 15:24:15 +02:00
Svyatoslav Scherbina 09c131afd2 [Native][tests] Add standalone test for KClass package names
To ensure that after introducing `ReflectionPackageName` annotation,
we still have tests that check KClass package names without it.
2022-08-01 15:24:15 +02:00
Svyatoslav Scherbina c1853a0218 [Native][tests] Introduce NATIVE_STANDALONE directive
This directive makes the test standalone, i.e. disables grouping it with
other tests into a single compilation, and in particular disables
package renaming for the test.

Also, remove the old hard-coded way to mark tests standalone.
2022-08-01 15:24:10 +02:00
Svyatoslav Scherbina d50b0693b2 [Native][tests] Don't make typeOf tests standalone
The test engine detected tests using typeOf and made them "standalone",
i.e. disabled test grouping and thus package renaming for them, to keep
the reflection information intact.

Now, with `ReflectionPackageName` annotation, this is not required
anymore.
2022-08-01 15:23:38 +02:00
Svyatoslav Scherbina cee0731cef [Native][tests] Keep reflection package name when renaming packages
The test engine renames packages in test files to allow group many tests
into single compilation for performance reasons.

As a result, reflection APIs return different package names. To deal
with this, the test engine uses certain heuristics to detect tests using
reflection APIs, and disables grouping (and thus package renaming) for
them.

This commit provides an alternative solution for the same problem --
now the test engine instructs the compiler to use original package names
for reflection information, by means of the introduced
`ReflectionPackageName` annotation.
2022-08-01 15:23:32 +02:00
Svyatoslav Scherbina 38723816b7 [Native][tests] Fix file annotation patching in test files
Previously, the test engine was copying @file:OptIn annotations from
each file to all the other files inside the same test data, and also was
removing other file annotations in certain cases.

Now it only adds the opt-ins specified with `!OPT_IN` directives, and
doesn't remove anything.
2022-08-01 15:23:19 +02:00
Mads Ager e46540729c Fix equality for generated test files.
They were compared based on the name of the file only disregarding
the module. Therefore, the test framework would only patch
package declarations for one file with a given name even if there
were multiple files with that name in different packages.
2022-08-01 08:57:17 +00:00
Steven Schäfer 6f0ff6aeb0 IR: Fix scope transparency in ReturnableBlockLowering
An IrReturnableBlock introduces a new variable scope and shouldn't be
replaced with a transparent IrComposite block.
2022-07-29 01:06:44 +02:00
Igor Chevdar 8981eb85de [box-tests] Added a couple of reproducers for KT-52795 2022-07-28 16:01:17 +00:00
Dmitriy Dolovov b210e24b43 [Native][tests] Temporarily disable String codegen/box tests with "-opt" mode 2022-07-27 22:39:34 +00:00
Dmitriy Dolovov 5d234c0cdc [Native][tests] Ability to programmatically mute codegen/box & regular tests 2022-07-27 22:39:33 +00:00
Ilya Gorbunov 1addc23b23 Add range iteration tests for rangeUntil
#KT-52932
2022-07-26 23:52:10 +00:00
Dmitriy Dolovov 8adb0528d7 [Native][tests] Don't use non-default runtime assertions mode with cache
^KT-53032
2022-07-20 14:43:08 +00:00