Commit Graph

13245 Commits

Author SHA1 Message Date
shiraji 0b57d8eb49 Do not use "Remove redundant '.let' call" when receiver is used #KT-14390 Fixed 2016-10-27 19:10:14 +03:00
Michael Bogdanov afe0b8a0b6 Switch to general codegen in 'Bytecode tool window' 2016-10-27 16:41:15 +03:00
Nikolay Krasko e053b77ede Test for "Code folding doesn't work in kotlin lambdas after some declatation" (KT-14411)
Fixed in previous commit

 #KT-14411 Fixed
2016-10-27 14:26:12 +03:00
Nikolay Krasko 08d628537c Assign trailing and preceding whitespaces to lambda block until the last comment in parser 2016-10-27 14:26:10 +03:00
Nikolay Krasko 0261385681 Report file name for getDefaultPlatform() information 2016-10-27 14:26:07 +03:00
Anton Bannykh 7ee3baa020 Replaced when appropriate 'TARGET_BACKEND: JVM' -> 'IGNORE_BACKEND: JS'. Enabled some succesfully working decompiledText tests. 2016-10-27 14:17:25 +03:00
Dmitry Jemerov 38a448ebbd use a non-deprecated API 2016-10-27 12:50:39 +02:00
Alexander Udalov 7f86ce0a20 Introduce fallback option to add built-ins in position manager test
In AbstractPositionManagerTest, built-ins could no longer be resolved because
JvmIDEVirtualFileFinder is used in IDE tests (even when the compilation is
called through JvmResolveUtil/GenerationUtils as in compiler tests), which is
not yet able to locate .kotlin_builtins files
2016-10-26 16:31:09 +03:00
Alexander Udalov e0989caf46 Load built-ins from module dependencies in JVM compiler
Introduce a new method KotlinClassFinder#findBuiltInsData, which is only
implemented correctly in the JvmCliVirtualFileFinder because it's only used in
the compiler code at the moment.

Introduce JvmBuiltInsPackageFragmentProvider, the purpose of which is to look
for .kotlin_builtins files in the classpath and provide definitions of
built-ins from those files.

Also exclude script.runtime from compilation because, as other excluded
modules, it has no dependency on the stdlib and is no longer compilable from
the IDE now, because it cannot resolve built-ins from anywhere
2016-10-26 16:31:09 +03:00
Alexander Udalov 88add3e06d Get rid of some KotlinBuiltIns#getBuiltInsModule usages
There will be no separate module for built-ins soon, they will be resolved as
normal dependencies
2016-10-26 16:31:06 +03:00
Alexey Sedunov 416569c2d2 Introduce Type Parameter: Disable shortcut (to avoid interference with IntelliJ API Watcher plugin) 2016-10-26 15:03:45 +03:00
Alexey Sedunov dc9c988287 Kotlin Facet: Fix serialization/deserialization 2016-10-26 15:03:44 +03:00
Alexey Sedunov 3fcdda2805 Kotlin Facet: Refactor TargetPlatform to sealed class. Move settings-related classes to top level 2016-10-26 15:03:43 +03:00
Alexey Sedunov ea13456bba Kotlin Facet: Add compiler settings to facet configuration 2016-10-26 15:03:42 +03:00
Alexey Sedunov 03f4d9f574 Kotlin Facet: Add extension point for compiler/stdlib version info with implementations for Maven and Gradle project models 2016-10-26 15:03:42 +03:00
Alexey Sedunov e0285b9955 Kotlin Facet: Extract VersionInfo class and getVersionInfo() utility function 2016-10-26 15:03:41 +03:00
Alexey Sedunov 37286d5b06 Kotlin Facet: Add API version setting 2016-10-26 15:03:40 +03:00
Alexey Sedunov 2326e3ed12 Kotlin Facet: Add custom settings and configuration extension point 2016-10-26 15:03:39 +03:00
mglukhikh 73b24f2b20 Build fix: "If then to elvis" inspection test 2016-10-26 14:15:07 +03:00
Nikolay Krasko e41cddd870 Allow to select single word on double click in one line doc comment (KT-14327)
(cherry picked from commit 184d39a)

 #KT-14327 Fixed
2016-10-25 18:18:07 +03:00
Mikhail Glukhikh ba0e36cdb1 (1.1 only) Var can be val: correct handling of delegated local variables #KT-14409 Fixed 2016-10-25 17:57:40 +03:00
Mikhail Glukhikh 66f3e266d9 Var can be val: correct handling of initialization in lambda #KT-14065 Fixed 2016-10-25 17:57:36 +03:00
Mikhail Glukhikh fd9e59ac7b Surround with null check for unsafe things: find first parent statement to surround (which is not used as expression) #KT-13958 Fixed 2016-10-25 17:57:32 +03:00
Mikhail Glukhikh e56a10aa41 "Surround with null check" is now a high-priority action 2016-10-25 17:57:29 +03:00
Mikhail Glukhikh 35d104782e Minor: primary constructor to secondary: do not specify independent property type explicitly 2016-10-25 17:57:25 +03:00
Mikhail Glukhikh a74f010e0f Primary constructor to secondary: always try to build constructor body #KT-14475 Fixed 2016-10-25 17:57:21 +03:00
Mikhail Glukhikh d6eee65d72 Object literal to lambda: more precise shorten references #KT-14289 Fixed 2016-10-25 17:57:17 +03:00
Mikhail Glukhikh dc76f2a62f Lambda to reference: check potential reference arguments by descriptors and not by names #KT-14420 Fixed 2016-10-25 17:57:13 +03:00
Mikhail Glukhikh 97b45569fc Lambda to reference: not-null types are now preferred for platform type receivers #KT-14394 Fixed 2016-10-25 17:57:09 +03:00
Mikhail Glukhikh a901de5112 KT-14084 related : replaceFirstReceiver now replaces ALL calls to safe calls if necessary
Fixes relevant "replace let" and "if to elvis" cases
2016-10-25 17:57:06 +03:00
Mikhail Glukhikh 2117b30b76 If expression to elvis now handles call chains #KT-14084 Fixed 2016-10-25 17:57:02 +03:00
Alexander Udalov 035d6156a7 Drop Cloneable in JS, synthesize it at compile-time on JVM
Use the same approach that is used for creating function type classes
(Function{0,1,...}) + add Cloneable to supertypes of Array and primitive arrays

 #KT-5537 Fixed
