Commit Graph

365 Commits

Author SHA1 Message Date
Dmitry Petrov 708e6914bd JVM JVM_IR hide sealed class constructors 2021-01-25 17:29:38 +03:00
Mads Ager ef36b81c67 [JVM_IR] Reduce the amount of super suffixes on accesibility bridges.
The super suffix was used for any static field/method that needed
an accessor. We should only use it when that field or method is
inherited.
2021-01-22 13:20:25 +01:00
Dmitry Petrov 0c463d3260 KT-44378 don't generate no-arg constructor for sealed classes 2021-01-15 22:31:01 +03:00
Alexander Udalov e0363788f4 Remove some remaining tests on old coroutines 2021-01-13 19:16:31 +01:00
Iaroslav Postovalov 77180a5b13 [JVM IR] Make file classes with all private members package-private 2021-01-12 12:47:59 +01:00
Kristoffer Andersen 43b61a618d [IR+Tests] Improve Local Function Debugging Experience
This change improves the debugging experience around local functions
on the IR backend. The changes include moving old
checkLocalVariablesTable (cLVT) tests to the new stepping/local variable
infrastructure in order to refine the tests and further define the
behavior of the two JVM backends, and their differences.

The primary ported test case is cLVT/localFun.kt that documents the
discrepancy in implementation strategy for local functions on the two
backends. The old backend implements local functions as lambdas
assigned to a local variable while the IR backend lifts them out as
static funtions on the surrounding class. The discrepancies and their
consequences are documented in bytecodeListing, idea-stepping,
localVariableTable and debugStepping tests.

The only _code change_ is disabling the captured variable name
mangling for captured variables on the IR backend. Captured variables
are passed as arguments to the static function, so in the debugger,
they really just are local variables. For them to show properly in the
debugger and be detectable by evaluate expression, they simply need no
mangling.

Finally, this change cleans 3 redundant cLVT tests, copyFunction.kt
and destructuringInlineLambda.kt and destructuringInFor.kt, that are
all covered in the new suite. The stepping behavior needs to be made
precise around for loops, but that is an entirely seperate issue.
2021-01-11 18:21:23 +01:00
Dmitry Petrov b02a9846d0 IR KT-44233 support flexible nullability in IrTypeSystemContext
^KT-44233 Fixed Target versions 1.5-M1
2021-01-11 17:33:50 +03:00
Steven Schäfer 98a9e142e8 JVM IR: Fix visibility of protected/private functions with reified types 2021-01-08 16:35:31 +01:00
Jinseong Jeon 7cc06489dd IR: move enum value array initialization out of <clinit>
#KT-44192 Fixed
2021-01-07 23:00:37 +01:00
Ilmir Usmanov 9c67d8f89e IC Mangling: Correctly mangle functions with generic return type
if the type's parent is inline class.
 #KT-43050 Fixed
 #KT-26130 Fixed
 #KT-32384 Fixed
2020-12-24 14:29:48 +01:00
Ilmir Usmanov 8bfcef415e Do not generate variables for non-generated fields
Use attributes instead of classes.
 #KT-43048 Fixed
2020-12-23 19:45:15 +01:00
Dmitry Petrov c9d330207b JVM_IR no nullability annotations on SAM wrapper constructor parameters 2020-12-22 16:09:46 +03:00
Dmitry Petrov 0dff583070 JVM KT-36984 SAM wrappers are anonymous inner classes 2020-12-22 16:09:45 +03:00
Dmitry Petrov 57dd9fc87a JVM_IR KT-36984 SAM wrappers are anonymous inner classes 2020-12-22 16:09:45 +03:00
Dmitry Petrov 443cd0fc2c Tests for issues fixed in JVM_IR 2020-12-22 16:07:06 +03:00
Dmitry Petrov 8999fd88b1 JVM_IR KT-43401 KT-43518 fix ACC_STRICT and ACC_SYNCHRONIZED flags 2020-12-16 14:10:36 +03:00
Dmitry Petrov 7ed3860c70 JVM_IR KT-43043 fix nullability annotations for inline class members 2020-12-16 13:43:29 +03:00
Dmitry Petrov b7330a9e14 JVM_IR KT-43877 fix generic signatures for SAM-converted lambdas 2020-12-11 20:26:29 +03:00
Dmitriy Novozhilov b416c669b0 [TEST] Update testdata due to dropped COMMON_COROUTINE_TEST directive 2020-12-10 01:31:04 +03:00
Dmitry Petrov 313dfaf48c JVM_IR KT-43812 erase generic arguments of SAM wrapper supertype 2020-12-09 20:06:02 +03:00
Denis.Zharkov 920ed558ee Add some tests on corner cases for @JvmRecord 2020-12-09 16:47:25 +03:00
Mikhael Bogdanov 1cfb81455c Generate correct names for companion @JvmStatic accessors in annotation class
#KT-31389 Fixed
2020-12-09 13:26:14 +01:00
Dmitry Petrov 3dbe02b7fe JVM_IR KT-43109 generate internal bridge for custom internal 'toArray'
Also add some tests for internal collection stubs.
2020-12-04 18:57:10 +03:00
Ilmir Usmanov 516fce37db Value classes: Allow unsigned arrays in annotations
including varargs, apparently.
So, we allow unsigned types and unsigned arrays in annotations,
but disallow user-defined inline classes.
 #KT-23816 Fixed
