Commit Graph

7804 Commits

Author SHA1 Message Date
Svyatoslav Scherbina 0021333b91 [Native][test] Unmute more passing tests
They now pass likely due to better handling of reflection information
when renaming packages when grouping tests (see cee0731).
2022-08-23 17:05:59 +00:00
Steven Schäfer a90c4d5dd5 JVM IR: Optimize equality on class literals 2022-08-23 00:14:11 +02:00
Mikhail Glukhikh 8a4105e542 IR: fix origin of default getter of Enum.entries synthetic property 2022-08-19 10:08:08 +00:00
Ivan Kylchik 4e740e91f2 Safely unfold callable reference instruction in interpreter
There was an assumption that if receiver exists then parameter will
also exist. This is not true for references marked with `JvmStatic`.
Later in `JvmStaticInObjectLowering` dispatch receiver may be dropped.
2022-08-18 16:50:05 +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
Abduqodiri Qurbonzoda 0942a414c8 Fix typeAnnotationTarget6.kt codegen box test 2022-08-13 01:33:48 +03:00
Abduqodiri Qurbonzoda de775ad728 Remove unsignedIntCompare_before.kt test data 2022-08-13 01:33:47 +03:00
Vsevolod Tolstopyatov e32e5c26a4 [reflect] Fix flaky tests that depend on Reflection.clearCaches()
* Use ReflectionFactoryImpl as single point of synchronization
* Synchronize all cache-sensitive tests on it in order to be robust in parallel test runners
* Remove redundant cache clear after each test

Merge-request: KT-MR-6842
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-12 14:10:08 +00:00
Vsevolod Tolstopyatov 22e26d0756 Move EnumEntries LVS to 1.9
* Also cleanup tests to avoid using obsolete WITH_RUNTIME
2022-08-12 09:35:32 +00:00
Mikhail Glukhikh 7333589663 K1/K2: add Enum.entries unconditionally and filter them out in tower
Before this commit, we added Enum.entries only in case when
LanguageFeature.EnumEntries was ON (with an exception in K1/Java case).
In this commit we add Enum.entries unconditionally, and in case
the language feature is OFF we filter them out during tower resolve.
2022-08-12 09:35:27 +00:00
Mikhail Glukhikh 12e8b1d844 K1: add support for Enum.entries synthetic property (see KT-48872)
#KT-53270 Fixed
2022-08-12 09:35:24 +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
Vsevolod Tolstopyatov e3bff290bd [JVM] Lower .entries calls on Kotlin enums
Leveraging the same mechanism with $EntriesMapping as Java enums.
Old (compiled with LV/AV < 1.8) enums are detected by looking for
static special <get-entries> method that cannot be introduced on
Kotlin enums otherwise

#KT-53236
2022-08-12 09:35:22 +00:00
Vsevolod Tolstopyatov a12a31ce68 [JVM] Lower .entries calls on Java enums
#KT-53236
2022-08-12 09:35:21 +00:00
Vsevolod Tolstopyatov e708809e55 [JVM] Support Enum.entries for enums being compiled with Kotlin 1.8+
#KT-53236
2022-08-12 09:35:20 +00:00
Ivan Kylchik 45b89de9f4 Optimize ir interpretation of Enum.name
There is no need to create honest object in case of such simple
calculation. Furthermore, it can be harmful if enum class has
non-constant initializer or property.

#KT-53480 Fixed
2022-08-11 18:55:30 +03: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
Vsevolod Tolstopyatov fdd541c1e9 Introduce runtime ClassValue-based cache for typeOf machinery
* Cache KType instances constructor from the given classifier
* For generics, cache KTypes with already substituted arguments
* It significantly speeds up all typeOf-based APIs, both accesses to typeOf and its related properties (i.e. classifier)

#KT-53508

