Commit Graph

39753 Commits

Author SHA1 Message Date
Alexey Andreev cfbb9209a7 Add JS DCE gradle plugin 2017-06-29 10:32:30 +03:00
Nikolay Krasko 9eefbc2036 Perform 'all import resolve' once and protect it with lock (EA-79696)
Binding context and diagnostic structures are not thread-safe now and
need to be protected with the lock.

Fix flacky test testRemoveDuplicateImport

This also probably fixes some traces in EA-79696
2017-06-28 18:57:13 +03:00
Nikolay Krasko 9f873f869a Print all diagnostics if null diagnostic found (EA-79696)
Diagnostics collection shouldn't contain nulls, but may do so when there
were unprotected simultaneous writes from several threads.
2017-06-28 18:57:12 +03:00
Mikhail Glukhikh 6c274cecff Protect getSingleAbstractMethodOrNull from data binding deadlock
Now it cannot cause resolve re-entrance
Probably #KT-18687 Fixed
2017-06-28 16:40:27 +03:00
Dmitry Neverov 3e29f9ed5a Don't report as redundant 1st semicolon in enum without entries
So #KT-12524 Fixed
2017-06-28 15:30:40 +03:00
Toshiaki Kameyama 3a606d13f0 Extends range of change visibility intention #KT-14093 Fixed 2017-06-28 15:28:50 +03:00
Dmitry Neverov 44ce5f73f7 Apply De Morgan's laws to non-negated binary expressions
So #KT-18460 Fixed
2017-06-28 15:28:43 +03:00
Toshiaki Kameyama af53a0ecd5 Add quick-fix "Replace with safe call & elvis" #KT-17815 Fixed 2017-06-28 15:28:35 +03:00
Toshiaki Kameyama c2707bb81b Support cascade if / when in lift return / assignment intentions
So #KT-13458 Fixed
So #KT-13436 Fixed
2017-06-28 15:28:28 +03:00
Toshiaki Kameyama ed04b4debd Add quick-fix for empty brackets after primary constructor
So #KT-18534 Fixed
2017-06-28 15:28:21 +03:00
Mikhael Bogdanov 69457ef3f1 Generate optimized hashCode for primitive type with jvmTarget 1.8+
#KT-7571 Fixed
2017-06-28 13:44:07 +02:00
Igor Chevdar d7e4350d42 Ignored/fixed some tests for Kotlin/Native 2017-06-28 12:54:32 +03:00
Alexey Andreev 7b52300287 Remove unnecessary system property from JS tests launch configuration
Replace it with property that allows to disable DCE tests.
This is useful for temporary disabling DCE without examining source
code to find property name.
2017-06-28 10:48:02 +03:00
Alexey Andreev 4037112f28 Implement deepCopy in JsRegExpr 2017-06-28 10:48:01 +03:00
Alexey Andreev 64331ffa40 Avoid excessive copying in JsLabel
See KT-18331
2017-06-28 10:48:01 +03:00
Denis Zharkov 3dc4f8a2ff Do not write generics for $suspendImpl synthetic method
#KT-18252 Fixed
2017-06-28 10:25:08 +03:00
Yan Zhulanow e7e0032cc8 Kapt3, minor, tests: Weaken regular expression for Metadata shrinking 2017-06-28 10:25:08 +03:00
Denis Zharkov d88d1d6189 Do not use non-existing class for suspend markers
As they remain in inline functions now proguard emits
a warning about them, even though inline suspend functions
are effectively inline-only and these markers can't be
executed at runtime

 #KT-18702 Fixed
2017-06-28 10:24:53 +03:00
Denis Zharkov cb95986c36 Report error on calls to obsolete inline suspend functions
They do not contain markers for suspend calls in them

