Commit Graph

66 Commits

Author SHA1 Message Date
Mikhail Glukhikh 8f1d07084b FIR: introduce ILLEGAL_SUSPEND_FUNCTION_CALL & PROPERTY_ACCESS diagnostics 2021-07-30 19:06:46 +03:00
Ilmir Usmanov dc2485ae71 Support suspend functions as superinterfaces
Forbid mixing suspend and non-suspend functional supertypes.
Since JVM BE generates suspend functional types as non-suspend ones
with SuspendFunction marker interface, there is not way to distinguish
non-suspend functional type from suspend one if they are mixed.
 #KT-18707 Fixed
2021-04-26 22:14:32 +02:00
Denis.Zharkov 0b0a6d6ede Fix false positive ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL
Previously added additional processing at findEnclosingSuspendFunction
seems unnecessary anymore

^KT-43258 Fixed
2021-04-13 11:47:05 +03:00
Victor Petukhov e754585e38 NI: add fallback strategy to get lexical scope to checking coroutine call legality
^KT-40247 Fixed
^KT-40337 Fixed
2020-07-16 15:33:27 +03:00
Mikhail Glukhikh aada7bfe51 FIR: handle suspend functions in callable reference resolve properly 2020-04-20 17:05:31 +03:00
simon.ogorodnik f573719cc1 [FIR] Fix missing receiver type if anonymous function without label 2020-04-08 14:56:17 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Alexander Udalov 77c87fa6c9 Remove API_VERSION 1.3 from compiler tests
So that these tests will now check behavior on the latest API version
2018-12-20 12:53:23 +01:00
Ilmir Usmanov 0c867b4804 Disable callable references to suspend functions in 1.2
#KT-25604: Fixed
2018-08-02 18:55:49 +03:00
Ilmir Usmanov 4ec82cad90 Minor: add test to call callable references from Java 2018-07-05 15:09:06 +03:00
Ilmir Usmanov 28ad498956 Use AnonymousFunctionDescriptor for suspend callable references
Also use it for local suspend functions, which allows us to remove hack
with dropSuspend.

Regenerate tests.
2018-07-05 15:08:49 +03:00
Ilmir Usmanov eea95441c5 Add diagnostics tests. Forbid callable reference to coroutineContext
#KT-16908: Fixed
2018-07-05 15:08:42 +03:00
Denis Zharkov 1d5144b168 Move coroutine-related diagnostic tests to run them with stdlib
It's necessary because all coroutine related declarations (Continuation, etc)
are now in the stdlib
2017-01-27 23:24:13 +03:00
Denis Zharkov 8fa8ba7055 Move coroutine-related runtime parts to kotlin.coroutines.experimental package
#KT-15975 Fixed
2017-01-27 23:24:13 +03:00
Dmitry Petrov 9d4047f5e4 Calls for suspend functions imported from object should be checked in CoroutineSuspendCallChecker. 2017-01-26 09:39:53 +03:00
Dmitry Petrov b9f9894310 KT-15677 KT-15775
Update parser & descriptor renderer to handle parenthesized types and function types properly.
Resolve annotations in parenthesized types.

AnnotationsImpl.isEmpty() returned false for targeted annotations only
(e.g., 'fun @receiver:Ann C?.foo()').
Properly keep track of targeted annotations.
2017-01-19 09:53:17 +03:00
Denis Zharkov d0d617b44e Fix signature mapping for default suspend function from interface
Use jvm suspend function view in function codegen.
Also use SUSPEND_FUNCTION_TO_JVM_VIEW slice if the value exists
for the given key

 #KT-15552 Fixed
2017-01-18 12:00:45 +03:00
Denis Zharkov de9c41c412 Fix overridability rules for suspend functions
Treat suspend and non-suspend functions as conflicting

 #KT-15413 Fixed
2017-01-14 13:24:53 +03:00
Denis Zharkov 978f53414f Prohibit local suspend functions
#KT-15392 Fixed
2017-01-14 13:24:53 +03:00
Denis Zharkov d43a4199f8 Prohibit suspend function type in supertype list
#KT-15391 Fixed
2017-01-14 13:24:53 +03:00
Denis Zharkov f12409504f Prohibit callable references to suspend functions
#KT-15662 Fixed
2017-01-14 13:24:53 +03:00
Denis Zharkov a048dde7a5 Support non-tail suspend calls in front-end
#KT-15597 In Progress
2017-01-14 13:24:53 +03:00
Denis Zharkov 2cb9d3a8ad Move coroutine intrinsics to kotlin.coroutine.intrinsics package
Also rename val SUSPENDED to SUSPENDED_MARKER

 #KT-15698 Fixed
2017-01-14 13:24:53 +03:00
Denis Zharkov 8475869fb3 Support common calls on suspend function typed values
Also support multiple value parameters in suspend function type

 #KT-15379 Fixed
 #KT-15380 Fixed
