This commit fixes tests in 173 branch, avoid exception:
com.intellij.openapi.util.TraceableDisposable$DisposalException:
Virtual pointer 'jar:///mnt/agent/work/bd0f559856a14a82/dist/kotlinc/lib/kotlin-stdlib-js.jar!/'
hasn't been disposed: --------------Creation trace:
java.lang.Throwable
at com.intellij.openapi.util.TraceableDisposable.<init>(TraceableDisposable.java:45)
at com.intellij.openapi.vfs.impl.VirtualFilePointerImpl.<init>(VirtualFilePointerImpl.java:41)
at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.getOrCreate(VirtualFilePointerManagerImpl.java:266)
at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:205)
at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:136)
at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.create(VirtualFilePointerContainerImpl.java:359)
at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.add(VirtualFilePointerContainerImpl.java:169)
at com.intellij.openapi.roots.impl.libraries.LibraryImpl.addRoot(LibraryImpl.java:505)
at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.exportRoots(NewLibraryEditor.java:247)
at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.applyTo(NewLibraryEditor.java:218)
at org.jetbrains.kotlin.idea.test.ConfigLibraryUtil.addLibrary(ConfigLibraryUtil.kt:113)
at org.jetbrains.kotlin.idea.test.KotlinStdJSProjectDescriptor.configureModule(KotlinStdJSProjectDescriptor.kt:38)
at org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor.configureModule(KotlinLightProjectDescriptor.java:46)
at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt:59)
at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt)
at com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel(ModuleRootModificationUtil.java:143)
at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:50)
at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:69)
at org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractDecompiledTextFromJsMetadataTest.setUp(AbstractDecompiledTextFromJsMetadataTest.kt:38)
...
See KT-21328
Compiler removes all files from its output directory.
Due to this reason (and some other reasons) it't not a good idea
to put DCE output to `classes` dir.
Therefore we changed output dir to `$buildDir/kotlin-js-min`.
Additionally, we now allow to customize output dir.
In particular, this fixes issues with webpack in multi-project build +
continuous Gradle build.
This behavior was used until 6a1b6d10d8, where the JDK has
unintentionally started to be added to the end of the list, breaking
code which depended on libraries which bundle something from the JDK
#KT-21299 Fixed
See KT-21493
It's hard to maintain staticRef in cached AST. In fact, we don't need
it in this optimization. We'll get excessive names in used set,
which is ok: non-function names don't matter, they'll be simply ignored.
One possible concern: there's more chance to get name same to
some function's name and it won't be removed. First, it's not fatal,
it won't break the code (but put some excessive code that will likely
be removed by DCE). Second, there's same chance of two functions
having same names, and we manage to avoid this (otherwise we'll get
many problems).
For-in-string loop can be generated using specialized 'length' and
'charAt' method calls, and with cached string length.
Note that update of the string variable in loop body doesn't affect
loop execution semantics.
#KT-21322 Fixed Target versions 1.2.20
If the range expression is not a local variable (which can be updated in
the loop body affecting loop behavior, see KT-21354), we can cache the
array length, thus turning a for-in-array loop into a simple optimizable
counter loop.
#KT-21321 In Progress
See the previous commit for information on the kotlin-reflect vs
kotlin-reflect-api distinction.
Add kotlin-reflect as an explicit runtime dependency of most of the test
configurations because even though they all depend on tests-common, the
runtime dependency on kotlin-reflect is not exported from tests-common
to other modules because the projectTests dependency is not transitive.
This is needed only for faster compilation of the Kotlin project itself
and has no effect on the public artifact
org.jetbrains.kotlin:kotlin-reflect.
The problem this is solving is the rebuild of the project once anything
has been changed in modules in 'core' (even inside function bodies, i.e.
a non-API change). Previously, changes in 'core' led to the compilation
of kotlin-reflect, which led to the rebuild of all modules depending on
kotlin-reflect directly or indirectly (which is almost all modules in
the project) because kotlin-reflect's artifacts are custom-built and the
changes can not be picked up incrementally. But 99.9% of the time the
initial changes in 'core' could not have any effect on the usages of
kotlin-reflect, because classes from those modules are moved to an
internal package in kotlin-reflect and thus are an internal
implementation detail.
Now, changes in 'core' still lead to the compilation of kotlin-reflect
and to the process of building the custom jar. But if a module depends
on kotlin-reflect-api, not kotlin-reflect, then the incremental
difference checker will detect that the module does not have to be
recompiled if there hasn't been any changes to the API of
kotlin-reflect-api. Which means that the module will not be rebuilt on
every change in 'core'.
This commit only introduces the new module. The dependencies
(kotlin-reflect -> kotlin-reflect-api) are replaced in the next commit.