Commit Graph

362 Commits

Author SHA1 Message Date
Denis Zharkov 9cb8a35275 Minor. Pull user-data related things to CallableDescriptor
Currently, we assume user data for all non-FunctionDescriptor
declarations is empty
2018-09-12 09:49:25 +03:00
Mikhail Glukhikh ad4da3d761 Code cleanup: convert flatMap { it } into flatten() 2018-09-07 16:32:18 +03:00
Alexander Udalov 34c033bcaf Take ReceiverParameterDescriptor in FunctionDescriptorImpl.initialize
Instead of just KotlinType. This will allow to pass annotations on the
receiver at call sites
2018-08-27 23:37:04 +02:00
Cuihtlauac ALVARADO 813d7ff84a Remove useless parameter
It seems a candidate is added either when requiresExtensionReceiver is true and
receiver is not null or when requiresExtensionReceiver is false and receiver is null.
Consequently, f appears useless.
2018-08-24 18:48:03 +03:00
Cuihtlauac ALVARADO eb7d77ebd9 Accept renaming and formating requests
* Rename "resolve" into "resolveCandidates"
* Use multi-line formatting for formal parameters
* Move ")" down one line at call sites
2018-08-24 18:48:03 +03:00
Cuihtlauac ALVARADO bf08755969 Factor duplicated code.
Move SimpleScopeTowerProcessor from TowerResolver into ScopeTowerProcessors.

Lift code duplicated in functions:

  * ExplicitReceiverScopeTowerProcessor.simpleProcess()
  * QualifierScopeTowerProcessor.simpleProcess()
  * NoExplicitReceiverScopeTowerProcessor.simpleProcess()

into AbstractSimpleScopeTowerProcessor. Turn it into a function and call it
in the various context. Incidentally, now useless functions resolveAsMember()
and resolveAsExtension() are  removed.
2018-08-24 18:48:03 +03:00
Mikhail Zarechenskiy 1a511166cc Discriminate unsigned types in overload resolution
#KT-24717 Fixed
 Relates to #KT-25996 and #KT-25997
2018-08-09 09:49:17 +03:00
Dmitry Savvinov 76c651421b Deprecate visibility of static members inherited from Java
Now they are not visible by short name through companion objects, just
like classifiers in KT-21515

^KT-25333 In progress
2018-07-19 13:32:38 +03:00
Ilmir Usmanov eea95441c5 Add diagnostics tests. Forbid callable reference to coroutineContext
#KT-16908: Fixed
2018-07-05 15:08:42 +03:00
Mikhail Zarechenskiy 8148bdc4d0 Support inline classes in MPP resolver/checker model 2018-06-08 19:13:39 +03:00
Mikhail Zarechenskiy 9891f562cc [NI] Make subtyping algorithm more robust to error types
During subtyping/incorporation we transform types (e.g. changing nullability,
 form of the type) and, basically, we're doing this to some FIXPOINT.
 It's important that we use `KotlinType.hashCode()` to compare types, but
 for error types hashCode is a hashCode of its supertype and, for example,
 `makeNullableAsSpecified` method recreate type every time. So, we continue
 to generate new constraints and we'll never stop incorporation algorithm
2018-06-07 15:45:53 +03:00
Mikhail Zarechenskiy 04c13aeae8 [NI] Fix exception on capturing type with inner typealiased typed 2018-06-05 14:05:50 +03:00
Mikhail Zarechenskiy b30b00eedb Configure overload resolution on unsigned types same as for primitives 2018-06-04 18:37:42 +03:00
Stanislav Erokhin 8f0b073c08 [NI] Prototype for SAM-conversion.
Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters

TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable

