Commit Graph

61338 Commits

Author SHA1 Message Date
Mark Punzalan bc9edea527 [JVM IR] Fix issue with suspend functions in @JvmMultifileClass. 2020-02-05 19:00:54 +01:00
Sergey Igushkin 764bf1cb32 Add a non-public-API mechanism to import free args for MPP source sets
Arguments can be set using a project extra property following the
pattern: `kotlin.mpp.freeCompilerArgsForSourceSet.$sourceSetName`.

Only a compilation's default source set free args are appended to the
compiler args during Gradle builds.
2020-02-05 20:46:26 +03:00
Sergey Igushkin a8aa334203 Fix API version parsing: add 1.4 to available values
In Kotlin 1.3, we didn't allow setting language version to 1.4. With
the default language version changed to 1.4, it worked because the
language version had only been checked in the setter of the language
settings, and the default value had not been checked.
2020-02-05 20:46:25 +03:00
Sergey Igushkin cd32cef2b6 Fix MPP Gradle tests
* Use `maven { setUrl(...) }` in Groovy DSL
* Configure compilation tasks beforehand
  in testMppBuildWithCompilerPlugins
* Prevent `gradleSettingsScript()` from failing
  when no settings script is found
2020-02-05 20:46:24 +03:00
Sergey Igushkin 77f60d6d6c Enable KlibBasedMppIT by default and on all host (using Linux targets) 2020-02-05 20:45:40 +03:00
Sergey Igushkin 5cc8dfb2a3 Compile common code to klib whenever HMPP is enabled
As the HMPP with *.kotlin_metadata was never widespread, we can
immediately move to *.klib compilations whenever a build author
enables HMPP.
2020-02-05 20:45:40 +03:00
Sergey Igushkin 0ef8d23f57 Rework legacy metadata variant in MPP with source sets metadata
* Make publishing the compatibility variant optional, and don't publish
  the compatibility variant by default -- the library maintainer should
  do this explicitly
* To build the compatibility artifact, compile the commonMain source
  set using a separate compilation (the default `main` compilation,
  while creating a separate `commonMain` compilation; this separation
  is needed to be able to still compile *.kotlin_metadata from
  commonMain even when compiling *.klib from all source sets)
* When the compatibility variant is disabled, clear the dependencies of
  the `main` compilation and disable its Kotlin compilation task
