Commit Graph

60167 Commits

Author SHA1 Message Date
Dmitriy Dolovov 59e84e826b Fast check of Kotlin/Native KLIBs by virtual files 2019-12-25 11:42:14 +07:00
Dmitriy Dolovov 98e9642a1e Stop publishing old KLIB reader 2019-12-25 11:42:04 +07:00
Igor Yakovlev 4afbbda858 Minor fixes of move refactoring
Fix NPE for case when target path for package is not exists
Clarify case when target path for file move does not exists
Fix NPE when file selector shows with empty edit box of file name in Move dialog
2019-12-24 21:25:38 +03:00
Igor Yakovlev a2db1f8314 Fix move tests for bunch 192 2019-12-24 19:49:07 +03:00
Roman Artemev f2f7d144aa [JS] Fix failing test 2019-12-24 19:26:06 +03:00
Roman Artemev 6ba8fbd451 [IR BE] Refactored FoldConstantLowering
- Fix `toString` evaluation for unsigned types in FoldConstantLowering
 - make corner cases around float/double evaluation work for K/JS
 - remove usage of kotlin type
2019-12-24 19:26:06 +03:00
Roman Artemev e4f83b96a3 [JS BE] Reduce temporary variable number produced during lowering
- Do not create temporary variable for pure expressions
 - Clean up unused and unreachable r-value on top level of statement block
2019-12-24 19:26:06 +03:00
Roman Artemev fb3bd8a9ac [JS BE] Implement accessor inlining optimization (WIP)
- enable constant folding
2019-12-24 19:26:05 +03:00
Roman Artemev 9871f8c579 [JS BE] Fix DCE to let it remove constant properties 2019-12-24 19:26:05 +03:00
Roman Artemev 2c94f590ca [JS BE] Improve error message in JS BE 2019-12-24 19:26:05 +03:00
Roman Artemev 738db7e511 [IR BE] Make FoldConstantLowering common 2019-12-24 19:26:05 +03:00
Roman Artemev 540b3cfec3 [JS IR] Fix test to make them able to run with JS 2019-12-24 19:26:05 +03:00
Roman Artemev b5af28b28d [JS IR] Fix state machine builder to fit into switch optimizer requirements 2019-12-24 19:26:05 +03:00
Roman Artemev 50889e77a8 [JS IR] Support switch optimization for when-expression 2019-12-24 19:26:05 +03:00
Roman Artemev 23caf15457 [JS IR] Implement Switch optimizer for JS IR codegen 2019-12-24 19:26:05 +03:00
Igor Yakovlev 8dd467bde0 Fix build for bunch 191 2019-12-24 19:16:52 +03:00
pyos 982a088f00 JVM_IR: do not copy defaults in functions with inline class parameters 2019-12-24 18:59:33 +03:00
Igor Chevdar 9e17140daf [JS_IR] Turned on passing JS_IR tests 2019-12-24 15:54:45 +03:00
Igor Chevdar 7a5e8b4316 [IR] Inliner: supported tricky function references
This includes references to functions with varargs and default arguments
2019-12-24 15:54:45 +03:00
Dmitry Petrov cdf9ef63ba Remove nullability assertions from special bridge call arguments 2019-12-24 12:50:06 +03:00
Toshiaki Kameyama fabeca5955 Redundant curly braces in string template: do not report labeled 'this'
#KT-35475 Fixed
2019-12-24 14:46:46 +07:00
Mikhail Glukhikh 80d29cdad1 FIR resolve: soften processBlock limitation during inference completion
This allows us to enter some lambdas unentered before
2019-12-24 10:42:55 +03:00
Mikhail Glukhikh fd73f5af20 FIR: simplify problematic test 2019-12-24 10:42:49 +03:00
Toshiaki Kameyama 03ec76b570 Redundant visibility modifier: do not report for 'internal' inside 'private'
#KT-35639 Fixed
2019-12-24 14:41:10 +07:00
Toshiaki Kameyama 49e5f170d1 "Replace 'when' with 'if'" intention: do not suggest if 'when' subject is variable declaration
#KT-35528 Fixed
2019-12-24 14:37:53 +07:00
Toshiaki Kameyama 1cdcef3b08 "Split property declaration" intention: do not suggest in 'when' subject
#KT-35528 Fixed
2019-12-24 14:37:53 +07:00
Ivan Gavrilovic eab6864269 KT-35536: Fix enum constants in KAPT
Enum constants are Pair, so make sure to unpack them correctly.
2019-12-24 15:14:47 +09:00
Ivan Gavrilovic 62924ddcd4 KT-35472: Detect when content of annotation processor changes
Even if annotation processor classpath is the same, in case
individual entries change (e.g. bulding annotationo processor
from source), KATP should run non-incrementally.

