Commit Graph

28463 Commits

Author SHA1 Message Date
Alexey Sedunov 39b46bb3ef Extract Function: Add support for member extension functions 2015-12-02 13:54:04 +03:00
Alexey Sedunov 6abf13be41 Extract Function: Consider member property with invoke() a receiver candidate
#KT-9774 Fixed
2015-12-02 13:54:03 +03:00
Alexey Sedunov 03e1480476 Extraction Engine: Get rid of explicit element offset manipulation and use copyable user data instead 2015-12-02 13:54:02 +03:00
Alexey Sedunov 44bc937499 Shorten References: Fix removal of explicit companion references in the position of callee expression
#KT-10102
2015-12-02 13:54:01 +03:00
Alexey Sedunov 2dcc38b92f Create from Usage: Forbid "Create parameter/local variable/property" on label references
#KT-10119 Fixed
2015-12-02 13:54:00 +03:00
Alexey Sedunov 3c87ccc5ff Move File: Reimplement Move dialog for Kotlin files. Do not show "Search for references" option (consider it true in all cases)
#KT-10118 Fixed
2015-12-02 13:53:59 +03:00
Alexey Sedunov bcadfd4661 Introduce Variable: Suggest choosing between single variable and
multi-declaration. Forbid multi-declaration for collections and arrays
 #KT-10242 Fixed