2020-12-03 17:22:08 +01:00
Alexander Udalov 6b649d02d3 JVM IR: fix visibility/modality of $suspendImpl methods
#KT-43614 Fixed
2020-12-02 20:53:55 +01:00
Alexander Udalov 8ce2e4654b JVM IR: allow custom toArray to have any array type
To avoid breaking Java source compatibility. This problem can be fixed
later once JVM IR is stabilized.

 #KT-43111 Fixed
2020-12-02 20:53:47 +01:00
Dmitry Petrov e6a3e38c4d JVM_IR no static inline class members for Kotlin JvmDefault methods
KT-43698 KT-43051
2020-12-02 20:04:13 +03:00
Alexander Udalov a917ebd11e JVM IR: use origin to detect property/typealias $annotations methods
Now that DEFAULT_IMPLS origins for methods do not exist after previous
commits, the name heuristic is no longer needed.
2020-12-02 15:54:15 +01:00
Alexander Udalov c7c793c724 JVM IR: do not use origin DEFAULT_IMPLS_BRIDGE(_TO_SYNTHETIC)
Instead, check that origin of the parent class is DEFAULT_IMPLS. Also,
add a separate origin SUPER_INTERFACE_METHOD_BRIDGE for interface
methods with bodies that are copied to classes.
2020-12-02 15:54:14 +01:00
Ilmir Usmanov 129de76288 Value classes: Generate @JvmInline annotation for inline classes
but not for value classes.
Since inline classes and value classes share the same flag, we use
presence of the annotation to distinguish them.
2020-12-01 23:45:47 +01:00
Dmitry Petrov 1412ee96f8 JVM_IR KT-43524 static wrappers for deprecated accessors are deprecated 2020-12-01 19:43:52 +03:00
Dmitry Petrov e96fc74ffa JVM_IR KT-43519 no delegates for external funs in multifile facades
Also add ABI tests for @JvmStatic/JvmOverloads + 'external'.
2020-12-01 19:43:52 +03:00
Dmitry Petrov 2b4564059e JVM_IR KT-43459 fix $annotations method receiver type 2020-12-01 19:43:51 +03:00
Dmitry Petrov 85b5948931 JVM_IR KT-43051 no static inline class members for default Java methods 2020-12-01 19:43:51 +03:00
Dmitry Petrov a157b58c61 JVM_IR KT-43610 keep track of "special bridges" for interface funs 2020-11-30 15:49:01 +03:00
Ilmir Usmanov 78e607c6b0 Value classes: Support @JvmName annotation on functions with inline
classes in signatures, but not on methods of inline classes.
2020-11-28 00:34:04 +01:00
Dmitry Petrov 498047e64e KT-43562 don't remap static inline class funs as special builtins 2020-11-25 17:31:46 +03:00
Dmitry Petrov 3a166f3592 KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors 2020-11-24 16:06:20 +03:00
Dmitry Petrov 2662679579 KT-43399 properly erase extension receiver type in property$annotations 2020-11-23 13:58:52 +03:00
Dmitry Petrov 551d0c1b64 JVM_IR KT-43440 private-to-this default interface funs are private 2020-11-23 13:56:17 +03:00
Dmitry Petrov e59c8e0a5c JVM_IR KT-42137 bridges are not generated for fake overrides 2020-11-20 14:33:20 +03:00
Steven Schäfer 7bfe2c0bbc JVM IR: Update test expectation for testSamAdapterAndInlineOnce
...and remove redundant bytecode text tests.
2020-11-19 19:46:49 +01:00
Ilmir Usmanov 7761d30365 Minor. Add test to check fallback 2020-11-19 17:39:33 +01:00
Ilmir Usmanov 0d79ed1077 Minor. Update test data 2020-11-19 17:39:32 +01:00
Ilmir Usmanov 2cd9016016 IC mangling: Replace compiler hack with configuration flag 2020-11-19 17:39:30 +01:00
Ilmir Usmanov b33774e5f2 IC mangling: Use empty list as a separator in the new mangling scheme 2020-11-19 17:39:28 +01:00
Ilmir Usmanov 2829d37cf5 IC mangling: Use old mangling scheme for stdlib
This way, new stdlib can still be usable in 1.4.20
2020-11-19 17:39:27 +01:00
Ilmir Usmanov 488d4ab018 IC mangling: Use '_' instead of 'x' as a placeholder before hashing 2020-11-19 17:39:27 +01:00
Ilmir Usmanov c62093f54c IC mangling: Change mangling rules
1. Use 'x' for each parameter, which is not an inline class, every
possible clash is handled by signature rather than name. This change
makes more API changes binary-compatible. So, the changes are in line
with the vision of inline classes are value classes, like primitives.

2. Take return type into account when mangling a function if the return
type is inline class. Otherwise, boxing bridge will not be generated,
which leads to CCE at runtime.
2020-11-19 17:39:24 +01:00
Alexander Udalov 7b5544ebd3 Use -source/target 1.6 for Java sources in codegen tests
In cases when the test has the JVM_TARGET directive, use that one for
Java compilation as well.

Otherwise, for box tests, the corresponding test in `JvmTarget6OnJvm6`
(module `:compiler:tests-different-jdk`) will fail. However, it affects
all codegen tests, so fix a bunch of them which use Java 8+ features to
explicitly compile with JVM target 1.8. In particular, this obsoletes
the SKIP_JDK6 directive in those tests because "JVM_TARGET: 1.8" also
skips it for JDK 6.

The check for IS_SOURCE_6_STILL_SUPPORTED is needed in order to still be
able to run tests in the project while only having a single JDK > 11
installed, and having all of the env vars JDK_16, JDK_17, JDK_18
pointing to that JDK.
2020-11-18 18:43:43 +01:00