Commit Graph

2448 Commits

Author SHA1 Message Date
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 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 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
Alexander Udalov 212240a008 Collect all deprecations, do not stop on the first found one
#KT-15245 In Progress
2016-12-15 11:46:17 +03:00
Stanislav Erokhin 3600b51d90 Minor. fix test data. 2016-12-14 23:59:38 +03:00
Stanislav Erokhin 457918a6dd Changed name resolution for dynamic extension. Added annotation DynamicExtension. 2016-12-14 21:36:26 +03:00
Mikhail Zarechenskiy 5b5d09b6b2 Fix test data: rename 'mod' to 'rem' 2016-12-14 15:29:00 +03:00
Mikhail Zarechenskiy e83568bcf3 Update test data after adding operator rem to builtIns 2016-12-14 15:29:00 +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 42d867b3bf Support number conversion for binary 'rem' operator 2016-12-14 15:29:00 +03:00
Stanislav Erokhin 59efedf610 Rename platform to header. 2016-12-13 18:00:00 +03:00
Stanislav Erokhin dbe8edda5f Remove propertyDelegate and fix unused parameter checker for provideDelegate. 2016-12-12 23:14:09 +03:00
Stanislav Erokhin 9dc9fb578f Rename toDelegateFor to provideDelegate. 2016-12-12 23:14:07 +03:00
Dmitry Petrov e2b6d2d849 Drop 'propertyDelegated' convention (without additional deprecation ceremony). 2016-12-12 23:13:58 +03:00
Dmitry Petrov 5ddf8e60e6 Use delegate initializer expression resolution scope for 'toDelegateFor' resolution. 2016-12-12 23:13:57 +03:00
Dmitry Petrov a6bc7271ae operator toDelegateFor: add front-end test for local delegate property 2016-12-12 23:13:56 +03:00
Dmitry Petrov 2ee31916c7 'createDelegate' operator renamed to 'toDelegateFor' 2016-12-12 23:13:55 +03:00
Dmitry Petrov e2ba288323 'createDelegate' operator convention:
- resolution & inference
- additional diagnostic for language feature support
2016-12-12 23:13:54 +03:00
Dmitry Petrov d3ab0f066e 'createDelegate' operator declaration 2016-12-12 23:13:53 +03:00
Mikhail Zarechenskiy 7a0e44b8f9 Resolve '%' as 'mod' when LV=1.0 2016-12-09 17:01:41 +03:00
Mikhail Zarechenskiy bc4a492f4d Resolve for rem/modAssign and mod/remAssign
rem/remAssign always wins if it is possible
2016-12-09 17:00:27 +03:00
Mikhail Zarechenskiy 8e73a902e4 Additional tests on mod/rem migration 2016-12-09 16:59:26 +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
Mikhail Zarechenskiy 5f71f1bcad Add warnings at declaration and call sites of operator 'mod' 2016-12-09 16:59:24 +03:00
Mikhail Zarechenskiy 97ca51381a Gradual migration of operator 'mod' to 'rem'
- Introduce new 'rem' operator convention
 - Prefer 'rem()' to 'mod()' when both are available, even if mod() is a
   member, and rem() -- an extension
 - Place operator 'rem' under the language feature
2016-12-09 16:43:35 +03:00
Mikhael Bogdanov f4259c5f82 Added deprecation for protected call within inline functions 2016-12-09 11:55:16 +01:00
Mikhael Bogdanov 038065e827 Updated NON_PUBLIC_CALL_FROM_PUBLIC_INLINE diagnostic to support @PublishedApi 2016-12-09 11:55:15 +01:00
Mikhael Bogdanov 7ea29d3397 Wrong @PublishedApi usage diagnostic 2016-12-09 11:55:15 +01:00
Denis Zharkov 891a036b59 Change resolution priority level for SAM adapters
After this change SAM adapters are being resolved in the same group
as members, thus their overload resolution happens simultaneously.

But in the case of overload resolution ambiguity try to filter out all
synthetic members and run the process again.

See the issue and new test for clarification

 #KT-11128 In Progress
2016-12-07 21:04:44 +03:00
Mikhail Zarechenskiy 160d43fe2e Introduce new feature: division by zero in constant expressions 2016-12-02 17:42:56 +03:00
Dmitry Petrov e63abff7e8 Recognize possible generic property call chain ('a.b<T>.c') on '::' LHS. 2016-12-02 10:20:05 +03:00
Mikhail Zarechenskiy 25c3b43858 Support Infinity and NaN in constant evaluator
This allows to store infinities and NaNs inside const vals
2016-12-01 16:08:53 +03:00
Denis Zharkov cbebb06574 Do not return star-projections during approximation
See comment in test for clarification

 #KT-14453 Fixed
2016-12-01 13:39:38 +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
Denis Zharkov a34c9c2580 Support new suspend convention in frontend
#KT-14924 In Progress
2016-11-29 14:14:50 +03:00
Dmitry Petrov 2cd6c85cc7 Syntax forms 'a<T>::foo', 'a?::foo' have special cases resolved for future releases.
'a<T>::foo' is reserved if 'a' is a simple name and can be resolved as an expression
(this can be extended to 'a.b.c<T>::foo' case, although that is rather hard to implement using PSI).

 'a?::foo' is reserved if 'a' can be resolved as an expression.
2016-11-29 13:10:01 +03:00
Dmitry Petrov 5d1b848658 KT-14196 Do not allow class literal with expression in annotation arguments 2016-11-29 13:10:01 +03:00
Alexander Udalov 8d3f6f1ce7 Check platform<->impl declaration compatibility
For each platform declaration, there must be at least one impl declaration in
the module with the compatible signature; similarly, for each impl declaration,
there must be at least one platform declaration with the compatible signature.

Note that currently the presence of the 'impl' modifier is not checked yet.

Also, the sad fact is that if you have platform and impl declarations which are
not compatible, you get two errors: on the platform delcaration and on the impl
declaration. This needs to be addressed as well
2016-11-25 20:50:26 +03:00
Alexander Udalov ad59d5a1c8 Define applicability for platform/impl modifiers 2016-11-25 20:50:24 +03:00
Alexander Udalov c1eebacd55 Do not render declarations from other modules in diagnostic tests
Because PackageViewDescriptor may consist of several package fragments from
different modules (see LazyPackageViewDescriptorImpl#fragments), we now filter
out fragments from irrelevant modules before rendering them into the .txt
2016-11-25 20:50:21 +03:00
Alexander Udalov a8bd82e863 Support only simple declarations for 'impl' type aliases
E.g. 'impl typealias Foo<A, B> = Bar<A, B>' is allowed; everything else
(variance, changing order of parameters, etc.) is pretty much disallowed.

This is done for simplicity: otherwise matching the platform/impl class scopes
would be not so straightforward
2016-11-25 20:50:20 +03:00