Commit Graph

182 Commits

Author SHA1 Message Date
Ilya Gorbunov
9f8e3dad33 Add coroutines-compat jar dependency to those tests that require it
#KT-36083
2020-01-29 09:12:40 +03:00
Dmitriy Novozhilov
76b3964e96 Update testdata according to change compiler version to 1.4 2020-01-17 10:33:50 +03:00
Alexander Udalov
e2a42446ed Use getter names for $annotations methods in most codegen tests
This is needed to update master to 1.4, while still testing the latest
compiler by default. Also add one test on the old behavior.
2019-12-30 16:29:13 +01:00
Ilya Chernikov
f38bb19fc6 [minor] Fix testdata for compiler 1.4 2019-12-19 14:01:01 +01:00
Toshiaki Kameyama
4d9b19da82 Remove comments from function/property implementation template
#KT-18539 Fixed
2019-11-13 08:37:25 +09:00
Nikolay Krasko
4d0fc1dc22 Remove 182 support
#KT-33536 Fixed
2019-08-30 12:13:44 +03:00
Alexander Udalov
01ddac58e1 Add language feature for changed name of property annotations method
#KT-31352 Fixed
2019-08-12 16:48:26 +02:00
Alexander Udalov
ea0142da60 Use JVM name of getter in synthetic method for property annotations
#KT-31352 In Progress
2019-08-12 16:48:25 +02:00
Ilmir Usmanov
e60674f5e1 Fix test data 2019-07-29 20:34:51 +03:00
Ilmir Usmanov
a35d405892 Do not generate accessor if private function is accessed from
coroutines intrinsic lambda.
The logic is if the lambda is crossinline we need to generate the
accessor. However, suspendCoroutine's and
suspendCoroutineUninterceptedOrReturn's parameter, despite being
crossinline, are effectively inline. Thus, we do not need to generate
the accessor.
 #KT-27503 Fixed
2019-07-25 15:25:59 +03:00
Alexander Udalov
f9d61f2dc7 Make inline+reified functions synthetic instead of private in bytecode
#KT-18563 Fixed
2019-05-28 16:17:49 +02:00
Alexander Udalov
b42adcd73d Restructure bytecode listing tests on InlineOnly/inline+reified 2019-05-28 15:56:15 +02:00
Ilmir Usmanov
266976ac1e Fix Java interop of inline suspend functions with suspend parameters
In 1.3.31 I fixed Java interop for inline function with coroutines
(TL;DR: when we need a state machine, generate two methods: one with
normal name, and the other one with $$forInline suffix, for the inliner
to use, just like inline suspend functions), however, I forgot a case
with inline suspend function with inline suspend function parameter.
In this case, the compiler a generated two functions, as needed, but,
neither of them had a state-machine. This change adds the state-machine
for the method with normal name. Note, that suspend inline functions
with crossinline parameter, which are also supported by the change,
did not cause incorrect behaviour, since until now they were generated
as synthetic.

 #KT-31354 Fixed
2019-05-21 17:50:25 +03:00
Ilmir Usmanov
360e30c133 Remove redundant continuation classes and INNERCLASS nodes
#KT-31339 Fixed
2019-05-14 16:00:39 +03:00
Ilmir Usmanov
20b9d8b2f3 Generate state-machine even if the object is going to be transformed
This fixes Java interop of inline functions, which use coroutines.
However, we cannot transform the state-machine. Thus, we generate
a $$forInline counterpart for suspend functions (similar to inline
suspend functions) and invokeSuspend$$forInline for lambdas if these
coroutines are going to transformed (i.e. are declared inside inline
functions).
During transformation we just skip method with state-machine and
transform the $$forInline counterpart. Of course, if inline site is
inline itself, we generate both state-machine version (which will be
dropped during the next transformation) and $$forInline version.
Consequently, the final version of the coroutines will not have
$$forInline counterpart.
Unfortunately, since CompileKotlinAgainstInlineKotlin tests do not allow
java sources, the tests for the interop are usual box tests.

 #KT-30707 Fixed
2019-04-18 01:12:52 +03:00
Ilmir Usmanov
00e952ab15 Introduce CHECK_TAIL_CALL_OPTIMIZATION directive
This directive generates TailCallOptimizationChecker in package helpers.
The check for tail call optimization is based on coroutine stack traces
bug (feature?): when tail call optimization hits, the continuation
object is not generated. Thus, there is no debug metadata for this
suspend function. Consequently, the coroutines stack trace does not
contain stack trace element for that function.
This check is performed by TailCallOptimizationChecker.

