Commit Graph

45758 Commits

Author SHA1 Message Date
Ilya Chernikov 9eab7a627d Add script API libs sources to the IDEA plugin 2018-05-03 22:15:10 +02:00
Alexander Udalov 64f5c2c9a3 Refactor and simplify AbstractCustomScriptCodegenTest
Remove copy-paste, use CodegenTestCase's infrastructure as much as
possible, use InTextDirectiveUtils instead of regexps
2018-05-03 22:15:10 +02:00
Alexander Udalov c48bb9c981 Minor, drop unused parameter in CodegenTestCase, add testJdkKind 2018-05-03 22:15:10 +02:00
Ilya Chernikov 48cf0bd949 Fixes and refactorings after review 2018-05-03 22:15:10 +02:00
Ilya Chernikov dff4be9e04 Implement script environment variables in backend, add simple test 2018-05-03 22:15:09 +02:00
Ilya Chernikov a9600e34bf Add test infrastructure for custom scripts testing, add receiver test 2018-05-03 22:15:09 +02:00
Ilya Chernikov 57db77a295 Refactor script infrastructure for easier usage and testability:
- add script annotation for specifying default configuration for a script
- add support for this annotation in the default configurator
- rename configurator accordingly
- add default implementation of the refineConfiguration method
- make property bag class open
2018-05-03 22:15:09 +02:00
Ilya Chernikov 516924cda1 Add support for script environment variables to the frontend 2018-05-03 22:15:09 +02:00
Ilya Chernikov 15f9ad9531 Implement quick non-script detection and lazy script discovery..
so ".kt" and ".java" files are not considered as scripts and quickly
filtered out, and for the other files the the checks are implemented
using sequences, mechanisms provided to supply script definitions
lazily, and script discovery is implemented using this mechanisms.
2018-05-03 22:15:09 +02:00
Ilya Chernikov 969340167f Apply scripting plugin in gradle plugin by default 2018-05-03 22:15:09 +02:00
Ilya Chernikov a29411a211 Process script templates everywhere properly:
- add options to disable scripting plugin and standard script definition
- move standard definition adding logic into appropriate place
- fix logic of scripting plugin loading
- add standard script definition on the environment creation to
  ensure compatibility with all usages
- fix testdata
- some minor fixes
2018-05-03 22:15:09 +02:00
Toshiaki Kameyama b5da48c566 Don't report suspicious callable reference on invoke with parameters
So #KT-23465 Fixed
2018-05-03 18:47:12 +03:00
Toshiaki Kameyama 13356d32fd Redundant SAM-constructor: highlight nested class name with outer class
So #KT-11156 Fixed
2018-05-03 18:32:44 +03:00
Toshiaki Kameyama 204c68070a Reformat RedundantSamConstructorInspection 2018-05-03 18:31:34 +03:00
Toshiaki Kameyama c43311ba9a Move to constructor: change default use-site target: property -> field
So #KT-23801 Fixed
2018-05-03 18:12:11 +03:00
Toshiaki Kameyama 012227dd73 Reformat MovePropertyToConstructorIntention 2018-05-03 18:11:23 +03:00
Toshiaki Kameyama 633679ac16 Preserve comments in "Remove variable" quick fix #KT-23753 Fixed 2018-05-03 18:09:22 +03:00
Alexey Tsvetkov 61edfaced5 Speed up pill
Pill runs 10x faster on my machine after the change
2018-05-03 18:03:18 +03:00
Toshiaki Kameyama 66d738848b Convert foreach to for loop: place caret on the variable declaration
So #KT-7822 Fixed
2018-05-03 17:54:56 +03:00
Toshiaki Kameyama 3221fbdca9 Don't "Remove explicit type" for callable with function initializer
So #KT-12168 Fixed
2018-05-03 17:46:47 +03:00
Toshiaki Kameyama 5204c73bec Quick-fix "use spread operator": make working with mapOf #KT-14556 Fixed 2018-05-03 17:11:33 +03:00
Toshiaki Kameyama a7110a1517 Add intention to indent a raw string #KT-9943 Fixed 2018-05-03 17:05:14 +03:00
Alexander Udalov a2d45062c2 Fix another non-determinism in CommonSupertypes 2018-05-03 16:02:49 +02:00
Mikhail Glukhikh e07f83ddbc "Redundant Unit" inspection: new tests, simplification & fixes
Related to KT-23977 and KT-24066
2018-05-03 16:12:20 +03:00
Toshiaki Kameyama 6e150d27f1 "Redundant Unit" inspection: fix for Unit returned as Any
So #KT-24066 Fixed
2018-05-03 16:12:19 +03:00
Toshiaki Kameyama c44cab4565 "Redundant Unit" inspection: Fix for labeled return #KT-23977 Fixed 2018-05-03 16:12:19 +03:00
Mikhael Bogdanov b4853d9293 Minor. Reformat 2018-05-03 12:04:47 +02:00
Mikhael Bogdanov eefc49a617 Use symbols to find local declarations in codegen 2018-05-03 12:04:45 +02:00
Mikhael Bogdanov f0e4420259 Don't recreate ir declarations to set body 2018-05-03 12:04:45 +02:00
Mikhael Bogdanov 35df7966cf Use symbols in IrGet/SetValue in JvmSharedVariablesManager 2018-05-03 12:04:32 +02:00
Mikhael Bogdanov bb6c837f6b Use symbols in IrGet/SetValue in EnumClassLowering 2018-05-03 11:38:52 +02:00
Mikhael Bogdanov 5a2e62dd4f Use symbols in IrGet/SetValue 2018-05-03 11:38:50 +02:00
Mikhael Bogdanov 077f3a4ed2 Minor. Reformat 2018-05-03 11:27:57 +02:00
Mikhael Bogdanov ed44327569 Properly set parents in JvmLower 2018-05-03 11:23:57 +02:00
Mikhael Bogdanov e793a7eea7 Use symbols in synthetic accessor to access accessor parameters 2018-05-03 11:23:56 +02:00
Mikhael Bogdanov 92e02e35fc Convert FrameMap to Kotlin and extract base logic 2018-05-03 11:23:56 +02:00
Mikhael Bogdanov 76bab8f3b0 Rename FrameMap.java to FrameMap.kt 2018-05-03 11:23:55 +02:00
Natalia Selezneva 49a1788728 Update testData after switching on kotlin internal mode in tests 2018-05-03 11:32:52 +03:00
Mikhail Zarechenskiy 5815e790ba Minor, use utility to get default type for number type constructor 2018-05-03 11:04:55 +03:00
Mikhail Zarechenskiy d6405c8147 Fix exception on mapping internal types to UAST types with NI
#EA-119071 Fixed
2018-05-03 11:04:54 +03:00
Ilmir Usmanov f507a26a12 Generate decomposed lambda params in suspend lambda's local variables
Unlike ordinary lambdas, suspend lambdas do the computation in
doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object;
method. As you can see, there are no decomposed parameters. As a result,
they used not to be generated.
To fix the issue, I add decomposed parameters to value parameters while
generating local variables table.

