Commit Graph

62217 Commits

Author SHA1 Message Date
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
Ilya Goncharov cc97138e9c [Gradle, JS] Extract JS presets container, no js in codegen since now 2020-02-21 13:14:36 +03:00
Ilya Goncharov fa335b5360 [Gradle, JS] Js default compiler type for mpp 2020-02-21 13:14:36 +03:00
Ilya Goncharov 8dc75def19 [Gradle, JS] Use default configuration names only once in constants 2020-02-21 13:14:36 +03:00
Ilya Goncharov 664775a43f [Gradle, JS] Configure compiler type with single platform plugin 2020-02-21 13:14:35 +03:00
Ilya Goncharov e631146fa7 [Gradle, JS] Fix DSL for Gradle JS wizard 2020-02-21 13:03:21 +03:00
Ilya Goncharov 3ae6b27556 [Gradle, JS] Fix DSL for JVM/JS wizard
#KT-36889 fixed
2020-02-21 13:03:18 +03:00
Abduqodiri Qurbonzoda 6670a2fff8 Update public api dump 2020-02-20 21:14:52 +03:00
Ilya Goncharov 569decce43 [Gradle, JS] Fix missed import 2020-02-20 19:32:35 +03:00
Ilya Goncharov d114945b76 [Gradle, JS] Change message in polite manner
#KT-36489 fixed
#KT-36843 fixed
2020-02-20 19:32:35 +03:00
Ilya Goncharov e0be8f271f [Gradle, JS] Not error, but warning with test fix 2020-02-20 19:32:35 +03:00
Ilya Goncharov 40fb6c67d2 [Gradle, JS] Add diagnostic messages for js targets 2020-02-20 19:32:34 +03:00
Ilya Goncharov aefaa6dc7f [Gradle, JS] Remove deprecated configurations 2020-02-20 19:32:34 +03:00
Ilya Goncharov 92291c03e8 [Gradle, JS] Add methods with string definition of compiler 2020-02-20 19:32:34 +03:00
Ilya Goncharov 203ca018e5 [Gradle, JS] Rename public KotlinJsCompilerType 2020-02-20 19:32:34 +03:00
Ilya Goncharov 488538889b [Gradle, JS] Extract JS presets container, no js in codegen since now 2020-02-20 19:32:34 +03:00
Ilya Goncharov 956b57a55d [Gradle, JS] Do not duplicate target initialization 2020-02-20 19:32:34 +03:00
Ilya Goncharov 881de0a538 [Gradle, JS] Make default configuration of target 2020-02-20 19:32:34 +03:00
Ilya Goncharov 9112da2ad7 [Gradle, JS] Create predefined source sets for single platform plugin 2020-02-20 19:32:34 +03:00
Ilya Goncharov 06be32550b [Gradle, JS] Fix lib and app test for both type 2020-02-20 19:32:34 +03:00
Ilya Goncharov a5602165ec [Gradle, JS] Fix names for js mpp 2020-02-20 19:32:33 +03:00
Ilya Goncharov e1f7296426 [Gradle, JS] Fast test with both js compilers 2020-02-20 19:32:33 +03:00
Ilya Goncharov 37b3b3ec56 [Gradle, JS] Js default compiler type for mpp 2020-02-20 19:32:33 +03:00
Ilya Goncharov 3d30598774 [Gradle, JS] Js compiler type in interface 2020-02-20 19:32:33 +03:00
Ilya Goncharov 36631a5954 [Gradle, JS] Fix parallel tests 2020-02-20 19:32:33 +03:00
Ilya Goncharov 86e13c25b3 [Gradle, JS] Default conpiler type instead of legacy 2020-02-20 19:32:33 +03:00
Ilya Goncharov ae89507736 [Gradle, JS] Add fish for js only lib-app test 2020-02-20 19:32:33 +03:00
Ilya Goncharov 16eb23c6b1 [Gradle, JS] Remove test with lib and app with not only legace
Because of performance reasons

- Fix usage of compiler type property
2020-02-20 19:32:33 +03:00
Ilya Goncharov 13594c80aa [Gradle, JS] Declare default configurations in js single plugin
Because in Kotlin DSL we want to declare configurations in methods instead of extensions of Strings
We need to create configurations explicitly in plugin
2020-02-20 19:32:33 +03:00
Ilya Goncharov f3f818edc3 [Gradle, JS] Use default configuration names only once in constants 2020-02-20 19:32:32 +03:00
Ilya Goncharov d9c08945a3 [Gradle, JS] Common dependency configurations for both js 2020-02-20 19:32:32 +03:00
Ilya Goncharov ecb89ad259 [Gradle, JS] Disambiguation classifier consider single platform plugin 2020-02-20 19:32:32 +03:00
Ilya Goncharov 4189bc88c2 [Gradle, JS] Provide disambiguation classifier for both mode 2020-02-20 19:32:32 +03:00
Ilya Goncharov b967e11511 [Gradle, JS] Configure compiler type with single platform plugin 2020-02-20 19:32:32 +03:00
Ilya Goncharov 22e826770d [Gradle, JS] Functions in extensions for configure compiler type 2020-02-20 19:32:32 +03:00
Ilya Goncharov 1346883837 [Gradle, JS] Fix published name for both compiler 2020-02-20 19:32:32 +03:00
Ilya Goncharov 185f7419d5 [Gradle, JS] Refactor with remove copypaste 2020-02-20 19:32:32 +03:00
Ilya Goncharov 397ff26e20 [Gradle, JS] With both compilers fully disambiguated names 2020-02-20 19:32:32 +03:00
Ilya Goncharov ae391f3776 [Gradle, JS] Fix codegen for js platform 2020-02-20 19:32:31 +03:00
Ilya Goncharov 1bebcd398e [Gradle, JS] Move JsCompilerType to Gradle Plugin API 2020-02-20 19:32:31 +03:00
Ilya Goncharov 82d31adb24 [Gradle, JS] Remove js compiler property from MPP plugin 2020-02-20 19:32:31 +03:00
Ilya Goncharov 4af389ba92 [Gradle, JS] Rename target on js in case of single platform 2020-02-20 19:32:31 +03:00
Mikhail Glukhikh 285f613ef7 [FIR TEST] Add test with unresolved member in nested lambdas (KT-36887) 2020-02-20 19:25:50 +03:00