Commit Graph

42906 Commits

Author SHA1 Message Date
Dmitry Savvinov 70a1beeff6 [NI] Use ErrorType in ParseErrorKotlinCallArgument
Previously, there was receiver of type Nothing, which could case result
of the call to be inferred to Nothing too. This could case bogus
UNREACHABLE_CODE diagnostics in cases like this:

```
fun <T> id(x: T) = x
fun test() {
    id(unresolvedReference) // type of statement is 'Nothing'
    // ... everything here is marked as unreachable ...
}
```

This commit changes type of receiver for such calls form Nothing to
ErrorType.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov eadd1355c2 [NI] Add ErrorType constraint
Previously, constraint wasn't added if bound was ErrorType. That could
cause TypeVariable to be inferred to Any?/Nothing instead of ErrorType,
which could influence other parts of analysis (in particular, inferring
Nothing instead of ErrorType can cause bogus UNREACHABLE_CODE diagnostics)

Because of that fix, intersection type can be added to CS as supertype,
which provokes AssertionError. This commit also relaxes this assertion,
as it seems that it's valid that supertype is an intersection type.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov 8e50a58408 [NI] New failing test after changes in applicabilities 2017-12-07 12:49:56 +03:00
Dmitry Savvinov 816d89e393 [NI] Improved testdata after changes in applicabilities
This commits introduces testdata changes, where NI behaviour strictly
improved, after several previous fixes.

For some tests, just WITH_NEW_INFERENCE directive was added. It
indicates, that some of previous commits first introduced error in that
test, and then some other commit fixed it (netting no overall testdata
change). It is preferrably to keep those annotations until we will
migrate to NI completely, to prevent unexpected regressions.
2017-12-07 12:49:56 +03:00
Dmitry Savvinov 9f63818bd3 [NI] Introduce INAPPLICABLE_ARGUMENTS_MAPPING_ERROR for some NI diagnostics 2017-12-07 12:49:56 +03:00
Dmitry Savvinov e2d65adc7e [NI] Fix KotlinResolutionCandidate.isSuccessfull
Check if ConstrainSystem has any contradiction in 'isSuccessful'.
Otherwise we may erroneously think that there are some successful
candidates in 'TowerResolver.SuccessfullResultCollector.pushCandidates()'
and clear other unsuccessful ones (while they actually may have higher
applicability).
2017-12-07 12:49:56 +03:00
Dmitry Savvinov 78a526c937 [NI] Support EffectSystem
- During final phase of resolution (i.e. converting NI-results to
OI-results), make call into EffectSystem to record all necessary
effects-related information.

- To be able to enhance resulting dataFlowInfo for call at that stage,
introduce internal method 'updateResultingDataFlowInfo' in
NewResolvedCallImpl.
2017-12-07 12:49:56 +03:00
Toshiaki Kameyama b23d62c760 Transfer type to parent property in "Remove redundant getter" inspection
So #KT-21612 Fixed
2017-12-07 12:19:35 +03:00
Mikhail Glukhikh 834c3fe62b Do not inline property setter if it's not required (e.g. ReplaceWith)
So #KT-21237 Fixed
2017-12-07 12:14:29 +03:00
Mikhail Glukhikh bddaab9d48 Inline properties without setter / with default setter correctly
Related to KT-21237
2017-12-07 12:14:29 +03:00
Nikolay Krasko fba50a8d15 Disable language injection for SpEL language as it cause to many troubles
It's known that there're several inspections that report warnings when
SpEL language is injected not to Java files if IDEA is before 173.
2017-12-07 12:02:39 +03:00
Michal Bendowski 6f350c032d Recognize injections in annotations (KT-13636)
Recognize patterns from both Java (psiMethod) and Kotlin
(kotlinParameter) that match the annotation argument.
2017-12-07 12:02:37 +03:00
Nikolay Krasko b7ba45c001 Reparse lambda expression after removing parameter comma (KT-21497)
Without the parameter it can become block.

 #KT-21497 Fixed
2017-12-07 12:02:07 +03:00
Nikolay Krasko 273bd55f01 Refactoring: extract methods 2017-12-07 11:49:19 +03:00
Dmitry Petrov 04ab3e1519 Use ForInSimpleProgressionLoopGenerator for most of the loop intrinsics 2017-12-07 11:36:20 +03:00
Dmitry Petrov 6b6ae2f7d7 Minor: formatting 2017-12-07 11:36:20 +03:00
Dmitry Petrov 75315a4edb Replace BoundedValue objects in 'indices' with SimpleBoundedValue 2017-12-07 11:36:20 +03:00
Nicolay Mitropolsky 209ba89a49 Uast: KotlinSecondaryConstructorWithInitializersUMethod introduced as workaround for KT-21617
to be the only constructor which includes `init` block when there is no primary constructors in the class
2017-12-06 22:19:57 +03:00
Nicolay Mitropolsky b8069b48c5 Uast: returning back secondary constructors bodies (KT-21575)
but secondary constructors without primary constructor will not contain initializers, it is still an issue
2017-12-06 22:19:57 +03:00
Nikita Skvortsov 962c512882 optimize search for modules nodes 2017-12-06 18:55:09 +01:00
Nikita Skvortsov cc580ca1dc optimize check of module-per-source-set 2017-12-06 18:55:09 +01:00
AJ Alt 8297fee615 Fix typo in File.copyTo KDoc 2017-12-06 18:11:11 +01:00
Yusuke Hosonuma 949f9b9342 gitignore: remove duplicates 2017-12-06 18:09:43 +01:00
Nikolay Krasko 110a9ff600 Fix project configuration: avoid adding test jar as library dependency
For some reason gradle processes "testJar" task differently and collects
artifacts for it during configuration phase. This helps Idea project
configurator understand that there's no need to attach test jar as separate
binary library dependency.

