Commit Graph

62259 Commits

Author SHA1 Message Date
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
Vladimir Dolzhenko 7053f1d00c Drop CancellationCheck usage from 193
Relates to #KT-36891
2020-02-21 13:40:48 +01:00
Toshiaki Kameyama 5a6cf19c68 Complete statement for class declaration: add '()' to supertype
#KT-31668 Fixed
2020-02-21 13:21:26 +01:00
Dmitry Petrov e9a7be4a46 Fix intersection type handling in PSI2IR 2020-02-21 15:11:16 +03:00
Mikhail Zarechenskiy 1624327ba4 [NI] Fix substitution in builder-inference for empty common system 2020-02-21 14:24:57 +03:00
pyos c5ffbfd33c JVM_IR: mark origins of capture fields in suspend lambdas 2020-02-21 12:11:19 +01:00
pyos 6b98ea2378 JVM_IR: do not place suspend markers around crossinline lambda calls 2020-02-21 12:11:19 +01:00
pyos 39ebc8cfa5 Add a suspend test that fails on JVM_IR 2020-02-21 12:11:19 +01:00
Ilmir Usmanov 52e7cd5725 JVM_IR: Remove $$forInline suffix for fake inliner variables
Otherwise, IDE will not be able to navigate to inline functions.
 #KT-36797 Fixed
2020-02-21 12:08:25 +01:00
Ilmir Usmanov 325ad14ac9 JVM_IR: Treat suspend main wrapper as always tail-call function
In other words, never generate suspend call markers inside it.
2020-02-21 12:00:54 +01:00
Ilmir Usmanov 8c4eef9844 JVM_IR: Return COROUTINE_SUSPENDED from suspend main wrapper
Before, if the code inside suspend main suspended, the wrapper would
just ignore it and return Unit. This was a signal for runSuspend to exit
main loop and return said Unit.
Instead of poping whatever suspend main returns, just return it.
2020-02-21 12:00:52 +01:00
Kristoffer Andersen 5b62c9e54d [WIP] Add Compiler Smoke Tests for (suspend) main methods
This commit ports the (parameterless) main integration tests in
`CompilerSmokeTest` to the IR backend. It also includes a simple
suspend main test.

The advanced ones (like `helloAppSuspendParameterlessMain`) are
currently blocked by pending changes to capturing suspend lambdas,
which are underway.
2020-02-21 12:00:50 +01:00
Kristoffer Andersen 55aafb3430 [JVM IR] Support Suspend Main
This adds supports for (parameterless) suspend main entry points for
the JVM IR backend.

In case main is a suspend function, it gains a continuation during
lowering, so we simply generate a plain old `public static void
main(String[] args)`. This entry point invokes `suspend main` via
`kotlin.coroutines.jvm.internal.RunSuspendKt#runSuspend`.

This PR introduces `runSuspend` as a built-in, and generates the
following `main`, passing `args` as appropriate:

```
fun main(args: Array<String>) {
  runSuspend { main(args) }
}
```

The phase ordering has been reshuffled countrary to previous
discussion on #2780, as the MainMethodGeneration pass now introduces lambdas in
the IR. Hence, it has to run before InventNamesForLocalClasses, yet
still after JvmOverloadsAnnotations.

Some dead code was discovered in AddContinuationLowering
2020-02-21 12:00:47 +01:00
Ilya Goncharov 068d547375 [Gradle, JS] UpperCased KotlinJsCompilerType 2020-02-21 13:14:36 +03:00
Ilya Goncharov 9acd98071e [Gradle, JS] Divide KotlinJsCompilerAttribute 2020-02-21 13:14:36 +03:00