Commit Graph

2438 Commits

Author SHA1 Message Date
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
Alexander Udalov 751949db69 Support platform/impl modifiers for classes
Do not report "unused parameter" for parameters of platform declarations. Do
not allow platform class constructors to have val/var parameters or have an
explicit delegation call to another constructor. Do not allow platform classes
to have 'init' blocks.

Also suppress the "supertype not initialized" error for platform classes: the
supertype should be initialized in the impl class
2016-11-25 20:50:19 +03:00
Alexander Udalov ce9691cd2b Support platform/impl modifiers for properties
Do not allow platform properties to have backing fields, initializers, be
delegated, lateinit or const, or have accessors with bodies
2016-11-25 20:50:18 +03:00
Alexander Udalov af1264a46d Support platform/impl modifiers for functions
Also add a new capability for ModuleDescriptor, which is used to obtain the
platform in the multi-platform scenario in tests.

Suppress the following errors for platform functions: "function has no body"
and "nothing to inline". Also do not report redeclaration between platform and
non-platform functions because this is the case when the common +
platform-specific code are analyzed together.

Note that some diagnostics reported in tests are not yet implemented in this
commit, they appear in subsequent commits
2016-11-25 20:50:17 +03:00
Alexander Udalov 525e6e53fe Do not report unhelpful diagnostic for unresolved call inside inline function
#KT-14887 Fixed
2016-11-22 18:19:01 +03:00
Alexander Udalov eacf64e4db Report initializer block-related diagnostic on 'init' keyword 2016-11-22 18:19:01 +03:00
Denis Zharkov 5276c3c755 Support 'interceptResume' operator in frontend
#KT-14891 In Progress
2016-11-22 14:33:40 +03:00
Dmitry Petrov e6fcf20cf2 No variance elision in type alias substitution.
Add test with cyclic inheritance via type alias.
2016-11-22 10:04:47 +03:00
Dmitry Petrov 67fe28b8d8 Combine type annotations for arguments of type aliases. 2016-11-22 10:04:47 +03:00
Dmitry Petrov 063bce23d2 Prohibit constructing projected types via type aliases. 2016-11-22 10:04:47 +03:00
Dmitry Petrov bab9cde280 Type alias projections & substitution rules.
1. Substitution variance (sv) is a substitution composition of type alias argument variance (av)
and corresponding expanding type argument variance (ev):
sv =
  | av == ev -> av
  | av == INVARIANT -> ev
  | ev == INVARIANT -> av
  | else -> (variance conflict error; av)

2. Resulting variance (rv) is a type argument composition of sv and type parameter variance (pv):
rv =
  | sv == tv => INVARIANT
  | sv == INVARIANT => INVARIANT
  | tv == INVARIANT => sv
  | else -> (variance conflict error; sv)
2016-11-22 10:04:47 +03:00