* fixed NoSuchMethod caused by mismatched signatures of the "invoke" method generated for lambda arguments
* added test cases in invoke.kt for KFunction and anonymous functions
* added a transformer to wrap the last expression in the bodies of lambdas with return
Local functions for lambdas declared in DefaultImpls are now also
getting additional type parameters from the containing class (see
4dd794c2d2), so function references to them should be adapted similarly
to normal calls.
This change fixes
`box/coroutines/featureIntersection/interfaceMethodWithBodyGeneric.kt`.
Otherwise EnhancedNullability annotation instance is lost (for some
reason it's not translated to IR elements), and in the newly added test,
the wrapper type in Java is confused with primitive, and this causes
a platform declaration clash error.
Also make IrTypeArgument.eraseTypeParameters private, since it's not
used outside.
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.
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.
* Use `maven { setUrl(...) }` in Groovy DSL
* Configure compilation tasks beforehand
in testMppBuildWithCompilerPlugins
* Prevent `gradleSettingsScript()` from failing
when no settings script is found
* 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.
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)
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)
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.
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.
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.
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.
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!!>")!>
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