Commit Graph

62273 Commits

Author SHA1 Message Date
Dmitry Gridin feaa53c4f2 Formatter: shouldn't format property chains
#KT-36387 Fixed
#KT-36466 Fixed
2020-02-25 16:48:33 +07:00
Mikhail Glukhikh 522eeae062 FIR2IR: standardize expression with smart cast conversion
To convert smart cast expression, now we just convert
original expression in standard way and wrap it with TYPE_OP.
Before this commit original expression was converted in different way,
that led to errors e.g. for this expression casting.
2020-02-25 12:13:42 +03:00
Mikhail Glukhikh d1fac6dce1 FIR2IR: declare receivers for all accessors of extension properties
Before this commit, extension receivers were declared only for
properties with container source, which is strange & inconsistent.
Now we declare accessor extension receiver iff corresponding property
has extension receiver.
2020-02-25 12:13:42 +03:00
Mikhail Glukhikh 8c155578f7 FIR2IR: generate both dispatch & extension receiver without 'else if' 2020-02-25 12:13:42 +03:00
Juan Chen 4f6fe1d0ca [FIR]: fix translation of top-level property accesses like array.indices
This commit addresses the following issues:

* accessors didn't take into account their property's receiver type,
which caused NoSuchMethod due to signature mismatch. Now the property's
receiver type is passed to Fir2Ir translation of accessors.

* property's parent was not class, e.g., kotlin.collections.indices.
Now the symbol table collects WrappedPropertyDescriptorWithContainerSource
besides WrappedFunctionDescriptorWithContainerSource, so that
facade classes for such properties can be generated before codegen.

* accessor's parent was not class. Now the containerSource of
the property descriptor is passed to accessor descriptor.
2020-02-25 12:13:42 +03:00
Vladimir Dolzhenko c9658eb6e4 Adjust tests due to keep imports for extension functions used in kdoc
Relates to #KT-27601
2020-02-25 09:29:39 +01:00
Vladimir Dolzhenko afd71d3d19 Adjust tests due to "Remove argument" quick fix for TOO_MANY_ARGUMENTS
Relates to #KT-34026
Relates to #KT-34332
2020-02-25 09:23:46 +01:00
Dmitry Petrov b047d78580 Minor: update testData for IR bytecode text and unmute test 2020-02-25 11:17:08 +03:00
Mikhail Zarechenskiy 0b9fc1541d [NI] Don't try inferring variables for effectively empty system 2020-02-25 10:45:59 +03:00
Kristoffer Andersen fe71d5256c [Minor] Refactor IR Suspend Main code to not use intrinsic 2020-02-24 19:33:43 +01:00
pyos a3d85e108f JVM_IR: keep suspend fun return type in IrCalls
Otherwise:

  * should the dispatch receiver of a call be another call to a `suspend
    fun` wrapped in something that is optimized away later, the owner of
    the method will be incorrect;

  * references to functions returning non-Unit but casted to `() ->
    Unit` (allowed by new inference) might in fact not return Unit after
    tail call optimization.
2020-02-24 17:12:43 +01:00
Mads Ager d982203d56 [JVM_IR] Handle big arity suspend functions in existing lowering.
Now that suspend function views are created in
AddContinuationLowering, we can let the
FunctionNVarargBridgeLowering deal with rewriting of large
arity FunctionN/SuspendFunctionN.
2020-02-24 13:01:18 +01:00
Toshiaki Kameyama e406669190 Invert if condition intention: don't add unnecessary 'continue'
#KT-12329 Fixed
2020-02-24 11:17:20 +01:00
Toshiaki Kameyama 62e335ac88 Implement members: fix it works correctly for data class
#KT-36686 Fixed
2020-02-23 22:00:38 +01:00
Georgy Bronnikov fe009ac695 IR: restore reading common Klib from JVM
Adapt to changes in linker
2020-02-23 14:55:29 +03:00
Toshiaki Kameyama d54a35ef56 Add "Remove argument" quick fix for TOO_MANY_ARGUMENTS
#KT-34026 Fixed
#KT-34332 Fixed
2020-02-23 10:17:10 +01:00
nataliya.valtman 13afb2e45e Make kotlin build version for buildSrc the same as for kotlin project 2020-02-23 09:02:22 +03:00
Toshiaki Kameyama 699ea0aa2b Replace 'if' with 'when': don't swallow comments if there is no synthetic else branch
#KT-34640 Fixed
2020-02-22 16:50:37 +01:00
Toshiaki Kameyama f487118be5 Change signature: fix it works correctly when call site function has no value argument list
#KT-23510 Fixed
2020-02-22 09:07:34 +01:00
kvirolainen 223ed1ad60 KT-27601 review fixes 2020-02-22 08:55:50 +01:00
kvirolainen 90cfa80683 KT-27601 keep imports for extension functions used in kdoc 2020-02-22 08:55:50 +01:00
Dmitry Savvinov 423aeb9a08 Always check project.useCompositeAnalysis in findAnalyzerServices
The important things here are changes in
ResovlerElementCache/PerFileAnalysisCache. Previously, we'd always use
'CompositeAnalyzerServices' for common-platform, even with HMPP turned
off.

