Commit Graph

34914 Commits

Author SHA1 Message Date
Alexander Udalov 4effe42f1d Use JvmResolveUtil#createContainer in KotlinOverloadTest and KotlinOverridingTest 2016-10-26 16:31:05 +03:00
Alexander Udalov 8a5c8da757 Simplify module configuration and built-ins dependency in some tests
- In tests on built-ins with no sources, just call
  JvmResolve.analyze(environment) and inspect the resulting module
- In AbstractLocalClassProtoTest, create container via
  TDAForJVM.createContainer
- Inline single module container creation into AbstractDiagnosticsTest
2016-10-26 16:31:04 +03:00
Alexander Udalov 2b34d62848 Extract superclass from FunctionClassScope and CloneableClassScope 2016-10-26 16:31:03 +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
Michael Bogdanov eaf9c2e8b0 Fix for KT-13890: IllegalAccessError when invoking protected method with default arguments
#KT-13890 Fixed
2016-10-26 12:13:20 +03:00
Michael Bogdanov 1e59161e8f Fix for KT-14201: UnsupportedOperationException: Don't know how to generate outer expression for anonymous object with invoke and non-trivial closure
#KT-14201 Fixed
2016-10-26 12:13:19 +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 1cfb8f2aef Use OverridingUtil#overrides instead of CodegenUtil#doesOverride
This may be more correct in case of complex cross-module inheritance, where
overridability should be detected by structural equality of signatures instead
of referential equality of constructed descriptors (no test added because it's
not so easy to come up with an example)
2016-10-25 15:42:34 +03:00
Alexander Udalov 4e7542b07d Filter out non-builtin package fragments from module when needed
In subsequent commits, a JVM module will be able to have up to two package
fragments for a given package FQ name. For example, for package "kotlin" in
kotlin-runtime.jar there will be a LazyJavaPackageFragment with binary
(Kotlin+Java) dependencies, and a BuiltInsPackageFragment for built-ins
metadata (which is loaded from kotlin/kotlin.kotlin_builtins)
2016-10-25 15:42:33 +03:00
Alexander Udalov 9ce211fe87 Use FQ names instead of descriptor equality in RangeCodegenUtil
This is safer in cases when descriptors for the same declaration can come from
different package fragment providers
2016-10-25 15:42:33 +03:00
Alexander Udalov ccd480236a Add mock JDK and mock runtime to light class tests 2016-10-25 15:42:33 +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 2f81d48f5e Use ClassId instead of FqName in JavaToKotlinClassMap
Extract mapJavaToKotlin which returns ClassId and needs no KotlinBuiltIns
instance
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 17e54b6d2d Add ClassDescriptorFactory#getAllContributedClassesIfPossible
Currently a no-op, will be used soon to make Cloneable a synthesized class,
visible in scope's getContributedDescriptors()
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
Denis Zharkov b7e8071a7d Do not use BasicInterpreter for bytecode analysis
The problem with BasicInterpreter is the following:
it creates BasicValue objects that should be replaced in favor of StrictBasicicValue

See commit message in 25c6ac1 for clarification

 #KT-14447 Fixed
2016-10-25 10:14:52 +03:00
Denis Zharkov e9efc9e892 Replace usages of BasicValue constants in master with StrictBasicValue 2016-10-25 10:14:52 +03:00
Denis Zharkov d279ded714 Add license and links to rewritten ASM classes 2016-10-25 10:14:52 +03:00
Denis Zharkov 3a197e8d7e Fix NPE caused by nullability checks optimizations
Mostly this commit replaces instances of original BasicValue from ASM
with ones of StrictBasicValue having strict equals implementation

Optimization issue was related to non-symmetric 'equals':
- NotNullBasicValue("java/lang/Object").equals(BasicValue("java/lang/Object")) == false
- BasicValue("java/lang/Object").equals(NotNullBasicValue("java/lang/Object")) == true

 #KT-14242 Fixed
2016-10-25 10:14:52 +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