Commit Graph

34860 Commits

Author SHA1 Message Date
Valentin Kipyatkov eae23b548f KT-14294 for to stdlib to firstOrNull/lastOrNull: intention is absent if there is additional var before for loop
#KT-14294 Fixed
2016-10-24 18:32:03 +03:00
Valentin Kipyatkov a89ef54578 KT-14210 for loop to stdlib: max/min is not recognized if there is additional if
#KT-14210 Fixed
2016-10-24 18:32:02 +03:00
Valentin Kipyatkov 35ed689b9f any() and other find operations to work with checks for not null and is instance 2016-10-24 18:32:02 +03:00
Valentin Kipyatkov 49ef880f3a Moved matcher 2016-10-24 18:32:02 +03:00
Valentin Kipyatkov b28d016709 count() to merge with filterNotNull and filterIsInstance + changed test for KT-14191 to use sum() 2016-10-24 18:32:02 +03:00
Valentin Kipyatkov afd25548a2 KT-14209 for loop to stdlib: sum is not recognized if before was check for type
#KT-14209 Fixed
2016-10-24 18:32:01 +03:00
Valentin Kipyatkov f5d4b1dc8d KT-14191 FormattingModelInconsistencyException Exception on applying intention Replace with count()
#KT-14191 Fixed
2016-10-24 18:32:01 +03:00
Denis Zharkov 10861e57ff Fix NDFDE for single underscore named property in primary constructor
NDFDE = NoDescriptorForDeclarationException

See the comment in change
2016-10-24 18:00:02 +03:00
Denis Zharkov 09dc207052 Add SingleUnderscoreForParameterName language feature 2016-10-24 18:00:02 +03:00
Denis Zharkov 1f0293eb42 Check modifiers applicability on destructured lambda parameters
#KT-14502 Fixed
2016-10-24 18:00:02 +03:00
Nikolay Krasko 8865c0be34 Step into functions with local variable on first line under "Skip simple getters" (KT-14488)
(cherry picked from commit 9423d65)

 #KT-14488 Fixed
2016-10-24 16:28:17 +03:00
Alexander Udalov 3f5d3e5dbc Fix errors and indent in built-ins sources 2016-10-24 15:30:40 +03:00
Alexander Udalov 2076a31094 Improve Collection/Array/String detection logic in intentions
Use static methods from KotlinBuiltIns and check all supertypes, support cases
of Collection, Map and CharSequence
2016-10-24 15:30:39 +03:00
Alexander Udalov a5a422fc4d Use TypeConstructor equality instead of ClassDescriptor in CollectionStubMethodGenerator
Equals/hashCode are meaningful for TypeConstructor instances (see
AbstractClassTypeConstructor.java) in contrast to ClassDescriptor where
equality is referential
2016-10-24 15:30:39 +03:00
Alexander Udalov 08398178e0 Make class descriptors in JvmRuntimeTypes lazy
The main reason currently is to avoid eager construction of
defaultContinuationSupertype long before it's needed, which could fail without
built-ins in the classpath
2016-10-24 15:30:39 +03:00
Alexander Udalov e1aaccaec1 J2K JvmRuntimeTypes: prettify 2016-10-24 15:30:39 +03:00
Alexander Udalov 32b672490f J2K JvmRuntimeTypes: convert 2016-10-24 15:30:39 +03:00
Alexander Udalov 9e4ffd9225 J2K JvmRuntimeTypes: rename .java -> .kt 2016-10-24 15:30:38 +03:00
Alexander Udalov d9f248ccf4 Minor refactoring in JvmDependenciesIndexImpl
Make SearchResult a sealed class, inline local function & trivial utility
2016-10-24 15:30:38 +03:00
Alexander Udalov 76523cc175 Split JvmDependenciesIndex to several files, move to 'index' package 2016-10-24 15:30:38 +03:00
Alexander Udalov cdf6567375 Drop TypeConstructor.getAnnotations(), uninherit TypeConstructor from Annotated
The method was unused on TypeConstructor instances, and almost all
implementations returned EMPTY anyway
2016-10-24 15:30:38 +03:00
Alexander Udalov 6b6ddf5f75 Import classes from kotlin.coroutines by default, add to default imports in JS 2016-10-24 15:30:38 +03:00
Mikhail Glukhikh 44d10672be KT-7929 related: KtDestructuringDeclarationEntry is not resolved to descriptor in OverridingDeprecatedMemberInspection 2016-10-24 15:17:56 +03:00
Mikhail Glukhikh 6b9252a5d3 KT-7929 related: incorrect KtDestructuringDeclarationEntry is not resolved to descriptor, fixes EA-76715 2016-10-24 15:17:52 +03:00
Mikhail Glukhikh 1c8a2bb4cc No more attempts to resolve KtDestructuringDeclaration to descriptor #KT-7929 Fixed
Also #KT-8442 Fixed
2016-10-24 15:17:48 +03:00
Denis Zharkov 7d89869c02 Do not suggest "Remove parameter" quick-fix on lambdas
Only "Rename to _" should work in the case.