In addition, when generating suspend lambda for inline, the codegen
does not take this kind of parameters into account. This is also fixed.

 #KT-18576: Fixed
2018-05-03 10:35:13 +03:00
Alexander Udalov 712a796637 Fix MultiModuleHighlightingTestGenerated.testUseCorrectBuiltInsForCommonModule
Add dependency from a_jvm8 on stdlib. Otherwise, `getEmptyList` from
a_common was resolved to have an error return type
2018-05-02 16:56:54 +02:00
Alexander Udalov ac4edbba5b Regenerate tests 2018-05-02 16:17:14 +02:00
Alexander Udalov f59963ef73 Simplify test case on deterministic null-checks 2018-05-02 14:40:15 +02:00
Denis Vnukov c5373c9029 Ensure deterministic insertion of checkExpressionValueIsNotNull.
Kotlinc source’s file DescriptorUtils.kt demonstarted non-deterministic
insertion of checkExpressionValueIsNotNull for value returned by
CallableDescriptor::getOriginal(). It was difficult to reproduce
this behavior on ф smaller example, but I added a test which was
failing once in 5-10 times while I was testing manually.

I believe this bug is close to KT-23704.

This PR addresses non-determinism to a degree when I can run 120
Compilations with './gradlew dist' and get same classes in all
jars in 'dist'.

NOTE that thew fact that insertion of checkExpressionValueIsNotNull may
depend on order of the types seems suspicios. This CL only addresses
non-determinism part, but I believe it’s worth looking into this more
from semantics point of view.
2018-05-02 14:36:04 +02:00
Alexander Udalov 10da41b136 Regenerate tests 2018-04-30 18:51:28 +02:00
Alexander Udalov c63cd430d1 Fix no-arg constructor generation for actual class 2018-04-30 15:26:50 +02:00
Alexander Udalov adb15d2d1a Do not report JvmOverloads warning on actual function with expected defaults
#KT-23910
2018-04-30 15:26:50 +02:00
Alexander Udalov 056c41bc00 Minor, improve kdoc of default args utilities in ArgumentsUtils.kt 2018-04-30 15:26:50 +02:00
Alexander Udalov a8488cf298 Fix JvmOverloads generation for actual methods
`countDefaultParameters` uses `hasDefaultValue` to compute the number of
parameters which have default values, which handles actual parameters
(who have default values in the expected declaration) correctly. Thus,
`getRemainingParameters` should use it as well to determine the list of
parameters to be skipped in each generated overload

 #KT-23910 Fixed
2018-04-30 15:26:50 +02:00