Commit Graph

7142 Commits

Author SHA1 Message Date
Pavel Kunyavskiy ea3713f051 Fix building fake overrides for sam and function references 2022-09-30 08:48:59 +00:00
Pavel Kunyavskiy 2d4c94a115 [K/N] Add test for inter-module suspend function override 2022-09-30 08:48:59 +00:00
Mikhail Glukhikh 1ad2ec302b FirOverrideChecker: don't report VIRTUAL_MEMBER_HIDDEN with invisible
#KT-53197 Fixed
2022-09-29 08:34:12 +00:00
Pavel Mikhailovskii 903a5d69a4 KT-53146 Don't coerce Nothing? returned from "catch" clauses
At first, I tried to modify the logic in PromisedValue.materializeAt
to get rid of all casts from Nothing? to other types, but that broke
a number of tests containing casts of java.lang.Void to other types,
so I decided to fix only this particular case with try...catch
(for some reason, here we get a null of type java.lang.Object).
2022-09-29 06:15:39 +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
Pavel Mikhailovskii 1b8a60b5a5 KT-51282 Add tests 2022-09-27 12:17:19 +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
Alexander Udalov ba150ca370 Add JVM target bytecode version 19
Test data in `box/annotations/typeAnnotations` is changed because nested
classes in type annotations are rendered differently in JDK 19
(`Outer.Nested` instead of `Outer$Nested`).

 #KT-54116 Fixed
2022-09-22 21:56:10 +02:00
Ilmir Usmanov 3ee09f05ef JVM: Check for multiple {POP, Unit} sequences in suspend function TCO
We already check for {POP, Unit} sequence before ARETURN, but if the
there are multiple sequence before ARETURN, the compiler assumes, that
TCO misses.

The fix is to check, that the instruction after the sequence is either
ARETURN or another {POP, Unit} sequence.

 #KT-50835
 #KT-54152 Fixed
2022-09-22 19:46:52 +02:00
Pavel Mikhailovskii f8fd23e373 KT-8575 Add tests and disable reflection for Java synthetic property references 2022-09-22 13:33:28 +00:00
Igor Yakovlev 081cd4a4a8 [WASM] Support nullable types for external functions 2022-09-22 11:54:04 +02:00
Ilmir Usmanov 569e72c34e Minor. Do not check for specific bytecode in test 2022-09-21 16:42:15 +00:00
Xin Wang 0eadf35132 Inline: Fix operand stack type verify error
This is a proposal to fix KT-49364.
Operand stack type verification happens before `checkcast`
is executed. When we implicitly cast an inline class
to a non-inline type, if type of stack value is not subtype
of the target, then coercing is necessary.
2022-09-21 16:42:14 +00:00
Artem Kobzar 73e7053c35 [K/JS] Use only single variant of default arguments function wrapper for exported and not-exported functions 2022-09-19 17:49:04 +00:00
Mads Ager b7a7fce34e Add suspend lambda annotations to invokeSuspend.
For non-suspend lambdas annotations are carried over to the
invoke method so that tooling can find the annotation there.
It seems reasonable that annotations are carried over to
the invokeSuspend method on suspend lambdas as well so that
similar tooling can be built and work for suspend lambdas.
2022-09-16 23:21:18 +02:00
Igor Yakovlev 38dd68f1f4 [WASM] Enable passing tests 2022-09-15 16:27:46 +00:00
Igor Yakovlev 61d6f69bca [WASM] Native support of returnable blocks 2022-09-15 16:27:41 +00:00
Mikhail Glukhikh 036f9affd8 K2: link via signatures if -Xlink-via-signatures is set
Related to KT-53505
2022-09-14 10:15:22 +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
Mikhail Glukhikh a742c126c2 FIR2IR: check for @JvmStatic also on property accessors 2022-09-07 17:05:13 +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
Pavel Mikhailovskii 6a14400342 KT-53804 Restore old and incorrect logic of generating InnerClasses attributes for kotlin-stdlib 2022-09-05 14:02:52 +00:00
Pavel Kunyavskiy 4d64f3a422 Ignore added test for JS backend 2022-09-05 12:20:21 +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
Pavel Kunyavskiy d822d3e7c6 [K/N] Reenable constant inlining except for Double nan constants
^KT-52970
2022-09-05 06:06:44 +00:00
Alexander Udalov 19bbcc5869 Do not generate metadata for callable reference classes
After an accidental change in 846537b367, we started generating metadata
into anonymous classes for callable references. This metadata contained
the Kotlin representation of the referenced function. In KT-53794, this
led to a problem where Java's protected visibility could not be
represented in Kotlin terms, which crashed the backend.

But also, this metadata is useless because there's no real use case for
interpreting it (since you already have a function reference object at
runtime with all the needed information), so it would take some extra
space in the bytecode.

 #KT-53794 Fixed
2022-09-01 12:15:25 +02:00
Simon Ogorodnik 154e53c701 K1: add diagnostic BUILDER_INFERENCE_STUB_RECEIVER
It's reported on receivers in extension function calls with stub type,
as such calls can shadow members of finalized stub types causing
change of resolve when corresponding type argument specified explicitly

It works by checking extension receiver during call resolution parts run
That way we can easily detect if we found an extension applicable to
stub receiver and report call diagnostic for it

KT-53739
2022-08-30 10:19:26 +00:00
Simon Ogorodnik 4227fd012f Fix test for two builder inference lambdas 2022-08-30 10:19:24 +00:00
Dmitriy Dolovov 444cdaa2d8 [Native][tests] Re-enable internalFromFriendModule codegen box test
^KT-53723

This reverts commit 6594ebe487f0758e0fab880e2902d3d28eca7f44.
2022-08-30 07:56:18 +00:00
Igor Chevdar ea4a841056 [box-tests] Ignored a test for K/N for now
The test checks internal declarations visibility from friend module,
the K/N test system is broken for now if uses caches
2022-08-30 07:29:07 +00:00
Artem Kobzar 8b826a865b [K/JS, K/WASM] feat(Enum.entries): add support of new enum static field for JS and WASM. 2022-08-29 16:04:12 +00:00
Alexander Udalov 690322b203 Add flag -Xno-new-java-annotation-targets
Do not generate TYPE_USE/TYPE_PARAMETER Java annotation targets when
this flag is specified.

 #KT-53712 Fixed
2022-08-29 13:43:49 +02:00
Alexander Udalov a09fd45ade Do not generate TYPE_USE/TYPE_PARAMETER when compiling against JDK 1.6
#KT-53712
2022-08-29 13:43:32 +02:00
Pavel Mikhailovskii d65775ca1a KT-47475 Do not copy InnerClass attribute for WhenMapping classes 2022-08-25 21:41:14 +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
Dmitriy Novozhilov 66117367ad [FIR] Transform context receivers on properties during type resolution stage
^KT-53706 Fixed
2022-08-24 15:36:42 +00:00
Pavel Mikhailovskii 18e61315f4 KT-27936 Generate InnerClasses attributes 2022-08-23 22:06:10 +00:00
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