Since this is runtime check, unlike bytecode tests, it does not require
test data adjustments on each codegen or inliner change.

Since the check is based on debug metadata, which is JVM specific, there
is not support for other backends yet.
2019-04-09 18:01:21 +03:00
Ilmir Usmanov
d154cf9a59 Fix test data 2019-03-18 14:04:04 +03:00
Ilmir Usmanov
7956ef18b2 Generate RETURN instead of ARETURN if (cross)inline suspend lambda returns Unit
#KT-30073 Fixed
2019-03-18 14:04:02 +03:00
Mikhael Bogdanov
3b57ceeafe Don't generate annotations on $default methods
#KT-29965 Fixed
2019-02-19 10:51:37 +01:00
Ilmir Usmanov
440cccae73 Loosen tail call check
Check that any source of ARETURN is inside a suspension point, not all
of them.
 #KT-27190 Fixed
2019-02-14 12:21:44 +03:00
Ilmir Usmanov
dc6bb4cd08 Revert "Simplify tail-call optimisation check"
This reverts commit a5bcd3495e.

 #KT-27190: Open
 #KT-29327: Fixed
2019-01-18 13:44:05 +03:00
Alexander Udalov
ec2dd58165 Remove LANGUAGE_VERSION from codegen tests on coroutines
Use `// !LANGUAGE: -ReleaseCoroutines` instead in tests which require
old (1.2) coroutines, and nothing in tests which require new coroutines
because master is already 1.3. Also remove superfluous API_VERSION and
other directives which have no effect anymore. Do not include runtime
automatically with `WITH_COROUTINES`/`COMMON_COROUTINES_TEST` in box
tests; require `WITH_RUNTIME` for that (majority of tests already had it
anyway), but remove it from bytecode text tests where runtime is always
added automatically. Fix the coroutine package selection code in
KotlinTestUtils and update the bunch files correspondingly.

Disable tests in `box/coroutines/noStdLib` on JVM: despite the name,
these tests were launched with stdlib because of the code in
CodegenTestCase, and they do not work without it because at least
CoroutineUtil.kt requires stdlib to compile correctly
2018-12-20 12:53:23 +01:00
Alexander Udalov
5b58eb8491 Remove LANGUAGE_VERSION from non-coroutine codegen tests
Most of these tests used this directive as a way to opt in to a new
language feature, and most of those features are already stable for a
long time, so no opt-in is needed. Some other tests used the directive
to opt out from a language feature, replace those by the `LANGUAGE`
directive. One test used the directive to test behavior that actually
depended on the API version; use `API_VERSION` directive there instead.
2018-12-20 12:53:23 +01:00
Alexander Udalov
c1ef89df2c Make anonymous classes for callable references synthetic
#KT-28453 Fixed
2018-12-18 17:48:19 +01:00
Vyacheslav Gerasimov
d84c5b1608 Switch to 183 platform 2018-12-06 20:16:58 +03:00
Mikhael Bogdanov
d2a205c72d Update synthetic parameter processing logic according to ASM 7 changes
#KT-27774 Fixed
2018-11-07 15:42:57 +01:00
Alexander Udalov
17d740a373 Do not try computing return type in OverloadChecker
Return type is not needed for checking overloads, but querying it may
involve resolving function bodies, which usually happens after overload
checking (see LazyTopDownAnalyzer.analyzeDeclarations) and at this point
can lead to incorrect BACKING_FIELD_REQUIRED value being computed for
some properties (see KT-27895)

 #KT-27895 Fixed
2018-11-07 11:00:15 +01:00
Alexander Udalov
5fb1bbe3f3 Add bytecode listing test on private default setter
Also fix test data of the kotlinp test and remove the newly added test
case in the obsolete PropertyGenTest

 #KT-20344 Fixed
2018-10-18 12:13:22 +02:00
Dmitry Petrov
f68ce4b35b Support default parameter values for inline class constructors and funs
#KT-26908
 #KT-26554

