Commit Graph

50605 Commits

Author SHA1 Message Date
Toshiaki Kameyama dc2a707444 Keyword completion: add 'class' after 'data' #KT-26632 Fixed 2018-11-28 14:47:37 +03:00
Dmitry Petrov 42e253b5ff KT-28456 generate index arguments per expression
In the desugaring for compound assignment to a collection element,
argument expression 'i' is mapped to value parameters 'iG' and 'iS' of
corresponding 'get' and 'set' operators.
In general, these value parameters can have different indices.

This requires extra machinery in argument generation - that is, to be
able to generate a particular expression argument using an arbitrary
callback. In the vast majority of the cases this callback will just use
the corresponding StatementGenerator to generate IR subtree for the
provided expression. In case of 'get' and 'set' operator calls for an
augmented assignment expression this will map corresponding argument
expressions to pregenerated temporary variables.

Thus, in the following context:
```
  class A

  operator fun A.get(vararg xs: Int) = 0
  operator fun A.set(i: Int, j: Int, v: Int) {}
```

statement `a[1, 2] += 3` will be desugared as (in a really pseudo
Kotlin):
```
  {
    val tmp_array = a
    val tmp_index0 = 1
    val tmp_index1 = 2
    tmp_array.set(
      i = tmp_index0,
      j = tmp_index1,
      v = tmp_array.get(xs = [tmp_index0, tmp_index1]).plus(3)
    )
  }
```
2018-11-28 14:36:44 +03:00
Toshiaki Kameyama 036b12f408 Extract interface: do not show private contstractor parameter on dialog
#KT-28408 Fixed
2018-11-28 13:46:57 +03:00
Mikhail Glukhikh 8fb213021c Create expect: remove false positive in inaccessible type detector 2018-11-28 12:36:29 +03:00
Mikhail Glukhikh 9ae7bc935d Create expect / actual refactoring: extract AbstractCreateDeclarationFix 2018-11-28 12:36:22 +03:00
Mikhail Glukhikh 222939efe7 Create expect / actual refactoring: extract common part to utilities 2018-11-28 12:00:55 +03:00
Mikhail Glukhikh 17e0e529e0 Create actual refactoring: get rid of actualNeeded 2018-11-28 12:00:54 +03:00
Mikhail Glukhikh d54b5b68cc Create expect / actual refactoring: get element description at one place 2018-11-28 12:00:54 +03:00
Mikhail Glukhikh 933d10e75d Create expect / actual refactoring: remove all declarations at start 2018-11-28 12:00:54 +03:00
Mikhail Glukhikh d3fada89b7 Generate enum entries in create actual / expected fixes as all other
This makes code a bit cleaner
2018-11-28 12:00:54 +03:00
Cuihtlauac ALVARADO a9280cdbcd Add support for proxies to scripts
Update jcabi-aether dependency from 0.10.1 to 1.0-SNAPSHOT. In order to
do that, add https://oss.sonatype.org/content/repositories/snapshots to
the repositories in tools/kotlin-script-util/build.gradle.kts

Script dependencies are resolved using jcabi-aether. Unfortunately "stable"
release (0.10.1) does not support proxies. Therefore, script dependencies
are not pulled behind a proxy. Issue is fixed in SNAPSHOT release of
jcabi-aether.

FIXED: KT-22363
2018-11-28 09:30:05 +01:00
Natalia Selezneva e3eda012c4 Tests: synchronize script dependencies in the beggining of the test because it invalidates the tested psi file 2018-11-28 11:16:26 +03:00
Natalia Selezneva 2d2a073c55 Tests: replace immediate run with TransactionGuard.submitTransaction to fix write in write-unsafe context in tests 2018-11-28 11:16:26 +03:00
Sergey Rostov 62b0b3e4e9 JPS: report about unsupported targets once
Report about unsupported targets once per target type, show presentable
chunks list and don't show more then 5 chunks.