However, with HMPP turned off, common-platform is always coerced to
[JVM, JS, Native], no matter which platforms that project actually
targets.
So, even if project compiles only for JVM/Native, we'll detect
platform of common module as [JVM, JS, Native], build composite analyzer
services *which include all checkers from all platforms*, and then
report false-positive errors from JS checkers.

^KT-35031 Fixed
^KT-33573 Fixed
^KT-34925 Fixed
2020-02-21 20:00:21 +03:00
Toshiaki Kameyama e56abcbb85 Inline variable: fix it works correctly for 'when' subject variable
#KT-29870 Fixed
2020-02-21 17:30:13 +01:00
Toshiaki Kameyama d8ab046136 Convert property to function: remove annotation use-site target
#KT-36834 Fixed
2020-02-21 17:03:26 +01:00
Toshiaki Kameyama d5e71ebef1 Invert if condition intention: 'isEmpty' <-> 'isNotEmpty'
#KT-34593 Fixed
2020-02-21 16:39:35 +01:00
Toshiaki Kameyama 79c15e49b6 Convert function to property: suggest on fun keyword
#KT-34450 Fixed
2020-02-21 16:32:17 +01:00
Toshiaki Kameyama 820b8c3c54 Introduce "Redundant '?: return null'" inspection
#KT-34819 Fixed
2020-02-21 16:24:42 +01:00
Toshiaki Kameyama 5f1cc3b152 Introduce "Redundant 'inner' modifier" inspection
#KT-3262 Fixed
2020-02-21 16:12:49 +01:00
Dmitriy Dolovov d76dc6f57e [Commonizer] Call commonizer on Gradle configuration phase
Issue #KT-36858

Initially it was called on execution step which may be omit
during project import into IDEA.
2020-02-21 21:54:15 +07:00
Mikhail Zarechenskiy f2f95496e3 [NI] Complete contradictory candidates inside builder-inference
In this test `kotlin` was resolved to the extension
 `val Class<T>.kotlin` because it was saved in builder-inference.
 Usually, it's fine, but not for qualified expressions as they have
 fallback resolve in case of error
2020-02-21 17:39:50 +03:00
Toshiaki Kameyama 3398683093 Unused symbol: do not report for secondary constructor when class is used as typealias
#KT-20907 Fixed
2020-02-21 15:11:38 +01:00
Mikhail Glukhikh 81f1f441fc [FIR] Add stub default values to kotlin.Enum constructor parameters 2020-02-21 16:39:00 +03:00
Mikhail Glukhikh 39bd97147f [FIR] Don't create initializers for simple enum entries
Usually FIR enum entry is initialized by anonymous object,
which is the container for all enum entry' declarations.
However, for simple enum entries there is no need of initializer at all.
2020-02-21 16:38:52 +03:00
Mikhail Glukhikh b1e9dbf994 [FIR] Use super<Enum> as delegated calls in enum constructors 2020-02-21 16:37:56 +03:00
Mikhail Glukhikh f173af9238 FIR2IR: use enum constructor call for enum entries 2020-02-21 16:37:50 +03:00
Mikhail Glukhikh 9e3f17c52a [FIR TEST] Add test for unresolved reference in default argument
See KT-36905
2020-02-21 16:37:10 +03:00
Toshiaki Kameyama a3252b9480 Unused symbol: fix false positive in anonymous object in top level or companion object
#KT-31800 Fixed
#KT-20868 Fixed
2020-02-21 14:36:18 +01:00
Toshiaki Kameyama ef1e54eda9 ReplaceToStringWithStringTemplateInspection: insert curly braces if needed
#KT-36735 Fixed
2020-02-21 14:28:07 +01:00
Toshiaki Kameyama c87bc2123c Add "Change to val" quick fix for MUST_BE_INITIALIZED
#KT-15723 Fixed
2020-02-21 14:09:54 +01:00
Nikolay Krasko a46c6ce5df Revert global project settings to LATEST_STABLE in teardown 2020-02-21 16:07:24 +03:00
Nikolay Krasko f995192f21 Always configure and restore api version settings in tests 2020-02-21 16:07:24 +03:00
Nikolay Krasko 6c83e9fb85 Clean LANGUAGE_VERSION_SETTINGS after the test 2020-02-21 16:07:24 +03:00
Nikolay Krasko 19bc39d3ab Clean facet if it wasn't set before test (fix tests on 201) 2020-02-21 16:07:23 +03:00
Nikolay Krasko af3b057ba2 Always clean language and api versions after usage 2020-02-21 16:07:23 +03:00
Nikolay Krasko c0dac9bf32 Refactoring: extract long function out of local context 2020-02-21 16:07:23 +03:00
Nikolay Krasko 3a5f42cc5e Refactoring: always use compiler settings with de-configuration in tests 2020-02-21 16:07:23 +03:00
Nikolay Krasko 018215f47d De-bunch KotlinLightCodeInsightFixtureTestCase.kt 2020-02-21 16:07:23 +03:00
Pavel Punegov 94be4d77ff Fix init order in inline fun (native test) 2020-02-21 16:04:53 +03:00
Toshiaki Kameyama 19093e2e02 Redundant companion reference: fix false positive when companion has same name member as companion name
#KT-36707 Fixed
2020-02-21 13:57:04 +01:00
Vasily Levchenko 98ce49ba73 [build][native] version with milestone clause 2020-02-21 13:51:20 +01:00