2016-10-25 15:42:33 +03:00
Alexander Udalov 0f4b10d37d Add JavaToKotlinClassMap#isJavaPlatformClass
Use it instead of mapPlatformClass where we only need to check emptiness
because mapPlatformClass requires built-ins and it's not always easy to come up
with the correct instance of built-ins.

In KotlinEvaluationBuilder, use the nullable function
findClassAcrossModuleDependencies instead of mapPlatformClass which uses the
throwing resolveClassByFqName. This is necessary because DefaultBuiltIns, which
are used there, are not always able to find classes mapped by a _Java_ to
Kotlin class map. (The correct solution would be not to use DefaultBuiltIns at
all, instead obtaining the correct instance of built-ins, which are almost
certainly going to be JvmBuiltIns, from the project configuration.)
2016-10-25 15:42:32 +03:00
Alexander Udalov 0e9f29fdba Make ClassDescriptor#classId nullable
Local classes or anonymous objects do not have a class id. Use "!!" almost
everywhere to make assertion explicit
2016-10-25 15:42:32 +03:00
Alexander Udalov c0147860bd Allow multiple ClassDescriptorFactory instances in deserialization 2016-10-25 15:42:32 +03:00
Nikolay Krasko cdabef51ed Add nullability to receiver type 2016-10-25 13:30:38 +03:00
Nikolay Krasko 22999fe67d Set hasValueArguments in KotlinAnnotationEntryStub to 'true' only if some arguments exist
Currently '()' is used for resolving ambiguity in parsing when annotating function types. This way a decompiled code
will need brackets, but compile code will have annotation without parameters. This commit will allow to make both stub-trees consistent.

Tested in ClsStubBuilderTestGenerated.testAnnotationsOnNullableTypes()
2016-10-25 13:30:37 +03:00
Nikolay Krasko a344ad0644 Fix absence of annotation for function type in cls stubs and ignore @ExtensionFunctionType 2016-10-25 13:30:35 +03:00
Nikolay Krasko d1dfcfaca1 Fix stub-psi mismatch exception on restoring annotation for nullable types
(cherry picked from commit 1aa37f11258dde289a9f7cb700294a038168fbdc)

Conflicts:
	compiler/frontend/src/org/jetbrains/kotlin/psi/stubs/KotlinStubVersions.kt
	idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/stubBuilder/TypeClsStubBuilder.kt
2016-10-25 13:22:53 +03:00
Mikhail Glukhikh e53940f4af KT-8442 related: correct handling of erroneous destructuring references, fixes EA-90434 2016-10-25 13:13:15 +03:00
Mikhail Glukhikh e7e56ab85c KT-8442 related: destructuring declarations aren't taken into account during light classes generation, fixes EA-81204 2016-10-25 13:13:11 +03:00
Valentin Kipyatkov 18f10860df KT-14336 for to stdlib to takeWhile: propose conversion into takeWhile if break is located in else branch
#KT-14336 Fixed
2016-10-24 18:32:05 +03:00
Valentin Kipyatkov 5c8db294df Fixed index variable case 2016-10-24 18:32:05 +03:00
Valentin Kipyatkov e5fcfae969 KT-13998 Loop to call chain converter produces 'none' instead of 'all'
#KT-13998 Fixed
2016-10-24 18:32:04 +03:00
Valentin Kipyatkov 89099b93b1 Split or glue together checks for not null and is instance + more intelligent use of filter vs filterTo
#KT-14284 Fixed
 #KT-14286 Fixed
 #KT-14287 Fixed
 #KT-14303 Fixed
2016-10-24 18:32:04 +03:00
Valentin Kipyatkov 53220b980e More correct checking of forEach requiring asSequence() 2016-10-24 18:32:04 +03:00
Valentin Kipyatkov a87ca8432e KT-14341 for to stdlib to forEach: if the loop variable is not used in the last/innerest statement the conversion is not proposed
#KT-14341 Fixed
2016-10-24 18:32:03 +03:00
Valentin Kipyatkov 5ca7688b7c Correct handling of explicit variable type 2016-10-24 18:32:03 +03:00
Valentin Kipyatkov 9326dfa048 Honor errors in code before when checking smart casts 2016-10-24 18:32:03 +03:00
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