Compare commits

..

686 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda
ef0b228bdf Specify sequence type explicitly to clarify sample 2020-08-09 18:20:36 +03:00
Abduqodiri Qurbonzoda
1f3607cf88 Fix flatten and unzip samples 2020-08-06 08:15:12 +03:00
kvirolainen
e559ca21c5 Samples on flatten, unzip 2020-08-06 07:45:32 +03:00
Vladimir Dolzhenko
6ec0e9546b Fix 192 compilation for UI for standalone gradle scripts
Relates to #KT-39790
2020-08-05 23:39:34 +02:00
Konstantin Tskhovrebov
66c1bd8c89 Revert "Update KMM plugin user texts."
This reverts commit 5edbc75d
2020-08-05 21:54:01 +03:00
Pavel Kirpichenkov
c0e713980b Add helpers for getting commonly used services without an opt-in
These services are LanguageVersionSettings, DataFlowValueFactory
#KT-39643 Fixed
2020-08-05 21:44:47 +03:00
Pavel Kirpichenkov
ffc3d8bdfc Introduce @FrontendInternals annotation
#KT-39643
2020-08-05 21:44:47 +03:00
Sergey Igushkin
eff5839369 "Kotlin Multiplatform Projects are an ~experimental~ Alpha feature." 2020-08-05 22:01:12 +04:00
Ilmir Usmanov
6c475e614a Minor. Update debugger tests 2020-08-05 19:47:55 +02:00
Ilmir Usmanov
68342a1f72 Initialize fake inliner variables on resume path
Otherwise, this will cause R8 to complain.
2020-08-05 19:47:55 +02:00
Ilmir Usmanov
bb5a99ec18 Do not put $completion to LVT if is dead 2020-08-05 19:47:54 +02:00
Florian Kistner
9925866293 203: Fix compilation 2020-08-05 19:36:43 +02:00
Florian Kistner
c792092410 Bump fastutil version to match 203 2020-08-05 19:36:42 +02:00
Nikita Bobko
c5398e8317 Move 'radixPrefix' from compiler modules to IDE modules
`radixPrefix` is used only in IDE now. So let's put it into IDE modules.

This commit is done in order to be able to use code dependent on
`radixPrefix` in `kotlin-ide` repo, because `kotlin-ide` depends on
1.4.0 artifacts of compiler. And `radixPrefix` isn't presented in
those artifacts
2020-08-05 20:17:17 +03:00
Sergey Igushkin
093d4b3108 Revert "Fix typealias usage nullability and annotations lost in deserialization"
This reverts commit 070848a1
2020-08-05 20:17:49 +04:00
Konstantin Tskhovrebov
5edbc75d7b Update KMM plugin user texts.
#Fixed KMM-324
2020-08-05 18:37:27 +03:00
Jinseong Jeon
b57794d96e IR util: IrExpression.isSafeToUseWithoutCopying 2020-08-05 17:07:27 +03:00
Jinseong Jeon
7ef1c74bbf FIR2IR: apply adapted reference conversion to coercion-to-unit 2020-08-05 17:07:27 +03:00
Mikhail Glukhikh
5f80bfd5d4 [FIR] Don't report UNINITIALIZED_VARIABLE on lateinit local variable 2020-08-05 16:47:51 +03:00
Natalia Selezneva
54d96a2dd7 UI for standalone gradle scripts
^KT-39790 Fixed
2020-08-05 15:22:22 +02:00
Mikhail Glukhikh
fc874e72b1 [FIR2IR] Initialize components a bit earlier to prevent lateinit errors 2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
17b289fa00 [FIR] Code cleanup: get rid of FirClass.buildUseSiteMemberScope() 2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
8bb5488a26 [FIR] look at intersectionOverride during override processing
This commit fixes some BB tests broken by previous commit
2020-08-05 12:11:34 +03:00
Mikhail Glukhikh
f1356a809e Fir2IrLazySimpleFunction: generate overridden symbols via FirTypeScope 2020-08-05 12:11:33 +03:00
Alexander Dudinsky
52c01abb83 Increase Xmx size after investigation OOM problem in KMM-316 2020-08-05 10:45:16 +03:00
Alexander Dudinsky
d012cd3272 Add kotlin-test-junit:install in dependencies for the kotlin-plugin install 2020-08-05 10:45:16 +03:00
Alexander Dudinsky
ea0099aa39 Fix testPlatformToCommonExpByInComposite.
In 9d362875da build started fail if mpp
or js targets not configured.
The test testPlatformToCommonExpByInComposite was fixed due it.
2020-08-05 10:45:16 +03:00
Alexander Dudinsky
05d6217f78 Changed gradle-plugin version in Gradle tests.
When 6.5.1 Gradle version was added, more tests have began to fail
because of legacy gradle-plugin versions (1.1., 1.2.) which are not
compatible with the new version of Gradle. This commit updates the used
version of the Gradle plugin to the latest stable (1.3.72) and makes it
configurable from tests.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
6652a7072c Fix testData due to KT-40551.
Starting from version 1.3.60, unnecessary dependencies with runtime
scopes have been added for modules jvmTest and jsTest. After updating
the plugin version in tests from 1.3.50 to 1.3.72 and master,
tests began to fail because of this. In order not to stop other checks
in tests, they were redone for the current behavior with unnecessary
dependencies.
After fixing bug KT-40551, the old behavior in tests will be returned.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
0298795b18 Add gradle.properties with kotlin.stdlib.default.dependency=false for tests
In the master version of plugin dependencies on stdlibs are enabled
by default. It is not expected for some tests.
Flag kotlin.stdlib.default.dependency=false fixed it.
2020-08-05 10:45:15 +03:00
Alexander Dudinsky
bc623e97ec Add Gradle version 6.5.1 for tests. 2020-08-05 10:45:15 +03:00
Alexander Dudinsky
1da05c54be Change gradle-plugin versions for tests from 1.3.50 to 1.3.72 2020-08-05 10:45:14 +03:00
Nick
f15f5bccc8 [FIR] Add more diagnostic messages 2020-08-05 10:41:06 +03:00
Victor Petukhov
f45de9d8fb NI: approximate not top-level captured types during code generation
^KT-40693 Fixed
2020-08-05 10:36:36 +03:00
Ilya Matveev
f6d7e7c52a CocoaPods: Fix setting custom framework name
The main scheme of a synthetic project generated for
pod import has the same name as the podspec generated
for the kotlin module (== Gradle project name). But
when starting an Xcode build, we specify the -scheme
argument to a framework name instead of project.name.

By default they are the same, but if a custom framework
name is specified, xcodebuild fails.

Issue #KT-40801 fixed
2020-08-05 06:46:53 +00:00
Mikhail Zarechenskiy
a45f73867a Add compatibility resolve when SAM conversion was applied partially
#KT-40646 Fixed
2020-08-05 00:03:33 +03:00
Sergey Igushkin
070848a1c1 Fix typealias usage nullability and annotations lost in deserialization
This fixes a regression introduced by the commit 4b0da0688a which made
deserializer expand typealiases but didn't take nullability and use site
annotations into account.

Issue #KT-40824 Fixed
2020-08-05 00:19:52 +04:00
Nick
ec4f04095c [FIR] Rearrange FirErrors.kt 2020-08-04 22:40:09 +03:00
Nick
207027b84c [FIR] Fix light tree's supertype FirDelegatedConstructorCall source 2020-08-04 22:37:43 +03:00
Nick
a59cedcd39 [FIR] Fix non-fake sources for constructor delegates 2020-08-04 22:37:42 +03:00
Nick
f74eb07203 [FIR] Fix incorrect diagnostic behaviour + several enum diagnostics 2020-08-04 22:28:49 +03:00
Nick
b76f757d47 [FIR] Add diagnostic for missing primary constructor 2020-08-04 22:28:49 +03:00
Nick
0f213e58db [FIR] Add diagnostic for primary constructor not called 2020-08-04 22:28:48 +03:00
Nick
bb0e1b7390 [FIR] Add diagnostic for constructor delegation cycles 2020-08-04 22:28:48 +03:00
Mikhail Glukhikh
e841b3a77b [FIR] Add diagnostic collection to KotlinToJVMBytecodeCompiler 2020-08-04 22:27:18 +03:00
Mikhail Glukhikh
9c3b8484b9 [FIR TEST] Add CLI test with should-be-error (not yet) 2020-08-04 22:27:18 +03:00
Ilmir Usmanov
824991a9dd Minor. Add tests. 2020-08-04 15:42:38 +02:00
Ilmir Usmanov
bbd4c21595 Cleanup spilled variables
#KT-16222
2020-08-04 15:42:37 +02:00
Ilmir Usmanov
999b41068b Minor. Refactor variables spilling
Split information collection and method node mutation.
2020-08-04 15:42:37 +02:00
Ilmir Usmanov
405c9743ef Do not spill dispatch receiver of suspend functions if it is not used
#KT-20571
2020-08-04 15:42:36 +02:00
Jinseong Jeon
5db7957230 FIR2IR: use type arguments from fully expanded type 2020-08-04 14:44:38 +03:00
Ilya Kirillov
606dc2f723 Fix binary compatibility problems in ImportInsertHelper & ShortenReferences 2020-08-04 12:46:13 +03:00
Victor Petukhov
af48f08f9c NI: take into account flexible types during capturing arguments from expression
^KT-40544 Fixed
2020-08-04 12:38:04 +03:00
vldf
65ebd02a39 [FIR] Fix for CanBeReplacedWithOperatorAssignment Checker 2020-08-04 11:20:42 +03:00
Mikhail Glukhikh
6f3df6faf4 [FIR] Regenerate extended checker tests 2020-08-04 09:35:36 +03:00
Mikhail Glukhikh
181a8bb79e [FIR TEST] Mute failing BB test with Byte/Short.and usage 2020-08-04 08:59:16 +03:00
Jinseong Jeon
47c47be3d3 FIR serializer: serialize annotations on FirTypeRef, not ConeKotlinType 2020-08-04 08:59:16 +03:00
Ivan Kylchik
0a28e5e031 Add argument unwrapping for case when argument is named 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
2e2099afae [FIR] Introduce NOT_AN_ANNOTATION_CLASS diagnostic 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
8fd087a964 [FIR] Don't report duplicated UNRESOLVED_REFERENCE on annotation entries 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
a6e811a67a [FIR] Add status to Java annotation constructor (fix after rebase) 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
8379b3794a [FIR2IR] Return fallback mode for annotation resolved placeholder 2020-08-04 08:59:15 +03:00
Dmitriy Novozhilov
b63257345b [FIR] Map Class to KClass in java annotations 2020-08-04 08:59:15 +03:00
Mikhail Glukhikh
282a295d43 [FIR] Enable arrayOf transformer in completion (inside annotations) 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
721b9b4d8c [FIR] Resolve annotations as calls 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
bc1fa8ed7f [FIR] Add constructor for java annotations 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
644e9843f9 [FIR] Add initialization of calleeReference for FirAnnotationCall 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
614291b2cc [FIR] Make FirAnnotationCall resolvable 2020-08-04 08:59:14 +03:00
Dmitriy Novozhilov
ffd30566be [FIR] Add FirErrorResolvedQualifier for qualifiers with resolve diagnostic 2020-08-04 08:59:14 +03:00
Dmitry Gridin
a5e9401a0a [configuration] change updater number to 1.4.* and 1.5.*
#KT-40639 Fixed
2020-08-04 11:13:30 +07:00
Julian Kotrba
88f508446a Make repeat example more expressive
This commit adds the zero-based index of current iteration from the passed HOF "action" of the repeat function to its associated code sample.

KT-20357
2020-08-04 00:48:06 +03:00
Ilya Gorbunov
a5178bb826 Minor: fix toJavaDuration docs 2020-08-04 00:34:15 +03:00
Ilya Gorbunov
99eb7f391b Fix doc wording around covariance/invariance 2020-08-04 00:33:05 +03:00
Roman Artemev
4f73e08704 [KLIB] Make fake override resolver garbage free as much as possible
- reduce memory pollution during FO resolve
2020-08-03 19:22:07 +03:00
Roman Artemev
876ee265f2 [KLIB] Fix memory leak in fake override resolver 2020-08-03 19:22:07 +03:00
Roman Artemev
e189cb1895 [KLIB] Fix memory leak in linker through haveSeen set 2020-08-03 19:22:06 +03:00
Roman Artemev
19b5fda750 [KLIB] Do not duplicate origin mapping per file 2020-08-03 19:22:06 +03:00
Roman Artemev
c253042948 [KLIB] Reduce amount of descriptors loaded during desc-idSig resolution 2020-08-03 19:22:06 +03:00
Roman Artemev
851c287105 [KLIB] Use SoftReference to hold proto memory
- fix metadata memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Roman Artemev
add0ad6733 [KLIB] Change KLIB IO API
- Use ReadBuffer instead of native java buffer
 - Use Weak buffers for File IO
 - fix klib memory leak for KT-40345
2020-08-03 19:22:06 +03:00
Jinseong Jeon
0e54f98b79 FIR: support adapted callable reference with vararg 2020-08-03 16:37:36 +03:00
Mikhail Glukhikh
4332e95b8a [FIR] Don't transform setter parameter type if it's given explicitly 2020-08-03 16:37:30 +03:00
vldf
8813ebd950 [FIR] Add RedundantSetterParameterType Checker 2020-08-03 16:37:24 +03:00
vldf
a6c9d869fb [FIR] Move RedundantCallOfConversionMethod to extended checkers 2020-08-03 16:31:49 +03:00
vldf
3349739d1e [FIR] Fixes for RedundantReturnUnitType checker 2020-08-03 11:42:19 +03:00
vladislavf7@gmail.com
2384afdd93 [FIR] refactoring for running extended checkers 2020-08-03 11:42:19 +03:00
vldf
cfc09048c6 [FIR] Add RedundantCallOfConversionMethod checker 2020-08-03 10:41:19 +03:00
Mikhail Glukhikh
39d4b79324 [FIR TEST] Fix FE 1.0 / FIR test data for nested / local type alias case 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
7724d060ff [FIR] Don't compare SYNTAX diagnostics in light tree diagnostic test 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
4e4fe9f719 [FIR] Support some kinds of fake sources in light builder 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
951aa8185e [FIR] Avoid duplicate diagnostics on expression.typeRef 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
dc46d51d9a [FIR TEST] Update diagnostic spec test data 2020-08-02 18:19:47 +03:00
Mikhail Glukhikh
6eab6f2f87 [FIR TEST] Replace OTHER_ERROR with UNRESOLVED_REFERENCE in test data 2020-08-02 18:19:47 +03:00
Nick
c55cdf1935 [FIR] Fix missing ErrorTypeRef for QA and clean DiagnosticCollector 2020-08-02 18:19:46 +03:00
Nick
7086b0cbf3 [FIR] Don't report duplicated errors in component calls typeRefs 2020-08-02 18:19:46 +03:00
Nick
4ceae8dc5e [FIR] Don't report duplicated errors in function calls typeRefs 2020-08-02 18:19:46 +03:00
Nick
6f85a07290 [FIR] Don't report duplicated errors in property declarations 2020-08-02 18:19:46 +03:00
Nick
889324e972 [FIR] Ignore failing test, improve DiagnosticKind, fix UPPER_BOUND 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
9335e09149 [FIR] Don't report duplicated errors in implicit properties / parameters 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
ceaffb1e8b [FIR] Don't report duplicated errors in implicit primary constructors 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
749346b73b [FIR] Don't report duplicated errors on default accessor error type refs 2020-08-02 18:19:45 +03:00
Mikhail Glukhikh
e0d25876b0 [FIR] Don't report simple diagnostics on fake sources 2020-08-02 18:19:44 +03:00
Mikhail Glukhikh
551bdd267d [FIR] Introduce WRONG_NUMBER_OF_TYPE_ARGUMENTS diagnostic 2020-08-02 18:19:44 +03:00
Mikhail Glukhikh
0804c6a0f3 [FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors
This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
2020-08-02 18:19:44 +03:00
Jinseong Jeon
c744dfba9c FIR: distinguish anonymous object as enum entry when scoping
so that `this` reference with the enum entry name as label can be
resolved
2020-08-02 18:06:15 +03:00
Jinseong Jeon
52631b7abd FIR2IR: make local storage track scopes, including anonymous init 2020-08-02 18:05:09 +03:00
Nick
26e3a111d6 [FIR] Add diagnostics for object related problems 2020-07-31 19:34:55 +03:00
Nick
694d3cad4e [FIR] Exposed visibility checker: optimize checks for local visibility 2020-07-31 19:28:10 +03:00
Nick
60462bea1c FirEffectiveVisibilityResolver: search parent in containingDeclarations
When determining effective visibility of 'something',
we use containing declarations from the context to find 'something'
parent, to avoid calling getClassSymbolByFqName for all cases.
2020-07-31 19:28:04 +03:00
Nick
7145caca40 [FIR] Refactor effective visibility calculation
Before this commit, we had effective visibility as a part of FIR status,
so it was integrated into the full pipeline. In this commit,
we introduced "effective visibility as a service" which is now used
only by exposed visibility checker. This allows us to make the thing
universal for all FIR nodes, including nodes for Java / deserialized.
2020-07-31 19:27:58 +03:00
Steven Schäfer
b15e32936e JVM IR: Optimize delegated properties (KT-36814) 2020-07-31 19:00:27 +03:00
vldf
8724efbe8a [FIR] Add empty range checker 2020-07-31 16:28:37 +03:00
vldf
b10defdbab [FIR] Add redundant single string expression template checker 2020-07-31 16:28:37 +03:00
vldf
95e0ba3d5c [FIR] Add ArrayEqualityOpCanBeReplacedWithEquals checker 2020-07-31 16:28:37 +03:00
Ilmir Usmanov
4d21a496fe Minor. Update tests 2020-07-31 14:33:52 +02:00
Dmitry Petrov
e11c90f26c JVM_IR: KT-40293 Box return type for DefaultImpls methods if required 2020-07-31 14:48:12 +03:00
Ilya Chernikov
034d5a948c Add JvmDefault to the new EP method for compatibility with older impls 2020-07-31 12:07:10 +02:00
Ilmir Usmanov
fa8c6deb18 Support restricted suspend lambdas in JVM_IR
#KT-40135 Fixed
2020-07-30 20:40:37 +02:00
Ilmir Usmanov
2c205410fa Check whether the field is indeed being initialized
in checkFieldInExactlyOnceLambdaInitialization
 #KT-40691 Fixed
2020-07-30 19:04:54 +02:00
Nikolay Krasko
d8b76f5b26 Register additional repository id 2020-07-30 19:33:58 +03:00
Vladimir Ilmov
7eca13569b (CoroutineDebugger) Enable agent for versions 1.3.8.*
Gradle artifact name gets changed from 'kotlinx-coroutines-core' to
'kotlinx-coroutines-core-jvm'. So it should support both.
2020-07-30 17:54:35 +02:00
Toshiaki Kameyama
c91858d470 Convert member to extension: do not suggest for delegated properties
#KT-35128 Fixed
2020-07-30 17:32:31 +03:00
Dmitry Petrov
46fccae7d1 PSI2IR: KT-40499 Fix delegated property desugaring
No type arguments were provided for property reference inside delegated
property accessors.
2020-07-30 13:18:36 +03:00
Jinseong Jeon
bff36e0199 FIR2IR: convert annotations on FirTypeRef 2020-07-30 11:25:36 +03:00
Georgy Bronnikov
4ca98041cd IR: update test data 2020-07-30 11:24:08 +03:00
Georgy Bronnikov
a27d63f58f JVM_IR: flexible nullability as annotation
We carry information about flexible nullability of IrType as an
annotation, so there is no need to look at its underlying KotlinType.
2020-07-30 11:24:07 +03:00
Georgy Bronnikov
a2e9521ad5 Make DescriptorlessExternalPackageFragmentSymbol public 2020-07-30 11:24:07 +03:00
Georgy Bronnikov
c2ead0303b IR: remove more descriptor usage 2020-07-30 11:24:07 +03:00
Alexander Gorshenev
9a717e9ecf Don't copy default value parameters for fake overrides 2020-07-29 22:15:10 +03:00
Mark Punzalan
2cfd776092 ForLoopsLowering: Assume step == 1 for *Range (e.g., IntRange) and
handle accordingly (e.g., do not read `step` property).
2020-07-29 20:44:51 +02:00
Dmitry Petrov
09e47fff7b Fix KotlinGradleIT.testCustomCompilerFile
Referencing org.jetbrains.annotations.{Nullable, NotNull} classes in
static initializer causes ClassNotFoundError in testCustomCompilerFile.
2020-07-29 20:33:17 +03:00
Dmitry Petrov
dae358c792 JVM: KT-40664 disable optimization for 'ULong in range of UInt' case 2020-07-29 20:33:17 +03:00
Dmitry Petrov
f2493d0950 JVM: KT-40665 more exact check for intrinsified range 'contains' 2020-07-29 20:33:17 +03:00
Roman Artemev
0559e192ee [JS IR] Support external delegation in case of JS in psi2ir
- fix FE delegation resolver
 - fix critical KT-40650
2020-07-29 19:57:05 +03:00
Nicolay Mitropolsky
c254651ed3 Uast: handling annotations on the property receiver (KT-40539) 2020-07-29 19:42:22 +03:00
Yaroslav Chernyshev
325ad56dcd Populate Kotlin source set roots with KotlinSourceRootTypes
By default Kotlin source root is populated with JavaSourceRootType and
changed during import only if real source folder exists.
Now Kotlin source roots has valid source type right after creation

#KT-37106 Fixed
2020-07-29 19:24:44 +03:00
Ilmir Usmanov
fec845365a Minor. No longer ignore obsolete PRE_RELEASE_CLASS diagnostic
in coroutine tests.
2020-07-29 17:52:01 +02:00
Simon Ogorodnik
ebfcd7e074 J2K: Improve presentation of conversions 2020-07-29 17:56:03 +03:00
Simon Ogorodnik
5c745facf4 J2K: Improve error message in case of incorrect detach 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
dc963e4ff6 Improve J2K progress reporting 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
8bcf1000f6 J2K: Fix java 9 try-with-resources 2020-07-29 17:56:02 +03:00
Simon Ogorodnik
c5005f8695 J2K: Speed-up add imports 2020-07-29 17:56:01 +03:00
Simon Ogorodnik
cd0c644654 J2K: Fix incorrect early detaching of elements in for conversion 2020-07-29 17:56:00 +03:00
Simon Ogorodnik
8c2dd876b5 J2K: Fix incorrect argument remapping when introducing defaults 2020-07-29 17:56:00 +03:00
Simon Ogorodnik
cd7ac55091 J2K: Show converted/total file counts 2020-07-29 17:55:59 +03:00
Simon Ogorodnik
468af0bb85 J2K: Fix type parameters in LHS of callable reference 2020-07-29 17:50:10 +03:00
Leonid Startsev
96d0b1c47a Update serialization runtime and fix test data
Revert "Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests"
2020-07-29 14:20:33 +03:00
Nikolay Krasko
a6a22d1cde Revert "Populate Kotlin source set roots with KotlinSourceRootTypes"
This reverts commit e2634190
2020-07-29 12:05:42 +03:00
Yaroslav Chernyshev
e263419088 Populate Kotlin source set roots with KotlinSourceRootTypes
By default Kotlin source root is populated with JavaSourceRootType and
changed during import only if real source folder exists.
Now Kotlin source roots has valid source type right after creation

#KT-37106 Fixed
2020-07-29 10:26:42 +03:00
Ilmir Usmanov
4fb5f8603a Keep $continuation in LVT
in case of suspend functions and `this` is case of lambdas, since they
are used in async stack trace generation.
Update tests.
 #KT-40661 Open
2020-07-29 00:01:12 +02:00
Ilmir Usmanov
db40808186 Minor. Remove unused SourceFrames 2020-07-29 00:01:11 +02:00
Ilmir Usmanov
70e91bd5db Shrink and split LVT records of variables according to their liveness
Otherwise, debugger will show uninitialized values of dead variables
after resume.
 #KT-16222
 #KT-28016 Fixed
 #KT-20571 Fixed
2020-07-29 00:01:10 +02:00
Ilmir Usmanov
e5995f0c12 Update R8
Because old version throws assertion error if parameter's LVT record
does no span the whole function.
2020-07-29 00:01:10 +02:00
Ilmir Usmanov
60875f96b4 Do not take LVT into account when calculating liveness of variables 2020-07-29 00:01:09 +02:00
Alexander Udalov
687d13a320 IR: cleanup expression implementations
Remove unused constructors with descriptors, minimize usages of
secondary constructors and make some properties non-lateinit, fix some
inspections.
2020-07-28 20:05:58 +02:00
Alexander Udalov
e36d3ba4f6 IR: remove IrNoArgumentsCallableReferenceBase
To simplify transformation of IR element hierarchy to classes.
2020-07-28 20:05:57 +02:00
Dmitriy Novozhilov
f270cd8d6e [FIR] Update testdata due to lack of callee reference in FirResolvedQualifier 2020-07-28 20:47:07 +03:00
Dmitriy Novozhilov
f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
anastasiia.spaseeva
5c0528b61e [Spec tests] Add tests for primary constructors declaration 2020-07-28 20:26:33 +03:00
anastasiia.spaseeva
0488dc985f [Spec tests] Add tests for intersection and OR 2020-07-28 20:26:32 +03:00
anastasiia.spaseeva
46774fb6d6 [Spec tests] Add call without an explicit receiver tests for top-level non-extension functions 2020-07-28 20:26:32 +03:00
anastasiia.spaseeva
bef59055cd [Spec tests] Fix test cases structure 2020-07-28 20:26:31 +03:00
anastasiia.spaseeva
4ad3847224 [Spec tests] Add tests for subtyping rules for simple classifier type 2020-07-28 20:26:30 +03:00
anastasiia.spaseeva
1801344c76 [Spec tests] Add tests for inner-and-nested-type-contexts section 2020-07-28 20:26:29 +03:00
anastasiia.spaseeva
d5ddb26180 [Spec tests] Add overload resolution tests for plus assign operator call 2020-07-28 20:26:28 +03:00
anastasiia.spaseeva
1d83c59e80 [Spec tests] Actualize test for callable reference section 2020-07-28 20:26:27 +03:00
anastasiia.spaseeva
4db209648d [Spec tests] Update spec version 2020-07-28 20:26:26 +03:00
anastasiia.spaseeva
3f862830f2 [Spec tests] Add tests for resolving callable references and some co-tests 2020-07-28 20:26:24 +03:00
anastasiia.spaseeva
cfbfec77a5 [Spec tests] Add tests for Algorithm of MSC selection 2020-07-28 20:26:23 +03:00
anastasiia.spaseeva
73850e97d7 [Spec tests] Add test for Coercion to Unit error diagnostics absence 2020-07-28 20:26:22 +03:00
anastasiia.spaseeva
26ac87d9be [Spec tests] Update spec testData 2020-07-28 20:26:21 +03:00
Alexander Udalov
f240d51d2c IR: do not inherit IrFakeOverride* from IrFunction/IrProperty
This will help to reduce boilerplate after making the latter classes.

Without this change, IrFunctionCommonImpl would not be able to be a
class because it would introduce a diamond class hierarchy, and thus
that would require copying all its contents to IrFunctionImpl and
IrFakeOverrideFunctionImpl.
2020-07-28 19:05:12 +02:00
Alexander Udalov
4892737cc9 Use IrFactory in kotlin-serialization-compiler 2020-07-28 19:04:44 +02:00
Alexander Udalov
0909894a96 PIR: make most implementations and carriers internal 2020-07-28 19:04:44 +02:00
Alexander Udalov
cce55f1609 IR: add module ir.tree.impl, move main IR implementation there 2020-07-28 19:04:44 +02:00
Alexander Udalov
77247deb23 IR: add module ir.tree.persistent, copy PIR implementation there
Use PersistentIrFactory in JS IR compiler entry points.
2020-07-28 19:04:43 +02:00
Alexander Udalov
9aed92d2dd Partially revert "Persistent IR implementation"
This partially reverts commit f437da8ee5.
Changes related to carriers and others are still there. They will be
moved out to a separate module in a subsequent commit.
2020-07-28 19:04:43 +02:00
Dmitry Petrov
980b91d082 JVM: generate 'Deprecated' on method as runtime-visible annotation
We generate @java.lang.Deprecated annotation on methods of $DefaultImpls
classes in compatibility mode. This annotation has RUNTIME retention and
should be visible.

Also, get rid of representing annotations as Class'es (yes we know that
these annotations are in compiler CLASSPATH, but we should not rely on
such classes and associated information).
2020-07-28 18:19:20 +03:00
Dmitry Petrov
4fdccb3b35 JVM_IR: don't generate repeated ElementType values in @Target 2020-07-28 18:19:20 +03:00
Ilya Goncharov
c065210b56 [Gradle, JS] Reuse task requirements
^KT-39825 fixed
2020-07-28 18:17:05 +03:00
Ilya Goncharov
9a3ae4f4fa [Gradle, JS] Common webpack configuration
^KT-39825 fixed
2020-07-28 18:16:51 +03:00
vldf
a2b26c00a1 Uncommented ControlFlowAnalysisBenchmark 2020-07-28 17:10:02 +03:00
vldf
fca0b7fedd [FIR] Add CFA benchmark 2020-07-28 14:30:40 +03:00
vldf
d7b3a86f5e [FIR] Add "can be val" extended checker 2020-07-28 14:17:38 +03:00
Jinseong Jeon
da6e96f4f1 FIR2IR: don't declare dispatch receiver for local functions 2020-07-28 13:43:10 +03:00
Jinseong Jeon
5a3367e09c FIR: initial support of suspend conversion for function reference 2020-07-28 13:37:05 +03:00
Alexander Udalov
b9243aad24 Minor, fix test data in bytecodeListing/specialBridges 2020-07-28 12:12:39 +02:00
Alexander Udalov
df324d5a08 IR: pull up common accept/transform implementations to interfaces
To avoid duplicating them among the main, persisting, lazy, and
fir2ir-lazy implementations.