See the changes introduced for fixing KT-16603
2017-06-28 10:24:27 +03:00
Zalim Bashorov 6441c9d913 Restore executable attributes for all files in kotlinc/bin after copying them 2017-06-27 21:57:59 +03:00
Zalim Bashorov 6cd678af06 Add the ability to provide custom tag when deploy to npm 2017-06-27 21:35:09 +03:00
Nikolay Krasko d8d862fa68 Do not compute class names for inline usages during stepping (KT-18411)
This was lost in "Debugger: Fix AbstractPositionManagerTest"(622430a29)

ExtraSteppingFilter: do not compute classNames for inline (f28f7eaa3b)

 #KT-18411 Fixed
2017-06-27 17:39:17 +03:00
Mikhail Glukhikh 7d7ef18e99 Fix type in README 2017-06-27 17:10:27 +03:00
Alexey Andreev f6964b18db Fix performance issue in JS inliner
See KT-18679
2017-06-27 15:10:21 +03:00
Alexander Udalov f96ef96078 Check JDK_16 and JDK_18 existence in build.xml 2017-06-27 14:54:53 +03:00
Alexander Udalov e42b151561 Support primitive array annotation arguments in ConstantValueFactory
This has no visible consequences at the moment, but will help once we
need to load such argument from some annotation in the compiler in the
future
2017-06-27 14:53:39 +03:00
Alexander Udalov b67542533b Drop unused FunctionDescriptor.Configuration.setSource 2017-06-27 14:53:39 +03:00
Alexander Udalov 288c2b5dc9 Minor, remove some obsolete usages of ResolutionContext#replaceScope 2017-06-27 14:53:39 +03:00
Alexander Udalov 59b932a815 Optimize away unneeded FqName computation in KotlinBuiltIns
Before computing the FqName, check the simple class name first. This
code was responsible for about 20% of FqNameUnsafe instances created
during compilation of "core" modules
2017-06-27 14:53:39 +03:00
Alexander Udalov 0352bdbca5 Optimize and improve AbstractClassTypeConstructor.equals
Instead of computing and comparing FQ names, compare simple names of
classes and theirs containers. This code was responsible for creation of
about 10% of FqNameUnsafe instances during compilation of "core"
modules.