The problem is that removing lambda's parameter may lead behaviour changes.
This quick-fix was not being invoked run before KT-14347 had been implemented

# Conflicts:
#	idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java
2016-10-24 10:19:25 +03:00
Denis Zharkov 5e1b219784 Implement quick-fix replacing parameter name with _
This quick-fix is registered for UNUSED_* diagnostic in places
where it can be applied (destructured declarations/lambda parameters)

 #KT-14431 Fixed
2016-10-24 10:19:25 +03:00
Denis Zharkov 51f4244980 Report UNUSED_DESTRUCTURED_PARAMETER_ENTRY
on destructured lambda parameters

 #KT-14347 Fixed
2016-10-24 10:19:25 +03:00
Denis Zharkov 9716d2ad54 Minor. Extract method in ControlFlowProcessor 2016-10-24 10:19:25 +03:00
Denis Zharkov 8a2c9ec7fe Minor. Extract method from the huge when entry 2016-10-24 10:19:25 +03:00
Denis Zharkov 4c69416f2b Report warning on unused entities that can be renamed to _
Currently it's all about lambda parameters/destructuring entries

 #KT-14347 In Progress
2016-10-24 10:19:25 +03:00
Denis Zharkov a9fcee098d Support single-underscore named variables in JVM backend
There are mainly two kind of changes:
- skipping 'componentX' calls for destructuring entries named _
- fixing local variable table for them
 - skip entries for destructuring entries named _
 - use $noName_<i> format for lambda parameters named _

 #KT-3824 Fixed
 #KT-2783 Fixed
2016-10-24 10:19:25 +03:00
Denis Zharkov 544d8f5b66 Minor. Extract method for retreiving variable descriptor in codegen 2016-10-24 10:19:25 +03:00
Denis Zharkov 4041c702b3 Minor. Get rid of code duplication
For initialization of destructuring entries in loops use the same logic
as for common local destructuring

The behavior may change a little: variable start label in a table
becomes less precise (now it starts a little bit earlier than it become initialized),
but it can't be very important as the same logic works for common
destructuring
2016-10-24 10:19:25 +03:00
Denis Zharkov dbca310d8c Support single-underscore variable names partially
Currently only parameters of lambdas/function expressions
and destructuring entries are allowed

 #KT-3824 In Progress
 #KT-2783 In Progress
2016-10-24 10:19:25 +03:00
Ilya Gorbunov 82364ad3e5 Filter out typealiases invisible due to API_VERSION < their SinceKotlin version, when determining excluded imports. 2016-10-21 18:19:03 +03:00
Ilya Gorbunov 11b03ebbb3 Annotate type aliases in kotlin-runtime with SinceKotlin 2016-10-21 18:19:03 +03:00
Alexander Udalov 47498ef835 Move ImportPath from 'descriptors' to 'frontend' 2016-10-21 17:10:41 +03:00
Alexander Udalov 4c52ce37d2 Drop TargetPlatform in utilities for module creation 2016-10-21 17:10:40 +03:00
Alexander Udalov 56e2173b3c Extract platform-independent default imports to TargetPlatform.Default.defaultImports
This is needed because SourceNavigationHelper uses default platform and it
needs default imports to be able to resolve references (otherwise
NavigateToLibrarySourceTestGenerated breaks)
2016-10-21 17:10:39 +03:00
Alexander Udalov 9ec781e859 Get rid of ModuleDescriptor#defaultImports, use DefaultImportProvider 2016-10-21 17:04:59 +03:00
Alexander Udalov 43c2b21987 Move import exclusion logic from ModuleDescriptorImpl to frontend 2016-10-21 17:04:58 +03:00
Alexey Tsvetkov 2bf0eb9e69 Fix pom.xml 2016-10-21 16:22:38 +03:00
Alexey Tsvetkov 0af7017836 Introduce common interface for common gradle options
This might be useful for future kotlin build scripts
2016-10-21 16:22:38 +03:00
Alexey Tsvetkov b7d97a3aa2 Do not remove annotations.txt (kapt1) file before kotlin compiler is called
#KT-14250 fixed

 Before this change the following could happen:
 0. Successful build.
 1. Only java files are changed.
 2. CompileKotlin task starts because java files are also input files for kotlin.
 3. annotations.txt file is deleted, but kotlin compiler is not called, so it is not regenerated.
 4. Javac fails.
2016-10-21 16:22:38 +03:00
Nikolay Krasko 770ea75138 Regenerate formatter tests 2016-10-21 15:58:29 +03:00
Mikhail Glukhikh bfaa9cf56f UnreachableCode.getUnreachableTextRanges always returns at least one range #KT-14158 Fixed 2016-10-21 10:31:50 +03:00
Dmitry Petrov 4fc135709e Inner classes lowering: remap old constructor parameters. 2016-10-21 10:05:41 +03:00
Dmitry Petrov 2986e7b508 Check for repeated annotations in type alias expansion. 2016-10-21 09:56:10 +03:00
Dmitry Petrov 5531762ab1 Check for repeated annotations in type alias declaration. 2016-10-21 09:56:10 +03:00