2015-12-02 13:46:47 +03:00
Ilya Chernikov c1c6d0ee3a fixes after review 2015-12-02 10:30:56 +01:00
Ilya Chernikov 6313ecac1c another attempt to fix parallel compilation - enabling keepalive in compiler use sites, but in jps taking parallel compilation option into account, so it should be now not set in tests 2015-12-02 10:30:56 +01:00
Mikhail Glukhikh 60e457167d Creating deep copy of local function declaration instructions in CFA, regression test #KT-10243 Fixed 2015-12-01 23:40:50 +03:00
Stanislav Erokhin 36206ddf6d Minor. Enable assertion for dist. 2015-12-01 20:44:27 +03:00
Ilya Gorbunov b7a50b333e Better replacement for containsAll, removeAll, retainAll with incompatible types. 2015-12-01 20:35:46 +03:00
Alexander Udalov 2821448dd8 Minor, simplify kdoc for KClass#qualifiedName 2015-12-01 20:20:48 +03:00
Stanislav Erokhin 8807cd828f Removed MemberScope.getPackage 2015-12-01 15:38:04 +03:00
Stanislav Erokhin 846fb397c4 Collect all candidates for completion 2015-12-01 15:38:04 +03:00
Stanislav Erokhin 2b66af29aa Added debug info 2015-12-01 15:38:03 +03:00
Stanislav Erokhin 22b14cfc5c Fix missing smart casts 2015-12-01 15:38:03 +03:00
Stanislav Erokhin 3776e5698f Removed hidden descriptors from new resolve 2015-12-01 15:38:03 +03:00
Stanislav Erokhin e92c314b46 Base dynamic support in new resolve 2015-12-01 15:38:02 +03:00
Stanislav Erokhin 2987576a0a Minor. fix applicability level for UsedSmartCastForDispatchReceiver 2015-12-01 15:38:02 +03:00
Stanislav Erokhin 5edadfe8ea Refactor ScopeTowerProcessor 2015-12-01 15:38:01 +03:00
Stanislav Erokhin bc49825f55 Fix testLib test 2015-12-01 15:38:01 +03:00
Pavel V. Talanov aa1a08fe7a Minor, getModuleInfo: improve on failure messages 2015-12-01 14:53:16 +03:00
Pavel V. Talanov bc816851f1 getModuleInfo: Provide utility to default to null instead of logging an error
Use it to workaround cases when java resolve references some unexpected classes/files, referencing non-physical Dummy.java in particular
2015-12-01 14:53:15 +03:00
Pavel V. Talanov 5e35be347c getModuleInfo: Correct module info for members of light classes for decompiled Kotlin classes 2015-12-01 14:53:12 +03:00
Natalia Ukhorskaya dc60c025c3 Support Evaluate Expression for renamed local variables in inline function
#KT-10179 Fixed
2015-12-01 11:48:43 +03:00
Natalia Ukhorskaya cd5e406876 Minor: fix warnings 2015-12-01 11:48:41 +03:00
Natalia Ukhorskaya a1f3c5381e Rename local variable for this in inline function 2015-12-01 11:48:41 +03:00
Michael Bogdanov a932315bf9 Rename local vars from inlined function
#KT-9798 Fixed
2015-12-01 11:48:40 +03:00
Natalia Ukhorskaya 5073b1d372 Don't skip inlined this 2015-12-01 11:48:39 +03:00
Natalia Ukhorskaya 29778311e8 Drop unnecesary logic about additional context for lambda in debugger 2015-12-01 11:48:38 +03:00
Dmitry Petrov f34f7556bc KT-10192 got fixed due to new if/when check
(which doesn't depend on the expected type for expression)
 #KT-10192 Fixed
2015-12-01 10:36:40 +03:00
Dmitry Petrov 76931affc6 KT-10139:
Non-exhaustive 'when' without 'else' used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.
2015-12-01 10:36:40 +03:00
Dmitry Petrov 1a3a296827 KT-10139: any if without else used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.

 #KT-10139 Fixed
2015-12-01 10:36:40 +03:00
Denis Zharkov b0dab4c67a Add minor changes after review
- Rename GENERIC_TYPE -> GENERIC_ARGUMENT
- Make 'callableDescriptor' nullable
2015-12-01 08:21:03 +03:00
Denis Zharkov 0fd2484bc9 Fix project source to overcome bootstrap problem 2015-12-01 08:21:02 +03:00
Denis Zharkov c4bc2c9ba6 J2K Renderer: convert and make contravariant 2015-12-01 08:21:02 +03:00
Denis Zharkov 5a5889e3f3 J2K Renderer: .java -> .kt 2015-12-01 08:21:01 +03:00
Denis Zharkov 303c756302 Refine generic signature for fields
- For vals use the same semantics as for return types
- For vars use the same semantics as for value parameters
2015-12-01 08:21:01 +03:00
Denis Zharkov 64e0af48ed Minor. Change default for needPrimitiveBoxing 2015-12-01 08:21:01 +03:00
Denis Zharkov ddb67d6c9c Support JvmSuppressWildcards and JvmWildcard annotations
#KT-9898 Fixed
2015-12-01 08:21:00 +03:00
Denis Zharkov 6292833a69 Refine generic signature for Map.get/remove
Before this change generic signature wasn't written because of wrong
assumption about it absence in all cases where we replace generic parameter
with Object
2015-12-01 08:21:00 +03:00
Denis Zharkov 20cbceb56d Add temporary hack for wildcards in Collections
By default we would render 'MutableCollection<String>.addAll(Collection<String>)' as
'(LCollection<String>;)' (without wildcard) because String is final and
effectively it's the same as '(LCollection<? extends String>;)'.

But that's wrong signature in a sense that java.util.Collection has different
signature: '(LCollection<? extends E>)'.

Actually the problem is much wider than collections,
it concerns any Java code that uses Kotlin classes with covariant
parameters without '? extends E' wildcards.

Temporary solution is just to hardcode/enumerate builtin methods
with special signature.
2015-12-01 08:20:59 +03:00
Denis Zharkov 0255be7deb Minor. Pass callableDescriptor into writeParameter 2015-12-01 08:20:59 +03:00
Denis Zharkov 406e31f54a Change default rules for declaration-site wildcards
Mostly this commit is about skipping wildcards that are redundant in some sense.
The motivation is that they looks `long` in Java code.

There are basically two important parts: return types and value parameters.

1. For return types default behaviour is skipping all declaration-site wildcards.
The intuition behind this rule is simple: return types are basically used in subtype position
(as an argument for another call), and here everything works well in case of 'out'-variance.
For example we have 'Out<Out<T>>>' as subtype both for 'Out<Out<T>>>' and 'Out<? extends Out<? extends T>>>',
so values of such type is more flexible in contrast to `Out<? extends Out<? extends T>>>` that could be used only
for the second case.

But we have choosen to treat `in`-variance in a different way: argument itself
should be rendered without wildcard while nested arguments are rendered by the rules
described further (see second part).

For example: 'In<Out<OpenClass>>' will have generic signature 'In<Out<? extends OpenClass>>'.
If we omit all wildcards here, then value of type 'In<Out<OpenClass>>'
will be impossible to use as argument for function expecting 'In<? super Out<? extends Derived>>'
where Derived <: OpenClass (you can check it manually :]).

And this exception should not be very inconvinient because in-variance is rather rare.

2. For value parameters we decided to skip wildcards if it doesn't make obtained signature weaker
in a sense of set of acceptable arguments.

More precisely:
    a. We write wildcard for 'Out<T>' iff T ``can have subtypes ignoring nullability''
    b. We write wildcard for 'In<T>' iff T is not equal to it's class upper bound (ignoring nullability again)

Definition of ``can have subtypes ignoring nullability'' is straightforward and you can see it in commit.

 #KT-9801 Fixed
 #KT-9890 Fixed
2015-12-01 08:20:59 +03:00
Denis Zharkov 1731cb8b40 Make jvmSignature optional in WriteSignatureTest 2015-12-01 08:20:58 +03:00
Denis Zharkov 917420f332 Convert TypeMappingMode from enum to plain class with constant instances 2015-12-01 08:20:58 +03:00
Denis Zharkov faf1e17888 Introduce TypeMappingMode.toGenericArgumentMode 2015-12-01 08:20:57 +03:00
Denis Zharkov ef2bc28463 Minor. Rename TypeMappingMode entries 2015-12-01 08:20:57 +03:00
Denis Zharkov d22aaf9d52 Introduce writeDeclarationSiteProjections option into TypeMappingMode 2015-12-01 08:20:57 +03:00