Also make the check more strict: previously, a class "c" declared in
package "a.b" would be considered equal to a class "c" declared in class
"b" in package "a". Because JVM type descriptors of such classes are
different, this behavior was suspicious and might have lead to error at
runtime. Now, we require the number of containing classes of the given
two classes also to be the same
2017-06-27 14:53:39 +03:00
Dmitry Petrov d5e02f069a Fast version for POP backward propagation (without SourceInterpreter) 2017-06-27 14:28:42 +03:00
Dmitry Petrov f1183d98a9 Fix complexity formula for SourceInterpreter
It is actually N^2 * F (VERY pessimistic case),
N = number of instructions
F = frame size
because frames contain sets of instructions.
2017-06-27 14:28:42 +03:00
Dmitry Petrov a84c2a6f31 Improve string concatentation & string templates code generation
Reuse StringBuilder instances for nested subexpressions.
(NB StringBuilder instance for string template with a string
concatenation inside an expression entry, such as `"${"a" + "b"}"`,
will not be reused, although that doesn't seem to be a real-life issue).

 #KT-18558 Fixed Target versions 1.1.4
 #KT-13682 Fixed Target versions 1.1.4

Join adjacent strings literals, escaped strings, and constant values
(in a language version that supports const val inlining).
Use StringBuilder#append(char) for single-character constants
(e.g., " " in "$a $b").

 #KT-17280 Fixed Target versions 1.1.4
 #KT-15235 Fixed Target versions 1.1.4
2017-06-27 14:28:42 +03:00
Dmitry Petrov ae71833a12 Use original descriptors for functions when generating stubs
Descriptors for builtin class members on JVM are substituted.
2017-06-27 13:00:10 +03:00
Dmitry Petrov 5e5a1bd686 Use java.lang.Object as a fall-back reference type
If for some reason during preliminary analysis in redundant null check
elimination we failed to determine a local variable type statically,
treat it as java.lang.Object.
This will disable some further optimizations using precise type
information (such as INSTANCEOF check elimination), but will not fail
with an exception anyway.
2017-06-27 12:56:34 +03:00
vitaly.khudobakhshov d165ea9ea7 Add expression type string to the REPL API
PR-1131
2017-06-27 11:28:40 +02:00
Alexander Udalov 8783f7a94e Remove unneeded nullability annotations in CallableReference 2017-06-26 18:46:26 +03:00
Alexey Andreev 20842dcc44 Add module name as a prefix to declaration keys in JS translator
This is necessary due to different modules can have same
package declarations. When importing declarations from these
packages, we should distinguish from which module we are importing it.

See KT-18652
2017-06-26 18:16:00 +03:00
Alexey Andreev 3331be9cc8 Fix JS CLI test that fails in Windows 2017-06-26 18:15:30 +03:00
Alexey Andreev adc04196b1 Support JS source map source embedding configuration in IDEA 2017-06-26 18:15:29 +03:00
Alexey Andreev a0e1bde594 Allow to embed source files into JS source maps 2017-06-26 18:15:28 +03:00
Nikolay Krasko 73c37ecd25 Remove usage of HighlightingSession.getEditor()
It's going to be deleted in IDEA.
2017-06-26 17:39:39 +03:00
Alexander Udalov 0c8ca5f930 Extract some functions from test class into base class
To be used in other tests which will be subclasses of
AbstractKotlinCompilerIntegrationTest
2017-06-26 16:22:05 +03:00
Alexander Udalov 69efb81a12 Minor refactoring in JavaModuleInfo
Remove unused declarations
2017-06-26 16:22:05 +03:00
Alexander Udalov fd0658e0f4 Minor, inline unneeded JvmDependenciesIndexFactory 2017-06-26 16:22:05 +03:00
Alexander Udalov 0e2e3b3e65 Cleanup KotlinCoreEnvironment and usages
Remove unused API, weaken declaration visibility, reformat
2017-06-26 16:22:05 +03:00
Alexander Udalov 999e4cda1d Compute module mappings eagerly in JvmPackagePartProvider, refactor
Previously we traversed all notLoadedRoots on each request for package
parts with the given package FQ name. Since notLoadedRoots might contain
a lot of roots (which never transition into "loadedModules" because e.g.
they are not Kotlin libraries, but just Java libraries or SDK roots with
the META-INF directory), this was potentially hurting performance. It
seems it's more optimal to compute everything eagerly once
JvmPackagePartProvider is constructed.

Another problem with the previous version of JvmPackagePartProvider was
that it did not support "updateable classpath" which is used by REPL and
kapt2, it only used the initial roots provided in the
CompilerConfiguration. In REPL specifically, we would thus fail to
resolve top-level callables from libraries which were dynamically added
to the execution classpath (via some kind of a @DependsOn annotation).
In the new code, JvmPackagePartProvider no longer depends on
CompilerConfiguration to avoid this sort of confusion, but rather relies
on the object that constructed it (KotlinCoreEnvironment in this case)
to provide the correct roots. This is also beneficial because the
computation of actual VirtualFile-based roots from the ones in the
CompilerConfiguration might get trickier with modular Java 9 roots
2017-06-26 16:22:05 +03:00
Alexander Udalov a5a78b8f91 Minor refactoring in ClasspathRootsResolver.convertClasspathRoots
Package prefix only makes sense for JavaSourceRoot content roots
2017-06-26 16:22:05 +03:00
Alexander Udalov 2424431e16 Extract ClasspathRootsResolver out of KotlinCoreEnvironment 2017-06-26 16:22:04 +03:00
Alexander Udalov 6d48b1c3fb Minor, extract MessageUtil.virtualFileToPath 2017-06-26 16:22:04 +03:00