[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
2018-06-04 12:21:56 +03:00
Stanislav Erokhin 4b8e95c243 Minor. Extract preparation for expected type to separate function 2018-06-04 12:21:52 +03:00
Stanislav Erokhin 232d069493 Minor. Use getExpectedType as util function for parameter type calculation
For almost all cases this change do nothing, because if parameter isn't
vararg, then both methods (FlatSignature.argumentValueType &
getExpectedType) return same value. Moreover if it is vararg parameter
and spread operator is not used, then results will be the same.
We can observe difference only when spread operator used
and when we compare two candidates corresponding parameters
for both spread arguments should be vararg parameters.
I.e. old way compares: Int vs String
new way compares: Array<out Int> vs Array<out String>.
2018-06-04 12:21:51 +03:00
Stanislav Erokhin b31d027aed [NI] Report deprecation for function from companion in NI. 2018-06-04 12:21:48 +03:00
Anton Bannykh 03e46ce0ca JS: more default arguments fixes (KT-24413, KT-21968 fixed)
MPP-related:
* inherited from interfaces
* inherited body from interface
* default arguments in an interface, implemented by a class delegate
* super call of a method with default argument

Also:
* inheritance from an interface and another interface descendant (KT-21968)
* inheritance through an intermediate interface
2018-05-28 15:27:21 +03:00
Alexander Udalov ed6f044fb0 Add internal WasExperimental for stdlib
Usages of declarations annotated with WasExperimental are allowed even
if the API version requirement is not satisfied, provided that the
opt-in to all mentioned markers is given. This is needed for smooth
graduation of API in kotlin-stdlib
2018-05-07 11:37:31 +02:00
Mikhail Zarechenskiy 54ca2cbbe0 Introduce original for ReceiverValue and use it inside coroutine checker 2018-05-04 19:54:14 +03:00
Mikhail Zarechenskiy 64b10d827d [NI] Refactoring: rename NonFixedType -> StubType 2018-05-04 19:08:22 +03:00
Mikhail Zarechenskiy 5187f6b060 [NI] Improve performance of resolution part for postoned variables 2018-05-04 19:08:21 +03:00
Mikhail Zarechenskiy a30a1f2a96 [NI] Update calls after inference for coroutines 2018-05-04 19:08:21 +03:00
Mikhail Zarechenskiy 99a95f31d3 [NI] There is no need in copying constraint storage as it read-only 2018-05-04 19:08:20 +03:00
Mikhail Zarechenskiy e0ca3421ca [NI] Use only receiver from coroutine call to mark postponed variable 2018-05-04 19:08:20 +03:00
Mikhail Zarechenskiy 59c4b9ad2f [NI] Make it possible to use nullable non-fixed type 2018-05-04 19:08:20 +03:00
Mikhail Zarechenskiy 9209222112 [NI] Introduce inference for coroutines and builder-like constructions 2018-05-04 19:08:19 +03:00
Alexander Udalov 056c41bc00 Minor, improve kdoc of default args utilities in ArgumentsUtils.kt 2018-04-30 15:26:50 +02:00
Pavel V. Talanov 5ddb7c71d1 Mpp resolve: fix actual/expect declaration lookup
Previously we would look fo expect declaration in common dependencies
    as opposed to looking inside the module exclusively
2018-04-20 20:00:04 +02:00
Mikhail Zarechenskiy 4a1c63cbbd [NI] Rename: isVariableReceiverForInvoke -> isForImplicitInvoke 2018-04-20 13:06:21 +03:00
Mikhail Zarechenskiy 397cc4f772 [NI] Support implicit invoke calls on parenthesized receivers 2018-04-20 13:06:21 +03:00
Denis Zharkov 1442dd6c2b Avoid exponential complexity in LexicalScope::findLocalVariable
There was an exponential complexity in case we have a chain
of nested LexicalScopeWrapper instances:
we were walking through the chain and on each step running
the algorithm recursively.

Such a case is possible in scripts where each line contains LexicalScopeWrapper

The fix looks safe to me because delegate was used there
for checking !is ImportingScope && !is LexicalChainedScope

In all other means, being recursively run the algorithm does the same job.

 #KT-22740 Fixed
2018-04-11 17:53:19 +03:00
Denis Zharkov a3c8afade5 Minor. Reformat ScopeUtils.kt 2018-04-11 17:53:19 +03:00
Alexey Tsvetkov 8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Mikhail Zarechenskiy 4ed5e2f35e [NI] Improve inference for lambdas that return lambdas 2018-03-26 14:59:52 +03:00
Mikhail Zarechenskiy bb4fb669a0 [NI] Refactoring: rename method 2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy 53b434a3e3 [NI] Use getValue/setValue methods simultaneously to infer types
Rewrite inference for delegated properties with the new scheme
2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy 0f60965595 [NI] Introduce basic resolver for many candidates 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy ff10e97c28 [NI] Make CallResolutionResult more typed 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy c8ef785010 [NI] Move method hasContradiction to constraints storage 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy 663b417c5a [NI] Introduce method to add extra constraints before completion 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy 50027225a1 [NI] Extract interface InferenceSession to a separate file 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy 1a5282c4b7 [NI] Introduce methods to extend inference for several candidates 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy 01cdc08026 [NI] Refactor: extract method to run candidate completion out 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy 2235f5eb48 [NI] Refactor: create separate method for candidate preparation 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy 8c44d44e78 [NI] Propagate class to extend inference through resolution context 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy 887a69b72e [NI] Extend constraint completer to work with several resolve atoms 2018-03-25 20:22:32 +03:00
Mikhail Zarechenskiy 15b46cdda9 [NI] Don't perform useless computation for smartcasts 2018-03-23 14:18:32 +03:00
Roman Artemev 0d0adbbc05 Fixed handling of default params in declaration (KT-23239) 2018-03-21 12:44:24 +03:00
Yan Zhulanow 34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00