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