Commit Graph

36065 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy feefe8d6ff Propagate coroutine settings support from facet into the language version settings 2016-12-15 23:58:10 +03:00
Mikhail Zarechenskiy 091756b221 Adapt facet, map coroutine settings on three keys 2016-12-15 23:58:09 +03:00
Alexey Sedunov 9460426d26 Kotlin Facet: Add coroutine support setting 2016-12-15 23:58:08 +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 30710955dc Minor: 'vararg' is a modifier on value parameters of functional types. 2016-12-15 23:58:06 +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
Roman Elizarov a70ac0160d fixed runWithCurrentContinuation 2016-12-15 23:58:04 +03:00
Denis Zharkov 85db356611 Minor. Drop test on coroutine applicability 2016-12-15 23:58:03 +03:00
Denis Zharkov 4737b3dd7f Update stubBuilder/deserialization tests on coroutines 2016-12-15 23:58:02 +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
Denis Zharkov 845e116aa9 Update bytecodeText and bytecodeListing tests on coroutines 2016-12-15 23:58:00 +03:00
Denis Zharkov 8387d04425 Revert "Add special tests for interceptRun support"
This reverts commit 01c21e218a.
2016-12-15 23:57:59 +03:00
Denis Zharkov 7ffefb515f Update test data for LightAnalysis/Coroutines 2016-12-15 23:57:58 +03:00
Stanislav Erokhin 6b4cdee887 Fix deserialization for SuspendFunction. 2016-12-15 23:57:57 +03:00
Stanislav Erokhin 42440f50dc Remove soft keyword coroutine & isCoroutine from ValueParameterDescriptor. 2016-12-15 23:57:56 +03:00
Stanislav Erokhin 55983a7808 Support type inference for coroutines. 2016-12-15 23:57:55 +03:00
Stanislav Erokhin 509a504318 Update test data for LookupTracker (removed package kotlin.coroutines from default imports) 2016-12-15 23:57:54 +03:00
Stanislav Erokhin 34a4159a94 Added coroutine import to front-end tests. 2016-12-15 23:57:53 +03:00
Stanislav Erokhin e014fb7181 Added coroutine import to back-end test. 2016-12-15 23:57:52 +03:00
Stanislav Erokhin 0132f3eea7 Remove kotlin.coroutine package from default imports. 2016-12-15 23:57:51 +03:00
Stanislav Erokhin 7d1b883171 Replace @Suspend to suspend in box tests. 2016-12-15 23:57:50 +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
Stanislav Erokhin 3ea24cbe08 Regenerate DiagnosticsTestGenerated 2016-12-15 23:57:48 +03:00
Stanislav Erokhin 642ea81625 Remove annotation Suspend. Use modificator instead. 2016-12-15 23:57:47 +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 9dc458375a Build proper modifier list stubs for 'SuspendFunction$n<...>' types. 2016-12-15 23:57:43 +03:00
Dmitry Petrov cf4fb1eb25 Since '@A R.() -> T' is now parsed as '@A (R.() -> T)',
receiver type with modifiers or annotations should be surrounded in parentheses on rendering: '(@A R).() -> T'

This also fixes stub builder tests (which check that stubs are consistent with rendered descriptors).
2016-12-15 23:57:42 +03:00
Dmitry Petrov 6e1340da82 Introduce 'SuspendFunction$n<...>' types. 2016-12-15 23:57:41 +03:00
Dmitry Petrov a15d423db4 Support modifiers on types in parser
(required for 'suspend' on functional types).

TYPE_REFERENCE element now has MODIFIER_LIST child, which hosts annotations and modifiers for the corresponding type reference.

Annotations and modifiers written before an extension function type are now parsed as annotations and modifiers for the functional type, not the receiver type.
So, '@Ann A.(B) -> C' was '(@Ann A).(B) -> C', and became '@Ann (A.(B) -> C)'.
NB: DSL_SCOPE_VIOLATION testData updated accordingly.

Type projection variance modifiers ('in', 'out') belong to a separate modifier list under corresponding type projection (not under a type reference).
'A<in suspend T>' is 'A<(in (suspend T))>', 'A<suspend in T>' is an error.

In stub builder, create a modifier list node to host annotations and modifiers (none so far; TODO properly serialize/deserialize types with modifiers).
2016-12-15 23:57:41 +03:00
Denis Zharkov 6649f64e9f Support new coroutine convention in JVM backend 2016-12-15 23:57:40 +03:00
Denis Zharkov 5a6b4a3224 Fix compilation 2016-12-15 23:57:22 +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
Denis Zharkov 66c2333eb5 Drop checks related to 'coroutine' modifier 2016-12-15 23:32:10 +03:00
Denis Zharkov b1d1128466 Minor. Move createFunctionType to core
As it will be used in the type mapper soon
2016-12-15 23:32:09 +03:00
Denis Zharkov 72401efb9f Update coroutine related runtime parts 2016-12-15 23:32:08 +03:00
Roman Elizarov 852a5ee064 New coroutine builder convention API 2016-12-15 23:32:07 +03:00
Dmitry Jemerov b4af532cf0 Remove "experimental" tag from JS features in the UI
#KT-15175 Fixed
2016-12-15 18:03:00 +01:00
Alexey Andreev 1bcb225afa JS: fix translation of invoke convention call when it is declared as extension member inside class. See KT-15073 2016-12-15 19:53:37 +03:00
Alexey Andreev 91aeeb20e8 JS: add test to prove that anonymous function that declares lambda is translated correctly. See KT-11589 2016-12-15 19:53:37 +03:00
Alexey Andreev c82f8213b0 JS: extract outer class reference as dispatchReceiver from ResolvedCall, to include it into UsageTracker mechanism. This allows to capture outer class of super class in local classes. See KT-13166 2016-12-15 19:05:34 +03:00
Alexey Andreev 87f4e53544 JS: when translating nested classes of local classes, capture closure variables via outermost local class. See KT-12566 2016-12-15 19:05:34 +03:00
Alexey Andreev b50bfaf071 JS: add test to prove that KT-14419 is not more reproducible. Add test to prove that extension delegate with extension getValue is translated correctly. 2016-12-15 19:05:33 +03:00
Alexey Andreev b21f906856 JS: add tests to prove that compiler does not optimize RTTI and safe calls based on type information. Remove corresponding optimization for !! operation. See KT-14033 2016-12-15 19:05:33 +03:00
Alexey Andreev e6501591fa JS: serialize type of local anonymous class as its denotable supertype. See KT-14888 2016-12-15 19:05:32 +03:00
Alexey Andreev b08afb0e93 JS: prohibit overriding external functions with optional parameters by non-external fake functions 2016-12-15 19:05:32 +03:00
Alexey Andreev e2dab5ab5c JS: prohibit overriding external functions with optional parameters by non-external functions. See KT-13889 2016-12-15 19:05:32 +03:00