Unlike previously, this optimisation works on every callee return type.
Tail-calls inside unit functions can be either
INVOKE...
ARETURN
or
INVOKE
POP
GETSTATIC kotlin/Unit.INSTANCE
ARETURN
The first pattern is already covered. The second one is a bit tricky,
since we cannot just assume than the function is tail-call, we also need
to check whether the callee returned COROUTINE_SUSPENDED marker.
Thus, resulting bytecode of function's 'epilogue' look like
DUP
INVOKESTATIC getCOROUTINE_SUSPENDED
IF_ACMPNE LN
ARETURN
LN:
POP
#KT-28938 Fixed
This fixes running IDEA with JPS build.
Gradle only uses compileClasspath configurations
for compilation. Hence the substitution introduced in 5c99243c10
affected only compile tasks (without affecting existing POMs).
However, Intellij import also looks into compileOnly configurations
in order to determine PROVIDED dependencies.
Only dependencies, that are present in both
compileOnly and compileClasspath confgurations,
are considered to have PROVIDED scope.
The substitution was replacing kotlin-reflect with kotlin-reflect-api
in compileClasspath configuration. CompileOnly configurations still resolved
to kotlin-reflect, so a compileOnly dependency to kotlin-reflect
would result in kotlin-reflect-api dependency with COMPILE scope in
IDEA.
This is exactly what happened in 'idea-runner' module, thus breaking
running IDEA from JPS build.
This change fixes the issue by configuring the same substitution
for compileOnly configurations.
Previously `validateTaskProperties` was run with tests
(`test` task depends on `validateTaskProperties` task).
Tests run with `--continue` argument on TeamCity,
so the validation was not failing remote-run builds.
To fix this, make `install` depend on `validateTaskProperties`.
so the REPL remain operational after exception in one of the snippets:
- separately return script class and script instance on evaluation (
because in case of an exception the class is valid, while the instance
is not).
- store both the class and the instance in the history
- handle this data accordingly
move compilation cache setting to the scripting host configuration
The cache implementation can now take into account all external
dependencies that may appear during refinement.
Also change initial refinement location accordingly and rearrange
caching interfaces to make it available in scripting plugin.
for compilation and evaluation configurations.
Add utilities to apply refinements uniformly.
Also fix one invoke for list values - it was not consistent with
other builders