Example: "Native is not yet supported in IDEA internal build system.
Please use Gradle to build a, b, c, d, e and 10 other  (enable 'Delegate
IDE build/run actions to Gradle' in Settings)."

#KT-26980 Fixed
#KT-28316 Fixed
2018-11-28 11:08:57 +03:00
Sergey Rostov ab2b4311fd JPS: fix SimpleKotlinJpsBuildTest.testDaemon
Make it the same as testJpsDaemonIC
2018-11-28 10:46:57 +03:00
Sergey Rostov 0c39358b5f JPS: fix testJpsDaemonIC
1. Checking for COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS was moved to COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH.

Looks like COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS was introduced incorrectly in 220fab0d3f.
Checking of this property was added in DaemonOptions.runFilesPathOrDefault, while DaemonOptions.runFilesPath was internally used in runFilesPathOrDefault and in many other places.
For example DaemonOptions.runFilesPath used to pass this option to daemon server.
So daemon was started with runFilesPath that ignores COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS.

2. JpsKotlinCompilerRunner._jpsCompileServiceSession was leaked between tests.

Fixed by extracting @TestOnly releaseCompileServiceSession() and calling it in tests tearDown()

3. The result of compileWithDaemon was ignored in compileWithDaemonOrFallback.

So, the fallback was never called, and the FAIL_ON_FALLBACK_PROPERTY was actually was never worked.
This was fixed. Also the message was improved to make it easier to find the original fail cause.
2018-11-28 10:46:57 +03:00
Sergey Rostov c06b000e8d JPS: Test for "Cyclically dependent modules should have same compiler"
KT-27285
2018-11-28 10:46:57 +03:00
Sergey Rostov 3c8b15ca54 JPS: Report "Cyclically dependent modules should have same compiler" as build error rather than exception
#KT-27285 Fixed
2018-11-28 10:46:57 +03:00
Sergey Rostov ce4422e2ef JPS, tests: Support multimodule mpp tests without steps 2018-11-28 10:46:58 +03:00
Ilya Gorbunov beec6a7c4a Update line numbers after reformatting coroutines stdlib sources 2018-11-28 06:05:03 +03:00
Ilya Gorbunov d7ff6c48ea Leave only 1.3 JS IR runtime sources
Update exclusions after merging coroutines sources into stdlib.
2018-11-28 06:05:03 +03:00
Ilya Gorbunov 5c94ef229b Move release coroutines sources into the corresponding stdlib sourcesets 2018-11-28 06:05:03 +03:00
Ilya Gorbunov 7d61a2de73 Reformat coroutine sources 2018-11-28 06:05:03 +03:00
Ilya Gorbunov ec3692026d Rename coroutines sourceset to coroutinesExperimental
Restore experimental coroutine tests as they were before e22ca022
and compile and run them twice:
 - first time with LV=1.2
 - second time with LV=1.3
2018-11-28 06:05:02 +03:00
Ilya Gorbunov 673844a059 Move coroutine tests to other stdlib-jvm tests 2018-11-28 06:05:02 +03:00
Georgy Bronnikov 1a529bd601 Revert "Switch off logging for failing IrBlackBox tests"
This reverts commit d23964034b.
2018-11-28 00:00:13 +03:00
Yan Zhulanow 6590497b8d Revert "Minor: Remove a deprecated method usage"
The method is still actual in IDEA 181 and Android Studio 3.1/3.2.
2018-11-28 02:25:34 +09:00
Yan Zhulanow 9bc02279c4 Kapt: Fix Maven build, add 'getJarPathForClass()' to the ProGuard configuration 2018-11-28 02:25:34 +09:00
Sergey Igushkin a0399d0541 Add new-mpp-lib-with-tests Kotlin DSL build script and test 2018-11-27 19:47:49 +03:00
Sergey Igushkin 202c86aafe Add a function attributes { } to KotlinTarget and KotlinCompilation
Gradle has a function `attributes { ... }` for `Configuration`, so we
can introduce one, too, for uniformity of the DSLs. This will configure
the `val attributes: AttributeContainer` of the `KotlinTarget` and
`KotlinCompilation`.

Issue #KT-27682 Fixed
2018-11-27 19:47:48 +03:00
Sergey Igushkin 5c5c161d59 Enable resources processing for Kotlin/JS target in MPP
Issue #KT-28363 Fixed
2018-11-27 19:47:47 +03:00
Sergey Igushkin 4dd95e331f Add missing DSL features to the MPP dependencies DSL
* Add DSL for project(...) with path and configuration
* Add DSL for e.g. api(someDependency) { /* ... */ }
* Add DSL for e.g. api(kotlin("stdlib"))

Issue #KT-26663 Fixed
2018-11-27 19:47:45 +03:00
Sergey Igushkin cee52c095f Add and generate Groovy-friendly DSL members
As Gradle Groovy DSL does out-of-the box not allow working with
SAM-receiving functions in the same way as those accepting a Closure,
and, moreover, does not work with Kotlin default parameters, we need
to provide Groovy-friendly DSL functions along with Kotlin DSL functions

This commit adds those additional members for all of the newly
introduced MPP DSL members.
2018-11-27 19:47:44 +03:00
Sergey Igushkin 88fa85fc1f Don't set the default Maven coordinates that are derived from project
In Gradle, a publication's Maven coordinates are by default derived from
the project. Setting them explicitly breaks the link, and the
coordinates are no more updated when the project's group and version
change.

Setting the coordinates in our code breaks with Gradle Kotlin DSL, where
the plugin is applied before the build script can even update the
project's group and version -- our code could set empty values, which
would update no more. Not setting them helps: the values are still
delegated to the project.
2018-11-27 19:47:43 +03:00
Sergey Igushkin a3b50e33b8 Remove the out-projection from kotlinSourceSets in kotlin extension
Gradle versions older than 4.10 could not correctly provide access to
the source set via delegation (i.e. `getting`, `creating` etc.) because
of the out-projection.

Remove the out-projection and expose just
`DomainObjectContainer<KotlinSourceSet>`, as under the hood we can still
use the `DefaultKotlinSourceSet` type for the items.
2018-11-27 19:47:42 +03:00
Sergey Igushkin 207bf7cf4a Add test for multiplatform projects with Gradle Kotlin DSL
* Adjust some of the test tools to work with *.kts scripts
* Expose the tool for version substitution into plugins DSL and use it
* Transform the lib-and-app test case to Gradle Kotlin DSL
2018-11-27 19:47:41 +03:00
Sergey Igushkin fe64d33ae4 Add defaultSourceSet to KotlinCompilation
Previously, the connection between a `KotlinCompilation` and its
default `KotlinSourceSet` (the one automatically created and added into
the compilation) was not expressed in the MPP model in any reasonable
way that can be used in the build scripts.

However, this connection seems to have settled in the build logic, and
it may be useful to be able to get the default source set from a
compilation, for example, to be able to configure dependencies across
several targets in a uniform way.

The metadata compilations don't have their dedicated source sets, but
we can think of commonMain as a default source set for the project's
metadata, is it is currently in fact only contains the declarations from
commonMain.

Issue #KT-27685 Fixed
2018-11-27 19:47:39 +03:00
Sergey Igushkin 581b161611 Expose statically-typed kotlinOptions and compileKotlinTask in DSL
To simplify configuring a `KotlinCompilation` with Gradle Kotlin DSL, it
is essential to expose statically-known types where possible.

This commit parametrizes `KotlinCompilation` with its Kotlin options
type (a subtype of `KotlinCommonOptions`) and adds `kotlinOptions` and
`compileKotlinTask` to `KotlinCompilation`.

(minor) Also reduce the visibility of `attachClassesDir` and
`setupPlugins` to internal, since this API is not for external use.
2018-11-27 19:47:38 +03:00
Sergey Igushkin 1e2436b1c1 Make KotlinNativeCompile implement the <...>.dsl.KotlinCompile interface
This is required for KotlinCompilation to be able to generically expose
the Kotlin compile tasls.
2018-11-27 19:37:50 +03:00
Sergey Igushkin ae5d59caf0 Add a new root of <...>.dsl.KotlinCompile hierarchy in API
This new interface uses a more general type for its kotlinOptions,
KotlinCommonToolOptions rather than KotlinCommonOptions. This is
needed for the Kotlin/Native task to implement a common interface
with the other Kotlin compilation tasks.
2018-11-27 19:37:50 +03:00
Sergey Igushkin ecd54d9b21 (minor) Move KotlinCommonToolOptions to kotlin-gradle-plugin-api
This change is needed to expose `kotlinOptions { ... }` in the
API interfaces.
2018-11-27 19:37:50 +03:00
Sergey Igushkin 635d436f02 Provide preset-like factory functions for creating targets in new MPP
* Pull the `targets` and `presets` properties of the `kotlin` extension
  up to an interface in `kotlin-gradle-plugin-api`

* Generate the code: we need type-safe statically-typed functions for
  different target type, which seems to be only possible to achieve by
  providing a function per preset.

* Place these functions in the top-level `kotlin` Gradle extension,
  rather than extension functions for `kotlin.targets`:

  - `kotlin.jvm { ... }` will work, while `kotlin.targets.jvm { ... }`
    won't, the extension function needs to be somehow brought into scope

  - reducing the nesting level by one seems to be a good move here

Issue #KT-26389 Fixed
2018-11-27 19:37:49 +03:00
Georgy Bronnikov d23964034b Switch off logging for failing IrBlackBox tests
Logging of tests that are expected to fail is controlled by
kotlin.suppress.expected.test.failures project property.
2018-11-27 16:53:34 +03:00
Yan Zhulanow 57d8e9457c Evaluate: Pass a constructor with loaded classes to 'runEval4J()'
So even if 'evaluateWithCompilation()' fails, 'runEval4J()' can use the additional classes.
2018-11-27 22:21:28 +09:00
Yan Zhulanow 1d1f3c3fd6 Minor: Remove a deprecated method usage 2018-11-27 22:21:27 +09:00
Yan Zhulanow 4cfd028768 Do not ignore an evaluation exception in StepOver command 2018-11-27 22:21:27 +09:00
Yan Zhulanow 03a6066ce0 Call 'StackFrameProxy::visibleVariables()' in a safe way (KT-27462) 2018-11-27 22:21:27 +09:00
Yan Zhulanow 47657df8da Kapt: Convert valid references to qualified names (KT-26304) 2018-11-27 22:21:27 +09:00
Yan Zhulanow 6a8a8b794d Kapt: Support correctErrorTypes in suspend functions (KT-27711) 2018-11-27 22:21:27 +09:00
Yan Zhulanow 4c5e982f3e Kapt: Fix an ArrayIndexOutOfBoundsException for suspend functions with generated return types 2018-11-27 22:21:26 +09:00