Also reformat a bit, and avoid storing descriptor in a field in some
places.
2020-07-28 12:05:24 +02:00
Alexander Udalov
12d2a02d22 JS IR: drop JsIrDeclarationBuilder
Move buildValueParameter back to JsIrBuilder, and use common IR builders
directly where buildFunction was called.
2020-07-28 12:05:24 +02:00
Alexander Udalov
0d605a6b7f IR: create IrBlockBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov
9ad4a754ce IR: create IrExpressionBody via IrFactory 2020-07-28 12:05:24 +02:00
Alexander Udalov
d1dc938a5d IR: use IrFactory in IR builders 2020-07-28 12:05:24 +02:00
Alexander Udalov
898dd20a9e IR: use IrFactory in misc utils 2020-07-28 12:05:23 +02:00
Alexander Udalov
f359f36ed9 IR: add IrFactory to IrDeclaration, use in deep copy 2020-07-28 12:05:23 +02:00
Alexander Udalov
305288aa82 IR: use IrFactory in psi2ir 2020-07-28 12:05:23 +02:00
Alexander Udalov
8c41ba8ee4 IR: use IrFactory in fir2ir 2020-07-28 12:05:23 +02:00
Alexander Udalov
9356f87f28 IR: use IrFactory in linker 2020-07-28 12:05:23 +02:00
Alexander Udalov
db4cbe7103 IR: use IrFactory in SymbolTable 2020-07-28 12:05:23 +02:00
Alexander Udalov
c6a127e87e IR: introduce IrFactory
This is needed to refactor IrPersistingElementBase-based implementations
into another module, to use it in JS IR.
2020-07-28 12:05:23 +02:00
Kirill Shmakov
96968cd9c9 Fix build after rebasing 2020-07-28 12:55:38 +03:00
Kirill Shmakov
96160cbb55 Adapt AS wizard to changes in main wizard 2020-07-28 12:26:19 +03:00
Kirill Shmakov
5c8833f608 Wizard: improve mobile app template 2020-07-28 12:26:19 +03:00
Ilya Kirillov
63fa6674a3 Wizard: temporary add ios shortcut target
Temporary as it will not be needed when HMPP wizard will be ready
2020-07-28 12:26:19 +03:00
Ilya Kirillov
f330cd3697 Wizard: relocate AndroidManifest.xml for MPP module 2020-07-28 12:26:19 +03:00
Ilya Kirillov
b3d48cda8c Wizard: add common tests for iOS/Android template 2020-07-28 12:26:19 +03:00
Ilya Kirillov
5ffcaf6508 Wizard: add shared code for iOS/Android template
fix android
2020-07-28 12:26:19 +03:00
Ilya Kirillov
66c756ad0f Wizard: add ability for wizard to generate expected/actual declarations in MPP module 2020-07-28 12:26:18 +03:00
Ilya Kirillov
7d1036ee7e Wizard: use property for storing module dependency 2020-07-28 12:26:18 +03:00
Ilya Kirillov
dbc43b66bf Wizard: introduce ModuleConfiguratorProperty 2020-07-28 12:26:18 +03:00
Ilya Kirillov
74d6919c7c Wizard: wrap property into PluginProperty for plugin properties 2020-07-28 12:26:18 +03:00
Ilya Kirillov
3c3ba361e8 Wizard: specify path for plugin entities in one place 2020-07-28 12:26:18 +03:00
Ilya Kirillov
c05c72387e Wizard: fix node js templates 2020-07-28 12:26:18 +03:00
aleksandrina-streltsova
63e2d771b3 Get rid of reflection in new project wizard core: manually specify properties in plugins 2020-07-28 12:26:17 +03:00
Ilya Kirillov
cc35529b9a Wizard: get rid of reflection: specify plugin path by hand 2020-07-28 12:23:57 +03:00
Ilya Kirillov
3ed11c0491 Wizard: get rid of reflection: force plugins to specify settings & tasks directly 2020-07-28 12:23:57 +03:00
vldf
eadd3f00f2 [FIR] Add CanBeReplacedWithOperatorAssignmentChecker 2020-07-28 10:13:28 +03:00
Kevin Bierhoff
fa8c6e7fb6 Uast: KT-40578: resolve Kotlin property writes to setters (#3597)
* KT-40578: resolve Kotlin property writes to setters

* limit to non-constructor properties

* Uast: `KotlinIDERenderLogTest.testConstructors` fix

Co-authored-by: Nicolay Mitropolsky <nicolay.mitropolsky@jetbrains.com>
2020-07-28 10:03:22 +03:00
Sergey Bogolepov
5851a7dea0 [kotlinx-metadata-klib] Proper support for nullable enum entry fields 2020-07-28 11:59:17 +07:00
Sergey Rostov
45f0328f21 scripting: preload scripting support plugins 2020-07-27 19:44:03 +00:00
Sergey Rostov
b5e04378ed scripting, ucache: don't init caches at start up
init it in async instead. all usages will be updated thanks to
highlighting/reindexing that is called after cache is constructed.

#KT-40242 Fixed
2020-07-27 19:44:03 +00:00
Dmitry Petrov
43fcb2330e JVM_IR: fix source file name for mutlifile class facades 2020-07-27 19:13:37 +03:00
Dmitry Petrov
89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Dmitriy Dolovov
b47946cbba Report interop functions with non-stable parameter names
^KT-34602
2020-07-27 23:11:36 +07:00
Dmitriy Dolovov
3d9093583f Metadata: 'non-stable parameter names' flag for callables
^KT-34602
2020-07-27 23:11:30 +07:00
Ilya Goncharov
8cace2bab4 [Gradle, JS] Add tests on kotlin/js module with js files 2020-07-27 19:00:12 +03:00
Ilya Goncharov
0b88f457e8 [Gradle, JS] Use .meta.js as source of "name" and "main" fields
^KT-40342 fixed
2020-07-27 19:00:12 +03:00
Victor Petukhov
cca64b8fab NI: use the inferred type to check of nullable array for vararg
^KT-40555 Fixed
2020-07-27 18:24:31 +03:00
Steven Schäfer
9d63412b3e JVM IR: Produce correct generic signatures for special bridge methods 2020-07-27 17:02:24 +02:00
Steven Schäfer
c16b548dff JVM IR: Don't produce annotations on builtin stub, toArray, and bridge methods 2020-07-27 17:02:24 +02:00
Andrei Klunnyi
f661b7604b KT-40557 Scratch: .kt files are treated as Kotlin scratches, opening fails
https://ea.jetbrains.com/browser/ea_problems/224367
2020-07-27 15:36:02 +02:00
Andrei Klunnyi
0e46a980f6 EA- 235760 // additional logging
https://ea.jetbrains.com/browser/ea_problems/235760
2020-07-27 15:36:00 +02:00
Andrei Klunnyi
c27453632e EA-235769 // StringIndexOutOfBoundsException
https://ea.jetbrains.com/browser/ea_problems/235769
2020-07-27 15:35:59 +02:00
Andrei Klunnyi
4afa50e081 EA-235759 // NPE fix
https://ea.jetbrains.com/browser/ea_problems/235759
2020-07-27 15:35:58 +02:00
Andrei Klunnyi
29281fd0bf EA-235761 // NPE fix
https://ea.jetbrains.com/browser/ea_problems/235761
2020-07-27 15:35:57 +02:00
Andrei Klunnyi
e63951c38c EA-235765 // NPE at refactoring suggestion
Fixed exception:
java.lang.NullPointerException: null cannot be cast to non-null type
org.jetbrains.kotlin.descriptors.CallableDescriptor

More info: https://ea.jetbrains.com/browser/ea_problems/235765
2020-07-27 15:35:55 +02:00
Dmitry Gridin
e8fd69fde1 [formatter] fix infinite recursion
Already exists in the new repo: original-hash e7ea6926a8a414ab6082299d99239ad167ab75a2

#KT-40636 Fixed
2020-07-27 19:56:19 +07:00
Ryan Nett
b1173317c5 Change scripting Severity enums to order from DEBUG to FATAL.
#KT-39502 fixed
2020-07-27 14:29:30 +02:00
Konstantin Tskhovrebov
59f6c0c273 Add flag for avoid double MPP gradle module resolve. 2020-07-27 15:11:48 +03:00
Ilya Goncharov
5444ffaf4b [Gradle, JS] Deprecate produceExecutable
^KT-40568 fixed
2020-07-27 14:44:47 +03:00
Ilya Goncharov
d9c269ed6b [Gradle, JS] Disable binaries.executable by default in wizard
^KT-40461 fixed
2020-07-27 14:35:45 +03:00
Natalia Selezneva
8d1f9df802 Do not show warning when multiple Gradle Definitions are loaded
This will happen when there are multiple gradle project linked to one IDEA project
andthey have different gradle versions
2020-07-27 13:08:01 +03:00
Ilya Matveev
a62f65940d Gradle, CocoaPods: Use synthetic dir as a working dir for pod gen
'Pod gen' creates an empty folder named 'Pods' in a directory where it
is executed. Earlier, 'pod gen' was executed in a project root
directory, so this `Pods` folder was created in a VCS-controlled
place. This patch fixes this issue by running 'pod gen' in a directory
where the synthetic project is located.
2020-07-27 10:02:07 +00:00
Ilya Matveev
7c3eda31fa Gradle, CocoaPods: Fix non-compilable dummy header
Issue #KT-39999 fixed
2020-07-27 10:02:07 +00:00
Ilya Matveev
85908713b1 Gradle, CocoaPods: Support pods with dashes in names
See https://github.com/JetBrains/kotlin-native/issues/2884
2020-07-27 10:02:06 +00:00
Zalim Bashorov
635869f15a Rewrite className helper to fix tests on android
Since android tests preprocess test data and
(at least) replace package for files and fix package usages
it's preferred to use fqnames explicitly
instead of assembly them from parts, as it was before.
2020-07-25 15:28:36 +03:00
Mikhail Glukhikh
0ded1d7006 FirBasedSignatureComposer: generate better error messages 2020-07-24 19:47:28 +03:00
Mikhail Glukhikh
40256aa43d Fir2IrLazyClass: generate enum values() / valueOf() properly 2020-07-24 19:47:28 +03:00
Mikhail Glukhikh
8bae0f2d0c [FIR2IR] Handle local visibility around signature composer properly 2020-07-24 19:47:27 +03:00
Mikhail Glukhikh
828524bde4 [FIR2IR] Fix conversion of default vararg arguments for annotations 2020-07-24 19:47:27 +03:00
Mikhail Glukhikh
240baa64a5 Fir2IrConverter: initialize call generator earlier to avoid lateinit err 2020-07-24 19:47:26 +03:00
Mikhail Glukhikh
2b52988f1b [FIR TEST] Add failing BB test with Deprecated annotation 2020-07-24 19:47:19 +03:00
Denis Zharkov
df1719c64c Fix incorrect mixed named/positioned arguments in project code
^KT-40404 Fixed
2020-07-24 13:36:52 +03:00
Denis Zharkov
dc6efa5a61 Fix incorrect handling of mixed named/positional arguments
^KT-40404 Fixed
2020-07-24 13:36:52 +03:00
Mikhail Bogdanov
d083297366 Support additional flags in MPP tests. Add diagnostic tests for defaults 2020-07-24 12:10:04 +02:00
Mikhail Bogdanov
125c72cb8d New default checks for mixed hierarchies
Old and new schemes
2020-07-24 12:10:04 +02:00
Denis Zharkov
de02b31ad7 FIR: Use phasedFir in resolve
^KT-40376 Fixed
2020-07-24 12:32:29 +03:00
Yaroslav Chernyshev
0de29e641d Fixed bug with pureKotlinSourceFolders for common modules 2020-07-24 12:22:00 +03:00
Yaroslav Chernyshev
142bd2e009 Filtering pureKotlinSourceFolders for existing package directories 2020-07-24 12:21:59 +03:00
Yaroslav Chernyshev
e6670d439f Small renaming classifier -> disambiguationClassifier 2020-07-24 12:21:58 +03:00
Yaroslav Chernyshev
96d9dad429 Fixed tests for pureKotlinSourceFolders by extending created facets 2020-07-24 12:21:57 +03:00
Yaroslav Chernyshev
f490085142 Support pureKotlinSourceFolders for MPP projects
#KT-34271 Fixed
#KT-32963 Fixed
2020-07-24 12:21:57 +03:00
nataliya.valtman
fde8a34c32 KT-40058 NPE from mpp gradle plugin on kotlinx.benchmarks 2020-07-24 10:46:45 +03:00
Ivan Kylchik
bc41681a2e Fix gradle import error after introducing new gradle task in benchmarks 2020-07-23 21:18:32 +03:00
Vyacheslav Gerasimov
96ac6e612d Build: Replace androidIdeTest task with kaptIdeTest
We dont run android ide tests anymore
2020-07-23 19:18:18 +03:00
Vyacheslav Gerasimov
803d24cd42 Build: Remove pluginTests task and deduplicate kapt test task 2020-07-23 19:18:17 +03:00
Vyacheslav Gerasimov
ee642e69b0 Build: Introduce mainIdeTests task 2020-07-23 19:18:17 +03:00
Dmitry Petrov
e2a4ca10d6 JVM_IR: fix inner class attributes for private class in interface 2020-07-23 19:13:28 +03:00
Dmitry Petrov
0741781462 Compare inner class access flags in bytecode listing tests 2020-07-23 19:13:28 +03:00
Natalia Selezneva
8d894929ae Minor: unify logging in scripting 2020-07-23 16:31:32 +03:00
Natalia Selezneva
8a6cdcba29 Do not hold a lock during loading script templates from dependencies
^KT-40383 Fixed
2020-07-23 16:24:13 +03:00
Natalia Selezneva
493c287bb0 Minor: fix notification text when script configuration is missing after request 2020-07-23 16:20:57 +03:00
Ivan Kylchik
265873becd Comment out runBenchmark tasks due to gradle import error 2020-07-23 15:20:35 +03:00
Roman Golyshev
be06c51aa7 KT-40363 Handle non-octal int literals in for-loop conversions
- See EA-210233
- ^KT-40363 Fixed
2020-07-23 11:24:48 +00:00
Roman Golyshev
cba671a3ef KT-40359 Catch NumberFormatException during literal conversion
- Instead of failing J2K conversion completely, insert TODO expression
to the resulting code (it is better to have a converted code with TODO
than to have nothing at all)
- See EA-210233 for similar exceptions
- ^KT-40359 Fixed
2020-07-23 11:24:48 +00:00
Roman Golyshev
cc0a787735 Add null-checking to KotlinIdeaResolutionException constructors
- NPE here leads to loosing the actual exception
- EA-235059 Fixed
2020-07-23 11:24:47 +00:00
Nicolay Mitropolsky
f7031e65ba Uast: don't throw exception if can't get a receiver parameter for annotation (KT-40494) 2020-07-23 10:33:44 +03:00
Jinseong Jeon
7872b21914 FIR: handle object invoke via type alias 2020-07-23 09:34:42 +03:00
Svyatoslav Kuzmich
4a803e9d2f [JS IR] Support object declaration export
Fixes KT-39117 and KT-39367
2020-07-23 08:21:59 +03:00
Svyatoslav Kuzmich
4027dae594 [JS] Add js/js.translator/testData/package-lock.json 2020-07-23 08:21:57 +03:00
Natalia Selezneva
be371c9294 Remove optimization in KotlinScriptDependenciesClassFinder
Scope can contains only classes for one script,
but allScriptDependenciesScope contains classes for all scripts
2020-07-23 00:00:51 +03:00
Natalia Selezneva
be8374a1a8 Minor: fix comments 2020-07-23 00:00:50 +03:00
Natalia Selezneva
e708e3f1c5 Do not suggest to load gradle.kts configurations after project reopening
For projects with distributionType=WRAPPED
Workaround for KT-40394

The original problem is that GradleInstallationManager.resolveGradleVersion returns null is case of distributionType=WRAPPED

^KT-40394 Fixed
2020-07-23 00:00:50 +03:00
Natalia Selezneva
300e9581de Fix UI for Kotlin Scripting page
Show 15 items in the list by default
Show hint at the top
Fixed for 201+

^KT-40097 Fixed
2020-07-22 23:49:47 +03:00
Natalia Selezneva
dd20b9062a Completion for script inside module should provide classes from related module
^KT-35825 Fixed
2020-07-22 23:49:47 +03:00
Alexander Udalov
65d3ae6253 JS IR: move declaration creation from IrBuilder to JsIrDeclarationBuilder
This is a temporary class until IrDeclarationFactory is there.
2020-07-22 22:40:08 +02:00
Alexander Udalov
d3a34a8898 Psi2Ir: somewhat simplify Psi2IrTranslator API
Inline some methods only used once, deduplicate usages, rearrange
parameters, etc.
2020-07-22 22:38:21 +02:00
Alexander Udalov
241f82c70f IR: avoid storing unnecessary fields in IrPropertyImpl 2020-07-22 22:38:21 +02:00
Alexander Udalov
3f06f8a6ba IR: avoid storing unnecessary fields in IrFunctionImpl 2020-07-22 22:38:20 +02:00
Alexander Udalov
517c3e1020 IR: introduce IrFakeOverrideFunction, IrFakeOverrideProperty
Use them instead of the implementations. This will allow to refactor
creation to a factory and allow to use other implementations in the
future.
2020-07-22 22:38:20 +02:00
Alexander Udalov
ca5eb40fa5 IR: minor, avoid usages of IrBlockBodyImpl/IrExpressionBodyImpl 2020-07-22 22:38:20 +02:00
Mark Punzalan
174576af61 ForLoopsLowering: Handle Sequence<*>.withIndex(). 2020-07-22 22:32:29 +02:00
Mark Punzalan
132960a695 ForLoopsLowering: Eliminate use of @ObsoleteDescriptorBasedAPI. 2020-07-22 22:32:29 +02:00
Mark Punzalan
b1ce21bc55 ForLoopsLowering: Reduce unnecessary temporary variables for the
"checked step" (check for a positive step arg) and "negated step"
(negate the step arg when the nested step is negative).
2020-07-22 22:32:29 +02:00
Mark Punzalan
291d62f653 ForLoopsLowering: Move handlers to sub-package and separate files. 2020-07-22 22:32:29 +02:00
Ivan Kylchik
44d283eb07 Fix FIR benchmark memory leak 2020-07-22 20:18:26 +03:00
Ivan Kylchik
be4dbf2dcd Create gradle scripts to run and analyze benchmark results 2020-07-22 20:18:25 +03:00
Ivan Kylchik
29d0e3dbb5 Reuse createSession function for FIR in benchmark 2020-07-22 20:18:24 +03:00
Dmitry Petrov
1272162a7f JVM_IR: generate "safe" names for functions in init blocks 2020-07-22 19:49:48 +03:00
Yaroslav Chernyshev
bb8f857809 [Gradle, Import] Added externalSystemId into facet for mpp projects
#KT-39803 Fixed
2020-07-22 19:44:09 +03:00
Ilya Goncharov
e5b0498eb6 Fix tests for Gradle kts and groovy dsl
^KT-40527 fixed
2020-07-22 14:04:57 +03:00
Ilya Goncharov
ae0bedd2ac [Gradle, JS] Different module kind for browser and nodejs
^KT-40527 fixed
2020-07-22 14:04:29 +03:00
Ilya Goncharov
38ec3ffb4a [Gradle, JS] Statically calculated module configurator id
^KT-40527 fixed
2020-07-22 14:04:15 +03:00
Ilya Goncharov
bf1b85343f [Gradle, JS] Remove copyright from template of node.js
^KT-40527 fixed
2020-07-22 14:03:40 +03:00
Ilya Goncharov
2d60d2c0e6 [Gradle, JS] Divide allowSinglePlatform
^KT-40527 fixed
2020-07-22 14:02:02 +03:00
Ilya Goncharov
af367b01ec [Gradle, JS] Add test on node js single platform project
^KT-40527 fixed
2020-07-22 14:01:50 +03:00
Ilya Goncharov
cb60b9e59c [Gradle, JS] singleplatformJs -> singlePlatformJsBrowser
^KT-40527 fixed
2020-07-22 14:01:20 +03:00
Ilya Goncharov
01ec8b5262 [Gradle, JS] Fix typo and add node js module configurator
^KT-40527 fixed
2020-07-22 13:59:46 +03:00
Ilya Goncharov
0d606e1346 [Gradle, JS] Fix id and text in simple js module configurators
^KT-40527 fixed
2020-07-22 13:59:33 +03:00
Ilya Goncharov
4c5cd44e75 [Gradle, JS] Localize Module Type
^KT-40527 fixed
2020-07-22 13:59:15 +03:00
Ilya Goncharov
29e37ee15f [Gradle, JS] Fix test for js single platform
^KT-40527 fixed
2020-07-22 13:58:47 +03:00
Ilya Goncharov
a866e51402 [Gradle, JS] NodeJs template files
^KT-40527 fixed
2020-07-22 13:58:32 +03:00
Ilya Goncharov
95f6669275 [Gradle, JS] Add NodeJs template plugin
^KT-40527 fixed
2020-07-22 13:58:19 +03:00
Ilya Goncharov
6866fdc3e1 [Gradle, JS] Add NodeJs template project
^KT-40527 fixed
2020-07-22 13:57:44 +03:00
Ilya Goncharov
4de31da0f3 [Gradle, JS] Fix typo
^KT-40527 fixed
2020-07-22 13:57:07 +03:00
Ilya Goncharov
e8dfc4dcd0 [Gradle, JS] JsSinglePlatform -> BrowserJsSinglePlatform
^KT-40527 fixed
2020-07-22 13:56:53 +03:00
Ilya Goncharov
b4334a3a3b [Gradle, JS] Fix formatting in Gradle Kotlin/JS wizard
^KT-40149 fixed
2020-07-22 13:23:03 +03:00
Jinseong Jeon
e1abaa9b51 FIR: special visibility handling for monitor{Enter|Exit} 2020-07-22 12:16:32 +03:00
Jinseong Jeon
85f692ab40 FIR2IR: use DescriptorWithContainerSource if container source is available
The use of DescriptorWithContainerSource is the key to trigger the
proper generation of stub facade class as parent.
2020-07-22 12:16:32 +03:00
Alexander Gorshenev
c076d81f0c [IR FAKE OVERRIDES] Properly account for outer class type parameters 2020-07-22 12:02:51 +03:00
Pavel Kirpichenkov
1ef17c6f3a Drop isErrorTypeAllowed flag from type system context
The flag was used exclusively during calculation of common super type.
This change relies on assumption, that common super type is
NOT calculated in IR type system context.
2020-07-22 11:41:42 +03:00
Pavel Kirpichenkov
710659324c [NI] Fix common supertype of types with error supertypes
Enable check for error supertypes during CST calculation in classic type system context.
Cyclic upper bound + known type parameters of superclasses may create non-error types
with error supertypes. Such types don't have common constructors with other normal types
and cause assertion errors during intersection.

^KT-36951 Fixed
2020-07-22 11:41:42 +03:00
Ilya Gorbunov
95cc35f22e Package builtins with jvm reflect into IDEA plugin only
Leave builtins with common reflect for stand-alone compiler.
2020-07-22 11:08:14 +03:00
Stanislav Erokhin
0c094b1719 Serialize jvm reflect into builtIns
Basically this is revert of 427e34fe5a commit
This was done due to the KT-39728.
Also we do pick every file separately, because builtIn serializer
unable to filter expects
2020-07-22 11:08:14 +03:00
Stanislav Erokhin
67090e1afb Move KTypeProjection to separate file 2020-07-22 11:08:14 +03:00
Zalim Bashorov
ee26fd4959 [KJS FE] Change severity of NON_EXPORTABLE_TYPE from error to warning
The change is required to avoid breaking examples using kotlin-wrappers
until we find an acceptable solution for them.

#KT-39873 Fixed
2020-07-22 10:51:41 +03:00
Denis Zharkov
41bd013796 Fix incorrect usages of @NotNull type parameters in project sources
^KT-36770 In progress
2020-07-22 10:16:14 +03:00
Denis Zharkov
037ff2fa52 Fix incorrect handling of @NotNull type parameters
^KT-36770 In progress
^KT-40114 Relates
^KT-28785 Relates
2020-07-22 10:16:14 +03:00
Denis Zharkov
f1c68a9080 Introduce JavaTypeEnhancement component
It's necessary to allow using language version settings in type enancement
2020-07-22 10:16:14 +03:00
Denis Zharkov
240311d9c7 Minor. Reformat JavaNullabilityChecker 2020-07-22 10:16:14 +03:00
Dmitry Petrov
d93885e71c Add tests for deprecated properties 2020-07-21 22:25:44 +03:00
Dmitry Petrov
e84339a0d3 JVM_IR: fields for deprecated enum entries have ACC_DEPRECATED flag
'Deprecated' annotation can't be applied to field itself.
2020-07-21 22:25:44 +03:00
Roman Artemev
edab3e3ba9 [PLUGIN API] Add referenceTypeAlias API to IrPluginContext
- attempt to fix KT-40193
2020-07-21 18:38:33 +03:00
Roman Artemev
c4b4912a71 Revert "[PLUGIN API] Make referenceClass resolve type aliases too" 2020-07-21 18:38:32 +03:00
Anton Bannykh
cb15570d75 [JS IR BE] Fix validation errors (duplicate nodes and incorrect parent) 2020-07-21 18:25:17 +03:00
Vyacheslav Gerasimov
d36d62e226 Add info about -Pteamcity to readme and make warning less annoying 2020-07-21 18:05:21 +03:00
Vyacheslav Gerasimov
a4457ba7ac Build: Setup dependency on dist for :compiler:fir:analysis-tests:test 2020-07-21 17:24:59 +03:00
Vyacheslav Gerasimov
58ee95c8a3 Build: Add root IDE test tasks to split tests in 3 parts 2020-07-21 17:24:59 +03:00
Vyacheslav Gerasimov
036c359993 Build: Make local profile warning more visible 2020-07-21 17:24:58 +03:00
Vyacheslav Gerasimov
d9fbaadb2e Build: Upgrade Gradle Enterprise plugin to 3.3.4 2020-07-21 17:24:58 +03:00
Roman Artemev
d7a0dbfae8 [PLUGIN API] Make referenceClass resolve type aliases too
- fix KT-40193
2020-07-21 15:36:31 +03:00
Leonid Startsev
a0154b9851 Add JarUtil.getJarAttribute to proguard rules
This method is used by serialization plugin to read runtime JAR
manifest.

Maven serialization plugin seems to use proguarded compiler
distribution,
so to use this method, it should be kept.

Size increased for about 2kb.
2020-07-21 15:10:08 +03:00
Leonid Startsev
e3f42721e9 Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests 2020-07-21 15:10:08 +03:00
Leonid Startsev
df5f38fec8 Implement reading kx.serialization runtime metadata from jar manifest
That allows to check whether current compiler plugin can work with
a given runtime version. Implementation-Version can help to detect whether
runtime version is too low, and Require-Kotlin-Version detects whether
runtime version is too high.

Corresponding diagnostic for Require-Kotlin included.
Implement minimal runtime version check for kotlinx.serialization
plugin.

 #KT-40036 Fixed

Cache result from getVersionsForCurrentModule in BindingTrace.
Hide check in the IDE, because caching in trace does not work there.
2020-07-21 15:10:08 +03:00
Leonid Startsev
7db0bf8195 Add new serialization runtime packages
encoding and descriptors. Rename ContextSerializer to Contextual.
Unify getClassFrom*Package functions.
2020-07-21 15:02:06 +03:00
Ivan Kylchik
8b9fb6a6cd [FIR] Remove FirOperatorCall node from fir tree 2020-07-21 13:54:19 +03:00
Ivan Kylchik
3c01a39846 [FIR] Update test data after introducing new fir nodes 2020-07-21 13:54:17 +03:00
Ivan Kylchik
d77d733244 [FIR] Complement fir rendering with newly created nodes 2020-07-21 13:54:17 +03:00
Ivan Kylchik
9a119a6757 [FIR] Replace all necessary usages of operator call with new ones
#KT-38333 Fixed
2020-07-21 13:54:16 +03:00
Ivan Kylchik
def47bdd9d [FIR] Add new equalityOperatorCall node in control flow graph 2020-07-21 13:54:15 +03:00
Ivan Kylchik
d23e9940ec [FIR] Change fir builder to use newly created nodes 2020-07-21 13:54:15 +03:00
Ivan Kylchik
708c8b8ef3 [FIR] Create additional nodes to replace operator call in some places
1. FirAssignmentOperatorStatement - represent assignment operations
such as =, +=, -=, /=, %=
2. FirEqualityOperatorCall - represent boolean operations such as ==,
!=, ===, !==

#KT-38333 In Progress
2020-07-21 13:54:14 +03:00
Roman Artemev
8c4930da2e [KLIB] Drop API which is no longer used 2020-07-21 13:15:35 +03:00
Roman Artemev
bb20e4759b [KLIB] Use queue to track classes required fake override resolve
- Avoid module visiting to prevent lazy bodies loading
2020-07-21 13:15:35 +03:00
vladislavf7@gmail.com
2b0639d4ad [FIR] Cleanup and refactoring for checkers 2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
fb946a6a3f [FIR] Move extended checkers list 2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
751ed60e42 [FIR] Fix redundant visibility modifier checker 2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
a8ff5d17dc [FIR] Fix redundant modality modifier checker
Fixed function FirDeclaration.hasBody() and some others improvement
2020-07-21 12:13:10 +03:00
vladislavf7@gmail.com
a988234bbf [FIR] Fix redundant explicit type checker 2020-07-21 12:13:09 +03:00
Pavel Punegov
eecb43d4c9 Ignore test in Native backend 2020-07-21 11:26:57 +03:00
Ilya Gorbunov
bace1b8055 Increase stdlib-js mocha test timeouts to 10s
Some tests often do not fit into the default timeout when running tests
in parallel on CI.
2020-07-21 05:43:38 +03:00
Steven Schäfer
d62a6a2631 JVM IR: Do not create accessors for enum entry constructors 2020-07-20 22:37:49 +02:00
Alexander Udalov
71730696b2 JVM IR: rename JvmDeclarationFactory -> JvmCachedDeclarations 2020-07-20 22:26:11 +02:00
Alexander Udalov
c7f9dc1c40 IR: rename DeclarationFactory to InnerClassesSupport, move out of context
Methods of the common interface DeclarationFactory were only used in
lowerings in InnerClassesLowering, which were used in JVM and JS, not
Native. Therefore, it makes sense to have this as a separate interface
and pass its implementation to these lowerings directly, instead of
declaring it in the common context (which is not going to be implemented
in Native).
2020-07-20 22:26:11 +02:00
Alexander Udalov
cf884fb048 IR: remove JVM-specific methods from DeclarationFactory 2020-07-20 22:26:11 +02:00
Alexander Udalov
6907decd99 Report file name on exception from ASM in BinaryJavaClass
This is useful to diagnose cases like KT-40339
2020-07-20 22:25:55 +02:00
Matthew Gharrity
221d49a995 Set wantsDiagnostics() in AbstractFilteringTrace
report() already delegates to the parentTrace, so
wantsDiagnostics() should delegate to it as well.
2020-07-20 21:12:25 +03:00
Dmitry Petrov
2e31f95554 Update testData 2020-07-20 20:04:32 +03:00
Dmitry Petrov
2b9606becf JVM_IR: field for suspend main parameter is synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
7be9b18ff4 JVM: field for suspend main parameter is synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
6bc44a366a JVM_IR: fields for suspend lambda parameters are synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
bae6037f00 JVM: fields for suspend lambda parameters are synthetic 2020-07-20 20:04:31 +03:00
Dmitry Petrov
fa75518bd7 JVM_IR: don't skip nullability annotations on private fields
Unfortunately, some annotation processors rely on those annotations.
2020-07-20 20:04:31 +03:00
Dmitry Petrov
d30c67db14 JVM: don't skip nullability annotations on private fields
Unfortunately, some annotation processors rely on those annotations.
2020-07-20 20:04:30 +03:00
Victor Petukhov
b0ac046b05 NI: decrease fixation priority for variables which have only incorporated from upper bound constraints
^KT-40045 Fixed
^KT-39633 Fixed
2020-07-20 19:20:18 +03:00
Ilya Goncharov
081248f859 [Gradle, JS] Extract properties provider in KotlinJsTarget 2020-07-20 17:44:12 +03:00
Ilya Goncharov
4917643583 [Gradle, JS] Check if not both compiler 2020-07-20 17:40:52 +03:00
Ilya Goncharov
61b5a738da [Gradle, JS] Rename flag for legacy
^KT-40320 fixed
2020-07-20 16:51:37 +03:00
Ilya Goncharov
e776444459 [Gradle, JS] binaries executable for legacy by default
^KT-40320 fixed
2020-07-20 16:51:22 +03:00
Ilya Goncharov
f7beea10a5 [Gradle, JS] Common configure should be last otherwise user settings can
be overwrote

^KT-40320 fixed
2020-07-20 16:51:08 +03:00
Jim Sproch
814bd48148 Keep members of com.google.common dependencies intact
It is a workaround for KTI-298
#KT-40354 In progress
2020-07-20 15:05:16 +03:00
Dmitriy Novozhilov
236dfe60f1 [FIR] Correctly build scopes for resolve of different parts of constructors
#KT-40409 Fixed
2020-07-20 14:38:17 +03:00
Dmitriy Novozhilov
94ff457e43 [FIR] Handle erroneous situation with type projection in supertype 2020-07-20 14:38:17 +03:00
Dmitriy Novozhilov
c94d583e2e [FIR] Add substitution for inner classes to supertype resolve
KT-38992 Fixed
2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
cf555ef2b6 [FIR] Move FirNestedClassifierScopeWithSubstitution to separate file 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
07e12f98b5 [FIR] Substitute supertypes in nested classifier scope
KT-38992
2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
cedd1c133e [FIR] Match type in super<type> access with actual supertypes of class 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
1ce4eca3a6 [FIR] Infer type arguments for captured parameters of inner classes
KT-38992
2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
1c622a5a3f [FIR] Add transformConversionTypeRef to FirTypeOperatorCall 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
1b78950ebb [FIR] Don't transform property initializers in type resolve 2020-07-20 14:38:16 +03:00
Dmitriy Novozhilov
9e94189852 [FIR] Add transformTypeParameters to FirTypeParameterRefsOwner 2020-07-20 14:38:15 +03:00
Mikhail Zarechenskiy
4083111dab Fix SAM conversion when lambda is the last expression of another lambda
#KT-39691 Fixed
2020-07-20 14:30:40 +03:00
Mikhail Zarechenskiy
a15d3c76b6 Fix references to sam adapted functions, also fix lookup location
#KT-31025 Fixed
2020-07-20 14:30:40 +03:00
Mikhail Zarechenskiy
0c79de1a98 Prohibit adapted reference resolve against reflective types
There are design questions about reflection for adapted references,
 so the current proposal is to prohibit reflection on them and support
 it properly later

 #KT-40406 Fixed
2020-07-20 14:30:39 +03:00
Vladimir Ilmov
d8de37f665 (CoroutineDebugger) using WeakReference as lastObservedFrame
relates to #KT-40073
2020-07-20 11:44:51 +02:00
Vladimir Ilmov
bcf1954860 (CoroutineDebugger) added support for DebugCoroutineInfoImpl in kotlinx-coroutines-core:1.3.8
relates to #KT-40073
2020-07-20 11:44:51 +02:00
Vladimir Ilmov
b43b238030 (CoroutineDebugger) embed agent into gradle JavaExec task
#KT-40417 fixed
2020-07-20 11:44:32 +02:00
Vladimir Ilmov
217428212f (CoroutineDebugger) Refactoring of retrieving BaseContinuationImpl chains 2020-07-20 11:43:23 +02:00
Vladimir Ilmov
14766a3e1a (CoroutineDebugger) lv 'task' added to tests in EventLoopImplBase kotlinx-coroutines-core:1.3.7 2020-07-20 11:38:01 +02:00
Vladimir Ilmov
e49f3b567b (CoroutineDebugger) minimum supported version kotlinx-coroutines-core.1.3.8
Workaround for starting agent on windows removed, version upgraded in tests
 #KT-40073 fixed
2020-07-20 11:38:00 +02:00
Denis Zharkov
cd896ae6c8 FIR: Implement FE 1.0 semantics for super unqualified calls
See original logic at org.jetbrains.kotlin.types.expressions.unqualifiedSuper.UnqualifiedSuperKt#resolveUnqualifiedSuperFromExpressionContext

^KT-39070 Fixed
^KT-39599 Related
2020-07-20 12:24:51 +03:00
Denis Zharkov
dfc75f3447 FIR: Support fake elements for light tree 2020-07-20 12:24:27 +03:00
Denis Zharkov
fea1fb0fc3 FIR: Rename FirSourceElement::withKind to fakeElement
And reinforce its contract
2020-07-20 12:24:27 +03:00
Denis Zharkov
376d3385d0 FIR: Handle super-receiver case in a special way
Before this change, it was resolved independently of containg call
But in fact, the type of `super` depends on the name of the callee
(see KT-39599 and KT-39070)
2020-07-20 12:24:27 +03:00
Jinseong Jeon
628b8b56b7 FIR2IR: convert annotations on type aliases 2020-07-20 09:40:52 +03:00
Jinseong Jeon
4e14f9500f FIR: account for vararg when creating KFunction type for callable reference 2020-07-20 09:39:34 +03:00
Mikhail Zarechenskiy
e5e50eabe9 Update testdata after 41a0cfe002 2020-07-20 07:04:59 +03:00
Yan Zhulanow
b351556b1f Fix testJarsWithDependenciesWithinClasses() compilation after unsuccessful cherry-pick 2020-07-20 06:10:36 +09:00
Anton Yalyshev
64aaeb52f5 Add change notes for 1.4-M1,2,3,RC builds #KT-40311 Fixed 2020-07-19 11:56:06 +03:00
Jim Sproch
a4a398239b Fallback to fileEntry provided by irFile 2020-07-18 11:16:09 +03:00
Georgy Bronnikov
c901e82a55 IR: add IrSimpleFunction.isInfix 2020-07-18 11:03:33 +03:00
Ivan Gavrilovic
8e4bc06b3c Create a valid jar in KaptIncrementalWithIsolatingApt test 2020-07-18 05:06:16 +09:00
Ivan Gavrilovic
77ba9a1bbb KT-34604: Fix race condition in KAPT
KAPT was relying on clearing JarFileFactory to make sure
annotation processing does not hold onto annotation processing
classpath once done. Once KAPT switched to using Gradle workers, multiple
KAPT runs were sharing the same class loader ie. the same version
of JarFileFactory. Clearing the cache resulted in race condition,
as some runs were unable to load processors from jars.

This commit fixes this problem by avoiding the use of ServiceLoader
which was causing the issue. Jars would be added to the cache, but
they would never be removed. That's why JarFileFactory had to be
clearned manually. By loading the processor names manually (simply
exploring the classpath), no file handles leak.

Fixes https://youtrack.jetbrains.com/issue/KT-34604
Test: verified against the test project from the bug
2020-07-18 05:06:15 +09:00
Ivan Gavrilovic
111a2ece72 KAPT: Fix error reporting
When incremental analysis is unable to run, handle
failure gracefully. More info will be provided by
compiler diagnostics.

Fixes KT-36302
2020-07-18 05:06:15 +09:00
Ivan Gavrilovic
11251a93ac KAPT: Fix serialization of class structure data
When serializing ClasspathEntryData, ids assigned to types were
incorrect, resulting in corrupt data when deserializing files. This
happened if there were dependencies between classes.

Fixes KT-39876
Test: ClasspathAnalyzerTest
2020-07-18 05:06:15 +09:00
Jim Sproch
ccbb2eaba9 Make linker visible to compiler plugins 2020-07-17 21:18:07 +03:00
Toshiaki Kameyama
80e4e7939d "Create abstract function" quick fix: don't suggest it if super classes are not writable
#KT-40215 Fixed
2020-07-17 19:35:02 +03:00
Vladimir Ilmov
0c832e30bf (CoroutineDebugger) Memory leak fixed on IDEA quit: 'org.jetbrains.kotlin.idea.debugger.coroutine.view.XCoroutineView
#KT-40386 fixed
2020-07-17 18:01:30 +02:00
Dmitriy Dolovov
6de848a15c [Commonizer] Introduce success marker file in Gradle task
The success marker file is written to the disk only upon successful
commonization. If something goes wrong, this file is not written to
the disk. So the subsequent call of 'runCommonizer' task will be
considered not up-to-date.

^KT-40120
2020-07-17 22:09:08 +07:00
Dmitriy Dolovov
178b5db8de [Commonizer] More precise up-to-date checks in Gradle task
Don't annotate the whole 'distributionDir' with @InputDirectory.
The contents of the distribution directory may grow over time due to
compilation cache and new commonized libraries.

Don't annotate 'baseDestinationDir' with @InputDirectory. The base
destination directory may contain numerous subdirectories with the
libraries produced for different combinations of commonized targets.
This means that the contents of the base directory will grow over time.

Use more precise directory up-to-dateness checks:
* Annotate the directory with the original common libraries
  (i.e. 'stdlib') as @InputDirectory.
* Annotate the directory with the original platform libraries
  (all targets altogether) as @InputDirectory.
* For each combination of commonized targets mark the list of the
  directories with resulting libraries as @OutputDirectories.

^KT-40120
2020-07-17 22:09:08 +07:00
Sergey Igushkin
d3f9f4f3e8 Fix stdlib-by-default failures when configuration has been resolved
Issue #KT-38221
2020-07-17 18:36:08 +04:00
Ilya Kirillov
dccac34282 J2K: do not run runUndoTransparentAction outside EDT
#KT-39739 fixed
2020-07-17 16:02:46 +03:00
Ilya Kirillov
d16f246375 Wizard: do not add stdlib for gradle based projects
#KT-40407 fixed
2020-07-17 16:02:44 +03:00
Ilya Kirillov
d2113766e1 Wizard: do not add NPM dependencies for Kotlin/JS wrappers
Those dependencies are included now into corresponding libraries

#KT-40377 fixed
2020-07-17 16:02:42 +03:00
Ilya Kirillov
9f5dd59d75 Wizard: do not add test task for JS when no test framework is chosen
#KT-40378 fixed
2020-07-17 16:02:40 +03:00
Ilya Kirillov
0208fad057 Wizard: do not allow to choose Frontend Application template & JS Library at the same time
#KT-40371 fixed
2020-07-17 16:02:39 +03:00
Ilya Kirillov
fdc06b2c1c Wizard: fix Android SDK path on Windows
#KT-40232 fixed
2020-07-17 16:02:38 +03:00
Pavel Kirpichenkov
a153e7fe30 Changes after review
#KT-37219
2020-07-17 15:27:37 +03:00
Mikhail Zarechenskiy
10bd3a11b8 Improve message about compatibility warning a bit
Relates to #KT-40111
2020-07-17 14:27:20 +03:00
Mikhail Zarechenskiy
fcf7a55ccc Fix delegated property resolve on number literals and proper types
There is no need to update type of delegate expression if it's already
 resolved correctly (doesn't include non-proper types). In almost all
 cases it was fine except number literals as there we didn't box
 expression in backend and got problems at bytecode verification stage

 #KT-40057 Fixed
2020-07-17 14:27:20 +03:00
Yunir Salimzyanov
e5bca3ce29 Enable execution of muted on database tests marked as FLAKY (KTI-288)
It became possible to do, because all the muted flaky tests are now
synchronized with TeamCity and muted there too
2020-07-17 14:01:23 +03:00
Alexander Dudinsky
27e7116f60 Added the gradle plugin SNAPSHOT version support for some tests.
`ImportAndCheckNavigation` and `GradleMultiplatformHighlightingTest` now
use the SNAPSHOT version of the gradle plugin also.
2020-07-17 13:55:25 +03:00
Mikhail Glukhikh
80022cccd9 [FIR] Introduce & use processOverriddenPropertiesWithDepth 2020-07-17 12:46:02 +03:00
Jinseong Jeon
13ef97e51e FIR2IR: set proper visibility of backing fields with @JvmField 2020-07-17 12:42:11 +03:00
Jinseong Jeon
f3475fd098 FIR2IR: store and convert annotations on enum entry 2020-07-17 09:48:45 +03:00
Vladimir Dolzhenko
a1ffc0b25a Handle standalone gradle scripts before (build|settnings|init).gradle.kts
#KT-39916 Fixed
2020-07-17 05:36:02 +00:00
Mikhail Zarechenskiy
a6e58edfb9 Update test data, unmute test
Now behavior is the same as in OI for these cases.
 The behavior was changed in 100a6f70ca
2020-07-17 07:47:15 +03:00
Abduqodiri Qurbonzoda
a05681001f Mark with @DeprecatedSinceKotlin #KT-22423 and #KT-28753 2020-07-17 02:39:20 +03:00
Ilya Gorbunov
87cb6372a0 Specify DeprecatedSinceKotlin for recently deprecated min/max funs
#KT-38854
2020-07-16 22:58:25 +03:00
Ilya Gorbunov
a9f4479557 Add stdlib-gen DSL support for DeprecatedSinceKotlin annotation 2020-07-16 22:58:25 +03:00
Vladimir Dolzhenko
5eb0242941 Add missed application component PluginStartupComponent for AS40
Relates to #KTI-299
2020-07-16 21:01:26 +02:00
Shagen Ogandzhanian
fa1e3169df Update dukat dependency to 0.5.7 2020-07-16 18:19:36 +02:00
Mikhail Glukhikh
026a6ffab2 FirUpperBoundViolatedChecker: code cleanup 2020-07-16 19:09:33 +03:00
Nick
1ea5678932 [FIR] UPPER_BOUND_VIOLATED optimizations 2020-07-16 19:04:29 +03:00
Nick
41a0cfe002 [FIR] Add diagnostic UPPER_BOUND_VIOLATED 2020-07-16 19:04:22 +03:00
Toshiaki Kameyama
b9a220c624 AddSuspendModifierFix: suggest in inline lambda
#KT-38139 Fixed
2020-07-16 18:49:29 +03:00
Vyacheslav Karpukhin
982f429d6b Moved the IdeaDefaultIdeTargetPlatformKindProvider declaration from jps.xml back to jvm-common.xml 2020-07-16 16:38:56 +02:00
Igor Chevdar
3c4f0d3c9e [box-tests] Added test 2020-07-16 19:23:03 +05:00
Igor Chevdar
8bbbee8ffd [IR] Supported IrFunctionExpression in ClosureAnnotator
It may be encountered during local classes extraction from inline lambdas
2020-07-16 19:23:02 +05:00
Alexander Udalov
c9fdef8233 IR: use buildField where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov
2d723f1c51 IR: use buildClass where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov
5b1193407a IR: use buildConstructor where possible 2020-07-16 16:09:31 +02:00
Alexander Udalov
6aa09f61d4 IR: use buildFun where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov
39e38c7049 IR: introduce buildVariable, use where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov
c3560e5854 IR: use buildTypeParameter, minor cleanup 2020-07-16 16:09:30 +02:00
Alexander Udalov
4b5464c6cc IR: introduce buildReceiverParameter, use where possible 2020-07-16 16:09:30 +02:00
Alexander Udalov
b36a6114aa IR: use buildValueParameter where possible 2020-07-16 16:09:29 +02:00
Vladimir Ilmov
378d0a757a DebuggerClassNameProvider refactoring 2020-07-16 16:05:01 +02:00
Alexander Dudinsky
f6a16c5203 Move some tests from common mute database to platforms specific 2020-07-16 15:43:01 +03:00
Victor Petukhov
e754585e38 NI: add fallback strategy to get lexical scope to checking coroutine call legality
^KT-40247 Fixed
^KT-40337 Fixed
2020-07-16 15:33:27 +03:00
Vladimir Dolzhenko
5951e7500a Register KOTLIN_BUNDLED via application component in 193
#KTI-299 Fixed
2020-07-16 12:32:52 +00:00
Vladimir Dolzhenko
345528d8f5 Use public api to register KOTLIN_BUNDLED macros
Relates to #KT-39968
2020-07-16 12:32:51 +00:00
vladislavf7@gmail.com
ab2128f55d [FIR] extended checkers infrastructure refactoring
Removed strange way to enable Extended Checkers and add new way to do it
2020-07-16 15:11:32 +03:00
vladislavf7@gmail.com
38543ce2a3 [FIR] add way to configure session in Diagnostic Tests 2020-07-16 15:11:32 +03:00
Svyatoslav Kuzmich
609f0ca9bc [JS IR] .d.ts generation for module systems
Support .d.ts generation for UMD, AMD, CommonJS module kinds in
addition to existing "plain" module kind.
2020-07-16 14:02:06 +03:00
nataliya.valtman
ee23e39b3c KT-37720 replace FileSystemLocation with File for TransformAction 2020-07-16 13:39:55 +03:00
Yunir Salimzyanov
63ba883a77 Refactoring of muteWithDatabase
- remove unused function RunNotifier.withMuteFailureListener
- inline some functions (isIgnoredInDatabaseWithLog, etc.)
- change declaration of mutedMessage
- change naming of AutoMute related functions
- extract to separate function isPresentedInDatabaseWithoutFailMarker
2020-07-16 13:16:41 +03:00
Roman Golyshev
fb9b3f96de KT-40301 Add more diagnostics for 'Module is not contained in resolver'
- See [EA-214260](https://ea.jetbrains.com/browser/ea_problems/214260)
2020-07-16 10:14:22 +00:00
Roman Golyshev
8fd16f4a39 Add contract to checkWithAttachment
- This way it is more convenient to use with null checks
2020-07-16 10:14:21 +00:00
Ilya Muradyan
0ff45f1cc4 Merge pull request #3544 from JetBrains/rr/ileasile/scopes-resolver-option
Add dependency scopes option for scripting (Ivy and Maven) resolvers
2020-07-16 13:03:01 +03:00
Vyacheslav Gerasimov
628efcb189 Build: Add kotlin.build.dependencies.iu.enabled property
Alias for intellijUltimateEnabled
2020-07-16 13:00:25 +03:00
Vyacheslav Gerasimov
996e529944 Build: Allow intellijUltimateEnabled without kotlin-ultimate directory
This allows to build against idea ultimate locally
2020-07-16 13:00:24 +03:00
Vyacheslav Gerasimov
34c1316ae0 Build: Enable local build cache with org.gradle.caching=true 2020-07-16 13:00:24 +03:00
Vyacheslav Gerasimov
2e7cb2b829 Build: Enable parallel builds with org.gradle.parallel=true 2020-07-16 13:00:24 +03:00
Jinseong Jeon
50f1f8f0eb FIR: consider more functional types during SAM resolution 2020-07-16 12:56:18 +03:00
Jinseong Jeon
d66c6c7e1e FIR serializer: transform KSuspendFunction types too 2020-07-16 12:56:18 +03:00
Ivan Kylchik
85e822e283 [FIR] Support smartcast after reference equality check
#KT-39000 Fixed
2020-07-16 12:43:55 +03:00
vladislavf7@gmail.com
63f7e95c89 [FIR] Add RedundantExplicitTypeChecker 2020-07-16 12:39:13 +03:00
Yunir Salimzyanov
3c798502c8 Synchronize muted TeamCity tests with database for .bunch configurations 2020-07-16 11:04:59 +03:00
Jinseong Jeon
c7a37eb6b2 FIR deserializer: load annotations on extension receiver parameters 2020-07-16 10:42:51 +03:00
Dmitriy Dolovov
02f08b16d6 [Commonizer] Ignore CallableDescriptor.hasSynthesizedParameterNames attribute 2020-07-16 14:26:37 +07:00
Mikhail Zarechenskiy
100a6f70ca Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-16 09:56:46 +03:00
Anton Bannykh
e45cd02b01 KLIB: add EmptyPackageFragment's to fix ModuleDescritor.getSubPackagesOf 2020-07-15 20:42:23 +03:00
Abduqodiri Qurbonzoda
d2c9fc41f1 Replace @LowPriorityInOverloadResolution with @DeprecatedSinceKotlin #KT-37101 2020-07-15 20:36:57 +03:00
Abduqodiri Qurbonzoda
4ac1b7748a Advance bootstrap to 1.4.20-dev-2133 2020-07-15 20:36:56 +03:00
Roman Artemev
cd9f59325e [KLIB] Fix deserialization of anonymous classes
In case of initializing property or function with anonymous object the
object is being exposed outside its field/function's scope and
accessible on previous level. In this case in `declarations only` mode
we have unbound symbols. Fix is to force body/initializer loading in
such cases.

Make sure it is deserialized in `declarations'only` mode too.

 - Fix KT-40216
 - Add test
2020-07-15 18:23:29 +03:00
Roman Artemev
d31de6c8de [Psi2IR] Improve assertion message 2020-07-15 18:23:28 +03:00
Alexander Dudinsky
d89083cd8c Fixup the tests vs master-gradle-plugin
Defined 4.0 and 1.3.0 as default versions of Gradle and plugin for PluginTargetVersions
Use `{{kotlin_plugin_repositories}}` template in testData of ImportTests
Update "mute" databases for new tests

Add `kotlin.stdlib.default.dependency=false` to some testData
2020-07-15 17:10:36 +03:00
Andrey Uskov
005314ce06 Support running import tests on bootstrap version of gradle plugin 2020-07-15 17:09:36 +03:00
Victor Petukhov
b0c96a61ec Don't try to infer postponed variables on lambdas without BuilderInference annotation
^KT-39618 Fixed
2020-07-15 16:19:43 +03:00
nataliya.valtman
9e737156dd KT-37720 Replace ArtifactTransform with TransformAction 2020-07-15 15:57:54 +03:00
Andrei Klunnyi
b9585dabd4 KT-32368 Rework Inline hints settings // fix QuickFixTestGenerated$AutoImports.testKt17525 2020-07-15 13:25:00 +02:00
Andrei Klunnyi
1639cadbb7 KT-32368 Rework Inline hints settings // remove non-existent ReturnHintLinePainter 2020-07-15 13:00:16 +02:00
Jinseong Jeon
30b91b128a FIR: adjust type of integer operator call as property initializer 2020-07-15 13:56:40 +03:00
Mikhail Glukhikh
ddd26de139 FirTypeIntersectionScope: extract 'createIntersectionOverride' 2020-07-15 13:36:31 +03:00
Mikhail Glukhikh
9934f7d56e [FIR TEST] Add test for KT-40327 2020-07-15 13:36:31 +03:00
Mikhail Glukhikh
92d40c27e2 FirBasedSignatureComposer: build signature even for private classes
FIR2IR assumes that we can build signature for any non-local class.
Later we can drop this assumption.
2020-07-15 13:36:31 +03:00
Mikhail Glukhikh
07b0ffef84 [FIR] Introduce & use remapArgumentsWithVararg 2020-07-15 13:36:30 +03:00
Jinseong Jeon
5c4f978073 FIR: transform arrayOf call with empty arguments 2020-07-15 13:36:30 +03:00
Jinseong Jeon
db9d42c153 IrConstTransformer: handle vararg with spread elements properly 2020-07-15 13:36:30 +03:00
Jinseong Jeon
5600eefea5 FIR: add support for varargs in annotation calls 2020-07-15 13:36:30 +03:00
Jinseong Jeon
4e6bd33eca FIR: create argument mapping for annotation call in general 2020-07-15 13:36:30 +03:00
Jinseong Jeon
1a861b2df9 FIR2IR: don't create synthetic class for enum entry w/o members 2020-07-15 13:36:30 +03:00
Juan Chen
2ea3579281 [FIR] add support for generic cases of delegation by implementation
Add type parameters for generic delegated members and type
substitution when implementing instantiated super interfaces.
2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
93632d2a18 FIR declaration transformer: unwrap synthetic property accessor properly 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
031f03a903 Introduce FirDeclarationOrigin.INTERSECTION_OVERRIDE 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
9107944b05 FirSyntheticProperty: take returnTypeRef directly from delegate 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
e2678149cb FirClassSubstitutionScope: fix overridden symbols traversing 2020-07-15 13:36:29 +03:00
Mikhail Glukhikh
10a1d5c03b FirTypeIntersectionScope: add intersection overrides caching 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
c1d223dbde FirTypeIntersectionScope: enhance support of inherited default parameters 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
c46fac3464 FirTypeIntersectionScope: support inherited default parameters 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
7a2ea49399 FirTypeIntersectionScope: introduce "intersection" fake overrides 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
5a422b5ef6 FirTypeIntersectionScope: optimize/cleanup processOverriddenFunctions 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
1bbed6c4ed [FIR2IR] Use FIR-specific methods to search for overridden functions 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
59cc9d4bc6 [FIR] Introduce FirTypeScope.processOverriddenFunctionWithDepth 2020-07-15 13:36:28 +03:00
Mikhail Glukhikh
8a29021aad [FIR2IR] Make data class synthetic members public API 2020-07-15 13:36:27 +03:00
Mikhail Glukhikh
521901f09a [FIR2IR] Cache type parameters for existing IR classes properly
Before this commit, we just recreated class header
for external IR class found by signature. However, it's not required,
because super-types, type parameters, etc. are already initialized.
So now we just read type parameters and build cache for them.
2020-07-15 13:36:27 +03:00
Victor Petukhov
d2f5fbdd08 Fix failing on AS test with inserting -Xinline-classes to build script 2020-07-15 13:35:16 +03:00
Kirill Shmakov
c8b3e622f1 Fix typo in field name 2020-07-15 10:52:42 +03:00
vladislavf7@gmail.com
d96772444e [FIR] Fix redundant visibility checker 2020-07-15 09:42:30 +03:00
Dmitry Savvinov
9b8128aaa8 Coerce commonTest to common in HMPP
Otherwise, Android import won't add dependency from androidTest to
commoonTest. See KT-38744 for details

^KT-38744 Fixed
2020-07-15 11:18:34 +07:00
Ilya Muradyan
1ac9b4c38f Add dependency scopes option for scripting resolvers 2020-07-14 23:42:00 +03:00
Vyacheslav Gerasimov
742b98bed6 Build: Fix stdlib-js-ir commonMainSources task dependency on version 2020-07-14 20:29:11 +03:00
vladislavf7@gmail.com
fb5fb44993 [FIR] Add RedundantModalityModifierChecker 2020-07-14 19:56:41 +03:00
Vyacheslav Gerasimov
e7c88a4349 Build: Add KotlinVersionCurrentValue to runtime classpath normalization
To avoid cache misses between local and remote build
2020-07-14 17:51:45 +03:00
Vyacheslav Gerasimov
e215d94b7b Build: Fix JavaExec task configuration
Setting some properties is not allowed in doFirst anymore in Gradle 6.5
2020-07-14 17:51:45 +03:00
Victor Petukhov
bf23b39d76 Add using -Xinline-classes by default in IDE intentions
^KT-34209 Fixed
2020-07-14 17:43:44 +03:00
Pavel Kirpichenkov
79d7babb57 Add test checking file annotations resolution
#KT-37219 Fixed
2020-07-14 17:07:42 +03:00
Nikolay Krasko
36a46482c5 Unmute IdeReplCompletionTestGenerated.testDefinedExtension in 202
Lost this line from 16c5ba0988
 during the mute-platform.csv.202 creation.
2020-07-14 17:05:30 +03:00
Natalia Selezneva
5954fe528b gradle.kts: do not return ErrorScriptDefinition into GradleBuildRootManager
In this case script definition is saved into script info,
but only real script definitions should be cached
In case of null script configurations will be reloaded into cache when scriptdefinitions will be ready

^KT-39910 Fixed
2020-07-14 15:30:21 +03:00
Natalia Selezneva
3e3f8aeb93 Mark importing as complete in case of some unexpected behavior
For example in case when script contains some errors gradleHome might be null
Then build root should be marked as updated
Also notification should be updated
2020-07-14 15:30:20 +03:00
Ilya Goncharov
2c67ab924f [Gradle, JS] this globalObject in webpack
^KT-40159 fixed
2020-07-14 14:42:26 +03:00
Andrei Klunnyi
93a82060d4 KT-39788 MPP, Gradle runner: Run does not add resource directory to classpath // gradle runner support
Before this commit "delegate to Gradle" option was not taken into
consideration. Was it MPP or SPP, KotlinRunConfiguration was always
executed by platform runner (as a default one). The reason behind this
was that there was no dedicated class (extension point) responsible for
Gradle-Kotlin pair. Now its KotlinGradleAppEnvProvider.
2020-07-14 11:24:59 +00:00
Andrei Klunnyi
681c2e9492 KT-39788 MPP, Gradle runner: Run does not add resource directory to classpath // classpath fix
The reason of resource directory absence was that it couldn't be loaded
from the project configuration file. Just after the import it remained
in the memory and runner couldn' get it. KotlinOutputPathsDataService as
a pair to KotlinOutputPaths is what was missing. Details are provided
below.
------------------------------------------------------------------------
On a disk configuration represents a binary file containing serialized
graph of external project structure. It contains nodes belonging to both
IDEA and its plugins.

To deserialize a node IDEA tries to load its class using a chain of
class-loaders: its own and those provided by actual set of plugins.
The nuance is how to get plugins' ones. The approach is the following.
There is an association between a node's payload and a service which is
supposed to consume it see KotlinOutputPathsDataService#getTargetDataKey
and DataNode#getKey). Plugin services are guaranteed to be loaded by
plugin class loader.
No association - service - no plugin, node was just skipped.
------------------------------------------------------------------------
2020-07-14 11:24:58 +00:00
Ilya Muradyan
07b566dd02 Add @JvmDefault for getPossibleSyntheticNestedClassNames 2020-07-14 14:17:58 +03:00
Zalim Bashorov
340512e27a [KJS] Throw exception on recursive types provided to typeOf and provide proper support later within KT-40173
#KT-38140 fixed
2020-07-14 14:14:13 +03:00
Zalim Bashorov
c552933459 [Test infra] Take into account transitive compatible targets while checking compatibility. 2020-07-14 14:14:12 +03:00
Zalim Bashorov
ca37c6bfe6 [KJS FE] Allow using typeOf with non-reified type parameters
#KT-38771 fixed
2020-07-14 14:14:11 +03:00
Ilya Goncharov
9d362875da [Gradle, JS] Fail build in case when mpp or js targets not configured
^KT-40210 fixed
^KT-40300 fixed
2020-07-14 13:59:00 +03:00
Sergey Igushkin
62aed1b53a Add kotlin.stdlib.default.dependency=false to avoid stdlib default dep 2020-07-14 14:47:40 +04:00
Sergey Igushkin
ad9d011ed0 Fix stdlib default dependencies with Android
* In Android test-related source sets, add an implementation dependency,
  not an api one, because adding dependencies to the api configurations
  leads to warnings from AGP

* Add the default stdlib dependency only to the Android main source set,
  as duplicating it elsewhere leads to issue with publishing the project
  with the `maven` plugin (duplicate conf2ScopeMappings)
2020-07-14 14:47:16 +04:00
Sergey Igushkin
d83d3304a5 KT-38221: Stdlib by default; KT-40225 Single dependency on kotlin-test
* Add a DSL property `kotlin.coreLibrariesVersion` that is used as the
  default version for all org.jetbrains.kotlin dependencies instead of
  the plugin version used previously – the pluging version is the
  default now.

* Support omitting the `kotlin-stdlib-*` dependencies in all kinds of
  projects. For the JVM source sets, choose the stdlib module by
  checking the jvmTarget in the compilations – if all compilations
  target 8+ then use `kotlin-stdlib-jdk8`.

* Support adding a single dependency on the fake module
  `kotlin-test-multiplatform` that is later expanded into the
  appropriate dependencies on `kotlin-test-*` modules. For JVM source
  sets, detect the test framework by inspecting the test tasks.

* (minor) Fix _executionSource not updated in KotlinJvmTestRun

* (minor) Lazily query `kotlinUsageContext`'s dependency-related
  properties to avoid freezing the configurations

Issue #KT-38221 Fixed
Issue #KT-40225 Fixed
2020-07-14 14:47:13 +04:00
Ilya Goncharov
49c8d99f61 [Gradle, JS] Resolution of compilation's configurations inside NPM conf
^KT-40201 fixed
2020-07-14 13:13:45 +03:00
Ilya Goncharov
40311dbe05 [Gradle, JS] Fix test on public package json with dependencies
^KT-40201 fixed
2020-07-14 13:13:35 +03:00
Ilya Goncharov
c5f89ebc0d [Gradle, JS] Add dev dependencies into public package json
^KT-40201 fixed
2020-07-14 13:13:18 +03:00
Mikhail Zarechenskiy
bb23556ead Don't perform Unit-conversion for functional types with type variables
#KT-40269 Fixed
2020-07-14 13:05:28 +03:00
Mikhail Zarechenskiy
09b44b3189 Fix rewrite at slice exception for callable references inside flatMap
#KT-40254 Fixed
2020-07-14 13:05:28 +03:00
Andrei Klunnyi
1e4c554bcd KT-32368 Rework Inline hints settings // compatibility with earlier IDEA versions 2020-07-14 10:03:51 +00:00
Andrei Klunnyi
604e270a73 KT-32368 Rework Inline hints settings // preview text 2020-07-14 10:03:50 +00:00
Andrei Klunnyi
7a69cf587e KT-32368 Rework Inline hints settings // HintType cleanup 2020-07-14 10:03:50 +00:00
Andrei Klunnyi
d6692a8062 KT-32368 Rework Inline hints settings // flattern parameter name hints menu 2020-07-14 10:03:49 +00:00
Andrei Klunnyi
be0cde1d70 KT-32368 Rework Inline hints settings // remove suspending call hints
Suspending call hints were removed according to KT-30928 and KT-39271.
2020-07-14 10:03:48 +00:00
Andrei Klunnyi
49d4f55c87 KT-32368 Rework Inline hints settings // special case for lambda hints
Lambda hints are placed at the end of a line in such a way that user
can't move the caret behind it. Unfortunately, hint provision
infrastructure doesn't take this detail into account.
As a workaround, KotlinLambdasHintsProvider now returns an empty result
(sink) to the outer infrastructure and accesses editor's inlay model
itself.
2020-07-14 10:03:48 +00:00
Andrei Klunnyi
d1722e3975 KT-32368 Rework Inline hints settings // migrate tests for types
KotlinReferencesTypeHintsProvider which in now responsible for
type hints is not compatible with the existing
InlayTypeHintsTest. Because of that tests were migrated to the new
infrastructure.
2020-07-14 10:03:47 +00:00
Andrei Klunnyi
36f3431559 KT-32368 Rework Inline hints settings // migrate tests for suspending calls
KotlinSuspendingCallHintsProvider which in now responsible for
suspending call hints is not compatible with the existing
SuspendingCallHintsTest. Because of that tests were migrated to the new
infrastructure.
2020-07-14 10:03:47 +00:00
Andrei Klunnyi
b0dece756a KT-32368 Rework Inline hints settings // migrate tests for lambdas
KotlinLambdasHintsProvider which in now responsible for lambda related
hints is not compatible with the existing LambdaReturnValueHintsTest.
Because of that tests were migrated to the new infrastructure.
2020-07-14 10:03:46 +00:00
Andrei Klunnyi
5fe1eaea17 KT-32368 Rework Inline hints settings // remove outdated KotlinCodeHintsPass
Some time ago platform couldn't place hints at the end of a line.
This is how KotlinCodeHintsPass appeared. Class was responsible for
lambda related hints. Now that platform evolved functionality was moved
to KotlinLambdasHintsProvider.
2020-07-14 10:03:45 +00:00
Andrei Klunnyi
533507de25 KT-32368 Rework Inline hints settings // split KotlinInlayParameterHintsProvider
Platform supports 2 interfaces for inlay hints providers:
- InlayParameterHintsProvider [1]
- InlayHintsProvider [2]

KotlinInlayParameterHintsProvider as an implementation of (1) and a
source of "Inlay Hints" menu has the following limitations:
- Platform treats component as a source of "Parameter hints" submenu
that cannot be split. Once can only add or remove its nested checkboxes.
- Only a single instance of (1) can be defined.

To have a separate menu items for "Inlay Hints" existing
KotlinInlayParameterHintsProvider was split. New providers
implementing (2) were extracted from it:
- KotlinReferencesTypeHintsProvider
- KotlinSuspendingCallHintsProvider
- KotlinLambdasHintsProvider

TODO: HintType move as a separate commit
2020-07-14 10:03:45 +00:00
Sergey Igushkin
5ec93fd74c Fixup for the fix of KT-39809
In the original fix for KT-39809, the Kapt plugin was not given a proper
empty implementation stub: it was added to `Kapt3GradleSubplugin`, while
originally the Kapt subplugin's META-INF/services entry pointed to
`Kapt3KotlinGradleSubplugin`.

This commit makes the correct class implement the legacy interface.

Issue #KT-39809 Fixed
2020-07-14 13:09:26 +04:00
Sergey Igushkin
4c273e1fc5 Fix resolving dependency on self in HMPP (KT-39037)
Apply a workaround for grade/gradle#13680

Issue #KT-39037 Fixed
2020-07-14 13:09:24 +04:00
Sergey Igushkin
aebca19fd7 Fix resolving an MPP dependency in custom configurations (KT-32239)
In the `KotlinPlatformType` disambiguation rule, don't prefer `common`
when there's a `jvm` or an `androidJvm` variant, as this would conflict
with disambiguation rules created by the other plugins, such as Gradle's
`java` which will choose `org.gradle.usage=java-api` and lead to
ambiguity.

Issue #KT-32239 Fixed
2020-07-14 13:09:22 +04:00
Mikhail Zarechenskiy
8158ba2be3 Add tests for obsolete issues
#KT-32183 Obsolete
 #KT-31474 Obsolete
 #KT-31853 Obsolete
2020-07-14 11:23:57 +03:00
Ilya Matveev
19dc3f071c Gradle, native: Enable assertions for in process compiler execution
Issue #KT-39764 fixed
2020-07-14 08:18:00 +00:00
vladislavf7@gmail.com
275ce16faa [FIR] add RedundantReturnUnitTypeChecker 2020-07-14 10:05:28 +03:00
Dmitry Savvinov
5c88b1e80a Allow depending on Native stdlib even if platforms do not match under HMPP
^KT-40102
2020-07-14 12:49:59 +07:00
Dmitry Savvinov
21026001db Add logging into ideaModelDependencies 2020-07-14 12:49:59 +07:00
Ilya Gorbunov
010e530ac4 Make common KClass extend common KClassifier
It already does that in all platforms.
Add KClass common API test.
2020-07-13 23:20:52 +03:00
Florian Kistner
1878ae8222 Don't apply copyright notice to Kotlin Ultimate
* Previous attempt apparently no longer effective
* Cover a few additional strangling files
2020-07-13 19:42:04 +02:00
Florian Kistner
ce39b75cc8 Don't apply copyright notice to Kotlin Ultimate
* Previous attempt apparently no longer effective
2020-07-13 19:37:38 +02:00
Ilya Goncharov
bbb3032e1c [Gradle, JS] Rename package-candidate.json to pre-package.json
^KT-39515 fixed
2020-07-13 19:32:29 +03:00
Ilya Goncharov
6a0315fe7a [Gradle, JS] force write package json in all cases
^KT-39515 fixed
2020-07-13 19:32:29 +03:00
Ilya Goncharov
b4a774e821 [Gradle, JS] Use package.json candidate
^KT-39515 fixed
2020-07-13 19:32:29 +03:00
Ilya Goncharov
8586d5e206 [Gradle, JS] Small refactoring of yarn imported
^KT-39515 fixed
2020-07-13 19:32:28 +03:00
Konstantin Tskhovrebov
cfd91023be Add native targets check to "isAllowCommonizer" method.
#KT-40164 Fixed.
2020-07-13 19:31:08 +03:00
Ilya Goncharov
797449f7e4 [Gradle, JS] Add TC client on TC output handler for browser run task
^KT-40178 fixed
2020-07-13 19:25:04 +03:00
Nikolay Krasko
943d012875 Fix comparison for SdkAndMockLibraryProjectDescriptor
There's no known problems connected with this change, but wrong
comparison might cause tests flakiness.

`allowKotlinPackage` and `classpath` fields were not included.
2020-07-13 17:58:04 +03:00
Nikolay Krasko
0db7806dec Use test classpath for annotations.jar search
Got unstable behaviour in 202 test because of setting
idea.home.path during the compiler execution.
2020-07-13 17:58:03 +03:00
Yaroslav Chernyshev
07e3dd9ec7 [Gradle, Cocoapods] Fixed bug in scheme name for pods 2020-07-13 16:37:37 +03:00
Nick
67e58ff152 [FIR] Fix redundant calls to firEffectiveVisibility() 2020-07-13 16:30:47 +03:00
Alexander Udalov
5340cf5567 Add property kotlin.build.useIR to enable JVM IR in Kotlin build
Right now this is only supposed to be turned on locally (`./gradlew
-Pkotlin.build.useIR=true ...`), to be able to quickly try how JVM
IR-compiled Kotlin compiler works.
2020-07-13 14:38:22 +02:00
Alexander Udalov
9c36c74357 Build: do not pass JVM compiler arguments to common KotlinCompile 2020-07-13 14:38:22 +02:00
Kristoffer Andersen
8d79a6ae03 [JVM IR] Copy inline class constructor annotations 2020-07-13 11:50:34 +03:00
Mikhail Zarechenskiy
678b76cab1 Fix presence of Deprecated hidden annotation for reference arguments
#KT-40234 Fixed
2020-07-13 11:23:28 +03:00
Ilya Matveev
c2e0cd60d7 Gradle tests: Temporary disable NativePlatformLibsIT for Windows
This test causes a build timeouts on CI which cannot be reproduced
locally. So we disable them to not block the testing process until
a proper fix is found.
2020-07-13 07:48:35 +00:00
Dmitry Savvinov
3ef760604b Force expansion to have the same nullability as abbreviation
Note that classifier.underlyingType is always non-nullable, but
abbreviation might be nullable, so we should keep them consistent

^KT-40199 Fixed
2020-07-13 11:50:10 +07:00
Dmitry Savvinov
8890ae10d4 Add test on signatures with nullable abbreviated types
Currently test fails, see KT-40199
2020-07-13 11:50:10 +07:00
Natalia Selezneva
e0bc54cd82 gradle.kts: update notification messages after proofreading 2020-07-12 22:37:45 +03:00
Mikhail Glukhikh
8005df42fb [FIR] Make redundant visibility modifier a warning 2020-07-11 10:45:33 +03:00
Mikhail Glukhikh
5276903bea Fix code style: DeclarationCheckersDiagnosticComponent 2020-07-11 10:45:33 +03:00
Mikhail Glukhikh
aee49c3fde [FIR TEST] Add forgotten txt-file for redundant visibility checker test 2020-07-11 10:45:32 +03:00
vladislavf7@gmail.com
be684c784f [FIR] Introduce extended checkers for inspection-like diagnostics 2020-07-11 10:45:32 +03:00
vladislavf7@gmail.com
4643d483a0 [FIR] Introduce RedundantVisibilityModifierChecker 2020-07-11 10:45:10 +03:00
Ilya Muradyan
510ac66ce1 Fix tests generation after upgrading Gradle to 6.5 2020-07-10 22:07:10 +03:00
Ilya Gorbunov
dd47962ad0 Extract current Kotlin version value into a separate class
In order to selectively ignore it during classpath normalization,
and do not recompile all the dependencies when just the version value
changes.
2020-07-10 19:12:07 +03:00
Nikolay Krasko
cb513b9a70 202: Fix KotlinUastReferencesTest 2020-07-10 19:09:27 +03:00
Ilya Gorbunov
20683d62a6 Postpone introducing common StringBuilder.capacity() function
Its support complicates JS StringBuilder implementation with no actual
performance improvements. Benefits of having capacity() function
in common code are also not completely clear.

Relates to KT-33069
#KT-40168
2020-07-10 18:49:39 +03:00
Steven Schäfer
097e0fb46c JVM IR: Mangle delegated properties with inline class type (KT-40125) 2020-07-10 17:06:44 +02:00
Sergey Rostov
e48d2b9b83 ScriptTemplatesClassRootsIndex: inc version and minor fixes
Content was changed, so we should force reindex.

Minor changes:
- There is no need to save a string, we can just save nothing
 by using the Unit value (see UnitKey.save and UnitKey.read)
- Unit can be shared between all indexes, so we can extract UnitKey object
- It would be good to extract abstract class FileListIndex:
  - for better readability: separate the logic of the specific index from the common FileListIndex implementation
  - someone can use it also
- mapOf (Unit to null) will create singletonMap itself and more readable
- ScriptTemplatesClassRootsIndex.KEY perhaps better to call NAME
2020-07-10 18:01:38 +03:00
Sergey Rostov
1f52c0e0d4 gradle.kts: improve service initializtion
- prevent analyzing .gradle.kts files until all services are loaded
- remove services caches where it is not required
- replace cached services with cache only during vfs events batch processing
- prevent services loading in actions updating
2020-07-10 17:47:10 +03:00
Georgy Bronnikov
a97d718de8 IR: remove a KotlinType use from Ir.kt 2020-07-10 17:35:30 +03:00
Georgy Bronnikov
aab95f93f2 JVM_IR: invoke method descriptor for default lambdas 2020-07-10 17:35:29 +03:00
Alexander Udalov
e8c3c70369 IR: make IrDeclarationWithVisibility.visibility mutable
It was mutable anyway in many subclasses. This is needed in order to
avoid depending on concrete IR implementations in the JVM IR backend
where it's necessary to be able to change visibility.
2020-07-10 16:17:06 +02:00
Alexander Udalov
96f0a8e8e5 IR: minor, inline OverridableMember 2020-07-10 16:17:06 +02:00
Alexander Udalov
e674226a3b IR: do not use Ir*Impl elements where it's not necessary 2020-07-10 16:17:06 +02:00
Alexander Udalov
dbad81473e IR: make IrMetadataSourceOwner.metadata mutable
To avoid casting to specific Ir*Impl elements at call sites.

Also inherit from IrMetadataSourceOwner only where it's needed: class,
file, function, property. Previously this field was always null and took
some space for things like value parameters, type parameters, etc.
2020-07-10 16:17:05 +02:00
simon.ogorodnik
689887c94d [FIR] Fail test if no modules analyzed successfully 2020-07-10 16:25:22 +03:00
Victor Petukhov
cdb122c698 Add skipped ignore directive in test for b08c7eff38 2020-07-10 14:52:51 +03:00
Mikhail Zarechenskiy
0c8b847ae6 Introduce compiler key to disable compatibility resolution mechanism
Enable it if one was using new inferene before 1.4

 #KT-40128 Fixed
 #KT-40112 Fixed
 #KT-40113 Fixed
2020-07-10 14:23:45 +03:00
Mikhail Glukhikh
c1fd891916 [FIR IDE] Fix compilation in asKtSymbolOrigin 2020-07-10 13:02:31 +03:00
Ilya Goncharov
644c5a941b [Gradle, JS] Add task on webpack-compile sync
^KT-40087 fixed

[Gradle, JS] Use runCompileSync only for run

^KT-40087 fixed

[Gradle, JS] Rename type on mode

^KT-40087 fixed

[Gradle, JS] Use explicit names in lambda

^KT-40087 fixed
2020-07-10 12:32:07 +03:00
Anton Bannykh
939f0d0344 [IR] minor: make StageController an open class
This should make creating a new "do nothing" controller more straightforward.
2020-07-10 11:30:42 +03:00
Anton Bannykh
abc6ecaa1c [JS IR BE] support SAM conversions in DCE-driven mode 2020-07-10 11:30:42 +03:00
Anton Bannykh
8fcd73e3cb [JS IR BE] move exceptionState initialization from constructor to coroutine entryState
This fixes the DCE-driven mode. Before this fix the suspend lambda constructor was modified
by the `invoke` body lowering. Which is wrong, becuase the corresponding class was created
by the CallableReferenceLoiwering much earlier.
2020-07-10 11:30:41 +03:00
Anton Bannykh
916a5f367c [IR] simplify Carriers (remove type parameters) 2020-07-10 11:30:41 +03:00
Anton Bannykh
adf5ee394e [JS IR BE] remove unnecesary code from DCE 2020-07-10 11:30:41 +03:00
Victor Petukhov
514ac7dc8f NI: introduce simple calls storage (which aren't gone through type inference) in coroutine inference session to further substitute postponed variable
^KT-40151 Fixed
2020-07-10 11:11:48 +03:00
Kirill Shmakov
3acb4e54d5 Update AS version 2020-07-10 11:06:33 +03:00
Vladimir Ilmov
3e69250f72 (CoroutineDebugger) Restored frame variables isn't shown for 2020.1.
#KT-40172 fixed
2020-07-10 09:57:38 +02:00
Mikhail Glukhikh
fbbf4e06ba [FIR] Support imported callable from object properly #KT-35730 Fixed 2020-07-10 10:25:39 +03:00
Mikhail Glukhikh
6b964cb61d [FIR2IR] Drop explicit receiver double-conversion for objects 2020-07-10 08:56:58 +03:00
Ilya Gorbunov
2f3e1dcbc6 Add EXACTLY_ONCE contract to suspendCoroutine* functions
Update line numbers in the affected test.
2020-07-10 01:05:16 +03:00
Ilya Gorbunov
1a32fdf6d7 Add EXACTLY_ONCE contract to functions that call their lambda parameter once
KT-35972
2020-07-10 01:05:16 +03:00
Ilya Gorbunov
c85432b2f9 Fix typo in kotlinx.dom docs 2020-07-10 01:05:16 +03:00
Ivan Kylchik
c44fd235ce [FIR] Remove isEnumEntry field from FirJavaField
This field isn't used anymore because java enum entry is represented by
FirEnumEntry
2020-07-09 23:49:55 +03:00
Ivan Kylchik
dcae6f1415 [FIR] Support when exhaustiveness for java enum
The problem appear because for java enum its entries was represented by
FirJavaField. To fix this FirEnumEntry was used

#KT-39621 Fixed
2020-07-09 23:49:54 +03:00
Ivan Kylchik
307871a050 [FIR] Unmute fir spec tests
#KT-38397 Fixed
#KT-38334 Fixed
2020-07-09 23:49:39 +03:00
Alexander Udalov
0baa1c8723 IR: remove deprecated constructor of IrClassImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
e6993e1b88 IR: remove deprecated constructor of IrConstructorImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
ef94716af5 IR: remove deprecated constructor of IrFieldImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
7f9ef5e11d IR: remove deprecated constructors of IrFunctionImpl 2020-07-09 18:51:04 +02:00
Alexander Udalov
551f1f85a9 IR: remove secondary constructor of IrModuleFragmentImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
19ec8646b8 IR: remove convenience factory for IrTypeAliasImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
fd83596c91 IR: remove deprecated constructor of IrTypeParameterImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
0691595ed2 IR: remove deprecated constructor of IrValueParameterImpl 2020-07-09 18:51:03 +02:00
Alexander Udalov
bba597cdff IR: remove deprecated constructors of IrVariableImpl 2020-07-09 18:51:02 +02:00
Alexander Udalov
d8a2b92098 IR: remove deprecated constructors of IrPropertyImpl 2020-07-09 18:51:02 +02:00
Vyacheslav Gerasimov
501fea1202 Fix TCServiceMessagesClient compilation against Gradle 6.5
Method `isRoot` doesn't exist anymore in TestDescriptorInternal
2020-07-09 19:31:21 +03:00
Vyacheslav Gerasimov
697bb04d46 Build: Setup jvmTarget 1.6 for several common modules
Some modules depending on them target jvm 1.6 and can't depend on
jvm 1.8 module in Gradle 6.5.
2020-07-09 19:31:20 +03:00
Vyacheslav Gerasimov
b5ee0e8222 Build: Remove jvmTarget 1.6 for several modules depending on 1.8 modules
Module targeting jvm 1.6 can't depend on jvm 8 one. In Gradle 6.5 this
behaviour is enforced by configuration error.
2020-07-09 19:31:20 +03:00
Vyacheslav Gerasimov
1fea01754d Build: Remove jvmTarget = "1.6" for kotlinx-metadata-klib
kotlinx-metadata-klib can't have jvmTarget 1.6 because it embeds module
:compiler:serialization which is compiled with jvmTarget 1.8. It is
enforced by configuration error in Gradle 6.5
2020-07-09 19:31:20 +03:00
Vyacheslav Gerasimov
508036742c Build: Upgrade Gradle to 6.5.1 2020-07-09 19:31:20 +03:00
Ilya Kirillov
39601f99ab Wizard: update ktor version
#KT-40037 fixed
2020-07-09 18:27:43 +03:00
Ilya Kirillov
44334fca11 Wizard: consider RC version as a EAP one
#KT-39871 fixed
2020-07-09 18:27:41 +03:00
Ilya Kirillov
9fde2ac269 Wizard: add kotlinx repo for projects using kotlinx-html
#KT-40004 fixed
2020-07-09 18:27:39 +03:00
Florian Kistner
346df07adc 203: Fix compilation for 203 2020-07-09 15:27:45 +02:00
Florian Kistner
4c4af9971e 203: Bump intellijSdk version for 203 2020-07-09 15:27:45 +02:00
Florian Kistner
202a55cb39 Bump intellijSdk version for 203 2020-07-09 15:27:45 +02:00
Dmitry Gridin
1c4d7c5772 Regenerate test data 2020-07-09 18:37:37 +07:00
Yan Zhulanow
81869b282b Mute failing QuickFixTestGenerated/KotlinSteppingTestGenerated 2020-07-09 19:23:16 +09:00
Ilya Muradyan
2487f9369c Fix REPL completion for import directives 2020-07-09 13:19:04 +03:00
Dmitriy Dolovov
16aee6c8d6 [Commonizer] Lookup descriptors that doesn't participate in commonization
^KT-40119
2020-07-09 16:44:33 +07:00
Dmitriy Dolovov
3af937ea9a [Commonizer] Remove isDefinitelyNotNullType from CirSimpleType 2020-07-09 16:44:32 +07:00
Nikolay Krasko
4d21455e72 Mute testImportAliasMultiDeclarations because of wrong behaviour in headless
Caused by: java.lang.AssertionError: Editor must be showing on the screen
	at com.intellij.ui.popup.AbstractPopup.showInBestPositionFor(AbstractPopup.java:546)
	at com.intellij.codeInsight.navigation.actions.GotoDeclarationOnlyHandler2.gotoDeclaration$intellij_platform_lang_impl(GotoDeclarationOnlyHandler2.kt:74)
	at com.intellij.codeInsight.navigation.actions.GotoDeclarationOrUsageHandler2.invoke(GotoDeclarationOrUsageHandler2.kt:63)
	at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$0(CodeInsightAction.java:57)
	at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$1(CodeInsightAction.java:63)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:158)
	at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:54)
	at org.jetbrains.kotlin.idea.navigation.AbstractGotoActionTest.doTest(AbstractGotoActionTest.kt:27)
	at org.jetbrains.kotlin.test.KotlinTestUtils.lambda$testWithCustomIgnoreDirective$6(KotlinTestUtils.java:804)
	at org.jetbrains.kotlin.test.MuteWithFileKt$testWithMuteInFile$1.invoke(muteWithFile.kt:41)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTestImpl(KotlinTestUtils.java:774)
	at org.jetbrains.kotlin.test.KotlinTestUtils.runTest(KotlinTestUtils.java:716)
	at org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.runTest(GotoDeclarationTestGenerated.java:24)
	at org.jetbrains.kotlin.idea.navigation.GotoDeclarationTestGenerated.testImportAliasMultiDeclarations(GotoDeclarationTestGenerated.java:38)
2020-07-09 12:43:11 +03:00
Nikolay Krasko
593fd646b1 Add mute-platform.csv.202 2020-07-09 12:43:10 +03:00
Roman Artemev
ca44242f37 [IR] Fix synthetic declarations generator to make it produce correct type
- Fix KT-40126
 - Add test
2020-07-09 11:47:07 +03:00
Igor Chevdar
d8f5b50cd8 [native-gradle-plugin] Respected changed cache format 2020-07-09 12:33:59 +05:00
Igor Chevdar
79af726872 [native-gradle-plugin] Fixed problem with rebuilding caches 2020-07-09 12:33:59 +05:00
Anton Yalyshev
bc979a33f7 Enable FUS for Code Completion in 1.4.0 2020-07-09 10:20:18 +03:00
Dmitriy Dolovov
d3e858645f [Commonizer] Remove CirTypeSignature from CirType 2020-07-09 10:08:13 +07:00
Dmitriy Dolovov
4ab5bfef22 [Commonizer] Preserve order of supertypes in commonized class 2020-07-09 10:08:06 +07:00
Dmitriy Dolovov
5e383e9d71 [Commonizer] Narrow CirClassifierId subtype cast in AnnotationsCommonizer 2020-07-09 10:07:59 +07:00
Dmitriy Dolovov
7a283c64cb [Commonizer] Minor. Reorder type params for CirNode 2020-07-09 10:07:52 +07:00
Andrey Uskov
c37f339d8c Send use-ir and jvmDefaults compiler arguments from IDE
Relates to KT-39924 and KT-39977
2020-07-08 20:39:44 +03:00
Andrey Uskov
550c53c2ac Report jvm-default compiler arguments from Gradle
#KT-39977 Fixed
2020-07-08 20:39:33 +03:00
Andrey Uskov
e3a5df1aaa Report use-ir flag from Gradle
#KT-39924 Fixed
2020-07-08 20:39:14 +03:00
Leonid Startsev
340deb01dd Add 'Incorrect Transient' diagnostic
when users write @Transient, they get @kotlin.jvm.Transient, because it's always in auto-import.
This annotation does not work with @Serializable classes; @kotlinx.serialization.Transient should be used instead.

Add quickfix for 'incorrect transient' diagnostic:
'Import kotlinx.serialization.Transient'
2020-07-08 20:17:11 +03:00
Leonid Startsev
6ef597a4ee Split ContextualSerialization annotation in two 2020-07-08 20:15:56 +03:00
Natalia Selezneva
3d91c410e7 *.gradle.kts: include project sources in script dependencies sources scope
^KT-39523 Fixed
2020-07-08 18:30:02 +03:00
Natalia Selezneva
93d7015139 Remove old roots from KotlinScriptDependenciesCLassFinder
Otherwise it may produce an exception that some invalid roots are returned by ScriptClassRootsCache
2020-07-08 18:30:01 +03:00
Natalia Selezneva
8bb3c0796d Add original errors into the IllegalStateException from import of build script models
This exception is needed to finish gradle import and avoid importing other models into IDE
In most cases this exception is repoted together with Gradle exception from import,
but as soon as it it visible in UI we add some clarification which errors are happened
2020-07-08 18:28:08 +03:00
Jinseong Jeon
3afc37438e FIR: handle getClassCall with integer literals 2020-07-08 18:23:27 +03:00
Vladimir Ilmov
7f472ba24e Switch to isApplicableAsync instead of isApplicable in ToStringRenderer
#KT-39717 fixed
2020-07-08 16:15:46 +02:00
Ilya Goncharov
3d9353f7f5 [Gradle, JS] Add test on dependencies clash
^KT-40093 fixed
2020-07-08 16:10:46 +03:00
Ilya Goncharov
2e2a5a0156 [Gradle, JS] Update version in package.json with file dependency
^KT-40093 fixed
2020-07-08 16:10:39 +03:00
Mikhail Zarechenskiy
2bb9838a80 Add test for obsolete issue
The problem was fixed in d51bb2c053

 #KT-37692 Obsolete
2020-07-08 15:30:20 +03:00
Yunir Salimzyanov
78a4563baf Update versions of database files to correctly sync muted tests
Cause: bunch files were updated to 201
2020-07-08 14:57:07 +03:00
Lilia
53b2fe9fd8 Add changelog for 1.4-M3 & 1.3.72 plugins update 2020-07-08 13:26:51 +02:00
Toshiaki Kameyama
d2deff4864 Add "Replace with 'equals(..., ignoreCase = true)'" inspection
#KT-40016 Fixed
2020-07-08 12:38:30 +02:00
Dmitriy Novozhilov
a5bfa3ae63 [FIR-TEST] Update broken testdata 2020-07-08 12:13:33 +03:00
Dmitriy Novozhilov
86791f1fef [FIR] Fix parsing fun modifier for interfaces in light-tree2fir 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
58af8d68a1 [FIR] Check for isFun flag in SAM resolution 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
d1cb776e29 [FIR] Assume all java interfaces are fun interfaces 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
a3a79e4295 [FIR] Update testdata due to incorrect SAM detection 2020-07-08 12:13:32 +03:00
Dmitriy Novozhilov
29849b1330 [FIR] Resolve rhs of += in dependent context 2020-07-08 12:13:31 +03:00
Vladimir Dolzhenko
943b59b5d8 Do not provide idea.platform.prefix in run configurations for IJ Ultimate 201+ 2020-07-08 10:26:18 +02:00
Alexander Dudinsky
38535c4fe1 New type of task - TestAggregation task
You can configure smoke test suites and get critical test results faster
This doesn't replace rr/* builds, but complements them for a faster round trip.

Also test tasks and patterns were added for KMM team.
 #KMM-265
2020-07-08 11:23:03 +03:00
Sergey Rostov
ebc4910834 ScriptTemplatesClassRootsIndex: inc version and minor fixes
Content was changed, so we should force reindex.
2020-07-08 11:03:25 +03:00
3846 changed files with 109004 additions and 38209 deletions

20
.idea/runConfigurations/Test__KMM.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="kmmTest" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method v="2" />
</configuration>
</component>

View File

@@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[kotlin.kotlin-ultimate]:*/&amp;&amp;!file[kotlin.kotlin-ultimate.*]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[group:kotlin-ultimate]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
</component>

View File

@@ -1,5 +1,504 @@
# CHANGELOG
## 1.4-M3
### Compiler
#### New Features
- [`KT-23575`](https://youtrack.jetbrains.com/issue/KT-23575) Deprecate with replacement and SinceKotlin
- [`KT-38652`](https://youtrack.jetbrains.com/issue/KT-38652) Do not generate optional annotations to class files on JVM
- [`KT-38777`](https://youtrack.jetbrains.com/issue/KT-38777) Hide Throwable.addSuppressed member and prefer extension instead
#### Performance Improvements
- [`KT-38489`](https://youtrack.jetbrains.com/issue/KT-38489) Compilation of kotlin html DSL increasingly slow
- [`KT-28650`](https://youtrack.jetbrains.com/issue/KT-28650) Type inference for argument type is very slow if several interfaces with a type parameter is used as an upper bound of a type parameter
#### Fixes
- [`KT-15971`](https://youtrack.jetbrains.com/issue/KT-15971) Incorrect bytecode generated when inheriting default arguments not from the first supertype
- [`KT-25290`](https://youtrack.jetbrains.com/issue/KT-25290) NI: "AssertionError: If original type is SAM type, then candidate should have same type constructor" on out projection of Java class
- [`KT-28672`](https://youtrack.jetbrains.com/issue/KT-28672) Contracts on calls with implicit receivers
- [`KT-30279`](https://youtrack.jetbrains.com/issue/KT-30279) Support non-reified type parameters in typeOf
- [`KT-31908`](https://youtrack.jetbrains.com/issue/KT-31908) NI: CCE on passing lambda to function which accepts vararg SAM interface
- [`KT-32156`](https://youtrack.jetbrains.com/issue/KT-32156) New inference issue with generics
- [`KT-32229`](https://youtrack.jetbrains.com/issue/KT-32229) New inference algorithm not taking into account the upper bound class
- [`KT-33455`](https://youtrack.jetbrains.com/issue/KT-33455) Override equals/hashCode in functional interface wrappers
- [`KT-34902`](https://youtrack.jetbrains.com/issue/KT-34902) AnalyzerException: Argument 1: expected I, but found R for unsigned types in generic data class
- [`KT-35075`](https://youtrack.jetbrains.com/issue/KT-35075) AssertionError: "No resolved call for ..." with conditional function references
- [`KT-35468`](https://youtrack.jetbrains.com/issue/KT-35468) Overcome ambiguity between typealias kotlin.Throws and the aliased type kotlin.jvm.Throws
- [`KT-35494`](https://youtrack.jetbrains.com/issue/KT-35494) NI: Multiple duplicate error diagnostics (in IDE popup) with NULL_FOR_NONNULL_TYPE
- [`KT-35681`](https://youtrack.jetbrains.com/issue/KT-35681) Wrong common supertype between raw and integer literal type leads to unsound code
- [`KT-35937`](https://youtrack.jetbrains.com/issue/KT-35937) Error "Declaration has several compatible actuals" on incremental build
- [`KT-36013`](https://youtrack.jetbrains.com/issue/KT-36013) Functional interface conversion not happens on a value of functional type with smart cast to a relevant functional type
- [`KT-36045`](https://youtrack.jetbrains.com/issue/KT-36045) Do not depend on the order of lambda arguments to coerce result to `Unit`
- [`KT-36448`](https://youtrack.jetbrains.com/issue/KT-36448) NI: fix tests after enabling NI in the compiler
- [`KT-36706`](https://youtrack.jetbrains.com/issue/KT-36706) Prohibit functional interface constructor references
- [`KT-36969`](https://youtrack.jetbrains.com/issue/KT-36969) Generate @NotNull on instance parameters of Interface$DefaultImpls methods
- [`KT-37058`](https://youtrack.jetbrains.com/issue/KT-37058) Incorrect overload resolution ambiguity on callable reference in a conditional expression with new inference
- [`KT-37120`](https://youtrack.jetbrains.com/issue/KT-37120) [FIR] False UNRESOLVED_REFERENCE for public and protected member functions and properties which are declared in object inner class
- [`KT-37149`](https://youtrack.jetbrains.com/issue/KT-37149) Conversion when generic specified by type argument of SAM type
- [`KT-37249`](https://youtrack.jetbrains.com/issue/KT-37249) false TYPE_MISMATCH when When-expression branches have try-catch blocks
- [`KT-37341`](https://youtrack.jetbrains.com/issue/KT-37341) NI: Type mismatch with combination of lambda and function reference
- [`KT-37436`](https://youtrack.jetbrains.com/issue/KT-37436) AME: "Receiver class does not define or inherit an implementation of the resolved method" in runtime on usage of non-abstract method of fun interface
- [`KT-37510`](https://youtrack.jetbrains.com/issue/KT-37510) NI infers `java.lang.Void` from the expression in a lazy property delegate and throws ClassCastException at runtime
- [`KT-37541`](https://youtrack.jetbrains.com/issue/KT-37541) SAM conversion with fun interface without a function fails on compiling and IDE analysis in SamAdapterFunctionsScope.getSamConstructor()
- [`KT-37574`](https://youtrack.jetbrains.com/issue/KT-37574) NI: Type mismatch with Kotlin object extending functional type passed as @FunctionalInterface to Java
- [`KT-37630`](https://youtrack.jetbrains.com/issue/KT-37630) NI: ILT suitability in a call is broken if there are CST calculation and calling function's type parameters
- [`KT-37665`](https://youtrack.jetbrains.com/issue/KT-37665) NI: applicability error due to implicitly inferred Nothing for returning T with expected type
- [`KT-37712`](https://youtrack.jetbrains.com/issue/KT-37712) No extension receiver in functional interface created with lambda
- [`KT-37715`](https://youtrack.jetbrains.com/issue/KT-37715) NI: VerifyError: Bad type on operand stack with varargs generic value when type is inferred
- [`KT-37721`](https://youtrack.jetbrains.com/issue/KT-37721) NI: Function reference with vararg parameter treated as array and missing default parameter is rejected
- [`KT-37887`](https://youtrack.jetbrains.com/issue/KT-37887) NI: Smart casting for Map doesn't work if the variable is already "smart casted"
- [`KT-37914`](https://youtrack.jetbrains.com/issue/KT-37914) NI: broken inference for a casting to subtype function within the common constraint system with this subtype
- [`KT-37952`](https://youtrack.jetbrains.com/issue/KT-37952) NI: improve lambdas completion through separation the lambdas analysis into several steps
- [`KT-38069`](https://youtrack.jetbrains.com/issue/KT-38069) Callable reference adaptation should have dependency on API version 1.4
- [`KT-38143`](https://youtrack.jetbrains.com/issue/KT-38143) New type inference fails when calling extension function defined on generic type with type arguments nested too deep
- [`KT-38156`](https://youtrack.jetbrains.com/issue/KT-38156) FIR Metadata generation
- [`KT-38197`](https://youtrack.jetbrains.com/issue/KT-38197) java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
- [`KT-38259`](https://youtrack.jetbrains.com/issue/KT-38259) NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER for provideDelegate
- [`KT-38337`](https://youtrack.jetbrains.com/issue/KT-38337) Map delegation fails for inline classes
- [`KT-38401`](https://youtrack.jetbrains.com/issue/KT-38401) FIR: protected effective visibility is handled unprecisely
- [`KT-38416`](https://youtrack.jetbrains.com/issue/KT-38416) FIR: infinite loop in BB coroutine test 'overrideDefaultArgument.kt'
- [`KT-38432`](https://youtrack.jetbrains.com/issue/KT-38432) FIR: incorrect effective visibility in anonymous object
- [`KT-38434`](https://youtrack.jetbrains.com/issue/KT-38434) Implement resolution of suspend-conversion on FE only, but give error if suspend conversion is called
- [`KT-38437`](https://youtrack.jetbrains.com/issue/KT-38437) [FIR] String(CharArray) is resolved to java.lang.String constructor instead of kotlin.text.String pseudo-constructor
- [`KT-38439`](https://youtrack.jetbrains.com/issue/KT-38439) NI: anonymous functions without receiver is allowed if there is an expected type with receiver
- [`KT-38473`](https://youtrack.jetbrains.com/issue/KT-38473) FIR: ConeIntegerLiteralType in signature
- [`KT-38537`](https://youtrack.jetbrains.com/issue/KT-38537) IllegalArgumentException: "marginPrefix must be non-blank string" with raw strings and space as margin prefix in trimMargin() call
- [`KT-38604`](https://youtrack.jetbrains.com/issue/KT-38604) Implicit suspend conversion on call arguments doesn't work on vararg elements
- [`KT-38680`](https://youtrack.jetbrains.com/issue/KT-38680) NSME when calling generic interface method with default parameters overriden with inline class type argument
- [`KT-38681`](https://youtrack.jetbrains.com/issue/KT-38681) Wrong bytecode generated when calling generic interface method with default parameters overriden with primitive type argument
- [`KT-38691`](https://youtrack.jetbrains.com/issue/KT-38691) NI: overload resolution ambiguity if take `R` and `() -> R`, and pass literal lambda, which returns `R`
- [`KT-38799`](https://youtrack.jetbrains.com/issue/KT-38799) False positive USELESS_CAST for lambda parameter
- [`KT-38802`](https://youtrack.jetbrains.com/issue/KT-38802) Generated code crashes by ClassCastException when delegating with inline class
- [`KT-38853`](https://youtrack.jetbrains.com/issue/KT-38853) Backend Internal error: Error type encountered: Unresolved type for nested class used in an annotation argument on an interface method
- [`KT-38890`](https://youtrack.jetbrains.com/issue/KT-38890) NI: false negative Type mismatch for values with fun keyword
- [`KT-39010`](https://youtrack.jetbrains.com/issue/KT-39010) NI: Regression with false-positive smartcast on var of generic type
- [`KT-39013`](https://youtrack.jetbrains.com/issue/KT-39013) 202, ASM 8: "AnalyzerException: Execution can fall off the end of the code"
- [`KT-39260`](https://youtrack.jetbrains.com/issue/KT-39260) "AssertionError: Unsigned type expected: Int" in range
- [`KT-39305`](https://youtrack.jetbrains.com/issue/KT-39305) NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER: unable to infer deeply nested type bound when class implements generic interface
- [`KT-39408`](https://youtrack.jetbrains.com/issue/KT-39408) Using unsigned arrays as generics fails in 1.4-M2 with class cast exception
- [`KT-39533`](https://youtrack.jetbrains.com/issue/KT-39533) NI: Wrong overload resolution for methods with SAM converted function reference arguments
- [`KT-39535`](https://youtrack.jetbrains.com/issue/KT-39535) NI: Inference fails for the parameters of SAM converted lambdas with type parameters
- [`KT-39603`](https://youtrack.jetbrains.com/issue/KT-39603) Require explicit override in JVM default compatibility mode on implicit generic specialization of inherited methods in classes
- [`KT-39671`](https://youtrack.jetbrains.com/issue/KT-39671) Couldn't inline method call 'expectBody'
- [`KT-39816`](https://youtrack.jetbrains.com/issue/KT-39816) NI:ClassCastException and no IDE error with provideDelegate when DELEGATE_SPECIAL_FUNCTION_MISSING in OI
- [`KT-32779`](https://youtrack.jetbrains.com/issue/KT-32779) `Rewrite at slice` in array access resolution in coroutine inference
- [`KT-39387`](https://youtrack.jetbrains.com/issue/KT-39387) Can't build Kotlin project due to overload resolution ambiguity on flatMap calls
- [`KT-39229`](https://youtrack.jetbrains.com/issue/KT-39229) NI: resolution to wrong candidate (SAM-type against similar functional type)
### Docs & Examples
- [`KT-36245`](https://youtrack.jetbrains.com/issue/KT-36245) Document that @kotlin.native.ThreadLocal annotation doesn't work anywhere except in Kotlin/Native
- [`KT-37943`](https://youtrack.jetbrains.com/issue/KT-37943) Conflicting overloads in the factory functions sample code in Coding Conventions Page
### IDE
#### New Features
- [`KT-10974`](https://youtrack.jetbrains.com/issue/KT-10974) Add Code Style: Import Layout Configuration Table
- [`KT-39065`](https://youtrack.jetbrains.com/issue/KT-39065) "Join lines" should remove trailing comma on call site
#### Fixes
- [`KT-9065`](https://youtrack.jetbrains.com/issue/KT-9065) Wrong result when move statement through if block with call with lambda
- [`KT-14757`](https://youtrack.jetbrains.com/issue/KT-14757) Move statement up breaks code in function parameter list
- [`KT-14946`](https://youtrack.jetbrains.com/issue/KT-14946) Move statement up/down (with Ctrl+Shift+Up/Down) messes with empty lines
- [`KT-15143`](https://youtrack.jetbrains.com/issue/KT-15143) Kotlin: Colors&Fonts -> "Enum entry" should use Language Default -> Classes - Static field
- [`KT-17887`](https://youtrack.jetbrains.com/issue/KT-17887) Moving statement (Ctrl/Cmd+Shift+Down) messes with use block
- [`KT-34187`](https://youtrack.jetbrains.com/issue/KT-34187) UAST cannot get type of array access
- [`KT-34524`](https://youtrack.jetbrains.com/issue/KT-34524) "PSI and index do not match" and IDE freeze with library import from `square/workflow`
- [`KT-35574`](https://youtrack.jetbrains.com/issue/KT-35574) UAST: UBreakExpression in when expression should be UYieldExpression
- [`KT-36801`](https://youtrack.jetbrains.com/issue/KT-36801) IDE: Unsupported language version value is represented with "latest stable" in GUI
- [`KT-37378`](https://youtrack.jetbrains.com/issue/KT-37378) Remove IDE option "Enable new type inference algorithm..." in 1.4
- [`KT-38003`](https://youtrack.jetbrains.com/issue/KT-38003) "Analyze Data Flow from Here" should work on parameter of abstract method
- [`KT-38173`](https://youtrack.jetbrains.com/issue/KT-38173) Reified types do no have extends information
- [`KT-38217`](https://youtrack.jetbrains.com/issue/KT-38217) Make Kotlin plugin settings searchable
- [`KT-38247`](https://youtrack.jetbrains.com/issue/KT-38247) "IncorrectOperationException: Incorrect expression" through UltraLightUtils.kt: inlined string is not escaped before parsing
- [`KT-38293`](https://youtrack.jetbrains.com/issue/KT-38293) Throwable: "'codestyle.name.kotlin' is not found in java.util.PropertyResourceBundle" at KotlinLanguageCodeStyleSettingsProvider.getConfigurableDisplayName()
- [`KT-38407`](https://youtrack.jetbrains.com/issue/KT-38407) Drop components from plugin.xml
- [`KT-38443`](https://youtrack.jetbrains.com/issue/KT-38443) No error on change in property initializer
- [`KT-38521`](https://youtrack.jetbrains.com/issue/KT-38521) ISE: Loop in parent structure when converting a DOT_QUALIFIED_EXPRESSION with parent ANNOTATED_EXPRESSION
- [`KT-38571`](https://youtrack.jetbrains.com/issue/KT-38571) Rework deprecated EPs
- [`KT-38632`](https://youtrack.jetbrains.com/issue/KT-38632) Change the code style to official in tests
### IDE. Code Style, Formatting
#### Fixes
- [`KT-24750`](https://youtrack.jetbrains.com/issue/KT-24750) Formatter: Minimum blank lines after class header does nothing
- [`KT-31169`](https://youtrack.jetbrains.com/issue/KT-31169) IDEA settings search fails to find "Tabs and Indents" tab in Kotlin code style settings
- [`KT-35359`](https://youtrack.jetbrains.com/issue/KT-35359) Incorrect indent for multiline expression in string template
- [`KT-37420`](https://youtrack.jetbrains.com/issue/KT-37420) Add setting to disable inserting empty line between declaration and declaration with comment
- [`KT-37891`](https://youtrack.jetbrains.com/issue/KT-37891) Formatter inserts empty lines between annotated properties
- [`KT-38036`](https://youtrack.jetbrains.com/issue/KT-38036) Use trailing comma setting does not apply to code example in Settings dialog
- [`KT-38568`](https://youtrack.jetbrains.com/issue/KT-38568) False positive: weak warning "Missing line break" on -> in when expression
- [`KT-39024`](https://youtrack.jetbrains.com/issue/KT-39024) Add option for blank lines before declaration with comment or annotation on separate line
- [`KT-39079`](https://youtrack.jetbrains.com/issue/KT-39079) Trailing comma: add base support for call site
- [`KT-39123`](https://youtrack.jetbrains.com/issue/KT-39123) Option `Align 'when' branches in columns` does nothing
- [`KT-39180`](https://youtrack.jetbrains.com/issue/KT-39180) Move trailing comma settings in Other tab
### IDE. Completion
- [`KT-18538`](https://youtrack.jetbrains.com/issue/KT-18538) Completion of static members of grand-super java class inserts unnecessary qualifier
- [`KT-38445`](https://youtrack.jetbrains.com/issue/KT-38445) Fully qualified class name is used instead after insertion of `delay` method
### IDE. Debugger
#### Fixes
- [`KT-14057`](https://youtrack.jetbrains.com/issue/KT-14057) Debugger couldn't step into Reader.read
- [`KT-14828`](https://youtrack.jetbrains.com/issue/KT-14828) Bad step into/over behavior for functions with default parameters
- [`KT-36403`](https://youtrack.jetbrains.com/issue/KT-36403) Method breakpoints don't work for libraries
- [`KT-36404`](https://youtrack.jetbrains.com/issue/KT-36404) Evaluate: "AssertionError: Argument expression is not saved for a SAM constructor"
- [`KT-37486`](https://youtrack.jetbrains.com/issue/KT-37486) Kotlin plugin keeps reference to stream debugger support classes after stream debugger plugin is disabled
- [`KT-38484`](https://youtrack.jetbrains.com/issue/KT-38484) Coroutines Debugger: IAE “Requested element count -1 is less than zero.” is thrown by calling dumpCoroutines
- [`KT-38606`](https://youtrack.jetbrains.com/issue/KT-38606) Coroutine Debugger: OCE from org.jetbrains.kotlin.idea.debugger.coroutine.proxy.mirror.BaseMirror.isCompatible
- [`KT-39143`](https://youtrack.jetbrains.com/issue/KT-39143) NPE on setCurrentStackFrame to Kotlin inner compiled class content
- [`KT-39412`](https://youtrack.jetbrains.com/issue/KT-39412) Failed to find Premain-Class manifest attribute when debugging main method with ktor
- [`KT-39634`](https://youtrack.jetbrains.com/issue/KT-39634) (CoroutineDebugger) Agent doesn't start if using kotlinx-coroutines-core only dependency
- [`KT-39648`](https://youtrack.jetbrains.com/issue/KT-39648) Coroutines debugger doesn't see stacktraces in case of the project has kotlinx-coroutines-debug dependency
### IDE. Gradle Integration
#### Performance Improvements
- [`KT-39059`](https://youtrack.jetbrains.com/issue/KT-39059) Poor performance of `modifyDependenciesOnMppModules`
#### Fixes
- [`KT-35921`](https://youtrack.jetbrains.com/issue/KT-35921) Gradle Import fails with "Unsupported major.minor version 52.0" on pure Java project in case "Gradle JDK" is lower 1.8 and Kotlin plugin is enabled
- [`KT-36673`](https://youtrack.jetbrains.com/issue/KT-36673) Gradle Project importing: move ModelBuilders and ModelProviders to kotlin-gradle-tooling jar
- [`KT-36792`](https://youtrack.jetbrains.com/issue/KT-36792) IDEA 2020.1: Some module->module dependencies in HMPP project are missed after import from Gradle
- [`KT-37125`](https://youtrack.jetbrains.com/issue/KT-37125) Imported modules structure for MPP project is displayed messy in UI in IDEA 2020.1
- [`KT-37428`](https://youtrack.jetbrains.com/issue/KT-37428) NPE at KotlinFacetSettings.setLanguageLevel() on the first project import
- [`KT-38706`](https://youtrack.jetbrains.com/issue/KT-38706) IDE Gradle import creates 4 JavaScript modules for MPP source sets with BOTH compiler type
- [`KT-38767`](https://youtrack.jetbrains.com/issue/KT-38767) Published hierarchical multiplatform library symbols are unresolved in IDE (master)
- [`KT-38842`](https://youtrack.jetbrains.com/issue/KT-38842) False positive [INVISIBLE_MEMBER] for `internal` declaration of commonMain called from commonTest
- [`KT-39213`](https://youtrack.jetbrains.com/issue/KT-39213) IDE: references from MPP project to JavaScript library are unresolved, when project and library are compiled with "both" mode
- [`KT-39657`](https://youtrack.jetbrains.com/issue/KT-39657) Language settings for intermediate source-sets are lost during import
### IDE. Gradle. Script
#### New Features
- [`KT-34481`](https://youtrack.jetbrains.com/issue/KT-34481) `*.gradle.kts`: use Intellij IDEA Gradle project sync mechanics for updating script configuration
#### Performance Improvements
- [`KT-34138`](https://youtrack.jetbrains.com/issue/KT-34138) Deadlock in `ScriptTemplatesFromDependenciesProvider`
- [`KT-38875`](https://youtrack.jetbrains.com/issue/KT-38875) Deadlock in ScriptClassRootsUpdater.checkInvalidSdks
#### Fixes
- [`KT-34265`](https://youtrack.jetbrains.com/issue/KT-34265) Bogus "build configuration failed, run 'gradle tasks' for more information" message and other issues related to "script dependencies"
- [`KT-34444`](https://youtrack.jetbrains.com/issue/KT-34444) *.gradle.kts: special storage of all scripts configuration on one file
- [`KT-35153`](https://youtrack.jetbrains.com/issue/KT-35153) build.gradle.kts: scripts in removed subproject remain imported, but shouldn't
- [`KT-35573`](https://youtrack.jetbrains.com/issue/KT-35573) Request for gradle build script configuration only after explicit click on notification
- [`KT-36675`](https://youtrack.jetbrains.com/issue/KT-36675) move .gradle.kts ModelBuilders and ModelProviders to kotlin-gradle-tooling jar
- [`KT-37178`](https://youtrack.jetbrains.com/issue/KT-37178) build.gradle.kts: Rework the notification for scripts out of project
- [`KT-37631`](https://youtrack.jetbrains.com/issue/KT-37631) Unnecessary loading dependencies after opening build.gradle.kts after project import with Gradle 6
- [`KT-37863`](https://youtrack.jetbrains.com/issue/KT-37863) Scanning dependencies for script definitions takes too long or indefinitely during Gradle import
- [`KT-38296`](https://youtrack.jetbrains.com/issue/KT-38296) MISSING_DEPENDENCY_SUPERCLASS in the build.gradle.kts editor while Gradle runs Ok
- [`KT-38541`](https://youtrack.jetbrains.com/issue/KT-38541) "Invalid file" exception in ScriptChangeListener.getAnalyzableKtFileForScript()
- [`KT-39104`](https://youtrack.jetbrains.com/issue/KT-39104) “Gradle Kotlin DSL script configuration is missing” after importing project in IJ201, Gradle 6.3
- [`KT-39469`](https://youtrack.jetbrains.com/issue/KT-39469) Gradle version is not updated in script dependencies if the version of gradle was changed in gradle-wrapper.properties
- [`KT-39771`](https://youtrack.jetbrains.com/issue/KT-39771) Freeze 30s from org.jetbrains.kotlin.scripting.resolve.ApiChangeDependencyResolverWrapper.resolve on loading script configuration with Gradle 5.6.4
### IDE. Inspections and Intentions
#### New Features
- [`KT-14884`](https://youtrack.jetbrains.com/issue/KT-14884) Intention to add missing "class" keyword for enum and annotation top-level declarations
- [`KT-17209`](https://youtrack.jetbrains.com/issue/KT-17209) Provide intention to fix platform declaration clash (CONFLICTING_JVM_DECLARATIONS)
- [`KT-24522`](https://youtrack.jetbrains.com/issue/KT-24522) Suggest to move typealias outside the class
- [`KT-30263`](https://youtrack.jetbrains.com/issue/KT-30263) Detect redundant conversions of unsigned types
- [`KT-35893`](https://youtrack.jetbrains.com/issue/KT-35893) Support Inspection for unnecessary asSequence() call
- [`KT-38559`](https://youtrack.jetbrains.com/issue/KT-38559) "Change JVM name" (@JvmName) quickfix: improve name suggester for generic functions
- [`KT-38597`](https://youtrack.jetbrains.com/issue/KT-38597) Expand Boolean intention
- [`KT-38982`](https://youtrack.jetbrains.com/issue/KT-38982) Add "Logger initialized with foreign class" inspection
- [`KT-39131`](https://youtrack.jetbrains.com/issue/KT-39131) TrailingCommaInspection: should suggest fixes for call-site without warnings
#### Fixes
- [`KT-5271`](https://youtrack.jetbrains.com/issue/KT-5271) Missing QuickFix for Multiple supertypes available
- [`KT-11865`](https://youtrack.jetbrains.com/issue/KT-11865) "Create secondary constructor" quick fix always inserts parameter-less call to `this()`
- [`KT-14021`](https://youtrack.jetbrains.com/issue/KT-14021) Quickfix to add parameter to function gives strange name to parameter
- [`KT-17121`](https://youtrack.jetbrains.com/issue/KT-17121) "Implement members" quick fix is not suggested
- [`KT-17368`](https://youtrack.jetbrains.com/issue/KT-17368) Don't highlight members annotated with @JsName as unused
- [`KT-20795`](https://youtrack.jetbrains.com/issue/KT-20795) "replace explicit parameter with it" creates invalid code in case of overload ambiguities
- [`KT-22014`](https://youtrack.jetbrains.com/issue/KT-22014) Intention "convert lambda to reference" should be available for implicit 'this'
- [`KT-22015`](https://youtrack.jetbrains.com/issue/KT-22015) Intention "Convert lambda to reference" should be available in spite of the lambda in or out of parentheses
- [`KT-22142`](https://youtrack.jetbrains.com/issue/KT-22142) Intentions: "Convert to primary constructor" changes semantics for property with custom setter
- [`KT-22878`](https://youtrack.jetbrains.com/issue/KT-22878) Empty argument list at the call site of custom function named "suspend" shouldn't be reported as unnecessary
- [`KT-24281`](https://youtrack.jetbrains.com/issue/KT-24281) Importing of invoke() from the same file is reported as unused even if it isn't
- [`KT-25050`](https://youtrack.jetbrains.com/issue/KT-25050) False-positive inspection "Call replaceable with binary operator" for 'equals'
- [`KT-26361`](https://youtrack.jetbrains.com/issue/KT-26361) @Deprecated "ReplaceWith" quickfix inserts 'this' incorrectly when using function imports
- [`KT-27651`](https://youtrack.jetbrains.com/issue/KT-27651) 'Condition is always true' inspection should not be triggered when the condition has references to a named constant
- [`KT-29934`](https://youtrack.jetbrains.com/issue/KT-29934) False negative `Change type` quickfix on primary constructor override val parameter when it has wrong type
- [`KT-31682`](https://youtrack.jetbrains.com/issue/KT-31682) 'Convert lambda to reference' intention inside class with function which return object produces uncompilable code
- [`KT-31760`](https://youtrack.jetbrains.com/issue/KT-31760) Implement Abstract Function/Property intentions position generated member improperly
- [`KT-32511`](https://youtrack.jetbrains.com/issue/KT-32511) Create class quick fix is not suggested in super type list in case of missing primary constructor
- [`KT-32565`](https://youtrack.jetbrains.com/issue/KT-32565) False positive "Variable is the same as 'credentials' and should be inlined" with object declared and returned from lambda
- [`KT-32801`](https://youtrack.jetbrains.com/issue/KT-32801) False positive "Call on collection type may be reduced" with mapNotNull, generic lambda block and new inference
- [`KT-33951`](https://youtrack.jetbrains.com/issue/KT-33951) ReplaceWith quickfix with unqualified object member call doesn't substitute argument for parameter
- [`KT-34378`](https://youtrack.jetbrains.com/issue/KT-34378) "Convert lambda to reference" refactoring does not work for suspend functions
- [`KT-34677`](https://youtrack.jetbrains.com/issue/KT-34677) False positive "Collection count can be converted to size" with `Iterable`
- [`KT-34696`](https://youtrack.jetbrains.com/issue/KT-34696) Wrong 'Redundant qualifier name' for 'MyEnum.values' usage
- [`KT-34713`](https://youtrack.jetbrains.com/issue/KT-34713) "Condition is always 'false'": quickfix "Delete expression" doesn't remove `else` keyword (may break control flow)
- [`KT-35015`](https://youtrack.jetbrains.com/issue/KT-35015) ReplaceWith doesn't substitute parameters with argument expressions
- [`KT-35329`](https://youtrack.jetbrains.com/issue/KT-35329) Replace 'when' with 'if' intention: do not suggest if 'when' is used as expression and it has no 'else' branch
- [`KT-36194`](https://youtrack.jetbrains.com/issue/KT-36194) "Add braces to 'for' statement" inserts extra line break and moves the following single-line comment
- [`KT-36406`](https://youtrack.jetbrains.com/issue/KT-36406) "To ordinary string literal" intention adds unnecessary escapes to characters in template expression
- [`KT-36461`](https://youtrack.jetbrains.com/issue/KT-36461) "Create enum constant" quick fix adds after semicolon, if the last entry has a comma
- [`KT-36462`](https://youtrack.jetbrains.com/issue/KT-36462) "Create enum constant" quick fix doesn't add trailing comma
- [`KT-36508`](https://youtrack.jetbrains.com/issue/KT-36508) False positive "Replace 'to' with infix form" when 'to' lambda generic type argument is specified explicitly
- [`KT-36930`](https://youtrack.jetbrains.com/issue/KT-36930) Intention "Specify type explicitly" adds NotNull annotation when calling java method with the annotation
- [`KT-37148`](https://youtrack.jetbrains.com/issue/KT-37148) "Remove redundant `.let` call doesn't remove extra calls
- [`KT-37156`](https://youtrack.jetbrains.com/issue/KT-37156) "Unused unary operator" inspection highlighting is hard to see
- [`KT-37173`](https://youtrack.jetbrains.com/issue/KT-37173) "Replace with string templates" intention for String.format produces uncompilable string template
- [`KT-37181`](https://youtrack.jetbrains.com/issue/KT-37181) Don't show "Remove redundant qualifier name" inspection on qualified Companion imported with star import
- [`KT-37214`](https://youtrack.jetbrains.com/issue/KT-37214) "Convert lambda to reference" with a labeled "this" receiver fails
- [`KT-37256`](https://youtrack.jetbrains.com/issue/KT-37256) False positive `PlatformExtensionReceiverOfInline` inspection if a platform type value is passed to a nullable receiver
- [`KT-37744`](https://youtrack.jetbrains.com/issue/KT-37744) "Convert lambda to reference" inspection quick fix create incompilable code when type is inferred from lambda parameter
- [`KT-37746`](https://youtrack.jetbrains.com/issue/KT-37746) "Redundant suspend modifier" should not be reported for functions with actual keyword
- [`KT-37842`](https://youtrack.jetbrains.com/issue/KT-37842) "Convert to anonymous function" creates broken code with suspend functions
- [`KT-37908`](https://youtrack.jetbrains.com/issue/KT-37908) "Convert to anonymous object" quickfix: false negative when interface has concrete functions
- [`KT-37967`](https://youtrack.jetbrains.com/issue/KT-37967) Replace 'invoke' with direct call intention adds unnecessary parenthesis
- [`KT-37977`](https://youtrack.jetbrains.com/issue/KT-37977) "Replace 'invoke' with direct call" intention: false positive when function is not operator
- [`KT-38062`](https://youtrack.jetbrains.com/issue/KT-38062) Reactor Quickfix throws `NotImplementedError` for Kotlin
- [`KT-38240`](https://youtrack.jetbrains.com/issue/KT-38240) False positive redundant semicolon with `as` cast and `not` unary operator on next line
- [`KT-38261`](https://youtrack.jetbrains.com/issue/KT-38261) Redundant 'let' call removal leaves ?. operator and makes code uncompilable
- [`KT-38310`](https://youtrack.jetbrains.com/issue/KT-38310) Remove explicit type annotation intention drops 'suspend'
- [`KT-38492`](https://youtrack.jetbrains.com/issue/KT-38492) False positive "Add import" intention for already imported class
- [`KT-38520`](https://youtrack.jetbrains.com/issue/KT-38520) SetterBackingFieldAssignmentInspection throws exception
- [`KT-38649`](https://youtrack.jetbrains.com/issue/KT-38649) False positive quickfix "Assignment should be lifted out of when" in presence of smartcasts
- [`KT-38677`](https://youtrack.jetbrains.com/issue/KT-38677) Invalid psi tree after `Lift assigment out of...`
- [`KT-38790`](https://youtrack.jetbrains.com/issue/KT-38790) "Convert sealed subclass to object" for data classes doesn't remove 'data' keyword
- [`KT-38829`](https://youtrack.jetbrains.com/issue/KT-38829) 'Remove redundant backticks' can be broken with @ in name
- [`KT-38831`](https://youtrack.jetbrains.com/issue/KT-38831) 'Replace with assignment' can be broken with fast code change
- [`KT-38832`](https://youtrack.jetbrains.com/issue/KT-38832) "Remove curly braces" intention may produce CCE
- [`KT-38948`](https://youtrack.jetbrains.com/issue/KT-38948) False positive quickfix "Make containing function suspend" for anonymous function
- [`KT-38961`](https://youtrack.jetbrains.com/issue/KT-38961) "Useless call on collection type" for filterNotNull on non-null array where list return type is expected
- [`KT-39069`](https://youtrack.jetbrains.com/issue/KT-39069) Improve TrailingCommaInspection
- [`KT-39151`](https://youtrack.jetbrains.com/issue/KT-39151) False positive inspection to replace Java forEach with Kotlin forEach when using ConcurrentHashMap
### IDE. JS
- [`KT-39275`](https://youtrack.jetbrains.com/issue/KT-39275) Kotlin JS Browser template for kotlin dsl doesn't include index.html
### IDE. KDoc
- [`KT-32163`](https://youtrack.jetbrains.com/issue/KT-32163) Open Quick Documentation when cursor inside function / constructor brackets
### IDE. Navigation
- [`KT-32245`](https://youtrack.jetbrains.com/issue/KT-32245) Method in Kotlin class is not listed among implementing methods
- [`KT-33510`](https://youtrack.jetbrains.com/issue/KT-33510) There is no gutter icon to navigate from `actual` to `expect` if `expect` and the corresponding `actual` declarations are in the same file
- [`KT-38260`](https://youtrack.jetbrains.com/issue/KT-38260) Navigation bar doesn't show directories of files with a single top level Kotlin class
- [`KT-38466`](https://youtrack.jetbrains.com/issue/KT-38466) Top level functions/properties aren't shown in navigation panel
### IDE. Project View
- [`KT-36444`](https://youtrack.jetbrains.com/issue/KT-36444) Structure view: add ability to sort by visibility
- [`KT-38276`](https://youtrack.jetbrains.com/issue/KT-38276) Structure view: support visibility filter for class properties
### IDE. REPL
- [`KT-38454`](https://youtrack.jetbrains.com/issue/KT-38454) Kotlin REPL in IntelliJ doesn't take module's JVM target setting into account
### IDE. Refactorings
- [`KT-12878`](https://youtrack.jetbrains.com/issue/KT-12878) "Change signature" forces line breaks after every parameter declaration
- [`KT-30128`](https://youtrack.jetbrains.com/issue/KT-30128) Change Signature should move lambda outside of parentheses if the arguments are reordered so that the lambda goes last
- [`KT-35338`](https://youtrack.jetbrains.com/issue/KT-35338) Move/rename refactorings mess up code formatting by wrapping lines
- [`KT-38449`](https://youtrack.jetbrains.com/issue/KT-38449) Extract variable refactoring is broken by NPE
- [`KT-38543`](https://youtrack.jetbrains.com/issue/KT-38543) Copy can't work to package with escaped package
- [`KT-38627`](https://youtrack.jetbrains.com/issue/KT-38627) Rename package refactorings mess up code formatting by wrapping lines
### IDE. Run Configurations
- [`KT-34516`](https://youtrack.jetbrains.com/issue/KT-34516) Don't suggest incompatible targets in a drop-down list for run test gutter icon in multiplatform projects
- [`KT-38102`](https://youtrack.jetbrains.com/issue/KT-38102) DeprecatedMethodException ConfigurationFactory.getId
### IDE. Scratch
- [`KT-38455`](https://youtrack.jetbrains.com/issue/KT-38455) Kotlin scratch files don't take module's JVM target setting into account
### IDE. Script
- [`KT-39791`](https://youtrack.jetbrains.com/issue/KT-39791) Kotlin plugin loads VFS in the output directories
### IDE. Structural Search
- [`KT-39721`](https://youtrack.jetbrains.com/issue/KT-39721) Optimize Kotlin SSR by using the index
- [`KT-39733`](https://youtrack.jetbrains.com/issue/KT-39733) Augmented assignment matching
- [`KT-39769`](https://youtrack.jetbrains.com/issue/KT-39769) "When expressions" predefined template doesn't match all when expressions
### IDE. Wizards
- [`KT-38673`](https://youtrack.jetbrains.com/issue/KT-38673) New Project Wizard: multiplatform templates are generated having unsupported Gradle version in a wrapper
- [`KT-38810`](https://youtrack.jetbrains.com/issue/KT-38810) Incorrect order of build phases in Xcode project from new wizard
- [`KT-38952`](https://youtrack.jetbrains.com/issue/KT-38952) Remove old new_project_wizards
- [`KT-39503`](https://youtrack.jetbrains.com/issue/KT-39503) New Project wizard 1.4+: release kotlinx.html version is added to dependencies with milestone IDE plugin
- [`KT-39700`](https://youtrack.jetbrains.com/issue/KT-39700) Wizard: group project templates on the first step by the project type
- [`KT-39770`](https://youtrack.jetbrains.com/issue/KT-39770) CSS Support in Kotlin wizards
- [`KT-39826`](https://youtrack.jetbrains.com/issue/KT-39826) Fix Android app in New Template Wizard
- [`KT-39843`](https://youtrack.jetbrains.com/issue/KT-39843) Change imports in JS/browser wizard
### JS. Tools
- [`KT-32273`](https://youtrack.jetbrains.com/issue/KT-32273) Kotlin/JS console error on hot reload
- [`KT-39498`](https://youtrack.jetbrains.com/issue/KT-39498) Update dukat version in toolchain near to release of 1.4-M3
### JavaScript
- [`KT-29916`](https://youtrack.jetbrains.com/issue/KT-29916) Implement `typeOf` on JS
- [`KT-35857`](https://youtrack.jetbrains.com/issue/KT-35857) Kotlin/JS CLI bundled to IDEA plugin can't compile using IR back-end out of the box
- [`KT-36798`](https://youtrack.jetbrains.com/issue/KT-36798) KJS: prohibit using @JsExport on a non-top-level declaration
- [`KT-37771`](https://youtrack.jetbrains.com/issue/KT-37771) KJS: Generated TypeScript does not recursively export base classes (can fail with generics)
- [`KT-38113`](https://youtrack.jetbrains.com/issue/KT-38113) Review public API of JS stdlib for IR BE
- [`KT-38765`](https://youtrack.jetbrains.com/issue/KT-38765) [JS / IR] AssertionError: class EventEmitter: Super class should be any: with nested class extending parent class
- [`KT-38768`](https://youtrack.jetbrains.com/issue/KT-38768) KJS IR: generate ES2015 (aka ES6) classes
### Libraries
#### New Features
- [`KT-11253`](https://youtrack.jetbrains.com/issue/KT-11253) Function to sum long or other numeric property of items in a collection
- [`KT-28933`](https://youtrack.jetbrains.com/issue/KT-28933) capitalize() with Locale argument in the JDK stdlib
- [`KT-34142`](https://youtrack.jetbrains.com/issue/KT-34142) Create SortedMap with Comparator and items
- [`KT-34506`](https://youtrack.jetbrains.com/issue/KT-34506) Add Sequence.flatMap overload that works on Iterable
- [`KT-36894`](https://youtrack.jetbrains.com/issue/KT-36894) Support flatMapIndexed in the Collections API
- [`KT-38480`](https://youtrack.jetbrains.com/issue/KT-38480) Introduce experimental annotation for enabling overload resolution by lambda result
- [`KT-38708`](https://youtrack.jetbrains.com/issue/KT-38708) minOf/maxOf functions to return min/max value provided by selector
- [`KT-39707`](https://youtrack.jetbrains.com/issue/KT-39707) Make some interfaces in stdlib functional
#### Performance Improvements
- [`KT-23142`](https://youtrack.jetbrains.com/issue/KT-23142) toHashSet is suboptimal for inputs with a lot of duplicates
#### Fixes
- [`KT-21266`](https://youtrack.jetbrains.com/issue/KT-21266) Add module-info for standard library artifacts
- [`KT-23322`](https://youtrack.jetbrains.com/issue/KT-23322) Document 'reduce' operation behavior on empty collections
- [`KT-28753`](https://youtrack.jetbrains.com/issue/KT-28753) Comparing floating point values in array/list operations 'contains', 'indexOf', 'lastIndexOf': IEEE 754 or total order
- [`KT-30083`](https://youtrack.jetbrains.com/issue/KT-30083) Annotate KTypeProjection.STAR with JvmField in a compatible way
- [`KT-30084`](https://youtrack.jetbrains.com/issue/KT-30084) Annotate functions in KTypeProjection.Companion with JvmStatic
- [`KT-31343`](https://youtrack.jetbrains.com/issue/KT-31343) Deprecate old String <-> CharArray, ByteArray conversion api
- [`KT-34596`](https://youtrack.jetbrains.com/issue/KT-34596) Add some validation to KTypeProjection constructor
- [`KT-35978`](https://youtrack.jetbrains.com/issue/KT-35978) Review and remove experimental stdlib API status for 1.4
- [`KT-38388`](https://youtrack.jetbrains.com/issue/KT-38388) Document `fromIndex` and `toIndex` parameters
- [`KT-38854`](https://youtrack.jetbrains.com/issue/KT-38854) Gradually change the return type of collection min/max functions to non-nullable
- [`KT-39023`](https://youtrack.jetbrains.com/issue/KT-39023) Document split(Pattern) extension differences from Pattern.split
- [`KT-39064`](https://youtrack.jetbrains.com/issue/KT-39064) Introduce minOrNull and maxOrNull extension functions on collections
- [`KT-39235`](https://youtrack.jetbrains.com/issue/KT-39235) Lift experimental annotation from bit operations
- [`KT-39237`](https://youtrack.jetbrains.com/issue/KT-39237) Lift experimental annotation from common StringBuilder
- [`KT-39238`](https://youtrack.jetbrains.com/issue/KT-39238) Appendable.appendRange - remove nullability
- [`KT-39239`](https://youtrack.jetbrains.com/issue/KT-39239) Lift experimental annotation from String <-> utf8 conversion api
- [`KT-39244`](https://youtrack.jetbrains.com/issue/KT-39244) KJS: update polyfills, all or most of them must not be enumerable
- [`KT-39330`](https://youtrack.jetbrains.com/issue/KT-39330) Migrate declarations from kotlin.dom and kotlin.browser packages to kotlinx.*
### Middle-end. IR
- [`KT-31088`](https://youtrack.jetbrains.com/issue/KT-31088) need a way to compute fake overrides for pure IR
- [`KT-33207`](https://youtrack.jetbrains.com/issue/KT-33207) Kotlin/Native: KNPE during deserialization of an inner class
- [`KT-33267`](https://youtrack.jetbrains.com/issue/KT-33267) Kotlin/Native: Deserialization error for an "inner" extension property imported from a class
- [`KT-37255`](https://youtrack.jetbrains.com/issue/KT-37255) Make psi2ir aware of declarations provided by compiler plugins
### Reflection
- [`KT-22936`](https://youtrack.jetbrains.com/issue/KT-22936) Not all things can be changed to `createType` yet, and now `defaultType` methods are starting to fail
- [`KT-32241`](https://youtrack.jetbrains.com/issue/KT-32241) Move KType.javaType into stdlib from reflect
- [`KT-34344`](https://youtrack.jetbrains.com/issue/KT-34344) KType.javaType implementation throws when invoked with a typeOf<T>()
- [`KT-38491`](https://youtrack.jetbrains.com/issue/KT-38491) IllegalArgumentException when using callBy on function with inline class parameters and default arguments
- [`KT-38881`](https://youtrack.jetbrains.com/issue/KT-38881) Add KClass.isFun modifier of functional interfaces to reflection
### Tools. Android Extensions
- [`KT-25807`](https://youtrack.jetbrains.com/issue/KT-25807) Kotlin extension annotation @Parcelize in AIDL returns Object instead of original T
### Tools. CLI
- [`KT-30211`](https://youtrack.jetbrains.com/issue/KT-30211) Support a way to pass arguments to the underlying JVM in kotlinc batch scripts on Windows
- [`KT-30778`](https://youtrack.jetbrains.com/issue/KT-30778) kotlin-compiler.jar contains shaded but not relocated kotlinx.coroutines
- [`KT-38070`](https://youtrack.jetbrains.com/issue/KT-38070) Compiler option to bypass prerelease metadata incompatibility error
- [`KT-38413`](https://youtrack.jetbrains.com/issue/KT-38413) Add JVM target bytecode version 14
### Tools. Compiler Plugins
- [`KT-39274`](https://youtrack.jetbrains.com/issue/KT-39274) [KJS / IR] Custom serializer for class without zero argument constructor doesn't compile
### Tools. Gradle
- [`KT-25428`](https://youtrack.jetbrains.com/issue/KT-25428) Kotlin Gradle Plugin: Use new Gradle API for Lazy tasks
- [`KT-34487`](https://youtrack.jetbrains.com/issue/KT-34487) Gradle build fails with "Cannot run program "java": error=7, Argument list too long
- [`KT-35957`](https://youtrack.jetbrains.com/issue/KT-35957) MPP IC fails with "X has several compatible actual declarations" error
- [`KT-38250`](https://youtrack.jetbrains.com/issue/KT-38250) Drop support for Gradle versions older than 5.3 in the Kotlin Gradle plugin
### Tools. Gradle. JS
#### New Features
- [`KT-30619`](https://youtrack.jetbrains.com/issue/KT-30619) Support NPM transitive dependencies in multi-platform JS target
- [`KT-38286`](https://youtrack.jetbrains.com/issue/KT-38286) [Gradle, JS] Error handling on Webpack problems
#### Fixes
- [`KT-31669`](https://youtrack.jetbrains.com/issue/KT-31669) Gradle/JS: rise error when plugin loaded more than once
- [`KT-32531`](https://youtrack.jetbrains.com/issue/KT-32531) [Gradle/JS] Add scoped NPM dependencies
- [`KT-34832`](https://youtrack.jetbrains.com/issue/KT-34832) [Kotlin/JS] Failed build after webpack run (Karma not found)
- [`KT-35194`](https://youtrack.jetbrains.com/issue/KT-35194) Kotlin/JS: browserRun fails with "address already in use" when trying to connect to local server
- [`KT-35611`](https://youtrack.jetbrains.com/issue/KT-35611) Kotlin Gradle plugin should report `kotlin2js` plugin ID as deprecated
- [`KT-35641`](https://youtrack.jetbrains.com/issue/KT-35641) Kotlin Gradle plugin should report `kotlin-dce-js` plugin ID as deprecated
- [`KT-36410`](https://youtrack.jetbrains.com/issue/KT-36410) JS: Collect stats about IR backend usage
- [`KT-36451`](https://youtrack.jetbrains.com/issue/KT-36451) KJS Adding npm dependency breaks Webpack devserver reloading
- [`KT-37258`](https://youtrack.jetbrains.com/issue/KT-37258) Kotlin/JS + Gradle: in continuous mode kotlinNpmInstall time to time outputs "ENOENT: no such file or directory" error
- [`KT-38109`](https://youtrack.jetbrains.com/issue/KT-38109) [Gradle, JS] Error handling on Karma launcher problems
- [`KT-38331`](https://youtrack.jetbrains.com/issue/KT-38331) Add an ability to control generating externals for npm deps individually
- [`KT-38485`](https://youtrack.jetbrains.com/issue/KT-38485) [Gradle, JS] Unable to configure JS compiler with string
- [`KT-38683`](https://youtrack.jetbrains.com/issue/KT-38683) Remove possibility to set NPM dependency without version
- [`KT-38990`](https://youtrack.jetbrains.com/issue/KT-38990) Support multiple range versions for NPM dependencies
- [`KT-38994`](https://youtrack.jetbrains.com/issue/KT-38994) Remove possibility to set NPM dependency with npm(org, name, version)
- [`KT-39109`](https://youtrack.jetbrains.com/issue/KT-39109) ArithmeticException: "/ by zero" caused by kotlinNodeJsSetup task with enabled gradle caching on Windows
- [`KT-39210`](https://youtrack.jetbrains.com/issue/KT-39210) Kotlin/JS: with both JS and MPP modules in the same project Gradle configuration fails on `nodejs {}` and `browser {}`
- [`KT-39377`](https://youtrack.jetbrains.com/issue/KT-39377) Use standard source-map-loader instead of custom one
### Tools. Gradle. Multiplatform
- [`KT-39184`](https://youtrack.jetbrains.com/issue/KT-39184) Support publication of Kotlin-distributed libraries with Gradle Metadata
- [`KT-39304`](https://youtrack.jetbrains.com/issue/KT-39304) Gradle import error `java.util.NoSuchElementException: Key source set foo is missing in the map` on unused source set
### Tools. Gradle. Native
- [`KT-37514`](https://youtrack.jetbrains.com/issue/KT-37514) CocoaPods Gradle plugin: Support building from terminal projects for several platforms
- [`KT-38440`](https://youtrack.jetbrains.com/issue/KT-38440) Make error message about missing Podfile path for cocoapods integration actionable for a user
- [`KT-38991`](https://youtrack.jetbrains.com/issue/KT-38991) Gradle MPP plugin: Enable parallel in-process execution for K/N compiler
- [`KT-39935`](https://youtrack.jetbrains.com/issue/KT-39935) Support overriding the `KotlinNativeCompile` task sources
- [`KT-37512`](https://youtrack.jetbrains.com/issue/KT-37512) Cocoapods Gradle plugin: Improve error logging for external tools
### Tools. J2K
- [`KT-35169`](https://youtrack.jetbrains.com/issue/KT-35169) Do not show "Inline local variable" popup during "Cleaning up code" phase of J2K
- [`KT-38004`](https://youtrack.jetbrains.com/issue/KT-38004) J2K breaks java getter call in java code
- [`KT-38450`](https://youtrack.jetbrains.com/issue/KT-38450) J2K should convert Java SAM interfaces to Kotlin fun interfaces
### Tools. JPS
- [`KT-27458`](https://youtrack.jetbrains.com/issue/KT-27458) The Kotlin standard library is not found in the module graph ... in a non-Kotlin project.
- [`KT-29552`](https://youtrack.jetbrains.com/issue/KT-29552) Project is completely rebuilt after each gradle sync.
### Tools. Scripts
- [`KT-37766`](https://youtrack.jetbrains.com/issue/KT-37766) Impossible to apply compiler plugins onto scripts with the new scripting API
### Tools. kapt
- [`KT-29355`](https://youtrack.jetbrains.com/issue/KT-29355) Provide access to default values for primary constructor properties
## 1.4-M2
### Compiler
@@ -1010,6 +1509,33 @@
- [`KT-35414`](https://youtrack.jetbrains.com/issue/KT-35414) Switch for `-Xexpression` to `-expression`/`-e` cli argument syntax for JVM cli compiler in 1.4
## 1.3.72 - IDE plugins update
### Backend. JVM
- [`KT-39013`](https://youtrack.jetbrains.com/issue/KT-39013) 202, ASM 8: "AnalyzerException: Execution can fall off the end of the code"
### IDE. Decompiler, Indexing, Stubs
- [`KT-37896`](https://youtrack.jetbrains.com/issue/KT-37896) IAE: "Argument for @NotNull parameter 'file' of IndexTodoCacheManagerImpl.getTodoCount must not be null" through KotlinTodoSearcher.processQuery()
### IDE. Gradle Integration
- [`KT-38037`](https://youtrack.jetbrains.com/issue/KT-38037) UnsupportedOperationException on sync gradle Kotlin project with at least two multiplatform modules
### IDE. Highlighting
- [`KT-39590`](https://youtrack.jetbrains.com/issue/KT-39590) Turn new inference in IDE for 1.3.70 version off
### IDE. Refactorings
- [`KT-38527`](https://youtrack.jetbrains.com/issue/KT-38527) Move nested class to upper level fails silently: MissingResourceException
### Tools.JPS
- [`KT-27458`](https://youtrack.jetbrains.com/issue/KT-27458) The Kotlin standard library is not found in the module graph ... in a non-Kotlin project.
## 1.3.72
### Compiler

View File

@@ -86,6 +86,8 @@ command line parameters on the first run:
- `compilerTest` - build and run all compiler tests
- `ideaPluginTest` - build and run all IDEA plugin tests
To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run proguard and have jar compression disabled by default.
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.

View File

@@ -40,6 +40,7 @@ repositories {
dependencies {
compile(kotlinStdlib())
compile(project(":compiler:frontend"))
compile(projectTests(":compiler:tests-common"))
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
@@ -73,6 +74,7 @@ benchmark {
param("size", 1000)
include("CommonCallsBenchmark")
include("ControlFlowAnalysisBenchmark")
//include("InferenceBaselineCallsBenchmark")
}
@@ -95,3 +97,52 @@ benchmark {
register("main")
}
}
tasks.named("classes") {
doLast {
tasks.named("mainBenchmarkJar", Zip::class.java) {
isZip64 = true
archiveName = "benchmarks.jar"
}
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
tasks.named(it, JavaExec::class.java) {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}
}
}
tasks.register<JavaExec>("runBenchmark") {
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
val ideaHome = intellijRootDir().canonicalPath
val benchmarkJarPath = "$buildDir/benchmarks/main/jars/benchmarks.jar"
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
main = "-jar"
doLast {
if (project.kotlinBuildProperties.isTeamcityBuild) {
val jsonArray = com.google.gson.JsonParser.parseString(File(resultFilePath).readText()).asJsonArray
jsonArray.forEach {
val benchmark = it.asJsonObject
// remove unnecessary name parts from string like this "org.jetbrains.kotlin.benchmarks.CommonCallsBenchmark.benchmark"
val name = benchmark["benchmark"].asString.removeSuffix(".benchmark").let {
val indexOfLastDot = it.indexOfLast { it == '.' }
it.removeRange(0..indexOfLastDot)
}
val params = benchmark["params"].asJsonObject
val isIR = if (params.has("isIR")) params["isIR"].asString else "false"
val useNI = if (params.has("useNI")) params["useNI"].asString else "false"
val size = params["size"].asString
val score = "%.3f".format(benchmark["primaryMetric"].asJsonObject["score"].asString.toFloat())
val irPostfix = if (isIR.toBoolean()) " isIR=true" else ""
val niPostfix = if (useNI.toBoolean() && !isIR.toBoolean()) " isNI=true" else ""
println("""##teamcity[buildStatisticValue key='$name size=$size${irPostfix}$niPostfix' value='$score']""")
}
}
}
}

View File

@@ -13,7 +13,6 @@ import com.intellij.psi.PsiFileFactory
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.testFramework.LightVirtualFile
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
@@ -26,21 +25,15 @@ import org.jetbrains.kotlin.context.withModule
import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession
import org.jetbrains.kotlin.fir.java.FirLibrarySession
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.storage.ExceptionTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.storage.StorageManager
@@ -170,43 +163,10 @@ abstract class AbstractSimpleFileBenchmark {
totalTransformer.process(listOf(firFile))
bh.consume(firFile.hashCode())
Extensions.getArea(env.project)
.getExtensionPoint(PsiElementFinder.EP_NAME)
.unregisterExtension(FirJavaElementFinder::class.java)
}
protected abstract fun buildText(): String
}
fun createSession(
environment: KotlinCoreEnvironment,
sourceScope: GlobalSearchScope,
librariesScope: GlobalSearchScope = GlobalSearchScope.notScope(sourceScope)
): FirSession {
val moduleInfo = FirTestModuleInfo()
val project = environment.project
val provider = FirProjectSessionProvider(project)
return FirJavaModuleBasedSession.create(moduleInfo, provider, sourceScope).also {
createSessionForDependencies(provider, moduleInfo, librariesScope, environment)
}
}
private fun createSessionForDependencies(
provider: FirProjectSessionProvider,
moduleInfo: FirTestModuleInfo,
librariesScope: GlobalSearchScope,
environment: KotlinCoreEnvironment
) {
val dependenciesInfo = FirTestModuleInfo()
moduleInfo.dependencies.add(dependenciesInfo)
FirLibrarySession.create(
dependenciesInfo, provider, librariesScope, environment.project,
environment.createPackagePartProvider(librariesScope)
)
}
class FirTestModuleInfo(
override val name: Name = Name.identifier("TestModule"),
val dependencies: MutableList<ModuleInfo> = mutableListOf(),
override val platform: TargetPlatform = JvmPlatforms.unspecifiedJvmPlatform,
override val analyzerServices: PlatformDependentAnalyzerServices = JvmPlatformAnalyzerServices
) : ModuleInfo {
override fun dependencies(): List<ModuleInfo> = dependencies
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.benchmarks
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole
import java.util.concurrent.TimeUnit
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
open class ControlFlowAnalysisBenchmark : AbstractSimpleFileBenchmark() {
@Param("1000")
private var size: Int = 0
@Benchmark
fun benchmark(bh: Blackhole) {
analyzeGreenFile(bh)
}
override fun buildText() =
buildString {
appendLine("fun test() {")
for (i in 0 until size) {
appendLine("for (i$i in 0..10) { ")
}
for (i in 0 until size) {
appendLine("}")
}
appendLine("}")
}
}

View File

@@ -27,7 +27,7 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
}
@@ -178,7 +178,7 @@ extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.2"
extra["versions.r8"] = "1.5.70"
extra["versions.r8"] = "2.0.88"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -193,6 +193,7 @@ if (!project.hasProperty("versions.kotlin-native")) {
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.getBooleanProperty("kotlin.build.useIR") ?: false)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -228,6 +229,8 @@ extra["compilerModules"] = arrayOf(
":compiler:frontend.java",
":compiler:cli-common",
":compiler:ir.tree",
":compiler:ir.tree.impl",
":compiler:ir.tree.persistent",
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.jvm",
@@ -405,9 +408,6 @@ allprojects {
val commonCompilerArgs = listOfNotNull(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xread-deserialized-contracts",
"-Xjvm-default=compatibility",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-progressive".takeIf { hasProperty("test.progressive.mode") }
)
@@ -419,9 +419,20 @@ allprojects {
}
}
val jvmCompilerArgs = listOf(
"-Xjvm-default=compatibility",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-Xnormalize-constructor-calls=enable"
)
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
kotlinOptions {
freeCompilerArgs = commonCompilerArgs + listOf("-Xnormalize-constructor-calls=enable")
freeCompilerArgs = commonCompilerArgs + jvmCompilerArgs
if (useJvmIrBackend) {
useIR = true
}
}
}
@@ -451,6 +462,7 @@ allprojects {
ignore("META-INF/MANIFEST.MF")
ignore("META-INF/compiler.version")
ignore("META-INF/plugin.xml")
ignore("kotlin/KotlinVersionCurrentValue.class")
}
}
@@ -507,9 +519,12 @@ gradle.taskGraph.whenReady {
fun Boolean.toOnOff(): String = if (this) "on" else "off"
val profile = if (isTeamcityBuild) "CI" else "Local"
logger.warn("$profile build profile is active (proguard is ${kotlinBuildProperties.proguard.toOnOff()}" +
", jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()})." +
" Use -Pteamcity=<true|false> to reproduce CI/local build")
val proguardMessage = "proguard is ${kotlinBuildProperties.proguard.toOnOff()}"
val jarCompressionMessage = "jar compression is ${kotlinBuildProperties.jarCompression.toOnOff()}"
val profileMessage = "$profile build profile is active ($proguardMessage, $jarCompressionMessage). " +
"Use -Pteamcity=<true|false> to reproduce CI/local build"
logger.warn("\n\n$profileMessage")
allTasks.filterIsInstance<org.gradle.jvm.tasks.Jar>().forEach { task ->
task.entryCompression = if (kotlinBuildProperties.jarCompression)
@@ -708,16 +723,9 @@ tasks {
dependsOn(":jps-plugin:test")
}
register("idea-plugin-main-tests") {
dependsOn("dist")
dependsOn(":idea:test")
}
register("idea-plugin-additional-tests") {
dependsOn("dist")
dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test",
":idea:idea-maven:test",
":j2k:test",
":nj2k:test",
@@ -740,17 +748,6 @@ tasks {
}
}
register("idea-plugin-tests") {
dependsOn("dist")
dependsOn(
"idea-plugin-main-tests",
"idea-plugin-additional-tests"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
}
}
register("idea-plugin-performance-tests") {
dependsOn("dist")
dependsOn(
@@ -767,10 +764,21 @@ tasks {
)
}
register("plugins-tests") {
dependsOn("dist")
register("ideaPluginTest") {
dependsOn(
"mainIdeTests",
"gradleIdeTest",
"kaptIdeTest",
"miscIdeTests"
)
}
register("mainIdeTests") {
dependsOn(":idea:test")
}
register("miscIdeTests") {
dependsOn(
":kotlin-annotation-processing:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
@@ -778,19 +786,58 @@ tasks {
":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-compiler-plugin:test",
":kotlinx-serialization-ide-plugin:test",
":idea:jvm-debugger:jvm-debugger-test:test"
":idea:jvm-debugger:jvm-debugger-test:test",
"idea-plugin-additional-tests",
"jps-tests",
":generators:test"
)
if (Ide.IJ()) {
dependsOn("idea-new-project-wizard-tests")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
}
register("gradleIdeTest") {
dependsOn(
":idea:idea-gradle:test",
":idea:idea-gradle-native:test"
)
}
register("ideaPluginTest") {
register("kmmTest", AggregateTest::class) {
dependsOn(
"idea-plugin-tests",
"jps-tests",
"plugins-tests",
"android-ide-tests",
":generators:test"
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
testPatternFile = file("tests/mpp/kmm-patterns.csv")
}
register("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
}
}
named("check") {
dependsOn("test")
}
named("checkBuild") {
if (kotlinBuildProperties.isTeamcityBuild) {
doFirst {
println("##teamcity[setParameter name='bootstrap.kotlin.version' value='$bootstrapKotlinVersion']")
}
}
}
register("publishIdeArtifacts") {
@@ -826,24 +873,6 @@ tasks {
)
}
}
register("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
}
}
named("check") {
dependsOn("test")
}
named("checkBuild") {
if (kotlinBuildProperties.isTeamcityBuild) {
doFirst {
println("##teamcity[setParameter name='bootstrap.kotlin.version' value='$bootstrapKotlinVersion']")
}
}
}
}
fun CopySpec.setExecutablePermissions() {

View File

@@ -22,7 +22,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
@@ -97,7 +97,7 @@ repositories {
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
implementation("com.gradle.publish:plugin-publish-plugin:0.11.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")

View File

@@ -1,16 +1,15 @@
@file:Suppress("PropertyName", "HasPlatformType", "UnstableApiUsage")
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
import java.io.Closeable
import java.io.OutputStreamWriter
import java.net.URI
import java.text.SimpleDateFormat
import java.util.*
import javax.xml.stream.XMLOutputFactory
import org.jetbrains.kotlin.gradle.tasks.internal.CleanableStore
import java.time.Duration
import java.time.Instant
import java.util.*
import javax.xml.stream.XMLOutputFactory
plugins {
base
@@ -180,6 +179,7 @@ val mergeSources by tasks.creating(Jar::class.java) {
dependsOn(sources)
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
isZip64 = true
if (!kotlinBuildProperties.isTeamcityBuild) {
from(provider { sources.map(::zipTree) })
}

View File

@@ -20,7 +20,7 @@ buildscript {
}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.17")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.19")
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import org.gradle.api.GradleException
import org.gradle.api.tasks.*
import org.gradle.api.tasks.testing.Test
import java.io.File
// You can see "How To" via link: https://jetbrains.quip.com/xQ2WAUy9bZmy/How-to-use-AggregateTest-task
open class AggregateTest : Test() { // Inherit from Test to see test results in IDEA Test viewer
private var patterns: MutableMap<String, MutableList<String>> = mutableMapOf()
@InputFile
lateinit var testPatternFile: File
init {
// Set empty FileCollection to avoid NPE when initializing a base 'Test' class
classpath = project.objects.fileCollection()
testClassesDirs = project.objects.fileCollection()
project.gradle.taskGraph.whenReady {
if (allTasks.filterIsInstance<AggregateTest>().isNotEmpty()) {
initPatterns()
allTasks.filterIsInstance<Test>().forEach { testTask -> subTaskConfigure(testTask) }
if (!project.gradle.startParameter.taskNames.all { project.tasks.findByPath(it) is AggregateTest }) {
logger.warn("Please, don't use AggregateTest and non-AggregateTest test tasks together. You can get incorrect results.")
}
}
}
}
private fun initPatterns() {
if (!testPatternFile.exists())
throw GradleException("File with test patterns is not found")
testPatternFile
.readLines()
.asSequence()
.filter { it.isNotEmpty() }
.forEach { line ->
// patternType is exclude or include value
val (pattern, patternType) = line.split(',').map { it.trim() }
patterns.getOrPut(patternType) { mutableListOf() }.add(pattern)
}
}
private fun subTaskConfigure(testTask: Test) {
testTask.outputs.upToDateWhen { false }
testTask.ignoreFailures = true
testTask.filter {
isFailOnNoMatchingTests = false
patterns["include"]?.let {
it.forEach { pattern ->
includeTestsMatching(pattern)
}
}
patterns["exclude"]?.let {
it.forEach { pattern ->
excludeTestsMatching(pattern)
}
}
}
}
@Override
@TaskAction
override fun executeTests() {
// Do nothing
}
}

View File

@@ -56,7 +56,7 @@ var Project.javaHome: String?
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
main = fqName
mainClass.set(fqName)
workingDir = rootDir
systemProperty("line.separator", "\n")
}

View File

@@ -26,7 +26,7 @@ fun CompatibilityPredicate.or(other: CompatibilityPredicate): CompatibilityPredi
}
enum class Platform : CompatibilityPredicate {
P183, P191, P192, P193, P201, P202;
P183, P191, P192, P193, P201, P202, P203;
val version: Int = name.drop(1).toInt()
@@ -48,6 +48,7 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
IJ193(Platform.P193),
IJ201(Platform.P201),
IJ202(Platform.P202),
IJ203(Platform.P203),
AS35(Platform.P183),
AS36(Platform.P192),

View File

@@ -23,6 +23,10 @@ fun JavaExec.passClasspathInJar() {
dependsOn(classpath)
inputs.files(classpath)
inputs.property("main", main)
archiveFileName.set("$main.${this@passClasspathInJar.name}.classpath.container.jar")
destinationDirectory.set(temporaryDir)
doFirst {
val classPathString = classpath.joinToString(" ") { project.file(it).toURI().toString() }
manifest {
@@ -34,16 +38,11 @@ fun JavaExec.passClasspathInJar() {
)
}
}
archiveName = "$main.${this@passClasspathInJar.name}.classpath.container.$extension"
destinationDir = temporaryDir
}
dependsOn(jarTask)
doFirst {
main = "-jar"
classpath = project.files()
args = listOf(jarTask.outputs.files.singleFile.path) + args.orEmpty()
}
main = "-jar"
classpath = project.files()
args = listOf(jarTask.outputs.files.singleFile.path) + args.orEmpty()
}

View File

@@ -1,3 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused")
// usages in build scripts are not tracked properly
@@ -97,9 +102,11 @@ fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): An
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"), classifier)
}
fun Project.kotlinBuiltins(): Any =
fun Project.kotlinBuiltins(): Any = kotlinBuiltins(forJvm = false)
fun Project.kotlinBuiltins(forJvm: Boolean): Any =
if (kotlinBuildProperties.useBootstrapStdlib) "org.jetbrains.kotlin:builtins:$bootstrapKotlinVersion"
else dependencies.project(":core:builtins")
else dependencies.project(":core:builtins", configuration = "runtimeElementsJvm".takeIf { forJvm })
fun DependencyHandler.projectTests(name: String): ProjectDependency = project(name, configuration = "tests-jar")
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")

View File

@@ -165,7 +165,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
classpath = mainSourceSet.runtimeClasspath
main = "com.intellij.idea.Main"
mainClass.set("com.intellij.idea.Main")
workingDir = File(intellijRootDir(), "bin")
@@ -184,7 +184,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-Dplugin.path=${ideaPluginDir.absolutePath}"
)
if (Platform[201].orHigher()) {
if (Platform[201].orHigher() && !isIntellijUltimateSdkAvailable()) {
jvmArgs("-Didea.platform.prefix=Idea")
}

View File

@@ -31,6 +31,45 @@ import java.lang.Character.isUpperCase
import java.nio.file.Files
import java.nio.file.Path
fun Task.dependsOnKotlinPluginInstall() {
dependsOn(
":kotlin-allopen:install",
":kotlin-noarg:install",
":kotlin-sam-with-receiver:install",
":kotlin-android-extensions:install",
":kotlin-build-common:install",
":kotlin-compiler-embeddable:install",
":native:kotlin-native-utils:install",
":kotlin-util-klib:install",
":kotlin-util-io:install",
":kotlin-compiler-runner:install",
":kotlin-daemon-embeddable:install",
":kotlin-daemon-client:install",
":kotlin-gradle-plugin-api:install",
":kotlin-gradle-plugin:install",
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:kotlin-test-common:install",
":kotlin-test:kotlin-test-annotations-common:install",
":kotlin-test:kotlin-test-jvm:install",
":kotlin-test:kotlin-test-js:install",
":kotlin-test:kotlin-test-junit:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
":kotlin-stdlib-jdk8:install",
":kotlin-stdlib-js:install",
":examples:annotation-processor-example:install",
":kotlin-script-runtime:install",
":kotlin-scripting-common:install",
":kotlin-scripting-jvm:install",
":kotlin-scripting-compiler-embeddable:install",
":kotlin-scripting-compiler-impl-embeddable:install",
":kotlin-test-js-runner:install"
)
}
fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,

View File

@@ -120,7 +120,7 @@ public abstract class AnnotationCodegen {
@Nullable Type returnType,
@Nullable KotlinType typeForTypeAnnotations,
@Nullable DeclarationDescriptorWithVisibility parameterContainer,
@NotNull List<Class<?>> additionalAnnotations
@NotNull List<String> additionalVisibleAnnotations
) {
if (annotated == null) return;
@@ -155,9 +155,9 @@ public abstract class AnnotationCodegen {
}
}
for (Class<?> annotation : additionalAnnotations) {
String descriptor = generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotation);
annotationDescriptorsAlreadyPresent.add(descriptor);
for (String annotation : additionalVisibleAnnotations) {
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotation, true);
annotationDescriptorsAlreadyPresent.add(annotation);
}
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
@@ -248,17 +248,17 @@ public abstract class AnnotationCodegen {
if (!TypeUtils.isNullableType(flexibleType.getLowerBound()) && TypeUtils.isNullableType(flexibleType.getUpperBound())) {
AnnotationDescriptor notNull = type.getAnnotations().findAnnotation(JvmAnnotationNames.JETBRAINS_NOT_NULL_ANNOTATION);
if (notNull != null) {
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, NotNull.class);
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, Type.getType(NotNull.class).getDescriptor(), false);
}
return;
}
}
boolean isNullableType = TypeUtils.isNullableType(type);
Class<?> annotationClass = isNullableType ? Nullable.class : NotNull.class;
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotationClass);
generateAnnotationIfNotPresent(
annotationDescriptorsAlreadyPresent,
TypeUtils.isNullableType(type) ? Type.getType(Nullable.class).getDescriptor() : Type.getType(NotNull.class).getDescriptor(),
false
);
}
private static final Map<JvmTarget, Map<KotlinTarget, ElementType>> annotationTargetMaps = new EnumMap<>(JvmTarget.class);
@@ -338,13 +338,14 @@ public abstract class AnnotationCodegen {
visitor.visitEnd();
}
@NotNull
private String generateAnnotationIfNotPresent(Set<String> annotationDescriptorsAlreadyPresent, Class<?> annotationClass) {
String descriptor = Type.getType(annotationClass).getDescriptor();
if (!annotationDescriptorsAlreadyPresent.contains(descriptor)) {
visitAnnotation(descriptor, false).visitEnd();
private void generateAnnotationIfNotPresent(
Set<String> annotationDescriptorsAlreadyPresent,
String annotationDescriptor,
boolean visible
) {
if (!annotationDescriptorsAlreadyPresent.contains(annotationDescriptor)) {
visitAnnotation(annotationDescriptor, visible).visitEnd();
}
return descriptor;
}
private static boolean isBareTypeParameterWithNullableUpperBound(@NotNull KotlinType type) {

View File

@@ -2835,7 +2835,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
KotlinType approximatedType =
CapturedTypeConstructorKt.isCaptured(type) ?
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
(KotlinType) approximator.approximateToSuperType(
type, TypeApproximatorConfiguration.InternalTypesApproximation.INSTANCE
) : null;

View File

@@ -83,6 +83,8 @@ import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
public class FunctionCodegen {
private static final String JAVA_LANG_DEPRECATED = Type.getType(Deprecated.class).getDescriptor();
public final GenerationState state;
private final KotlinTypeMapper typeMapper;
private final BindingContext bindingContext;
@@ -221,7 +223,7 @@ public class FunctionCodegen {
InlineClassDescriptorResolver.isSpecializedEqualsMethod(functionDescriptor);
generateMethodAnnotationsIfRequired(
functionDescriptor, asmMethod, jvmSignature, mv,
isCompatibilityStubInDefaultImpls ? Collections.singletonList(Deprecated.class) : Collections.emptyList(),
isCompatibilityStubInDefaultImpls ? Collections.singletonList(JAVA_LANG_DEPRECATED) : Collections.emptyList(),
skipNullabilityAnnotations
);
GenerateJava8ParameterNamesKt.generateParameterNames(functionDescriptor, mv, jvmSignature, state, (flags & ACC_SYNTHETIC) != 0);
@@ -285,7 +287,7 @@ public class FunctionCodegen {
@NotNull Method asmMethod,
@NotNull JvmMethodGenericSignature jvmSignature,
@NotNull MethodVisitor mv,
@NotNull List<Class<?>> additionalNoArgAnnotations,
@NotNull List<String> additionalVisibleAnnotations,
boolean skipNullabilityAnnotations
) {
FunctionDescriptor annotationsOwner;
@@ -302,7 +304,7 @@ public class FunctionCodegen {
}
AnnotationCodegen.forMethod(mv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(annotationsOwner, asmMethod.getReturnType(), functionDescriptor.getReturnType(), null, additionalNoArgAnnotations);
.genAnnotations(annotationsOwner, asmMethod.getReturnType(), functionDescriptor.getReturnType(), null, additionalVisibleAnnotations);
generateParameterAnnotations(
annotationsOwner, mv, jvmSignature,

View File

@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.calls.checkers.isRestrictsSuspensionReceiver
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
class JvmRuntimeTypes(
module: ModuleDescriptor,
@@ -96,6 +98,14 @@ class JvmRuntimeTypes(
else
descriptor
if (actualFunctionDescriptor.returnType == null)
throw KotlinExceptionWithAttachments(
"Return type for function description is null. Super type cannot be calculated." +
"initDesc=${descriptor}, actDesc=${actualFunctionDescriptor}, isReleaseCoroutines=${
languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)
}"
)
val functionType = createFunctionType(
descriptor.builtIns,
Annotations.EMPTY,

View File

@@ -726,7 +726,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
public SourceMapper getOrCreateSourceMapper() {
if (sourceMapper == null) {
// note: this is used in InlineCodegen and the element is always physical (KtElement) there
sourceMapper = new SourceMapper(SourceInfo.Companion.createInfo((KtElement)element, getClassName()));
sourceMapper = new SourceMapper(SourceInfo.Companion.createFromPsi((KtElement)element, getClassName()));
}
return sourceMapper;
}

View File

@@ -435,10 +435,10 @@ public class PropertyCodegen {
if (annotatedField != null) {
// Don't emit nullability annotations for backing field if:
// - backing field is invisible from Java (private or synthetic);
// - backing field is synthetic;
// - property is lateinit (since corresponding field is actually nullable).
boolean skipNullabilityAnnotations =
(modifiers & ACC_PRIVATE) != 0 || (modifiers & ACC_SYNTHETIC) != 0 ||
(modifiers & ACC_SYNTHETIC) != 0 ||
propertyDescriptor.isLateInit();
AnnotationCodegen.forField(fv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(annotatedField, type, propertyDescriptor.getType());

View File

@@ -21,28 +21,26 @@ import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtNamedFunction
data class SourceInfo(val source: String, val pathOrCleanFQN: String, val linesInFile: Int) {
data class SourceInfo(
val sourceFileName: String?,
val pathOrCleanFQN: String,
val linesInFile: Int
) {
companion object {
fun createInfo(element: KtElement?, internalClassName: String): SourceInfo {
fun createFromPsi(element: KtElement?, internalClassName: String): SourceInfo {
assert(element != null) { "Couldn't create source mapper for null element $internalClassName" }
val lineNumbers = CodegenUtil.getLineNumberForElement(element!!.containingFile, true)
?: error("Couldn't extract line count in ${element.containingFile}")
?: error("Couldn't extract line count in ${element.containingFile}")
//TODO hack condition for package parts cleaning
val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
return SourceInfo(element.containingKtFile.name, cleanedClassFqName, lineNumbers)
val fileName = element.containingKtFile.name
return SourceInfo(fileName, cleanedClassFqName, lineNumbers)
}
fun createInfoForIr(lineNumbers: Int, internalClassName: String, containingFileName: String): SourceInfo {
//TODO cut topLevel names
// val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile)
// val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$')
return SourceInfo(containingFileName, internalClassName, lineNumbers)
}
}
}

View File

@@ -590,7 +590,7 @@ private fun generateLambdaForRunSuspend(
lambdaBuilder.newField(
JvmDeclarationOrigin.NO_ORIGIN,
ACC_PRIVATE or ACC_FINAL,
ACC_PRIVATE or ACC_FINAL or ACC_SYNTHETIC,
"args",
ARRAY_OF_STRINGS_TYPE.descriptor, null, null
)

View File

@@ -236,7 +236,7 @@ class CoroutineCodegenForLambda private constructor(
val fieldInfo = parameter.getFieldInfoForCoroutineLambdaParameter()
v.newField(
OtherOrigin(parameter),
Opcodes.ACC_PRIVATE,
Opcodes.ACC_PRIVATE + Opcodes.ACC_SYNTHETIC,
fieldInfo.fieldName,
fieldInfo.fieldType.descriptor, null, null
)

View File

@@ -20,6 +20,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.tree.*
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import kotlin.math.max
private const val COROUTINES_DEBUG_METADATA_VERSION = 1
@@ -132,15 +133,19 @@ class CoroutineTransformerMethodVisitor(
UninitializedStoresProcessor(methodNode, shouldPreserveClassInitialization).run()
updateLvtAccordingToLiveness(methodNode, isForNamedFunction)
val spilledToVariableMapping = spillVariables(suspensionPoints, methodNode)
val suspendMarkerVarIndex = methodNode.maxLocals++
val suspensionPointLineNumbers = suspensionPoints.map { findSuspensionPointLineNumber(it) }
val continuationLabels = suspensionPoints.withIndex().map {
transformCallAndReturnContinuationLabel(
it.index + 1, it.value, methodNode, suspendMarkerVarIndex, suspensionPointLineNumbers[it.index])
// Create states in state-machine, to which state-machine can jump
val stateLabels = suspensionPoints.withIndex().map {
transformCallAndReturnStateLabel(
it.index + 1, it.value, methodNode, suspendMarkerVarIndex, suspensionPointLineNumbers[it.index]
)
}
methodNode.instructions.apply {
@@ -163,7 +168,7 @@ class CoroutineTransformerMethodVisitor(
0,
suspensionPoints.size,
defaultLabel,
firstStateLabel, *continuationLabels.toTypedArray()
firstStateLabel, *stateLabels.toTypedArray()
),
firstStateLabel
)
@@ -180,25 +185,39 @@ class CoroutineTransformerMethodVisitor(
})
}
initializeFakeInlinerVariables(methodNode, stateLabels)
dropSuspensionMarkers(methodNode)
methodNode.removeEmptyCatchBlocks()
// The parameters (and 'this') shall live throughout the method, otherwise, d8 emits warning about invalid debug info
val startLabel = LabelNode()
val endLabel = LabelNode()
methodNode.instructions.insertBefore(methodNode.instructions.first, startLabel)
methodNode.instructions.insert(methodNode.instructions.last, endLabel)
fixLvtForParameters(methodNode, startLabel, endLabel)
if (languageVersionSettings.isReleaseCoroutines()) {
writeDebugMetadata(methodNode, suspensionPointLineNumbers, spilledToVariableMapping)
}
}
// When suspension point is inlined, it is in range of fake inliner variables.
// Path from TABLESWITCH into unspilling goes to latter part of the range.
// In this case the variables are uninitialized, initialize them
private fun initializeFakeInlinerVariables(methodNode: MethodNode, stateLabels: List<LabelNode>) {
for (stateLabel in stateLabels) {
val unitializedFakeInlinerVariables = arrayListOf<LocalVariableNode>()
for (record in methodNode.localVariables) {
if (isFakeLocalVariableForInline(record.name) &&
methodNode.instructions.indexOf(record.start) < methodNode.instructions.indexOf(stateLabel) &&
methodNode.instructions.indexOf(stateLabel) < methodNode.instructions.indexOf(record.end)
) {
methodNode.instructions.insert(stateLabel, withInstructionAdapter {
iconst(0)
store(record.index, Type.INT_TYPE)
})
}
}
}
}
private fun addCompletionParameterToLVT(methodNode: MethodNode) {
val index =
/* all args */ Type.getMethodType(methodNode.desc).argumentTypes.fold(0) { a, b -> a + b.size } +
/* all args */ Type.getMethodType(methodNode.desc).argumentTypes.fold(0) { a, b -> a + b.size } +
/* this */ (if (isStatic(methodNode.access)) 0 else 1) -
/* only last */ 1
val startLabel = with(methodNode.instructions) {
@@ -311,31 +330,10 @@ class CoroutineTransformerMethodVisitor(
}
}
private fun fixLvtForParameters(methodNode: MethodNode, startLabel: LabelNode, endLabel: LabelNode) {
val paramsNum =
/* this */ (if (isStatic(methodNode.access)) 0 else 1) +
/* real params */ Type.getArgumentTypes(methodNode.desc).fold(0) { a, b -> a + b.size }
for (i in 0 until paramsNum) {
fixRangeOfLvtRecord(methodNode, i, startLabel, endLabel)
}
}
private fun fixRangeOfLvtRecord(methodNode: MethodNode, index: Int, startLabel: LabelNode, endLabel: LabelNode) {
val vars = methodNode.localVariables.filter { it.index == index }
assert(vars.size <= 1) {
"Someone else occupies parameter's slot at $index"
}
vars.firstOrNull()?.let {
it.start = startLabel
it.end = endLabel
}
}
private fun writeDebugMetadata(
methodNode: MethodNode,
suspensionPointLineNumbers: List<LineNumberNode?>,
spilledToLocalMapping: List<List<SpilledVariableDescriptor>>
spilledToLocalMapping: List<List<SpilledVariableAndField>>
) {
val lines = suspensionPointLineNumbers.map { it?.line ?: -1 }
val metadata = classBuilderForCoroutineState.newAnnotation(DEBUG_METADATA_ANNOTATION_ASM_TYPE.descriptor, true)
@@ -590,7 +588,7 @@ class CoroutineTransformerMethodVisitor(
}
}
private fun spillVariables(suspensionPoints: List<SuspensionPoint>, methodNode: MethodNode): List<List<SpilledVariableDescriptor>> {
private fun spillVariables(suspensionPoints: List<SuspensionPoint>, methodNode: MethodNode): List<List<SpilledVariableAndField>> {
val instructions = methodNode.instructions
val frames =
if (useOldSpilledVarTypeAnalysis) performRefinedTypeAnalysis(methodNode, containingClassInternalName)
@@ -598,11 +596,15 @@ class CoroutineTransformerMethodVisitor(
fun AbstractInsnNode.index() = instructions.indexOf(this)
// We postpone these actions because they change instruction indices that we use when obtaining frames
val postponedActions = mutableListOf<() -> Unit>()
val maxVarsCountByType = mutableMapOf<Type, Int>()
val livenessFrames = analyzeLiveness(methodNode)
val spilledToVariableMapping = arrayListOf<List<SpilledVariableDescriptor>>()
// References shall be cleaned up after uspill (during spill in next suspension point) to prevent memory leaks,
val referencesToSpillBySuspensionPointIndex = arrayListOf<List<ReferenceToSpill>>()
// while primitives shall not
val primitivesToSpillBySuspensionPointIndex = arrayListOf<List<PrimitiveToSpill>>()
// Collect information about spillable variables, that we use to determine which variables we need to cleanup
for (suspension in suspensionPoints) {
val suspensionCallBegin = suspension.suspensionCallBegin
@@ -629,7 +631,8 @@ class CoroutineTransformerMethodVisitor(
// NB: it's also rather useful for sake of optimization
val livenessFrame = livenessFrames[suspensionCallBegin.index()]
val spilledToVariable = arrayListOf<SpilledVariableDescriptor>()
val referencesToSpill = arrayListOf<ReferenceToSpill>()
val primitivesToSpill = arrayListOf<PrimitiveToSpill>()
// 0 - this
// 1 - parameter
@@ -637,69 +640,144 @@ class CoroutineTransformerMethodVisitor(
// k - continuation
// k + 1 - data
// k + 2 - exception
val variablesToSpill =
(0 until localsCount)
.filterNot { it in setOf(continuationIndex, dataIndex, exceptionIndex) }
.map { Pair(it, frame.getLocal(it)) }
.filter { (index, value) ->
(index == 0 && needDispatchReceiver && isForNamedFunction) ||
(value.type != null && livenessFrame.isAlive(index))
}
for (slot in 0 until localsCount) {
if (slot == continuationIndex || slot == dataIndex || slot == exceptionIndex) continue
val value = frame.getLocal(slot)
if (value.type == null || !livenessFrame.isAlive(slot)) continue
for ((index, basicValue) in variablesToSpill) {
if (basicValue == StrictBasicValue.NULL_VALUE) {
postponedActions.add {
with(instructions) {
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
aconst(null)
store(index, AsmTypes.OBJECT_TYPE)
})
}
}
if (value == StrictBasicValue.NULL_VALUE) {
referencesToSpill += slot to null
continue
}
val type = basicValue.type!!
val type = value.type!!
val normalizedType = type.normalize()
val indexBySort = varsCountByType[normalizedType]?.plus(1) ?: 0
varsCountByType[normalizedType] = indexBySort
val fieldName = normalizedType.fieldNameForVar(indexBySort)
localVariableName(methodNode, index, suspension.suspensionCallEnd.next.index())
?.let { spilledToVariable.add(SpilledVariableDescriptor(fieldName, it)) }
postponedActions.add {
with(instructions) {
// store variable before suspension call
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
load(index, type)
StackValue.coerce(type, normalizedType, this)
putfield(classBuilderForCoroutineState.thisName, fieldName, normalizedType.descriptor)
})
// restore variable after suspension call
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
getfield(classBuilderForCoroutineState.thisName, fieldName, normalizedType.descriptor)
StackValue.coerce(normalizedType, type, this)
store(index, type)
})
}
if (normalizedType == AsmTypes.OBJECT_TYPE) {
referencesToSpill += slot to SpillableVariable(value, type, normalizedType, fieldName)
} else {
primitivesToSpill += slot to SpillableVariable(value, type, normalizedType, fieldName)
}
}
spilledToVariableMapping.add(spilledToVariable)
referencesToSpillBySuspensionPointIndex += referencesToSpill
primitivesToSpillBySuspensionPointIndex += primitivesToSpill
varsCountByType.forEach {
maxVarsCountByType[it.key] = max(maxVarsCountByType[it.key] ?: 0, it.value)
for ((type, index) in varsCountByType) {
maxVarsCountByType[type] = max(maxVarsCountByType[type] ?: 0, index)
}
}
postponedActions.forEach(Function0<Unit>::invoke)
// Calculate variables to cleanup
maxVarsCountByType.forEach { entry ->
// Use CFG to calculate amount of spilled variables in previous suspension point (P) and current one (C).
// All fields from L$C to L$P should be cleaned. I.e. we should spill ACONST_NULL to them.
val cfg = ControlFlowGraph.build(methodNode)
// Collect all immediately preceding suspension points. I.e. suspension points, from which there is a path
// into current one, that does not cross other suspension points.
val suspensionPointEnds = suspensionPoints.associateBy { it.suspensionCallEnd }
fun findSuspensionPointPredecessors(suspension: SuspensionPoint): List<SuspensionPoint> {
val visited = mutableSetOf<AbstractInsnNode>()
fun dfs(current: AbstractInsnNode): List<SuspensionPoint> {
if (!visited.add(current)) return emptyList()
suspensionPointEnds[current]?.let { return listOf(it) }
return cfg.getPredecessorsIndices(current).flatMap { dfs(instructions[it]) }
}
return dfs(suspension.suspensionCallBegin)
}
val predSuspensionPoints = suspensionPoints.associateWith { findSuspensionPointPredecessors(it) }
// Calculate all pairs SuspensionPoint -> C and P, where P is minimum of all preds' Cs
fun countVariablesToSpill(index: Int): Int =
referencesToSpillBySuspensionPointIndex[index].count { (_, variable) -> variable != null }
val referencesToCleanBySuspensionPointIndex = arrayListOf<Pair<Int, Int>>() // current to pred
for (suspensionPointIndex in suspensionPoints.indices) {
val suspensionPoint = suspensionPoints[suspensionPointIndex]
val currentSpilledReferencesCount = countVariablesToSpill(suspensionPointIndex)
val preds = predSuspensionPoints[suspensionPoint]
val predSpilledReferencesCount =
if (preds.isNullOrEmpty()) 0 else preds.maxOf { countVariablesToSpill(suspensionPoints.indexOf(it)) }
referencesToCleanBySuspensionPointIndex += currentSpilledReferencesCount to predSpilledReferencesCount
}
// Mutate method node
fun generateSpillAndUnspill(suspension: SuspensionPoint, slot: Int, spillableVariable: SpillableVariable?) {
if (spillableVariable == null) {
with(instructions) {
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
aconst(null)
store(slot, AsmTypes.OBJECT_TYPE)
})
}
return
}
with(instructions) {
// store variable before suspension call
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
load(slot, spillableVariable.type)
StackValue.coerce(spillableVariable.type, spillableVariable.normalizedType, this)
putfield(
classBuilderForCoroutineState.thisName,
spillableVariable.fieldName,
spillableVariable.normalizedType.descriptor
)
})
// restore variable after suspension call
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
getfield(
classBuilderForCoroutineState.thisName,
spillableVariable.fieldName,
spillableVariable.normalizedType.descriptor
)
StackValue.coerce(spillableVariable.normalizedType, spillableVariable.type, this)
store(slot, spillableVariable.type)
})
}
}
fun cleanUpField(suspension: SuspensionPoint, fieldIndex: Int) {
with(instructions) {
insertBefore(suspension.suspensionCallBegin, withInstructionAdapter {
load(continuationIndex, AsmTypes.OBJECT_TYPE)
aconst(null)
putfield(
classBuilderForCoroutineState.thisName,
"L\$$fieldIndex",
AsmTypes.OBJECT_TYPE.descriptor
)
})
}
}
for (suspensionPointIndex in suspensionPoints.indices) {
val suspension = suspensionPoints[suspensionPointIndex]
for ((slot, referenceToSpill) in referencesToSpillBySuspensionPointIndex[suspensionPointIndex]) {
generateSpillAndUnspill(suspension, slot, referenceToSpill)
}
val (currentSpilledCount, predSpilledCount) = referencesToCleanBySuspensionPointIndex[suspensionPointIndex]
if (predSpilledCount > currentSpilledCount) {
for (fieldIndex in currentSpilledCount until predSpilledCount) {
cleanUpField(suspension, fieldIndex)
}
}
for ((slot, primitiveToSpill) in primitivesToSpillBySuspensionPointIndex[suspensionPointIndex]) {
generateSpillAndUnspill(suspension, slot, primitiveToSpill)
}
}
for (entry in maxVarsCountByType) {
val (type, maxIndex) = entry
for (index in 0..maxIndex) {
classBuilderForCoroutineState.newField(
@@ -708,6 +786,34 @@ class CoroutineTransformerMethodVisitor(
)
}
}
// Calculate debug metadata mapping
fun calculateSpilledVariableAndField(
suspension: SuspensionPoint,
slot: Int,
spillableVariable: SpillableVariable?
): SpilledVariableAndField? {
if (spillableVariable == null) return null
val name = localVariableName(methodNode, slot, suspension.suspensionCallEnd.next.index()) ?: return null
return SpilledVariableAndField(spillableVariable.fieldName, name)
}
val spilledToVariableMapping = arrayListOf<List<SpilledVariableAndField>>()
for (suspensionPointIndex in suspensionPoints.indices) {
val suspension = suspensionPoints[suspensionPointIndex]
val spilledToVariable = arrayListOf<SpilledVariableAndField>()
referencesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
primitivesToSpillBySuspensionPointIndex[suspensionPointIndex].mapNotNullTo(spilledToVariable) { (slot, spillableVariable) ->
calculateSpilledVariableAndField(suspension, slot, spillableVariable)
}
spilledToVariableMapping += spilledToVariable
}
return spilledToVariableMapping
}
@@ -736,14 +842,14 @@ class CoroutineTransformerMethodVisitor(
return suspensionCallEnd.next as LabelNode
}
private fun transformCallAndReturnContinuationLabel(
private fun transformCallAndReturnStateLabel(
id: Int,
suspension: SuspensionPoint,
methodNode: MethodNode,
suspendMarkerVarIndex: Int,
suspendPointLineNumber: LineNumberNode?
): LabelNode {
val continuationLabel = LabelNode().linkWithLabel()
val stateLabel = LabelNode().linkWithLabel()
val continuationLabelAfterLoadedResult = LabelNode()
val suspendElementLineNumber = lineNumber
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)
@@ -771,7 +877,7 @@ class CoroutineTransformerMethodVisitor(
load(suspendMarkerVarIndex, AsmTypes.OBJECT_TYPE)
areturn(AsmTypes.OBJECT_TYPE)
// Mark place for continuation
visitLabel(continuationLabel.label)
visitLabel(stateLabel.label)
})
// After suspension point there is always three nodes: L1, NOP, L2
@@ -822,7 +928,7 @@ class CoroutineTransformerMethodVisitor(
}
}
return continuationLabel
return stateLabel
}
// Find the next line number instruction that is defintely hit. That is, a line number
@@ -888,9 +994,19 @@ class CoroutineTransformerMethodVisitor(
return
}
private data class SpilledVariableDescriptor(val fieldName: String, val variableName: String)
private data class SpilledVariableAndField(val fieldName: String, val variableName: String)
}
private class SpillableVariable(
val value: BasicValue,
val type: Type,
val normalizedType: Type,
val fieldName: String
)
private typealias ReferenceToSpill = Pair<Int, SpillableVariable?>
private typealias PrimitiveToSpill = Pair<Int, SpillableVariable>
internal fun InstructionAdapter.generateContinuationConstructorCall(
objectTypeForState: Type?,
methodNode: MethodNode,
@@ -1027,3 +1143,72 @@ internal fun replaceFakeContinuationsWithRealOnes(methodNode: MethodNode, contin
methodNode.instructions.set(fakeContinuation, VarInsnNode(Opcodes.ALOAD, continuationIndex))
}
}
/* We do not want to spill dead variables, thus, we shrink its LVT record to region, where the variable is alive,
* so, the variable will not be visible in debugger. User can still prolong life span of the variable by using it.
*
* This means, that function parameters do not longer span the whole function, including `this`.
* This might and will break some bytecode processors, including old versions of R8. See KT-24510.
*/
private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction: Boolean) {
val liveness = analyzeLiveness(method)
fun List<LocalVariableNode>.findRecord(insnIndex: Int, variableIndex: Int): LocalVariableNode? {
for (variable in this) {
if (variable.index == variableIndex &&
method.instructions.indexOf(variable.start) <= insnIndex &&
insnIndex < method.instructions.indexOf(variable.end)
) return variable
}
return null
}
fun isAlive(insnIndex: Int, variableIndex: Int): Boolean =
liveness[insnIndex].isAlive(variableIndex)
val oldLvt = arrayListOf<LocalVariableNode>()
for (record in method.localVariables) {
oldLvt += record
}
method.localVariables.clear()
// Skip `this` for suspend lamdba
val start = if (isForNamedFunction) 0 else 1
for (variableIndex in start until method.maxLocals) {
if (oldLvt.none { it.index == variableIndex }) continue
var startLabel: LabelNode? = null
for (insnIndex in 0 until (method.instructions.size() - 1)) {
val insn = method.instructions[insnIndex]
if (!isAlive(insnIndex, variableIndex) && isAlive(insnIndex + 1, variableIndex)) {
startLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode
}
if (isAlive(insnIndex, variableIndex) && !isAlive(insnIndex + 1, variableIndex)) {
// No variable in LVT -> do not add one
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
if (lvtRecord.name == CONTINUATION_VARIABLE_NAME) continue
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
// startLabel can be null in case of parameters
@Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start
// No LINENUMBER in range -> no way to put a breakpoint -> do not bother adding a record
if (InsnSequence(startLabel, endLabel).none { it is LineNumberNode }) continue
method.localVariables.add(
LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
)
}
}
}
for (variable in oldLvt) {
// $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables
// For example, $continuation is used to create async stack trace
if (variable.name == CONTINUATION_VARIABLE_NAME ||
variable.name == SUSPEND_CALL_RESULT_NAME ||
isFakeLocalVariableForInline(variable.name)
) {
method.localVariables.add(variable)
}
// this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
if (variable.name == "this" && !isForNamedFunction) {
method.localVariables.add(variable)
}
}
}

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceValue
typealias SourceFrames = Array<Frame<SourceValue>?>

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen.coroutines
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceValue
typealias SourceFrames = Array<Frame<SourceValue>>

View File

@@ -26,7 +26,6 @@ import org.jetbrains.org.objectweb.asm.tree.analysis.BasicInterpreter
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
// TODO Use this in variable liveness analysis
internal class MethodNodeExaminer(
val languageVersionSettings: LanguageVersionSettings,
containingClassInternalName: String,

View File

@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
@@ -28,10 +27,8 @@ import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.kotlin.resolve.inline.isInlineOnly
import org.jetbrains.kotlin.resolve.isInlineClassType
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
@@ -233,7 +230,7 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
)
val sourceInfo = sourceMapper.sourceInfo!!
val callSite = SourcePosition(codegen.lastLineNumber, sourceInfo.source, sourceInfo.pathOrCleanFQN)
val callSite = SourcePosition(codegen.lastLineNumber, sourceInfo.sourceFileName!!, sourceInfo.pathOrCleanFQN)
val inliner = MethodInliner(
node, parameters, info, FieldRemapper(null, null, parameters), isSameModule,
"Method inlining " + sourceCompiler.callElementText,

View File

@@ -100,6 +100,11 @@ class PsiDefaultLambda(
override fun mapAsmSignature(sourceCompiler: SourceCompilerForInline): Method {
return sourceCompiler.state.typeMapper.mapSignatureSkipGeneric(invokeMethodDescriptor).asmMethod
}
override fun findInvokeMethodDescriptor(): FunctionDescriptor =
parameterDescriptor.type.memberScope
.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND)
.single()
}
abstract class DefaultLambda(
@@ -150,14 +155,10 @@ abstract class DefaultLambda(
}
}, ClassReader.SKIP_CODE or ClassReader.SKIP_FRAMES or ClassReader.SKIP_DEBUG)
invokeMethodDescriptor =
parameterDescriptor.type.memberScope
.getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND)
.single()
.let {
//property reference generates erased 'get' method
if (isPropertyReference) it.original else it
}
invokeMethodDescriptor = findInvokeMethodDescriptor().let {
//property reference generates erased 'get' method
if (isPropertyReference) it.original else it
}
val descriptor = Type.getMethodDescriptor(Type.VOID_TYPE, *capturedArgs)
val constructor = getMethodNode(
@@ -206,6 +207,8 @@ abstract class DefaultLambda(
protected abstract fun mapAsmSignature(sourceCompiler: SourceCompilerForInline): Method
protected abstract fun findInvokeMethodDescriptor(): FunctionDescriptor
private companion object {
val PROPERTY_REFERENCE_SUPER_CLASSES =
listOf(

View File

@@ -85,9 +85,14 @@ class SourceMapper(val sourceInfo: SourceInfo?) {
get() = fileMappings.values.toList()
init {
sourceInfo?.let {
// Explicitly map the file to itself -- we'll probably need a lot of lines from it, so this will produce fewer ranges.
getOrRegisterNewSource(it.source, it.pathOrCleanFQN).mapNewInterval(1, 1, it.linesInFile)
sourceInfo?.let { sourceInfo ->
// If 'sourceFileName' is null, this class doesn't have debug information
// (e.g., multi-file class facade with multiple parts).
sourceInfo.sourceFileName?.let { sourceFileName ->
// Explicitly map the file to itself -- we'll probably need a lot of lines from it, so this will produce fewer ranges.
getOrRegisterNewSource(sourceFileName, sourceInfo.pathOrCleanFQN)
.mapNewInterval(1, 1, sourceInfo.linesInFile)
}
}
}

View File

@@ -5,16 +5,10 @@
package org.jetbrains.kotlin.codegen.optimization.common
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.load.java.JvmAbi
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
import org.jetbrains.org.objectweb.asm.tree.IincInsnNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
import org.jetbrains.org.objectweb.asm.tree.VarInsnNode
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import java.util.*
@@ -29,10 +23,6 @@ class VariableLivenessFrame(val maxLocals: Int) : VarFrame<VariableLivenessFrame
bitSet.set(varIndex, true)
}
fun markAllAlive(bitSet: BitSet) {
this.bitSet.or(bitSet)
}
fun markDead(varIndex: Int) {
bitSet.set(varIndex, false)
}
@@ -45,34 +35,17 @@ class VariableLivenessFrame(val maxLocals: Int) : VarFrame<VariableLivenessFrame
}
override fun hashCode() = bitSet.hashCode()
override fun toString(): String = (0 until maxLocals).map { if (bitSet[it]) '@' else '_' }.joinToString(separator = "")
}
fun analyzeLiveness(node: MethodNode): List<VariableLivenessFrame> {
val typeAnnotatedFrames = MethodTransformer.analyze("fake", node, OptimizationBasicInterpreter())
val visibleByDebuggerVariables = analyzeVisibleByDebuggerVariables(node, typeAnnotatedFrames)
return analyze(node, object : BackwardAnalysisInterpreter<VariableLivenessFrame> {
fun analyzeLiveness(method: MethodNode): List<VariableLivenessFrame> =
analyze(method, object : BackwardAnalysisInterpreter<VariableLivenessFrame> {
override fun newFrame(maxLocals: Int) = VariableLivenessFrame(maxLocals)
override fun def(frame: VariableLivenessFrame, insn: AbstractInsnNode) = defVar(frame, insn)
override fun use(frame: VariableLivenessFrame, insn: AbstractInsnNode) =
useVar(frame, insn, node, visibleByDebuggerVariables[node.instructions.indexOf(insn)])
useVar(frame, insn)
})
}
private fun analyzeVisibleByDebuggerVariables(
node: MethodNode,
typeAnnotatedFrames: TypeAnnotatedFrames
): Array<BitSet> {
val res = Array(node.instructions.size()) { BitSet(node.maxLocals) }
for (local in node.localVariables) {
if (local.name.isInvisibleDebuggerVariable()) continue
for (index in node.instructions.indexOf(local.start) until node.instructions.indexOf(local.end)) {
if (Type.getType(local.desc).sort == typeAnnotatedFrames[index]?.getLocal(local.index)?.type?.sort) {
res[index].set(local.index)
}
}
}
return res
}
private fun defVar(frame: VariableLivenessFrame, insn: AbstractInsnNode) {
if (insn is VarInsnNode && insn.isStoreOperation()) {
@@ -80,22 +53,10 @@ private fun defVar(frame: VariableLivenessFrame, insn: AbstractInsnNode) {
}
}
private fun useVar(
frame: VariableLivenessFrame,
insn: AbstractInsnNode,
node: MethodNode,
visibleByDebuggerVariables: BitSet
) {
frame.markAllAlive(visibleByDebuggerVariables)
private fun useVar(frame: VariableLivenessFrame, insn: AbstractInsnNode) {
if (insn is VarInsnNode && insn.isLoadOperation()) {
frame.markAlive(insn.`var`)
} else if (insn is IincInsnNode) {
frame.markAlive(insn.`var`)
}
}
private fun String.isInvisibleDebuggerVariable(): Boolean =
startsWith(JvmAbi.LOCAL_VARIABLE_NAME_PREFIX_INLINE_ARGUMENT) ||
startsWith(JvmAbi.LOCAL_VARIABLE_NAME_PREFIX_INLINE_FUNCTION) ||
this == SUSPEND_FUNCTION_COMPLETION_PARAMETER_NAME
}

View File

@@ -69,9 +69,10 @@ abstract class PrimitiveNumberRangeIntrinsicRangeValue(
?: throw AssertionError("Floating point intrinsic range value should be a range literal")
InFloatingPointRangeLiteralExpressionGenerator(operatorReference, rangeLiteral, comparisonGenerator, codegen.frameMap)
}
else -> InIntegralContinuousRangeExpressionGenerator(
operatorReference, rangeContainsTypeInfo, getBoundedValue(codegen), comparisonGenerator, codegen.frameMap
)
else ->
InIntegralContinuousRangeExpressionGenerator(
operatorReference, rangeContainsTypeInfo, getBoundedValue(codegen), comparisonGenerator, codegen.frameMap
)
}
}

View File

@@ -208,17 +208,25 @@ fun isPrimitiveRangeContains(descriptor: CallableDescriptor): Boolean {
}
fun isUnsignedIntegerRangeContains(descriptor: CallableDescriptor): Boolean {
if (descriptor.name.asString() != "contains") return false
val dispatchReceiverType = descriptor.dispatchReceiverParameter?.type
val extensionReceiverType = descriptor.extensionReceiverParameter?.type
return (dispatchReceiverType != null && isUnsignedRange(dispatchReceiverType)) ||
(extensionReceiverType != null && isUnsignedRange(extensionReceiverType))
when {
dispatchReceiverType != null && extensionReceiverType == null -> {
if (descriptor.name.asString() != "contains") return false
return isUnsignedRange(dispatchReceiverType)
}
extensionReceiverType != null && dispatchReceiverType == null -> {
if (!descriptor.isTopLevelInPackage("contains", "kotlin.ranges")) return false
return isUnsignedRange(extensionReceiverType)
}
else ->
return false
}
}
fun isPrimitiveNumberRangeExtensionContainsPrimitiveNumber(descriptor: CallableDescriptor): Boolean {
if (descriptor.name.asString() != "contains") return false
if (!descriptor.isTopLevelInPackage("contains", "kotlin.ranges")) return false
val extensionReceiverType = descriptor.extensionReceiverParameter?.type ?: return false

View File

@@ -87,7 +87,10 @@ fun getComparisonGeneratorForRangeContainsCall(
getComparisonGeneratorForKotlinType(elementType)
KotlinBuiltIns.isUInt(elementType) ->
UIntComparisonGenerator
if (KotlinBuiltIns.isULong(valueParameterType))
null
else
UIntComparisonGenerator
KotlinBuiltIns.isULong(elementType) ->
ULongComparisonGenerator

View File

@@ -301,7 +301,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
super.serializeErrorType(type, builder)
}
private fun <K, V> getBinding(slice: SerializationMappingSlice<K, V>, key: K): V? =
private fun <K : Any, V> getBinding(slice: SerializationMappingSlice<K, V>, key: K): V? =
bindings.get(slice, key) ?: globalBindings.get(slice, key)
private inner class SignatureSerializer {

View File

@@ -31,6 +31,9 @@ dependencies {
compile(project(":kotlin-util-io"))
compile(project(":compiler:ir.serialization.common"))
// TODO: as soon as cli-jvm is extracted out of this module, move this dependency there
compileOnly(project(":compiler:ir.tree.impl"))
compileOnly(toolsJarApi())
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }

View File

@@ -388,6 +388,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
}
if (inlineClasses) {
@@ -467,6 +468,8 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
if (!functionReferenceWithDefaultValueFeaturePassedExplicitly)
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
}
if (featuresThatForcePreReleaseBinaries.isNotEmpty()) {

View File

@@ -6,6 +6,7 @@ plugins {
dependencies {
compile(project(":compiler:cli"))
compile(project(":compiler:ir.serialization.js"))
compileOnly(project(":compiler:ir.tree.persistent"))
runtimeOnly(project(":kotlin-reflect"))
if (Platform[193].orLower()) {
compile(intellijDep()) { includeJars("picocontainer", rootProject = rootProject) }

View File

@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.cli.common.messages.*
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.library.resolver.KotlinLibraryResolveResult
import org.jetbrains.kotlin.psi.KtFile
@@ -87,6 +88,7 @@ fun buildKLib(
configuration = configuration,
allDependencies = allDependencies,
friendDependencies = emptyList(),
irFactory = PersistentIrFactory,
outputKlibPath = outputPath,
nopack = true
)

View File

@@ -24,13 +24,17 @@ import org.jetbrains.kotlin.cli.common.messages.MessageUtil
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
import org.jetbrains.kotlin.incremental.js.IncrementalNextRoundChecker
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer
import org.jetbrains.kotlin.ir.backend.js.*
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
import org.jetbrains.kotlin.js.config.EcmaVersion
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.js.config.JsConfig
@@ -193,6 +197,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
configuration = config.configuration,
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
irFactory = PersistentIrFactory,
outputKlibPath = outputKlibPath,
nopack = arguments.irProduceKlibDir
)

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.cli.jvm.compiler;
import com.intellij.DynamicBundle;
import com.intellij.codeInsight.ContainerProvider;
import com.intellij.codeInsight.runner.JavaMainMethodProvider;
import com.intellij.core.JavaCoreApplicationEnvironment;
import com.intellij.lang.MetaLanguage;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.psi.FileContextProvider;
import com.intellij.psi.augment.PsiAugmentProvider;
import com.intellij.psi.compiled.ClassFileDecompilers;
import com.intellij.psi.meta.MetaDataContributor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem;
public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnvironment {
public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) {
KotlinCoreApplicationEnvironment environment = new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode);
registerExtensionPoints();
return environment;
}
private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) {
super(parentDisposable, unitTestMode);
}
private static void registerExtensionPoints() {
registerApplicationExtensionPoint(DynamicBundle.LanguageBundleEP.EP_NAME, DynamicBundle.LanguageBundleEP.class);
registerApplicationExtensionPoint(FileContextProvider.EP_NAME, FileContextProvider.class);
registerApplicationExtensionPoint(MetaDataContributor.EP_NAME, MetaDataContributor.class);
registerApplicationExtensionPoint(PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
registerApplicationExtensionPoint(JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);
registerApplicationExtensionPoint(ContainerProvider.EP_NAME, ContainerProvider.class);
registerApplicationExtensionPoint(ClassFileDecompilers.getInstance().EP_NAME, ClassFileDecompilers.Decompiler.class);
registerApplicationExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(Extensions.getRootArea());
}
@Nullable
@Override
protected VirtualFileSystem createJrtFileSystem() {
return new CoreJrtFileSystem();
}
}

View File

@@ -52,8 +52,12 @@ import org.jetbrains.kotlin.codegen.KotlinCodegenFacade
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.GenerationStateEventCallback
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.diagnostics.*
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
import org.jetbrains.kotlin.fir.FirPsiSourceElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.collectors.FirDiagnosticsCollector
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
import org.jetbrains.kotlin.fir.backend.Fir2IrConverter
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendClassResolver
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmClassCodegen
@@ -71,6 +75,7 @@ import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.ir.backend.jvm.jvmResolveLibraries
import org.jetbrains.kotlin.ir.backend.jvm.serialization.JvmManglerDesc
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.javac.JavacWrapper
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
import org.jetbrains.kotlin.modules.Module
@@ -82,6 +87,7 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.diagnostics.SimpleDiagnostics
import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.utils.newLinkedHashMapWithExpectedSize
@@ -355,17 +361,28 @@ object KotlinToJVMBytecodeCompiler {
val firProvider = (session.firProvider as FirProviderImpl)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val resolveTransformer = FirTotalResolveProcessor(session)
val collector = FirDiagnosticsCollector.create(session)
val diagnostics = mutableListOf<FirDiagnostic<*>>()
val firFiles = ktFiles.map {
val firFile = builder.buildFirFile(it)
firProvider.recordFile(firFile)
firFile
}.also {
}.also { firFiles ->
try {
resolveTransformer.process(it)
resolveTransformer.process(firFiles)
firFiles.forEach {
diagnostics += collector.collectDiagnostics(it)
}
} catch (e: Exception) {
throw e
}
}
AnalyzerWithCompilerReport.reportDiagnostics(
SimpleDiagnostics(
diagnostics.map { it.toRegularDiagnostic() }
),
environment.messageCollector
)
val debugTargetDescription = "target " + module.getModuleName() + "-" + module.getModuleType() + " "
val codeLines = environment.countLinesOfCode(ktFiles)
@@ -378,9 +395,8 @@ object KotlinToJVMBytecodeCompiler {
val (moduleFragment, symbolTable, sourceManager, components) =
Fir2IrConverter.createModuleFragment(
session, resolveTransformer.scopeSession, firFiles,
moduleConfiguration.languageVersionSettings, signaturer = signaturer,
generatorExtensions = JvmGeneratorExtensions(),
mangler = FirJvmKotlinMangler(session)
moduleConfiguration.languageVersionSettings, signaturer,
JvmGeneratorExtensions(), FirJvmKotlinMangler(session), IrFactoryImpl
)
performanceManager?.notifyIRTranslationFinished(ktFiles.size, codeLines, debugTargetDescription)
@@ -442,6 +458,30 @@ object KotlinToJVMBytecodeCompiler {
return writeOutputs(environment, projectConfiguration, chunk, outputs)
}
private fun FirDiagnostic<*>.toRegularDiagnostic(): Diagnostic {
val psiSource = element as FirPsiSourceElement<*>
@Suppress("TYPE_MISMATCH")
when (this) {
is FirSimpleDiagnostic ->
return SimpleDiagnostic(
psiSource.psi, factory.psiDiagnosticFactory, severity
)
is FirDiagnosticWithParameters1<*, *> ->
return DiagnosticWithParameters1(
psiSource.psi, this.a, factory.psiDiagnosticFactory, severity
)
is FirDiagnosticWithParameters2<*, *, *> ->
return DiagnosticWithParameters2(
psiSource.psi, this.a, this.b, factory.psiDiagnosticFactory, severity
)
is FirDiagnosticWithParameters3<*, *, *, *> ->
return DiagnosticWithParameters3(
psiSource.psi, this.a, this.b, this.c, factory.psiDiagnosticFactory, severity
)
}
throw IllegalArgumentException("Unknown diagnostics: $this")
}
private fun getBuildFilePaths(buildFile: File?, sourceFilePaths: List<String>): List<String> =
if (buildFile == null) sourceFilePaths
else sourceFilePaths.map { path ->

View File

@@ -4,8 +4,6 @@ plugins {
id("jps-compatible")
}
jvmTarget = "1.6"
val ktorExcludesForDaemon: List<Pair<String, String>> by rootProject.extra
dependencies {

View File

@@ -36,6 +36,7 @@ sourceSets {
}
projectTest(parallel = true) {
dependsOn(":dist")
workingDir = rootDir
jvmArgs!!.removeIf { it.contains("-Xmx") }
maxHeapSize = "3g"

View File

@@ -259,3 +259,4 @@ public final class LongRange : R|kotlin/ranges/LongProgression|, R|kotlin/ranges
}
}

View File

@@ -1,4 +1,6 @@
@R|java/lang/annotation/Documented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) public abstract annotation class MyNullable : R|kotlin/Annotation| {
public constructor(): R|MyNullable|
}
public open class NonNullNever : R|kotlin/Any| {
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|kotlin/String?|

View File

@@ -11,4 +11,6 @@
}
@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class FieldsAreNullable : R|kotlin/Annotation| {
public constructor(): R|FieldsAreNullable|
}

View File

@@ -7,10 +7,18 @@
}
@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|spr/UnknownNullability|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class ForceFlexibility : R|kotlin/Annotation| {
public constructor(): R|spr/ForceFlexibility|
}
@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| {
public constructor(): R|spr/NonNullApi|
}
@R|java/lang/annotation/Target|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| {
public constructor(): R|spr/Nullable|
}
@R|java/lang/annotation/Documented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) public abstract annotation class UnknownNullability : R|kotlin/Annotation| {
public constructor(): R|spr/UnknownNullability|
}

View File

@@ -21,8 +21,14 @@ public abstract interface B : R|kotlin/Any| {
}
@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|spr/UnknownNullability|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class ForceFlexibility : R|kotlin/Annotation| {
public constructor(): R|spr/ForceFlexibility|
}
@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| {
public constructor(): R|spr/NonNullApi|
}
@R|java/lang/annotation/Documented|() @R|javax/annotation/meta/TypeQualifierNickname|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) public abstract annotation class UnknownNullability : R|kotlin/Annotation| {
public constructor(): R|spr/UnknownNullability|
}

View File

@@ -55,6 +55,10 @@
}
@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| {
public constructor(): R|NonNullApi|
}
@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NullableApi : R|kotlin/Annotation| {
public constructor(): R|NullableApi|
}

View File

@@ -13,8 +13,14 @@
}
@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class FieldsAreNullable : R|kotlin/Annotation| {
public constructor(): R|FieldsAreNullable|
}
@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| {
public constructor(): R|NonNullApi|
}
@R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/CheckForNull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|(), R|java/lang/annotation/ElementType.FIELD|())) public abstract annotation class NullableApi : R|kotlin/Annotation| {
public constructor(): R|NullableApi|
}

View File

@@ -11,6 +11,10 @@
}
@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.TYPE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| {
public constructor(): R|spr/NonNullApi|
}
@R|java/lang/annotation/Target|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| {
public constructor(): R|spr/Nullable|
}

View File

@@ -11,6 +11,10 @@ public open class A : R|kotlin/Any| {
}
@R|java/lang/annotation/Target|(R|java/lang/annotation/ElementType.PACKAGE|()) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|() @R|javax/annotation/meta/TypeQualifierDefault|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) public abstract annotation class NonNullApi : R|kotlin/Annotation| {
public constructor(): R|spr/NonNullApi|
}
@R|java/lang/annotation/Target|(<implicitArrayOf>(R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.PARAMETER|())) @R|java/lang/annotation/Retention|(R|java/lang/annotation/RetentionPolicy.RUNTIME|()) @R|java/lang/annotation/Documented|() @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) @R|javax/annotation/meta/TypeQualifierNickname|() public abstract annotation class Nullable : R|kotlin/Annotation| {
public constructor(): R|spr/Nullable|
}

View File

@@ -11,8 +11,7 @@ public/*package*/ open class A : R|kotlin/Any| {
}
public final enum class Mixed : R|kotlin/Enum<ft<Mixed, Mixed?>!>| {
public final static field NOT_ENTRY_EITHER: R|Mixed|
public final static enum entry NOT_ENTRY_EITHER: R|Mixed|
public final static fun values(): R|kotlin/Array<Mixed>| {
}
@@ -21,10 +20,8 @@ public final enum class Mixed : R|kotlin/Enum<ft<Mixed, Mixed?>!>| {
}
public final enum class Signs : R|kotlin/Enum<ft<Signs, Signs?>!>| {
public final static field HELLO: R|Signs|
public final static field WORLD: R|Signs|
public final static enum entry HELLO: R|Signs|
public final static enum entry WORLD: R|Signs|
public final static field X: R|ft<Signs, Signs?>!|
public final static fun values(): R|kotlin/Array<Signs>| {

View File

@@ -0,0 +1,17 @@
// WITH_RUNTIME
fun foo(p: Int) {
val a = arrayOf(1, 2, 3)
val b = arrayOf(3, 2, 1)
if (a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS!>==<!> b) { }
}
fun testsFromIdea() {
val a = arrayOf("a")
val b = a
val c: Any? = null
a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS!>==<!> b
a == c
a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS!>!=<!> b
}

View File

@@ -0,0 +1,18 @@
FILE: ArrayEqualityCanBeReplacedWithEquals.kt
public final fun foo(p: R|kotlin/Int|): R|kotlin/Unit| {
lval a: R|kotlin/Array<kotlin/Int>| = R|kotlin/arrayOf|<R|kotlin/Int|>(vararg(Int(1), Int(2), Int(3)))
lval b: R|kotlin/Array<kotlin/Int>| = R|kotlin/arrayOf|<R|kotlin/Int|>(vararg(Int(3), Int(2), Int(1)))
when () {
==(R|<local>/a|, R|<local>/b|) -> {
}
}
}
public final fun testsFromIdea(): R|kotlin/Unit| {
lval a: R|kotlin/Array<kotlin/String>| = R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(a)))
lval b: R|kotlin/Array<kotlin/String>| = R|<local>/a|
lval c: R|kotlin/Any?| = Null(null)
==(R|<local>/a|, R|<local>/b|)
==(R|<local>/a|, R|<local>/c|)
!=(R|<local>/a|, R|<local>/b|)
}

View File

@@ -0,0 +1,3 @@
interface IC {
fun toString(x: String): String = "IC$x"
}

View File

@@ -0,0 +1,7 @@
FILE: StringTemplate.kt
public abstract interface IC : R|kotlin/Any| {
public open fun toString(x: R|kotlin/String|): R|kotlin/String| {
^toString <strcat>(String(IC), R|<local>/x|.R|kotlin/Any.toString|())
}
}

View File

@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
fun Boolean.toInt() = if (this) 1 else 0
fun test(x: Int, y: Int): Int {
return (x > y).toInt()
}

View File

@@ -0,0 +1,15 @@
FILE: booleanToInt.kt
public final fun R|kotlin/Boolean|.toInt(): R|kotlin/Int| {
^toInt when () {
this@R|/toInt| -> {
Int(1)
}
else -> {
Int(0)
}
}
}
public final fun test(x: R|kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Int| {
^test CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(R|<local>/y|)).R|/toInt|()
}

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = Byte.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toByte()<!>

View File

@@ -0,0 +1,3 @@
FILE: byte.kt
public final val foo: R|kotlin/Byte| = Q|kotlin/Byte|.R|kotlin/Byte.Companion.MAX_VALUE|.R|kotlin/Byte.toByte|()
public get(): R|kotlin/Byte|

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 'a'.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toChar()<!>

View File

@@ -0,0 +1,3 @@
FILE: char.kt
public final val foo: R|kotlin/Char| = Char(a).R|kotlin/Char.toChar|()
public get(): R|kotlin/Char|

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 1.1.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toDouble()<!>

View File

@@ -0,0 +1,3 @@
FILE: double.kt
public final val foo: R|kotlin/Double| = Double(1.1).R|kotlin/Double.toDouble|()
public get(): R|kotlin/Double|

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 1.1f.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toFloat()<!>

View File

@@ -0,0 +1,3 @@
FILE: float.kt
public final val foo: R|kotlin/Float| = Float(1.1).R|kotlin/Float.toFloat|()
public get(): R|kotlin/Float|

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = 1.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toInt()<!>

View File

@@ -0,0 +1,3 @@
FILE: int.kt
public final val foo: R|kotlin/Int| = Int(1).R|kotlin/Int.toInt|()
public get(): R|kotlin/Int|

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = Long.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toLong()<!>

View File

@@ -0,0 +1,3 @@
FILE: long.kt
public final val foo: R|kotlin/Long| = Q|kotlin/Long|.R|kotlin/Long.Companion.MAX_VALUE|.R|kotlin/Long.toLong|()
public get(): R|kotlin/Long|

View File

@@ -0,0 +1,5 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo(s: String?) {
val t: String = s.toString()
}

View File

@@ -0,0 +1,4 @@
FILE: nullable.kt
public final fun foo(s: R|kotlin/String?|): R|kotlin/Unit| {
lval t: R|kotlin/String| = R|<local>/s|.R|kotlin/toString|()
}

View File

@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
data class Foo(val name: String)
fun nullable2(foo: Foo?) {
val s: String = foo?.name.toString()
}

View File

@@ -0,0 +1,17 @@
FILE: nullable2.kt
public final data class Foo : R|kotlin/Any| {
public constructor(name: R|kotlin/String|): R|Foo| {
super<R|kotlin/Any|>()
}
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final fun copy(name: R|kotlin/String| = this@R|/Foo|.R|/Foo.name|): R|Foo|
}
public final fun nullable2(foo: R|Foo?|): R|kotlin/Unit| {
lval s: R|kotlin/String| = R|<local>/foo|?.{ $subj$.R|/Foo.name| }.R|kotlin/toString|()
}

View File

@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
val foo: String? = null
foo?.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>
}

View File

@@ -0,0 +1,5 @@
FILE: safeString.kt
public final fun test(): R|kotlin/Unit| {
lval foo: R|kotlin/String?| = Null(null)
R|<local>/foo|?.{ $subj$.R|kotlin/Any.toString|() }
}

View File

@@ -0,0 +1,6 @@
// WITH_RUNTIME
data class Foo(val name: String)
fun test(foo: Foo?) {
val s: String? = foo?.name?.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>
}

View File

@@ -0,0 +1,17 @@
FILE: safeString2.kt
public final data class Foo : R|kotlin/Any| {
public constructor(name: R|kotlin/String|): R|Foo| {
super<R|kotlin/Any|>()
}
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final fun copy(name: R|kotlin/String| = this@R|/Foo|.R|/Foo.name|): R|Foo|
}
public final fun test(foo: R|Foo?|): R|kotlin/Unit| {
lval s: R|kotlin/String?| = R|<local>/foo|?.{ $subj$.R|/Foo.name| }?.{ $subj$.R|kotlin/Any.toString|() }
}

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = Short.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toShort()<!>

View File

@@ -0,0 +1,3 @@
FILE: short.kt
public final val foo: R|kotlin/Short| = Q|kotlin/Short|.R|kotlin/Short.Companion.MAX_VALUE|.R|kotlin/Short.toShort|()
public get(): R|kotlin/Short|

View File

@@ -0,0 +1,2 @@
// WITH_RUNTIME
val foo = "".<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>

View File

@@ -0,0 +1,3 @@
FILE: string.kt
public final val foo: R|kotlin/String| = String().R|kotlin/Any.toString|()
public get(): R|kotlin/String|

View File

@@ -0,0 +1,3 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
val foo = 1.toLong()

View File

@@ -0,0 +1,3 @@
FILE: toOtherType.kt
public final val foo: R|kotlin/Long| = Int(1).R|kotlin/Int.toLong|()
public get(): R|kotlin/Long|

View File

@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: UByte) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUByte()<!>
}

View File

@@ -0,0 +1,4 @@
FILE: uByte.kt
public final fun test(i: R|kotlin/UByte|): R|kotlin/Unit| {
lval foo: R|kotlin/UByte| = R|<local>/i|.R|kotlin/UByte.toUByte|()
}

View File

@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: UInt) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUInt()<!>
}

View File

@@ -0,0 +1,4 @@
FILE: uInt.kt
public final fun test(i: R|kotlin/UInt|): R|kotlin/Unit| {
lval foo: R|kotlin/UInt| = R|<local>/i|.R|kotlin/UInt.toUInt|()
}

View File

@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: ULong) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toULong()<!>
}

View File

@@ -0,0 +1,4 @@
FILE: uLong.kt
public final fun test(i: R|kotlin/ULong|): R|kotlin/Unit| {
lval foo: R|kotlin/ULong| = R|<local>/i|.R|kotlin/ULong.toULong|()
}

View File

@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test(i: UShort) {
val foo = i.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toUShort()<!>
}

View File

@@ -0,0 +1,4 @@
FILE: uShort.kt
public final fun test(i: R|kotlin/UShort|): R|kotlin/Unit| {
lval foo: R|kotlin/UShort| = R|<local>/i|.R|kotlin/UShort.toUShort|()
}

View File

@@ -0,0 +1,3 @@
// WITH_RUNTIME
val foo = ""
val bar = foo.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toString()<!>

View File

@@ -0,0 +1,5 @@
FILE: variable.kt
public final val foo: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final val bar: R|kotlin/String| = R|/foo|.R|kotlin/Any.toString|()
public get(): R|kotlin/String|

Some files were not shown because too many files have changed in this diff Show More