* When the compatibility variant is enabled, exposed it for project
  dependencies resolution as well, so that its artifact can be used by
  the dependent project instead of the granular metadata artifact that
  will contain *.klib (which can't be read by the legacy compiler)
* Refactor the configuration of the metadata compilation dependencies:
  concentrate all the logic in one place and make it process the source
  sets graph lazily.
2020-02-05 20:45:39 +03:00
Sergey Igushkin 8a08fef2b3 Export implementation dependencies of Native-shared source sets as API
As the Kotlin/Native compiler always requires transitive dependencies
to be present among the libraries during compilation, it is necessary
to export the implementation dependencies of Native-shared source sets
as if they were API dependencies.

To do that, add the extendsFrom-relationship between the apiElements
configuration of the metadata target (so that Gradle adds the
dependencies to the transitive dependencies graph) and also add the
dependencies to the project structure metadata (so that the consumer
can find out that it's only their corresponding Native-shared source
sets that need these particular transitive dependencies)
2020-02-05 20:45:39 +03:00
Sergey Igushkin 81216ceb51 Use the project name + compilation name for secondary klib compilations
This helps avoid duplicate library names when compiling shared-Native
source sets (the resulting klibs will have a more unique name than just
the source set name which likely repeats between projects)
2020-02-05 20:45:38 +03:00
Pavel Kirpichenkov 2a15df6a20 [IDEA-TESTS] Update configuration tests involving LATEST_STABLE version
Change `LATEST_STABLE` with `VersionView.RELEASED_VERSION`
in tests checking default language configuration options.

Replace `LATEST_STABLE` with fixed version in `testDropKotlincOnVersionAutoAdvance`
as the test actually compares it with version from kotlinc.xml.
It being latest stable is not relevant.

By default the lastest stable Kotlin version is selected for module
when there is no explicit version in configuration. However, it is
the version previous to `LanguageVersion.LATEST_STABLE` during prerelease.
2020-02-05 20:15:17 +03:00
Pavel Kirpichenkov a5d201e263 Exclude unsupported language versions from gradle options
^KT-36146 Fixed
2020-02-05 20:15:17 +03:00
Pavel Kirpichenkov f530c0c903 minor: reformat 2020-02-05 20:15:17 +03:00
Pavel Kirpichenkov 87e0186334 Cleanup test checking legacy inline suspend
Move expected library compilation output to file.
^KT-36240 Fixed
2020-02-05 19:34:59 +03:00
Ilmir Usmanov 8335ad7e98 JVM_IR: Minor. Add test 2020-02-05 15:07:55 +01:00
Ilmir Usmanov 5977799c59 JVM_IR: Get rid of non-local related hacks in coroutines inlining 2020-02-05 15:07:49 +01:00
Ilmir Usmanov e5bd4f74f3 JVM_IR: Do not copy attributes into DEFAULT_IMPLS functions
Otherwise, on creating suspend function views these functions will clash
with interface ones. Instead, compute name of their continuation classes
based on attributes of the interface class.
2020-02-05 15:07:43 +01:00
Ilmir Usmanov fc70455877 JVM_IR: Move suspend function views creation to lowering
Now AddContinuationLowering is responsible for both adding continuation
classes to suspend functions and adding continuation parameters to
them.
Because we cannot create a view if inline suspend function is defined
in another file, we generate a stub without body when we encounter call
to it. And then, when we lower the file containing the function we add
the body. This way we have no unlowered views after the lowering.
Thus, after the lowering there should be no suspend function, which
are not views, therefore, remove VIEW origins.
Because transformations of suspend functions can copy them into another
object, use attribute as a key inside function to view map.
2020-02-05 15:07:37 +01:00
Alexander Udalov 5e7343624b Update test data of wrongInlineTarget to 1.4 2020-02-05 13:09:53 +01:00
Alexander Udalov 9f9eef44b1 Use captured type approximation from new inference in ExpressionCodegen
This is needed in order to avoid star projections being expanded into
`out Any?`, which is visible for users of `typeOf` since 1.4.

 #KT-30278 Fixed
2020-02-05 13:09:08 +01:00
Toshiaki Kameyama 4d1937b92d "Redundant 'suspend' modifier": do not report when function has 'suspend' calls by parenthesized expression
#KT-24869 Fixed
2020-02-05 14:31:13 +03:00
Roman Golyshev 31315e2c45 Add plugin_version and file_type features for ML completion
- This is required to be able to use ML completion infrastructure to monitor code completion quality (even without ML enhancement)
2020-02-05 12:19:49 +03:00
Mikhail Glukhikh 98ea2231f1 [FIR] Code cleanup: NodeConfigurator 2020-02-05 11:19:25 +03:00
Mikhail Glukhikh 0fa98ed635 [FIR] Discriminate abstract members when resolving on super 2020-02-05 11:19:23 +03:00
Mikhail Glukhikh 8e40782e7b [FIR] Add test with abstract / non-abstract ambiguity 2020-02-05 11:19:22 +03:00
Mikhail Glukhikh f7d658b624 FIR2IR: fix dispatch receiver generation (non-function case) 2020-02-05 11:19:21 +03:00
Mikhail Glukhikh b09b2673bf FIR2IR: handle non-ambiguous super references properly 2020-02-05 11:19:20 +03:00
Mikhail Glukhikh 71b0840ef9 [FIR] Implement super resolve as a particular tower resolver case 2020-02-05 11:19:19 +03:00
Dmitry Petrov ee020ef290 KT-36336 @EnhancedNullability and null checks
Don't insert implicit null check on a value of @EnhancedNullability type
used where @EnhancedNullability type is expected.

This uncovers a bunch of other problems in FE and BE.
KT-36343 and KT-36347 are bugs in StrictJavaNullabilityAssertions
implementation which should most likely be fixed in next major language
version (with proper breaking change notice).
KT-36344 is a design problem which should be addressed after 1.4 issues
are resolved.
2020-02-05 11:15:41 +03:00
Vladimir Dolzhenko 6489b56fb0 Fix 192 compilation for move remove redundant imports to bg thread
Relates to #KT-24122
2020-02-04 18:36:38 +01:00
Vladimir Dolzhenko dd0613bc7a Move remove redundant imports to bg thread
#KT-24122 Fixed
2020-02-04 16:34:57 +01:00
Denis Zharkov fef2e06db4 FIR: Fix test data 2020-02-04 17:55:12 +03:00
Pavel Kirpichenkov 75d57c7d3f Update pattern for finding diagnostics in diagnostic tests
Also use updated diagnostic pattern in TreesCompareTest.
In rare cases diagnostic was cut too early on !> characters,
that were a part of diagnostic parameter:
<!DIAGNOSTIC("Type<DefinitelyNotNullTypeArgument!!>")!>
2020-02-04 17:49:18 +03:00
Kristoffer Andersen 4dd794c2d2 [JVM_IR] Propagate Type Parameters to DefaultImpls
This ensures correct generation of generic signatures in the resulting
byte code, but it _is_ a work in progress: the actual type *arguments*
passed for these parameters during compilation are dummy `Any?` types.

Sites that need more work are indicated with TODO's.

- copy type parameters of interfaces to methods moved to DefaultImpls
- implement type parameter renaming scheme from JVM, with proper
  renaming and substitution.
- adjust call sites in bridges in classes->DefaultImpls
- adjust call sites in bridges from DefaultImpls->Interface
- adjust call sites in bridges from DefaultImpls->DefaultImpls
- adjust super calls ->DefaultImpls
- adjust calls in code of Interfaces->DefaultImpls
2020-02-04 17:41:31 +03:00
Kristoffer Andersen 3606a4104b [JVM IR] Documentation for remapTypeParameters 2020-02-04 17:41:31 +03:00
Dmitry Gridin 6c439ae85a Create TrailingCommaIntention
#KT-34744
2020-02-04 21:34:53 +07:00
Dmitry Gridin 195d9020a6 TrailingCommaInspection: shouldn't be associated with formatter settings
#KT-34744
2020-02-04 21:34:53 +07:00
Dmitry Gridin b5d0956a5e Move call-site trailing comma to registry
#KT-34744
2020-02-04 21:34:53 +07:00
Dmitry Gridin c34b417d0c Fix tests after disabling trailing comma
#KT-34744
2020-02-04 21:34:53 +07:00
Dmitry Gridin 3fb34596ae Code style: disable trailing comma by default
#KT-34744
2020-02-04 21:34:52 +07:00
Denis Zharkov 4f834cb16b FIR: Get rid of replacements map during calls completion
Otherwise, it's complicated to work with nested lambdas:
outer/inner ones may be replaced independently and still refer
to the old one instances.
So in the changed test, if we don't apply the commit, will remain
implicit return and receiver types for the nested lambda

Anyway, once we decided to leave immutable semantics,
replacements are not necessary anymore
2020-02-04 16:24:01 +03:00
Denis Zharkov 8d24e0f842 FIR: Add some absent "replace" methods for callable declarations
It's necessary to avoid copying lambdas in LambdaAnalyzerImpl
2020-02-04 16:24:01 +03:00
Denis Zharkov c3e900b945 FIR: Make replace function accepting parameter with nullability as-is 2020-02-04 16:24:01 +03:00
Denis Zharkov 23e9a0c861 FIR: Force processing postponed arguments nested in lambdas
See the call-site of processAllContainingCallCandidates in getOrderedNotAnalyzedPostponedArguments
2020-02-04 16:24:01 +03:00
Ilya Goncharov 1e2e556328 [Gradle, JS] Fix test 2020-02-04 16:21:13 +03:00
Igor Chevdar 8214a9383c Enabled some tests 2020-02-04 16:14:29 +03:00
Igor Chevdar 562e8e357a [IR] SAM lowering: supported suspend functions 2020-02-04 16:14:27 +03:00
Igor Chevdar d6f91333dc [IR] SAM lowering: use block body instead of expr body
irBlockBody { +irReturn(..) } instead of irExprBody { .. }
K/N doesn't support expr bodies for now
2020-02-04 16:14:27 +03:00
Igor Chevdar 645488b342 [IR] SAM lowering: place wrappers into file if no enclosing class exists 2020-02-04 16:14:27 +03:00
Igor Chevdar 6ecda9e8af [IR] [JVM_IR] Commonized SAM conversions lowering 2020-02-04 16:14:27 +03:00
Dmitriy Dolovov 4dbf60eb2c Fix: Load properties in konan Distribution in safe way
Issue #KT-36333
2020-02-04 19:24:42 +07:00