Having compiled module in dependencies results IDEA finds both compiled and
source version of classes. This may cause bad navigation and reindexing.
2017-12-06 19:14:28 +03:00
Mikhail Zarechenskiy 1d736f59b6 [NI] Refine nullability for CST of types with undefined nullability 2017-12-06 18:36:20 +03:00
Mikhail Zarechenskiy b9d390449c [NI] Refactor constraints transformations, update comments 2017-12-06 18:36:19 +03:00
Mikhail Zarechenskiy 351c592c83 [NI] Drop hack that was used before DefinitelyNotNull types 2017-12-06 18:36:17 +03:00
Mikhail Zarechenskiy b2299ed19f [NI] Fix testdata after introducing DefinitelyNotNull types 2017-12-06 18:36:16 +03:00
Mikhail Zarechenskiy 9565b56b2a [NI] Render DefinitelyNotNull types with !! postfix 2017-12-06 18:36:14 +03:00
Mikhail Zarechenskiy 7f0cca52ca [NI] Use definitely not-null types for smartcasts 2017-12-06 18:36:13 +03:00
Mikhail Zarechenskiy 64f0688b71 [NI] Introduce DefinitelyNotNullType as type for T!! or {T & Any} 2017-12-06 18:36:11 +03:00
Mikhail Zarechenskiy 8e0171d475 [NI] Don't loose platform types on simplifying lower constraints 2017-12-06 18:08:52 +03:00
Alexey Sedunov e2743c8f34 Rename: Do not use KotlinDirectoryAsPackageRenameHandler via dispatch handler
#KT-21604 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov e1ed74008f Rename: Fix exception on attempt to rename KtConstructorDelegationReference
#KT-21536 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov ec85b708c9 Misc: Use delegate with predefined name for fake light methods
#KT-21414 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov 89352a295d Maven Import: Support compiler arguments specified directly in <args>
#KT-21592 Fixed
2017-12-06 14:17:56 +03:00
Alexey Sedunov 288560eb37 Misc: Fix project configuration test 2017-12-06 14:17:55 +03:00
Alexey Sedunov 4369c6d26c Minor: Update Maven import test data 2017-12-06 14:17:55 +03:00
Mikhael Bogdanov 5c2f5fee39 Make 'addCommonSourceSetToPlatformSourceSet' open to support native specifics 2017-12-06 10:57:08 +01:00
Mikhael Bogdanov 60b812e3dd Increase android emulator startup await 2017-12-06 10:57:08 +01:00
shiraji 5d44037a2b Support 'it op something' case in "redundant let" #KT-21373 Fixed 2017-12-05 19:23:44 +03:00
Ramon Wirsch f961f33f9d Fix for KT-19188
Fixes nondeterministic Default Method Order under existance of generic
type parameters.
SubstitutingScope did not respect source code method order by not using
a LinkedHashSet
2017-12-05 18:33:22 +03:00
Mikhail Glukhikh 8257e14055 J2K: perform additional isActiveFor check before applying inspections 2017-12-05 18:21:22 +03:00
Mikhail Glukhikh 7eb62b9ca4 Add kapt as test runtime dependency to J2K 2017-12-05 18:18:48 +03:00
Mikhail Glukhikh a90e3c2e45 Add "replace map.put with assignment" to J2K
Related to KT-21502
2017-12-05 18:18:25 +03:00
Dereck Bridie 8c305a137f Introduce inspection "replace map.put with assignment" #KT-21502 Fixed 2017-12-05 16:57:36 +03:00
Nikolay Krasko ab28bdf32f Store in test data failure for quotedName name 2017-12-05 16:07:55 +03:00
Nikolay Krasko 57d62eb74a Document error behaviour of evaluate expression lost sometime 2017-12-05 16:07:54 +03:00
Nikolay Krasko b21fb1a375 Replace assertTrue with assertEquals in AbstractKotlinEvaluateExpressionTest 2017-12-05 16:07:53 +03:00
Nikolay Krasko 04e6aa76cf Fix lint apiCheck lint 2017-12-05 16:07:53 +03:00