Move default parameter value tests to separate directory
2018-10-15 12:21:14 +03:00
Ilmir Usmanov
a5bcd3495e Simplify tail-call optimisation check
Check, that all suspension points are immediately followed by ARETURN
and do not check that all these ARETURNs are immediately preceded by
suspension points.
 #KT-27190 Fixed
2018-10-12 15:10:12 +03:00
Dmitry Petrov
ab90b2b901 Fix nullability propagation in inline class type mapping
#KT-27096

See https://jetbrains.slack.com/archives/C06E082M6/p1537949572000100
2018-09-28 10:46:42 +03:00
Dmitry Petrov
0dd04c3424 Postpone companion object field visibility
Have to reconsider this issue because of interface companion objects.
2018-09-27 10:35:23 +03:00
Dmitry Petrov
792ff3c39e Generate private interface companion object as package-private synthetic 2018-09-27 10:35:23 +03:00
Mikhael Bogdanov
1face1c334 Don't generate annotations on synthetic accessor parameters 2018-09-19 12:14:09 +02:00
Mikhael Bogdanov
38652372ce Generate private constructors for Enums
#KT-2680 Fixed
  #KT-16867 Fixed
2018-09-19 12:14:08 +02:00
Mikhael Bogdanov
9e6637dced Don't generate additional annotations on synthetic accessors 2018-09-14 16:23:57 +02:00
Dmitry Petrov
88fb76bffc Fix annotations loading for inline class constructors 2018-09-14 16:09:41 +03:00
Mikhael Bogdanov
03f092fd39 Revert "Generate private constructors for Enums" cause of bootstrap problem
This reverts commit 81435c9
2018-09-13 17:07:56 +02:00
Mikhael Bogdanov
81435c98fa Generate private constructors for Enums
#KT-2680 Fixed
  #KT-16867 Fixed
2018-09-13 10:09:58 +02:00
Dmitry Petrov
792c5f8b3f Generate metadata and annotations for hidden constructor
Reflection expects to see a callable method for a hidden constructor,
thus, it should be a synthetic accessor.
JVM method signature in metadata should point to the synthetic accessor.
Annotations for hidden constructor should be written on the synthetic
accessor.
2018-09-12 15:33:11 +03:00
Denis Zharkov
fc3c4ad883 Support parameterless and suspend main functions in multifile classes
#KT-26574 Fixed
2018-09-12 09:49:25 +03:00
Denis Zharkov
1cc0c12f87 Add language feature for extended main convention
- suspend
- parameterless

 #KT-17679 Fixed
 #KT-26574 Fixed
2018-09-12 09:49:25 +03:00
Dmitry Petrov
58442899b8 Postpone NoConstantValueAttributeForNonConstVals till 1.4
Requires special inspection for migrating Java code.
2018-09-11 11:27:33 +03:00
Dmitry Petrov
006c0aa740 Hide constructors accepting inline class parameters 2018-09-07 15:57:59 +03:00
Dmitry Petrov
65ad93ebe4 Don't generate getter for private or internal inline class primary vals 2018-09-07 10:27:31 +03:00
Dmitry Petrov
cafaa3e13c Mangle inline class members
<IMPL_SUFFIX> for method is a method signature hash,
if method value parameter types contain inline class types,
otherwise 'impl'.

Constructor methods are named as 'constructor-<IMPL_SUFFIX>'.

Synthesized 'box' and 'unbox' methods are named as
'<METHOD_NAME>-<IMPL_SUFFIX>'.

Erased implementations of overriding and non-overriding methods
are named as '<METHOD_NAME>-<IMPL_SUFFIX>'.

Fully specialized implementation of 'equals' will have a special suffix.
2018-09-07 10:25:53 +03:00
Dmitry Petrov
43b4190f7c Test: visibility of inline class members
Also merge in testInlineClassWrapperPrimaryConstructorIsSynthetic
and testInlineClassConstructors.
2018-09-07 09:31:33 +03:00
Dmitry Petrov
d8a6db8774 Mark synthesized box/unbox methods in inline classes as ACC_SYNTHETIC 2018-09-07 09:31:26 +03:00
Dmitry Petrov
d24b0fd3b2 Test: 'constructor' methods visibility 2018-09-07 09:31:26 +03:00
Dmitry Petrov
0bd1c4d1b7 Make inline class wrapper constructor private 2018-09-07 09:31:26 +03:00