Commit Graph

32776 Commits

Author SHA1 Message Date
Pavel V. Talanov 8a9de2a00f Show all Kotlin annotations when browsing hierarchy of "java.lang.Annotation" 2016-07-26 11:42:09 +03:00
Pavel V. Talanov 84dae76bd9 Index enum classes as if they have "Enum" in supertypes
#KT-13057 Fixed
2016-07-26 11:42:08 +03:00
Pavel V. Talanov 8f006bd4aa Add test for KT-13057 with infrastructure 2016-07-26 11:42:08 +03:00
Alexey Andreev 05dd039151 KT-12275 Add JS optimization that transforms the following code
```
do {
    X
    if (B) break;
} while (A)
```

to

```
do {
    X
} while (!B && A)
```

Add inversion that takes boolean expression and applies negation to it, simplifying if possible (like !!a => a).
2016-07-25 18:46:46 +03:00
Alexey Andreev b3d29adad9 KT-12275 Add JS optimization that transforms the following code
```
do {
    guard: {
        // do something
        break guard;
        // do something
    }
} while (condition)
```

to

```
do {
    // do something
    continue;
    // do something
} while (condition)
```
2016-07-25 18:32:10 +03:00
Alexey Andreev 1a61115148 KT-12275 Preserve evaluation order when do..while loop with extractable condition contains continue statement 2016-07-25 18:32:08 +03:00
Alexander Udalov 3ef3bb8251 Minor, add comment, remove warning suppression 2016-07-25 15:55:31 +03:00
Alexander Udalov d945c33d5e Move some members from OverrideResolver to OverridingUtil 2016-07-25 15:55:31 +03:00
Alexander Udalov aaf618e035 Minor, inline HashSetUtil#symmetricDifference 2016-07-25 15:55:31 +03:00
Alexander Udalov 475fb6e8a7 Simplify OverrideResolver#filterOverrides
- move source vs binary equivalent call filtering hack to
  ResolutionResultsHandler (see c4778bfe5a for
  the original commit introducing this behavior)
- rewrite the algorithm so that it doesn't need noDuplicates in the beginning:
  modulo the hack above whish is only needed in ResolutionResultsHandler,
  descriptor equivalence is checked anyway in OverrideResolver#overrides
2016-07-25 15:55:31 +03:00
Alexander Udalov a6faab834d Move OverrideResolver#generateOverridesInAClass to CollectionStubMethodGenerator
Also simplify substantially
2016-07-25 15:55:31 +03:00
Alexander Udalov bbd1e889a6 Use kotlin.Function1 instead of intellij Function in OverrideResolver 2016-07-25 15:55:31 +03:00
Alexander Udalov 191f532675 Remove OverrideResolver#filterOutOverriding, simplify the only usage 2016-07-25 15:55:31 +03:00
Alexander Udalov 5d04fa3c2f Remove unreachable code in ResolutionResultsHandler 2016-07-25 15:55:31 +03:00
Alexander Udalov 89c5799155 Move utilities used in IDE from OverrideResolver to descriptorUtils.kt 2016-07-25 15:55:31 +03:00
Alexander Udalov 24c383a009 Remove unnecessary loop from OverrideResolver#filterOverrides
It was not needed because overridability in both ways is already checked in
DescriptorEquivalenceForOverrides, which is called in
OverrideResolver#overrides
2016-07-25 15:55:31 +03:00
Alexey Tsvetkov 517e457f06 Update changelog 2016-07-25 15:54:39 +03:00
Denis Zharkov becb1f1f95 Make stack values for assignment-like operations lazy
As well as for other kinds of expressions

Within attached test they were generated twice in case of last expression of coroutine block,
because coroutine related codegen part is built upon assumption that all expressions should be generated lazily

Also add a test about unary postfix increment/decrement

 #KT-13156 Fixed