2016-12-22 11:15:52 +03:00
Denis Zharkov 5ec62108ee Rename RestrictsSuspendExtensions -> RestrictsSuspension 2016-12-16 18:56:30 +03:00
Stanislav Erokhin b527a4d158 Global rename in test data for coroutines
(cherry picked from commit 132f97b)
2016-12-15 23:58:26 +03:00
Stanislav Erokhin 8968bc3dd6 RestrictSuspension -> RestrictsSuspendExtensions
(cherry picked from commit 9e0c733)
2016-12-15 23:58:24 +03:00
Dmitry Petrov f19581dc4d Suspend lambdas can't have value parameters (UNSUPPORTED in M04). 2016-12-15 23:58:16 +03:00
Stanislav Erokhin c5aeaae8e6 Support explicit this receiver (this.foo()) for RestrictSuspension function call. 2016-12-15 23:58:15 +03:00
Mikhail Zarechenskiy 4b892b1c9c Report corresponding diagnostic on suspend lambda 2016-12-15 23:58:13 +03:00
Stanislav Erokhin b88c8ea2e7 Support checks for annotation RestrictSuspension. 2016-12-15 23:58:12 +03:00
Mikhail Zarechenskiy 664485f4bb Introduce keys to control applicability of coroutines
By default now we produce warnings on coroutines
2016-12-15 23:58:07 +03:00
Dmitry Petrov 80bd916f5d 'SuspendFunction$n' should not be visible in member scopes (should be unresolved).
'SuspendFunction$n' class descriptors are created on demand by KotlinBuiltIns (and cached).
On serialization, types constructed with 'SuspendFunction$n' are written as 'Function$n' with extra flag (SUSPEND_TYPE).
On deserialization, corresponding 'SuspendFunction$n' classes are used.
2016-12-15 23:58:05 +03:00
Dmitry Petrov a3338b2230 Allow only 'out' modifier for value parameter modifiers in functional type
(comments also mention 'lazy' and 'ref'; these value parameter modifiers are unsupported, anyway).
2016-12-15 23:58:02 +03:00
Dmitry Petrov eec96f1954 Extension functions & inference. 2016-12-15 23:58:01 +03:00
Stanislav Erokhin 55983a7808 Support type inference for coroutines. 2016-12-15 23:57:55 +03:00
Stanislav Erokhin 34a4159a94 Added coroutine import to front-end tests. 2016-12-15 23:57:53 +03:00
Stanislav Erokhin 0132f3eea7 Remove kotlin.coroutine package from default imports. 2016-12-15 23:57:51 +03:00
Stanislav Erokhin 90586a5a22 Minor. Add some new test cases for suspend function type inside suspend function type. 2016-12-15 23:57:49 +03:00
Stanislav Erokhin 2671826ed1 Fix front-end test data: replace @Suspend -> suspend. 2016-12-15 23:57:49 +03:00
Dmitry Petrov 6d73e13798 Generic type arguments inference for lambdas as suspend functions. 2016-12-15 23:57:46 +03:00
Dmitry Petrov bf987cff5f Tests for basic SuspendFunction-related restrictions (already implemented within type system) 2016-12-15 23:57:45 +03:00
Dmitry Petrov bc069cd686 Lambda in position with suspend function expected type:
simple case - val initializer.
2016-12-15 23:57:44 +03:00
Dmitry Petrov 6e1340da82 Introduce 'SuspendFunction$n<...>' types. 2016-12-15 23:57:41 +03:00
Denis Zharkov 1ab003c029 Support another one coroutine convention in front-end
- There will be no `coroutine` keyword for builders
- They accept a special suspend function type instead
  (it's return type is straightforward, not Continuation<Unit>)
- Instances of these types may be run with special built-in functions
- These built-ins functions are parametrized
  with handleResult/handleException/interceptResume, so these operators
  become unnecessary (and controllers too)

NB: `@Suspend` annotation is subject to replace with the `suspend` modifier
on types
2016-12-15 23:32:11 +03:00
Mikhail Zarechenskiy e67543e08e Revert "Update test data as operator 'mod' became deprecated"
This reverts commit 040f4e90ce.
2016-12-14 15:29:00 +03:00
Mikhail Zarechenskiy 040f4e90ce Update test data as operator 'mod' became deprecated
Revert this commit after changing 'mod' to 'rem' in stdlib
2016-12-09 16:59:25 +03:00
Denis Zharkov b8e1ce7a05 Report error on non-tail suspend-calls
It only concerns calls inside another suspend function

 #KT-14924 In Progress
2016-12-01 10:11:37 +03:00
Denis Zharkov aa50f1d824 Report error when suspend call is illegal in the scope
Namely when it's not contained inside coroutine or another suspend function

 #KT-14924 In Progress
2016-12-01 10:11:37 +03:00
Denis Zharkov 2c3b0aeddb Add 'suspendWithCurrentContinuation' and 'Suspend' object in built-ins
They are part of the new suspension convention, relevant
support in backends will be added in later commits

 #KT-14924 In Progress
2016-11-29 14:14:50 +03:00