Test: KaptIncrementalWithIsolatingApt.testUnchangedAnnotationProcessorClasspathButContentChanged
2019-12-24 15:14:47 +09:00
Stéphane Nicolas 7b227f3113 Remove Redundant Project
Just some syntax cleanup when visting the file.
Note: I was trying to understand why the output folders of kapt are creating so eagerly in a build, during configuration time indeed...(they should be created later, during execution).
2019-12-24 15:14:47 +09:00
Georgy Bronnikov d4b0151f51 JVM_IR: fix name of received field for suspend lambdas
$ at the start caused AnonymousObjectTransformer to skip the field.
2019-12-23 18:03:46 +01:00
Ilmir Usmanov 068d3f4beb JVM_IR: Use IrInlineReferenceLocator to find inline suspend lambdas and lambdas, which capture crossinline 2019-12-23 18:03:45 +01:00
Ilmir Usmanov 1ea89ce28e JVM_IR: Minor. Unmute tests 2019-12-23 18:03:44 +01:00
Ilmir Usmanov 5c92da3f35 JVM_IR: Do not generate parameter annotations for continuation constructors
The idea is the same as in case of anonymous objects: they are created only
from Kotlin code, so we are sure, that the parameters are valid.
Also, the inliner complains on their transformations.
2019-12-23 18:03:43 +01:00
Ilmir Usmanov 9292022f88 JVM_IR: Support inner lambdas which capture crossinline 2019-12-23 18:03:42 +01:00
Ilmir Usmanov daa76cbf1e JVM_IR: Support inner objects with multiple suspend functions
Do not clean `functionsToAdd`
2019-12-23 18:03:41 +01:00
Ilmir Usmanov a1448ebb37 JVM_IR: Support crossinline suspend lambdas
The main idea is the following: since we need to generate
(fake)continuations before inlining, we move IrClasses of suspend
lambdas and continuation classes of named functions into the functions.
Thus, it allows the codegen to generate them prior to inlining and
the inliner will happily transform them for us.
Because of that, lowerings which transform call-site function are likely
to change reference to lowered suspend lambdas or functions.
Hence, do not rely on references to lowered suspend lambdas or
functions, instead, rely on attributes.

Do not generate continuation for inline suspend lambdas.
Previously, inline suspend lambdas were treated like suspend functions,
thus we generated continuations for them. Now we just do not treat them
as suspend functions or lambdas during AddContinuationLowering.
We should add continuation parameter to them, however.

Do not generate secondary constructor for suspend lambdas, otherwise,
the inliner is unable to transform them (it requires only one
constructor to be present).

Generate continuation classes for suspend functions as first statement
inside the function.
This enables suspend functions in local object inside inline functions.
Since we already have attributes inside suspend named functions, we
just reuse them to generate continuation class names. This allows us
to close the gap between code generated by old back-end and the new
one.

If a suspend named function captures crossinline lambda, we should
generate a template for inliner: a copy of the function without
state-machine and a continuation constructor call. The call is needed
so the inliner transforms the continuation as well.

Refactor CoroutineTransformerMethodVisitor, so it no longer depends on
PSI.
2019-12-23 18:03:40 +01:00
Ilmir Usmanov 3b37f6bd32 JVM_IR: Add attributes to named suspend functions
This is a prerequisite to moving continuation classes inside said
functions, which is needed to support crossinline suspend lambdas.
The logic of whether to copy attributes on lowerings or not is simple:
  - if the lowering moves function body to a new place, it should copy
  the attributes.
  - if the lowering just generates new declarations (i.e. bridges), it
  should leave attributes as is.
2019-12-23 18:03:39 +01:00
Igor Yakovlev 0f1592b023 Remove deprecated method usage 2019-12-23 16:32:43 +03:00
Igor Yakovlev 6fb788d446 Fix move refactoring for several class files
Fixed #KT-35235
(also fixed #KT-35427)
2019-12-23 16:32:43 +03:00
Mads Ager 51f726be9b JVM_IR: Fix check for whether classes are from Java.
This allows us to not generate redundant immutable collection
stubs. The code to generate the immutable collection stubs does
not deal well with thinking that all external declarations
come from Java.
2019-12-23 14:24:48 +01:00
Steven Schäfer e261b1e2de JVM IR: Fix line numbers in callable reference classes 2019-12-23 14:03:34 +01:00
pyos 59f2aa7add JVM_IR: remove constructors of nested annotations 2019-12-23 13:59:42 +01:00
pyos 17d2fda946 JVM_IR: keep nullability when remapping type parameters 2019-12-23 14:28:05 +03:00
Igor Chevdar 1b95040934 [kotlin-native-plugin] Two fixes:
* Added property to select the cache kind (none, dynamic, static)
* Fixed the check if the cache needs to be rebuilt
2019-12-23 12:37:38 +03:00
Mikhail Zarechenskiy e078282767 Fix ambiguity between Java and Kotlin SAM candidates
Because of incorrect flag we generated synthetic SAM candidates and got ambiguity when feature `SamConversionPerArgument` was enabled (Gradle case) because candidates for Java were duplicated

 #KT-35579 Fixed
2019-12-23 12:22:20 +03:00
Mikhail Glukhikh 99e02665b5 Add forgotten FIR test data for old FE test 2019-12-23 12:11:07 +03:00
Mikhail Glukhikh 81ac46d35d Fix FIR test data for old FE test 2019-12-23 12:02:54 +03:00
Ilya Goncharov 74889ef3ad [Gradle, JS] Actualize node and yarn version
#KT-35599 fixed
2019-12-23 11:31:15 +03:00
Ilya Goncharov 24e3310393 [Gradle, JS] Add check on run and dist task
- Check existence of compile output file to prevent fail in case of NO-SOURCE

#KT-31894 fixed
2019-12-23 11:29:17 +03:00
Dmitry Petrov fefdce0406 KT-35550 Generate type parameters for delegating property accessors 2019-12-23 10:10:16 +03:00