Merge-request: KT-MR-6818
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-09 18:40:32 +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
Vsevolod Tolstopyatov c6cbab43f7 Introduce KClass-based cache for KPackageFragment
* It is a heavy-weight object that is hard to compute
* It is being constructed each type _cached_ method ref is used in equals/hashCode
* Module name is deliberately ignored, corresponding doc is added where appropriate 

#KT-48136

Merge-request: KT-MR-6817
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-08 15:57:56 +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 7090a2716a [box-tests] Made test Native-specific
Seems like other backends don't like top level lateinit properties
2022-08-07 08:23:41 +03:00
Igor Chevdar 6799988227 [box-tests] Added a multi-module test on lateinit properties 2022-08-06 17:40:27 +00:00
Igor Chevdar 8041692144 [box-tests] Disabled a test for K/N
The test isn't passing when using K/N per-file caches and in order to fix it,
some hacks are required, which isn't worth it considering that test contains invalid code.
2022-08-06 17:40:26 +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
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
Ilya Gorbunov a044555299 Do not run rangeUntil operator tests in old JVM BE #KT-52933 2022-08-03 22:18:12 +00:00
Steven Schäfer 03aee58585 JVM IR: Avoid IrComposite in ReturnableBlockLowering (KT-53202) 2022-08-03 00:19:31 +02:00
Mikhael Bogdanov 90f8f8e14e Support inner classes in -Xjdk-release
#KT-52823 Fixed
2022-08-02 04:56:20 +00: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
Mads Ager 59c2bde10a [K/N] Unmute passing tests. 2022-08-01 08:57:16 +00:00
Mads Ager efde7c53d2 Remove reference to System.out.println from test.
This makes the test usable for non-jvm targets as well.
2022-07-29 09:34:53 +00:00
Steven Schäfer 7e472301b6 Re-enable "JVM IR: Move direct invoke optimization into a separate pass" 2022-07-29 01:06:44 +02: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
Mikhail Glukhikh 32a73968de Stop tower resolve in K2 in more similar manner with K1 2022-07-27 15:29:41 +00:00
Ilya Gorbunov 1addc23b23 Add range iteration tests for rangeUntil
#KT-52932
2022-07-26 23:52:10 +00:00
Denis.Zharkov 7f7e5c5975 FIR: Fix candidate receivers orders when choosing a context receiver
^KT-53257 Fixed
2022-07-25 15:11:29 +00:00
Alexander Udalov 584b70719e JVM IR: disable SAM conversion in case type has 'in' projection
... and the corresponding type parameter has a non-trivial (i.e.
non-`Any?`) upper bound.

The best solution here would be to get rid of
`removeExternalProjections` completely, and just use the type of the
argument at the call site, but see KT-52428.

 #KT-51868 Fixed
2022-07-23 01:10:53 +02:00
Mikhail Glukhikh 3ae75a5094 FIR2IR: generate annotations on fake override parameters #KT-53208 Fixed 2022-07-22 16:39:52 +00:00
Mikhail Glukhikh 5445f4043a K2: expand types during smartcasting to prevent redundant intersections
#KT-53184 Fixed
2022-07-22 16:39:52 +00:00
Mikhail Glukhikh 9add6f3d55 K2: add more accurate & more automatic control of diagnostic suppression
#KT-51363 Fixed
2022-07-22 11:35:26 +00:00
Svyatoslav Kuzmich 11c8c01a50 [Wasm] Update v8 shell to v10.5.207 2022-07-19 18:46:52 +02:00
Pavel Mikhailovskii 846537b367 KT-45375 Lightweight lambdas; KT-52817 introduce @JvmSerializableLambda 2022-07-18 17:10:07 +02:00
Pavel Mikhailovskii fd5800e8b5 KT-53090 Support -Xlambdas=indy for anonymous functions 2022-07-18 08:18:05 +00:00
Alexander Udalov b50d2ff20a Revert "JVM IR: Move direct invoke optimization into a separate pass"
This reverts commit f0760e0550.

The reason is that it leads to KT-53202.
2022-07-15 18:29:07 +02:00