2016-07-25 13:56:43 +03:00
Alexey Sedunov 0a8490a068 Introduce Type Alias: Suggest initial name based on extracted type 2016-07-25 12:44:30 +03:00
Alexey Sedunov 0769d47f4b Introduce Type Alias: Support type constructor extraction 2016-07-25 12:44:28 +03:00
Alexey Sedunov b5828a5fa1 Refactoring: Allow multiple ElementKinds when choosing element to refactor 2016-07-25 12:44:26 +03:00
Alexey Sedunov 09d36291de Misc: Update function/type alias signature preview upon changing checkbox state 2016-07-25 12:44:24 +03:00
Mikhail Glukhikh 30b0875b26 Merge pull request #906 from cypressious/make_val_private
Quickfix "Make primary constructor parameter a val" makes the val private now #KT-13187 Fixed
2016-07-25 09:46:42 +03:00
Mikhail Glukhikh 299097d112 KT-10903 Lambda to callable reference: use named arguments if needed, lift restriction about parameter default values
(cherry picked from commit 5232af5)
2016-07-25 09:40:34 +03:00
Dmitry Jemerov a979c7e1d7 ugly fix for failing tests. without the string template, KotlinFilePathReferenceContributor injects a file reference into the string literal, and an unrelated intention (AddAnnotationIntention) tries to resolve it. resolving the reference caches the default contexts in FIleReferenceSet, which caches the order entries of a module in an OrderRootsCache. this creates VirtualFilePointers which are for some reason not disposed properly. 2016-07-23 21:18:26 +02:00
Kirill Rakhman ce80f94830 Quickfix "Make primary constructor parameter a val" makes the val private now
Fixes #KT-13187
2016-07-23 14:32:25 +02:00
Yoshinori Isogai 8aaf28e240 KT-12887 Extend selection should select call's invoked expression (#904)
#KT-12887 fixed
2016-07-22 21:23:42 +03:00
Alexander Udalov 83000c50ff Remove quotes around visibility in invisible member diagnostic 2016-07-22 18:13:41 +03:00
Alexander Udalov b6b2303aa7 Improve error message for inaccessible invisible_fake members
#KT-8989 Fixed
2016-07-22 18:13:40 +03:00
Alexander Udalov a92f0a0446 Do not report "reflection is not available" on built-in sources 2016-07-22 18:13:39 +03:00
Alexander Udalov 9be219b69c Check presence of dispatch receiver parameter in modifier checks
Also fix typo in "inapplicable infix" diagnostic message
2016-07-22 18:13:39 +03:00
Alexander Udalov 2a390155a9 Fix quotes in diagnostic messages
See 8316953259
2016-07-22 18:13:38 +03:00
Kirill Rakhman 5948b69679 AddConstModifierIntention: handle more edge cases #KT-13173 Fixed
(cherry picked from commit 4755596)
2016-07-22 18:07:14 +03:00
Nikolay Krasko adbb07f30b Do not fail on adding sources to libraries that can't be recognized (EA-73238)
It's valid situation when user in Gradle project had created ordinal Java module and wants to configure
it with Kotlin. We should add Gradle library to dependency but there's no need to configure sources for it.
2016-07-22 15:21:27 +03:00
Nikolay Krasko 0f4319de8e Minor: fix warning 2016-07-22 15:21:27 +03:00
Nikolay Krasko 95d0604339 Evaluate getting text under read action (EA-82155, EA-82587) 2016-07-22 15:21:27 +03:00
Nikolay Krasko 3d0cfdf585 Don't fail if there's no modules in combobox with unconfigured modules (EA-76203)
Confirmed reproduction steps:
1. Open Kotlin gradle project (or do the sync) - it will be considered unconfigured until synchronisation is finished
2. Click configure and see Choose Configuration popup
3. Wait sync is finished
4. Click proposed configurator in popup

As all projects are considered configured now, single module selection will be empty
2016-07-22 15:21:27 +03:00
Alexander Udalov 0dd71cc0c0 Minor, add test on bound reference to enum entry member 2016-07-22 11:05:19 +03:00
Alexander Udalov 9ab8da2ef9 Fix type of reference to protected var
#KT-12982 Fixed
2016-07-22 11:05:19 +03:00
Alexander Udalov 6baf3ae737 Minor, inline LexicalScope.Companion.empty 2016-07-22 11:05:19 +03:00
Alexander Udalov 969ff43152 Merge CallableReferencesResolutionUtils.kt into DoubleColonExpressionResolver 2016-07-22 11:05:19 +03:00
Alexander Udalov 2fcd4e955a Simplify code in callable reference resolution 2016-07-22 11:05:19 +03:00
Alexander Udalov 00f1415ed7 Fix "rewrite at slice LEXICAL_SCOPE" during callable reference resolution
Following the TODO in CallableReferencesResolutionUtils.kt, delete the
suspicious scope and use the new resolution process with the qualifier which
was obtained after the resolution of LHS. However, by default the tower
resolution algorithm also considers each qualifier as a class value as well,
which would be wrong here because resolution of LHS as a "value" happens
earlier in DoubleColonExpressionResolver and with slightly different rules. To
avoid that, do not mix in the "explicit receiver" scope tower processor when
creating processors for callable reference resolution.

Also delete unused functions and classes related to deleted scope, refactor
Scopes.kt

 #KT-8596 Fixed
2016-07-22 11:05:19 +03:00
Alexander Udalov 7b59864ed9 Refine double colon LHS resolution if expression is an object 2016-07-22 11:05:19 +03:00
Alexander Udalov 5a6237b357 Refactor resolution of double colon expression LHS
Try resolving the LHS only when it looks (PSI-wise) like it could represent a
type element. This, for example, allows "illegal selector" error to be reported
on weird expressions like '""?.""::class'.

Also remove expression text from the "illegal selector" diagnostic, it's not
needed and can screw up the error message if the text is too big
2016-07-22 11:05:19 +03:00
Mikhail Glukhikh 5a2f34b351 Deduct x != null from x?.y is NotNullType 2016-07-21 21:15:34 +03:00
Mikhail Glukhikh 90c6868f9b renderDataFlowValue() moved to test from completion 2016-07-21 21:15:31 +03:00
Mikhail Glukhikh edeef90c4b Minor improvements in DataFlowValue / IdentifierInfo 2016-07-21 21:15:27 +03:00
Mikhail Glukhikh 11f50186fa x?.y != null and x?.call() != null provoke now x != null, a set of tests #KT-2127 Fixed 2016-07-21 21:15:19 +03:00
Mikhail Glukhikh 9001b9bcc0 DataFlowValue & DataFlowValueFactory major refactoring, get rid of DataFlowValue.id : Any?
Instead, DataFlowValue now requires IdentifierInfo implementation to be created
DataFlowValue is compared using IdentifierInfo
2016-07-21 21:15:05 +03:00