Compare commits

...

781 Commits

Author SHA1 Message Date
Elena Lepilkina
783851ffe0 Update Kotlin/Native version 2020-04-10 16:43:23 +03:00
Mikhail Zarechenskiy
9177b74a2e Fix delegated property resolve with intermediate ID provideDelegate
#KT-37406 Fixed
2020-04-09 15:48:10 +03:00
Toshiaki Kameyama
237bf05d17 Replace with: do not remove annotation use-site targets
(cherry picked from commit 06bd620dd6)
2020-04-09 17:45:45 +07:00
Kevin Bierhoff
6e0708fb4a only stub default constructor when compiling against .java source files
(cherry picked from commit 7448761dfd)
2020-04-08 19:28:00 +02:00
Kirill Shmakov
8652cff489 Fix tests for KT-38079
(cherry picked from commit 5460327c8d)
2020-04-08 11:16:10 +03:00
Kirill Shmakov
a0268f98ac Adapt exception line numbering for file link (KT-38079)
#KT-38079 Fixed

(cherry picked from commit 2b8b5af18b)
2020-04-08 11:16:06 +03:00
Vladimir Dolzhenko
1416564b72 Improvements in KotlinCopyPasteReferenceProcessor
reduced scope of nonBlockingRead to avoid long rerun of it
used smart pointers to keep valid elements over changes
moved back to non-modal progress

Relates to #KT-37414
#KT-37971 Fixed
#KT-37808 Fixed

(cherry picked from commit 87242b419a)
2020-04-07 18:42:31 +02:00
Ilya Matveev
2128d3dfe7 Gradle, native: Correctly clear flag when detecting parallel compilation
Issue #KT-37696 Fixed
2020-03-27 16:36:09 +07:00
Igor Yakovlev
3aaf376c73 Rename of "destruction declarations" to "destructuring declarations" in UI
Fixed #KT-37487
2020-03-26 12:33:09 +03:00
Dmitry Gridin
f6725ba880 i18n, konan: fix bundles
#KT-37483

(cherry picked from commit 3a5deaac09)
2020-03-26 10:18:02 +07:00
Vladimir Dolzhenko
e0be2044a5 Add checkCanceled on common autocompletion, hl resolve path
(cherry picked from commit 15e2afe5ab)

Relates to #KT-35135
2020-03-25 18:31:30 +01:00
Denis Zharkov
752ef6d3f3 Fix UI freezes caused by calls with a huge number overloads
While we have an overload resolution algorithm working for O(n^2),
call resolution for the single particular call may work more then just
a second.
Thus, we need to call ProgressManager.checkCanceled() with more granularity

^KT-35135 Fixed

(cherry picked from commit aac72871e7)
2020-03-25 18:30:59 +01:00
Vladimir Dolzhenko
05cbeae123 Fix incremental analysis for whitespaces
incremental analysis could ignore whitespace iff old item was whitespace

#KT-37629 Fixed

(cherry picked from commit 0073d260f8)
2020-03-25 16:15:20 +01:00
Vladimir Ilmov
b76f7ea56c (CoroutineDebugger) NPE fix in CoroutineAsyncStackTraceProvider 2020-03-25 11:14:37 +01:00
Dmitry Gridin
1566c2e219 i18n: NativeDefinitions: remove redundant bundle
#KT-37483

(cherry picked from commit 84c9929935)
2020-03-25 14:55:58 +07:00
Dmitry Gridin
cfbf8ee81a i18n: NativeDefinitions: add getter to property
#KT-37483

(cherry picked from commit afb8ff1dd5)
2020-03-25 14:55:57 +07:00
nikita.movshin
7fe66d3456 Fix changelog for 1.3.71 2020-03-23 18:05:51 +03:00
nikita.movshin
b659ad424c Fix changelog for 1.3.71 2020-03-23 15:50:11 +03:00
nikita.movshin
c4ab358aab Add changelog for 1.3.71 2020-03-23 11:49:56 +03:00
Dmitry Gridin
61a60317aa KotlinSdkType: fix i18n for 192
#KT-37632 Fixed
#KT-37483

(cherry picked from commit d84f528a47)
2020-03-20 18:20:14 +07:00
Alexander Podkhalyuzin
fc81533c16 Fixed diff with master 2020-03-20 09:50:02 +03:00
Valentin Kipyatkov
6473e35c73 Suppress suggested refactoring for unused private and local declarations
(cherry picked from commit 084276ef1f)
2020-03-20 09:45:44 +03:00
Valentin Kipyatkov
05c33660ae Do not suggest to update usages on renaming duplicated method or property
(cherry picked from commit e95d1c1224)
2020-03-20 09:45:31 +03:00
Valentin Kipyatkov
bcdb9344a6 Using new API
(cherry picked from commit 395ba7d008)
2020-03-20 09:45:16 +03:00
Valentin Kipyatkov
a5ef38ab18 Minor changes after code review
(cherry picked from commit 12bf8a44e7)
2020-03-20 09:43:54 +03:00
Valentin Kipyatkov
1c7a952ca6 Suggested Rename and Change Signature implementation for Kotlin
(cherry picked from commit b9a9000569)
2020-03-20 09:43:39 +03:00
Natalia Selezneva
703be29c0e Remove idea-gradle-tooling-api.jar from IDEA 2020
Because gradle-6.1.jar is now bundled into idea-gradle plugin

(cherry picked from commit 04c924a119)
2020-03-18 21:26:04 +03:00
Vladimir Dolzhenko
5519806a0e Run inspections after completion of general highlight pass in 201
#KT-37553 Fixed

(cherry picked from commit e1ae81e0a1)
2020-03-18 18:29:58 +01:00
Vladimir Dolzhenko
52cb5bfa36 Register Kotlin specific highlight passes via highlightingPassFactory in 193+
(cherry picked from commit 3cdcdbf6a8)
2020-03-18 18:29:38 +01:00
Vladimir Dolzhenko
5032dde2a6 Update to 201.6487-EAP-CANDIDATE-SNAPSHOT
(cherry picked from commit 2e20cdf2e6)
2020-03-18 18:28:25 +01:00
nikita.movshin
05d16cac90 Update K/N 2020-03-18 17:15:51 +03:00
Mikhail Zarechenskiy
c63f8176cb Fix project compilation against bootstrap compiler
This is needed after e3b6104489
2020-03-18 16:26:57 +03:00
Dmitry Gridin
a4438287f0 Formatter: fix continuation indent in call chain
#KT-37545 Fixed

(cherry picked from commit 7a3f6f5312)
2020-03-18 19:48:43 +07:00
Alexander Gorshenev
65956caf2e 1.3.70 to fail nicely on 1.4 klibs 2020-03-18 13:44:50 +03:00
Alexander Gorshenev
6616660456 Provide library producer compiler version in klib abi mismatch disagnostics 2020-03-18 13:44:50 +03:00
Alexander Gorshenev
deaeaa3ab3 Be prepared if in the future we extend klib abi version to a triple 2020-03-18 13:44:50 +03:00
Yan Zhulanow
33f30e2c42 Add more robust check for plugin application order (KT-37245)
Cause build to fail if the 'kotlin-kapt' plugin is applied before the
  main Kotlin plugin ('kotlin' or 'kotlin-android').
  The 'logger.error()' prints an error message, however the build
  continues.

(cherry picked from commit 897c48f97e)
2020-03-18 18:27:26 +09:00
Andrey Uskov
29e0c84996 Fix import of MPP projects in IDEA 2020.1 2020-03-18 11:35:07 +03:00
Anton Bannykh
46abf98743 JS: fix KT-37386
Anonymous object constructor parameters should not reuse JsName's
of the super class. Otherwise the temporary name renamer gets
confused.

(cherry picked from commit 63a909dee6)
2020-03-18 10:33:37 +03:00
Ilya Matveev
1c1b637cc4 Gradle, native: Forbid parallel in-process compiler execution
After enabling the in-process compiler execution, we got several
reports related to the race condition that takes place during
system properties configuring (e.g. KT-37442, KT-37444, probably
KT-37362).

The right fix here is to get rid of using system properties at all.
But it requires changes in many places of the K/N compiler and such
a patch is not safe enough to include it into a bug-fix release. So
it's decided to forbid parallel in-process compiler execution in 1.3.71

Issue #KT-37565 Fixed
2020-03-18 12:01:55 +07:00
Vladimir Dolzhenko
8a21d3d506 Don't show modal progress dialog on calculate method parameter hint info
#KT-37537 Fixed
Relates to #EA-216268

(cherry picked from commit c29f76580c)
2020-03-17 11:17:30 +01:00
Igor Yakovlev
3753bf0e20 Fix for change signature refactoring type resolve
Fixed #KT-37451
2020-03-17 12:03:58 +03:00
Dmitry Gridin
7c0f68c007 i18n: remove template name from bundle
#KT-37483

(cherry picked from commit 309ceef49a)
2020-03-17 15:38:37 +07:00
Dmitry Gridin
f12ecbccf5 Replace ConfigurationFactory with SimpleConfigurationType
#KT-36781 Fixed

(cherry picked from commit b9ffed3f04)
2020-03-16 22:11:05 +07:00
Sergey Igushkin
8ad6ace648 Filter kapt generate stubs classpath for non-existent entries (KT-37241)
Issue #KT-37241 Fixed

(cherry picked from commit a0aeb1554d)
2020-03-16 16:59:09 +03:00
Dmitry Gridin
5919fc4054 EqualsOrHashCodeInspection: update bundle for 201
#KT-37483

(cherry picked from commit 75f1fb0237)
2020-03-16 18:54:08 +07:00
Dmitry Gridin
7b06b6d233 i18n: fix findUsages for 201
#KT-37483

(cherry picked from commit c7a21a094f)
2020-03-16 18:54:00 +07:00
Dmitry Gridin
e5b208de44 i18n: fix findUsages dialogs
#KT-37483

(cherry picked from commit 49cdea7fdb)
2020-03-16 18:53:52 +07:00
Vladimir Dolzhenko
7933b06fdb Fix ExtensionTestUtil compilation for 191; CustomUsageSearcherTest compilation for 201
Relates to #KT-36657
2020-03-15 09:32:08 +01:00
Dmitry Gridin
d72913b100 i18n: update bundle for IdeErrorMessages 2020-03-13 20:23:39 +07:00
Dmitry Gridin
7fdd660ec8 i18n: update bundle for *.form 2020-03-13 20:23:39 +07:00
Dmitry Gridin
6bcc9008b3 i18n: fix tests 2020-03-13 20:23:39 +07:00
Dmitry Gridin
a9157c4657 i18n: update bundle for idea 2020-03-13 20:23:39 +07:00
Dmitry Gridin
2d1de19246 i18n: fix tests 2020-03-13 20:23:39 +07:00
Dmitry Gridin
eb7f5dc4f1 i18n: update bundle for jvm-debugger 2020-03-13 20:23:39 +07:00
Dmitry Gridin
458d8c91a3 i18n: add bundle for idea-repl 2020-03-13 20:23:39 +07:00
Dmitry Gridin
3ecdcf8436 i18n: add bundle for idea-live-templates 2020-03-13 20:23:39 +07:00
Dmitry Gridin
ad974f4c97 i18n: update bundle for idea-jvm 2020-03-13 20:23:38 +07:00
Dmitry Gridin
dfa615dc73 i18n: update bundle for idea-gradle 2020-03-13 20:23:38 +07:00
Dmitry Gridin
60566b0808 i18n: add bundle for idea-completion 2020-03-13 20:23:38 +07:00
Dmitry Gridin
0e19c05db8 i18n: update bundle for idea-analysis 2020-03-13 20:23:38 +07:00
Dmitry Gridin
392a70785a i18n: fix bundle location 2020-03-13 20:23:38 +07:00
Dmitry Gridin
1c24e4b72b i18n: add @NonNls to NodeIndentStrategy 2020-03-13 20:23:38 +07:00
Dmitry Gridin
6ab0bfebcc i18n: add bundle for idea/intentions 2020-03-13 20:23:38 +07:00
Dmitry Gridin
3b3ec92015 i18n: fix tests 2020-03-13 20:23:37 +07:00
Dmitry Gridin
6a15465e8d i18n: fix compilation 2020-03-13 20:23:37 +07:00
Dmitry Gridin
40d96812c4 i18n: fix text 2020-03-13 20:23:37 +07:00
Dmitry Gridin
7d2d6f1671 i18n: replace KotlinBundleBase with AbstractKotlinBundle 2020-03-13 20:23:37 +07:00
Dmitry Gridin
90c5b1d9b8 i18n: add bundle for idea/inspections 2020-03-13 20:23:37 +07:00
Dmitry Gridin
88c71bdb7d i18n: add bundle for idea/inspections/* 2020-03-13 20:23:37 +07:00
Dmitry Gridin
aa55353916 i18n: add bundle for idea/codeInsight 2020-03-13 20:23:37 +07:00
Dmitry Gridin
3448dd87be i18n: add bundle for idea/actions 2020-03-13 20:23:36 +07:00
Dmitry Gridin
669f801aeb i18n: add bundle for idea/quickfix 2020-03-13 20:23:36 +07:00
Dmitry Gridin
e70f1e9cc7 i18n: createByPattern: add @NonNls to parameters 2020-03-13 20:23:36 +07:00
Dmitry Gridin
66111eb9c6 i18n: KtPsiFactory: add @NonNls to parameters 2020-03-13 20:23:36 +07:00
Dmitry Gridin
8cbe8d8e63 i18n: add bundle for idea/quickfix/* 2020-03-13 20:23:36 +07:00
Dmitry Gridin
f0f252730d i18n: add bundle for idea/refactoring/ui 2020-03-13 20:23:36 +07:00
Dmitry Gridin
47133126b9 i18n: add bundle for idea/refactoring/safeDelete 2020-03-13 20:23:36 +07:00
Dmitry Gridin
16d8b66a62 i18n: fix tests 2020-03-13 20:23:36 +07:00
Roman Golyshev
5ed7937d83 i18n: move all kotlin bundles to resources/messages directories 2020-03-13 20:23:35 +07:00
Roman Golyshev
bc6d563205 i18n: fix bundle messages/testData messages where necessary 2020-03-13 20:23:35 +07:00
Roman Golyshev
e923541d07 i18n: add bundle for idea/refactoring/rename
- Modify `text.parameter` value to `Parameter`;
use `text.parameter.0` in previous usages
- Add @Nls and @NonNls annotations to few places
2020-03-13 20:23:35 +07:00
Roman Golyshev
ff192a7d81 i18n: add bundle for idea/refactoring/pushDown 2020-03-13 20:23:35 +07:00
Roman Golyshev
7be8159365 i18n: add bundle for idea/refactoring/pullUp
- Add @NonNls to used methods from `KtPsiFactory`
2020-03-13 20:23:35 +07:00
Roman Golyshev
936518d07f i18n: add bundle for idea/refactoring/move 2020-03-13 20:23:35 +07:00
Roman Golyshev
09b9c93bdf i18n: add bundle for idea/refactoring/memberInfo 2020-03-13 20:23:34 +07:00
Dmitry Gridin
4f0c3c583a i18n: fix compilation 2020-03-13 20:23:34 +07:00
Dmitry Gridin
9a010ffc33 i18n: move to KotlinBundle 2020-03-13 20:23:34 +07:00
Dmitry Gridin
bbb905b60a i18n: add bundle for idea/refactoring/introduce 2020-03-13 20:23:33 +07:00
Dmitry Gridin
87daee8641 i18n: add bundle for idea/refactoring/inline 2020-03-13 20:23:33 +07:00
Dmitry Gridin
88e5a34de0 i18n: add bundle for idea/refactoring/cutPaste 2020-03-13 20:23:33 +07:00
Dmitry Gridin
307c7962f1 i18n: add bundle for idea/refactoring/copy 2020-03-13 20:23:33 +07:00
Dmitry Gridin
a57e0c6957 i18n: add bundle for idea/refactoring/changeSignature 2020-03-13 20:23:33 +07:00
Dmitry Gridin
c9875fbb07 i18n: add @NotNls to bundles 2020-03-13 20:23:33 +07:00
Dmitry Gridin
330eeb62d2 i18n: add bundle for idea/reporter 2020-03-13 20:23:32 +07:00
Dmitry Gridin
1290e807df i18n: add bundle for idea/roots 2020-03-13 20:23:32 +07:00
Dmitry Gridin
d8f5f0a5a1 i18n: add bundle for idea/script 2020-03-13 20:23:32 +07:00
Dmitry Gridin
33876a4857 i18n: add bundle for idea/slicer 2020-03-13 20:23:32 +07:00
Dmitry Gridin
6187103cdd i18n: add bundle for idea/testIntegration 2020-03-13 20:23:32 +07:00
Dmitry Gridin
da536d816f i18n: add bundle for idea/update 2020-03-13 20:23:32 +07:00
Dmitry Gridin
b9fa42cd8a i18n: add bundle for idea/versions 2020-03-13 20:23:32 +07:00
Dmitry Gridin
c773216b68 i18n: add bundle for idea/internal 2020-03-13 20:23:32 +07:00
Dmitry Gridin
caa00c207d i18n: add bundle for idea/imports 2020-03-13 20:23:32 +07:00
Dmitry Gridin
ef459e1c47 i18n: fix bundle for idea/findUsages 2020-03-13 20:23:31 +07:00
Dmitry Gridin
f5e9c03e09 i18n: add bundle for idea/highlighter 2020-03-13 20:23:31 +07:00
Dmitry Gridin
d354fd16ae i18n: add bundle for idea/hierarchy 2020-03-13 20:23:31 +07:00
Dmitry Gridin
ef4ba70626 i18n: add bundle for idea/framework 2020-03-13 20:23:31 +07:00
Dmitry Gridin
ace06e0a86 i18n: add bundle for idea/formatter 2020-03-13 20:23:31 +07:00
Yan Zhulanow
30a886a9ae i18n: Internationalize part of the 'idea' module 2020-03-13 20:23:31 +07:00
Dmitry Gridin
b5a5d9be47 i18n: add bundle for idea/findUsages 2020-03-13 20:23:31 +07:00
Dmitry Gridin
c98735e25d i18n: add bundle for idea/filters 2020-03-13 20:23:31 +07:00
Dmitry Gridin
542073914d i18n: add bundle for idea/facet 2020-03-13 20:23:30 +07:00
Dmitry Gridin
15ceee9813 i18n: add bundle for idea/editor 2020-03-13 20:23:30 +07:00
Dmitry Gridin
9dc530d060 i18n: add bundle for idea/copy 2020-03-13 20:23:30 +07:00
Dmitry Gridin
d22610b448 i18n: fix compilation 192 2020-03-13 20:23:30 +07:00
Dmitry Gridin
d143f22405 i18n: add bundle for idea/configuration 2020-03-13 20:23:30 +07:00
Dmitry Gridin
8b5aab5b6c i18n: add bundle for j2k 2020-03-13 20:23:30 +07:00
Dmitry Gridin
5ea660ad49 i18n: fix properties in idea-gradle 2020-03-13 20:23:30 +07:00
Yan Zhulanow
3a86f7a50f i18n: Unify string naming in KotlinBundle 2020-03-13 20:23:30 +07:00
Yan Zhulanow
8838a72889 i18n: Add bundle for idea-jvm 2020-03-13 20:23:29 +07:00
Yan Zhulanow
40019a4c2b i18n: Add bundle for idea-gradle-native 2020-03-13 20:23:29 +07:00
Yan Zhulanow
c415b902ab i18n: Add bundle for idea-new-project-wizard 2020-03-13 20:23:29 +07:00
Yan Zhulanow
6aa10b4f1b i18n: Add bundle for idea-native 2020-03-13 20:23:29 +07:00
Yan Zhulanow
71a6667d5b i18n: Add bundle for idea-maven 2020-03-13 20:23:29 +07:00
Yan Zhulanow
f8c5f50f54 i18n: Add bundle for JVM debugger (evaluation) 2020-03-13 20:23:29 +07:00
Yan Zhulanow
d54cd6c3eb i18n: Add bundle for JVM debugger (coroutine) 2020-03-13 20:23:29 +07:00
Yan Zhulanow
b82870624e i18n: Add bundle for JVM debugger (core) 2020-03-13 20:23:29 +07:00
Yan Zhulanow
0f07aa3c26 i18n: Add bundle for New J2K 2020-03-13 20:23:29 +07:00
Yan Zhulanow
ef5de7cf96 i18n: Add bundle for New J2K services 2020-03-13 20:23:28 +07:00
Yan Zhulanow
f5e042dd67 i18n: Add bundle for idea-git 2020-03-13 20:23:28 +07:00
Yan Zhulanow
297598af4e i18n: Extract common caching code from bundles, J2K existing bundles 2020-03-13 20:23:28 +07:00
Yan Zhulanow
6b4bc145cd Rename .java to .kt 2020-03-13 20:23:28 +07:00
Dmitry Gridin
e7acac9db4 i18n: add bundle for idea-gradle 2020-03-13 20:23:28 +07:00
Dmitry Gridin
207ce72c42 i18n: rewrite bundles with AbstractKotlinBundle 2020-03-13 20:23:28 +07:00
Dmitry Gridin
3173881779 i18n: add bundle for idea-gradle 2020-03-13 20:23:28 +07:00
Dmitry Gridin
2892ccf168 i18n: add bundle for idea-core 2020-03-13 20:23:28 +07:00
Dmitry Gridin
9e2ebbf1af i18n: add bundle for ide-common 2020-03-13 20:23:27 +07:00
Dmitry Gridin
cc44efc1c3 i18n: add bundle for formatter 2020-03-13 20:23:27 +07:00
Dmitry Gridin
9380eb0258 i18n: introduce AbstractKotlinBundle 2020-03-13 20:23:27 +07:00
Nicolay Mitropolsky
1e691a7d23 Uast: UastFakeLightMethod hashcode fix (KT-37200)
(cherry picked from commit d1739289c6)
2020-03-13 12:00:38 +03:00
Nicolay Mitropolsky
7dc08666ed Uast: UastFakeLightMethod equality fix (KT-37200)
(cherry picked from commit 753d4b3cbd)
2020-03-13 12:00:38 +03:00
kovalp
1ea8900fc4 Do not stop searchTextOccurrences when isSearchForTextOccurrences is false
#KT-36657 Fixed

(cherry picked from commit 9ceca69154)
2020-03-13 10:00:07 +03:00
kovalp
e0bad4b4d3 Adds AdditionalExtractableAnalyser EP.
Adds annotations to ExtractableCodeDescriptor.
Adds functionality of adding annotations to KtPsiFactory.CallableBuilder

(cherry picked from commit 86f9cb6eef)
2020-03-13 09:59:50 +03:00
Dmitry Gridin
f4883f2912 UnusedUnaryOperatorInspection: shouldn't report on annotation entry
#KT-37294 Fixed

(cherry picked from commit 80caa063b3)
2020-03-12 15:58:20 +07:00
Anton Yalyshev
b9f1efe868 Disable FUS for Code Completion in 1.3.71
(cherry picked from commit b44be51b5c)
2020-03-12 10:53:41 +03:00
Mikhail Zarechenskiy
7254a72abc Filter out PSI values & valueOf methods from Java structure
These methods were recently added in Java PSI for IJ 201 and now have
 clash with the methods that we add on our side. Note that we can't
 start using methods from PSI as is because of different nullability:
 they have flexible types in their signatures while current methods
 have not-null types

 #KT-36095 Fixed
2020-03-12 10:25:30 +03:00
Leonid Startsev
5e603318b8 Do not check visibility of enum entries in explicit api mode
Although they're instances of DeclarationDescriptorWithVisibility,
they can't have visibilities

#KT-37040 Fixed

(cherry picked from commit 5d73550b48 and 01108d595c)
2020-03-11 17:13:10 +03:00
Leonid Startsev
9608f1798f Do not insert @SerializableWith marker annotation if already present
Such situation may happen if generic class is customized by user
with object-kind serializer. In such case, both arguments from
generateSerializerGetter and generateSerializerFactory are objects.
See linked issue for details:

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/749

(cherry picked from commit 15fa6ea757)
2020-03-11 17:12:24 +03:00
Leonid Startsev
373a1147c8 Do not check 'no ctor parameters' for serializable enums
fixes https://github.com/Kotlin/kotlinx.serialization/issues/742

Do not use serializableIrClass if it is not bound (this may happen
in case we're generating external serializer for library class)

fixes https://github.com/Kotlin/kotlinx.serialization/issues/744

(cherry picked from commit e20354926b)
2020-03-11 17:12:07 +03:00
Alexander Podkhalyuzin
9bc0dff4b9 Fixed generated text from jvm classfile, when quotes is required
#KT-34759 Fixed

(cherry picked from commit 5bb74d9840)
2020-03-11 15:55:29 +03:00
Alexander Udalov
726c66e0bf Remove unneeded workaround for IBM JDK and older intellij-core
The underlying problem (IDEA-206446) was fixed a long time ago and the
compiler is no longer affected by it.

 #KT-37286 Fixed

(cherry picked from commit 4d2ee279c0)
2020-03-11 13:25:04 +01:00
Vladimir Dolzhenko
2c5e3798b3 Make copy-paste resolve task modal to avoid invalid psi elements
Due to background formatting pasted PSI elements become invalid quite soon and it is not possible to make resolve

#KT-37414 Fixed

(cherry picked from commit 8af5e2bb04)
2020-03-11 11:59:07 +01:00
Nikolay Krasko
eb0e5e3aca 201: Update to 201.6073.9 2020-03-11 12:09:43 +03:00
Nikolay Krasko
0734da0461 201: Mute JS android tests in MultiplatformProjectImportingTest 2020-03-11 12:09:43 +03:00
Nikolay Krasko
4cfc3cfc99 201: Mute test because of NPE: element.parent must not be null (IDEA-234737) 2020-03-11 12:09:43 +03:00
Nikolay Krasko
8474b23b4f 201: Fix setup for AbstractKotlinExceptionFilterTest tests 2020-03-11 12:09:43 +03:00
Nikolay Krasko
bba8ed21bc 201: Mute SpringRenameTestGenerated tests 2020-03-11 12:09:43 +03:00
Nikolay Krasko
01ddb0be62 201: Remove declarations added for dropped newApi in hierarchy 2020-03-11 12:09:42 +03:00
Nikolay Krasko
4084c48edd 201: Update to 201.5985.32 2020-03-11 12:09:42 +03:00
Nikolay Krasko
67eea10b19 Update to 201.5259.13-EAP-SNAPSHOT
- No UIUtil.removeLeakingAppleListeners anymore
- getParameterHints nullability
- versions of lz4-java and guava were changed

(cherry picked from commit 2340a86d8d)
2020-03-11 12:09:42 +03:00
Nikolay Krasko
019ce473a5 Access to test root disposable through accessor
(cherry picked from commit 6c968859ad)
2020-03-11 12:09:42 +03:00
Nikolay Krasko
27b732e035 Refactoring: extract resetApplicationToNull to separate file
(cherry picked from commit 272ccf64ae)
2020-03-11 12:09:42 +03:00
Nikolay Krasko
34954f79aa Fixes 2020-03-11 12:09:42 +03:00
Nikolay Krasko
90a05e51e5 Remove trailing commas 2020-03-11 12:09:42 +03:00
Nikolay Krasko
01924b8d08 Disable parallel execution for gradle tests
(cherry picked from commit 208c7274dd)
2020-03-11 12:09:42 +03:00
Nikolay Krasko
889277827a Fix testUnresolvedMultiline test data
(cherry picked from commit d47fc7280b)
2020-03-11 12:09:42 +03:00
Nikolay Krasko
8f3ea372f2 201: Mute HierarchicalMultiplatformProjectImportingTest: No module dependency found
(cherry picked from commit 6a9dfd4935)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
de7e77053a 201: Mute quick fix tests: Range must be inside element being annotated
(cherry picked from commit 774db02b23)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
34e2208fbf 201: Mute TodoSearchTest: duplicate TODO items
(cherry picked from commit 06adac1abf)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
601a647ebe 201: Mute incremental compilation tests with constants
(cherry picked from commit 543168c61d)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
381e560335 201: Mute a lot of tests with enums
(cherry picked from commit 8501ea78c8)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
0278cf710b 201: Mute QuickFixTestGenerate: Range must be inside element being annotated
(cherry picked from commit 79e663828a)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
b1110e0e46 201: Mute GradleScriptInputsWatcherTest failures
(cherry picked from commit f5a97ea56e)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
d2b2f71789 201: Upgrade nodejs plugin in 201 branch
(cherry picked from commit dad7fd383c)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
ba0068578c 201: Mute NewMultiplatformProjectImportingTest tests
No module dependency found
No source folder found

(cherry picked from commit f0a4f838f2)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
44ce7b6017 201: Mute MultiplatformProjectImportingTest tests
Failed search dependency in Gradle tests.

(cherry picked from commit f4cd25ce72)
2020-03-11 12:09:41 +03:00
Nikolay Krasko
a4c4c8574c 201: Mute NewJavaToKotlinConverterSingleFileTestGenerated tests
(cherry picked from commit 67dee52b8a)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
0b6cce6b0b 201: Fix maven plugin loading by adding repository-search to runtime
(cherry picked from commit 958b8a0b10)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
40cc9b934b 201: Fix loading project in configuration tests
De-bunch AbstractConfigureKotlinTest.kt, just don't use field in 193.

(cherry picked from commit 0fcd011abb)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
769fdc2c1f 201: Trick idea home path exception with custom idea.home variable
(cherry picked from commit 1a01ba0ae5)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
6bc1ab9583 Copy 192 muted tests
(cherry picked from commit da2683d180)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
c76bca3483 Register JDK for default project to prevent create leaking one for Gradle import
(cherry picked from commit dd21736471)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
522529eb1c Enable mute in code for all KotlinLightCodeInsightFixtureTestCaseBase
(cherry picked from commit c9fd79c311)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
8c6ad6efe3 Minor: better asserts in TodoSearchTest.kt
(cherry picked from commit 1c0a9d2981)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
56417b7577 Enable mute test with database in BaseKotlinJpsBuildTestCase
(cherry picked from commit 26df2a5c68)
2020-03-11 12:09:40 +03:00
Nikolay Krasko
f1eebf60d9 Ignore auto-mute files
(cherry picked from commit 31ba40cc99)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
e8e8121aa1 Enable mute for KotlinCompletionTestCase
(cherry picked from commit c22272bbca)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
295cc79181 Update method after UsefulTestCase update to make in work in 201
(cherry picked from commit 66e2f95dba)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
d17d6386f7 Support auto-mute in parametrized JUnit 4 tests
(cherry picked from commit 3c3b1bb5e4)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
a8a80d0d31 Minor: remove unneeded class
(cherry picked from commit f042b04320)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
92fec04b91 Revert global project settings to LATEST_STABLE in teardown
(cherry picked from commit a46c6ce5df)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
b148d0c4a1 Always configure and restore api version settings in tests
(cherry picked from commit f995192f21)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
568553af3b Clean LANGUAGE_VERSION_SETTINGS after the test
(cherry picked from commit 6c83e9fb85)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
bc095ef1af Clean facet if it wasn't set before test (fix tests on 201)
(cherry picked from commit 19bc39d3ab)
2020-03-11 12:09:39 +03:00
Nikolay Krasko
e214a18f8d Always clean language and api versions after usage
(cherry picked from commit af3b057ba2)
2020-03-11 12:09:38 +03:00
Nikolay Krasko
3d4b7f1936 Refactoring: extract long function out of local context
(cherry picked from commit c0dac9bf32)
2020-03-11 12:09:38 +03:00
Nikolay Krasko
d95a94a6c1 Refactoring: always use compiler settings with de-configuration in tests
(cherry picked from commit 3a5f42cc5e)
2020-03-11 12:09:38 +03:00
Nikolay Krasko
fd4b10985a De-bunch KotlinLightCodeInsightFixtureTestCase.kt
(cherry picked from commit 018215f47d)
2020-03-11 12:09:38 +03:00
nikita.movshin
352d8cabf8 Fix changelog 2020-03-07 23:51:02 +03:00
nikita.movshin
9efc495990 Update compatibility range for AS 3.6 and 4.0 2020-03-06 19:09:33 +03:00
Sergey Igushkin
59e8a4992e Internal visibility between common source sets in Gradle (KT-37264)
In KotlinCompileCommon, pass the friendPaths and refinesPaths arguments

In KotlinNativeCompilation, add both friend and refined dependencies as
friends for now.

In getVisibleSourceSetsFromAssociateCompilations, exclude the metadata
compilations to avoid incorrect results (those compilations don't have
proper kotlin

Issue #KT-37264 Fixed
2020-03-06 18:44:57 +03:00
Sergey Igushkin
671f9ebe06 Support friend internal visibility in K2Metadata compiler (KT-37264)
Add and handle the friend paths and refines paths compiler arguments;
Reuse klib dependency module descriptors in the resolver for project;

Issue #KT-37264
2020-03-06 18:44:55 +03:00
Ilya Goncharov
1db02e921a [Gradle, JS] Move logic of resolving NpmDependency to Npm Api
#KT-36196 fixed

[Gradle, JS] Support transitive mode for npm dependencies

#KT-36196 fixed

[Gradle, JS] Fix naming

#KT-36196 fixed

[Gradle, JS] Consider transitivity in cache of npm dependencies

#KT-36196 fixed

[Gradle, JS] Migrate from singletons to classes

#KT-36196 fixed
2020-03-06 16:43:02 +03:00
Vladimir Dolzhenko
4eaabf2a1a Handle properly lambda change in incremental analysis
Fixed #KT-37273

(cherry picked from commit dc6be68a41)
2020-03-06 11:47:59 +01:00
Alexander Podkhalyuzin
709195d069 Revert "Since build updated for 193 branch due incompatibility"
This reverts commit 070a6546
2020-03-06 10:29:03 +03:00
Alexander Podkhalyuzin
070a654658 Since build updated for 193 branch due incompatibility
(cherry picked from commit 135ae32f75)
2020-03-06 10:26:16 +03:00
Dmitry Petrov
58f75f0ba5 Generate compiler tests 2020-03-04 20:26:23 +03:00
Dmitry Petrov
7cb6be8b18 KT-37024 Optimized delegated property metadata generation in inline fun 2020-03-04 20:26:22 +03:00
Vladimir Dolzhenko
c99801cc04 Use LightJavaModule.getModule for 193
Fixed #KT-37229

(cherry picked from commit 0be5a82460)
2020-03-04 17:23:34 +01:00
Yan Zhulanow
f8c36eb0a0 Changelog: remove "trailing comma" feature from 1.3.70 2020-03-04 20:44:45 +09:00
Yan Zhulanow
1889376aba Remove 1.4-specific language features from 1.3.70 changelog 2020-03-04 17:17:54 +09:00
Dmitriy Novozhilov
5d9e053928 Update ChangeLog.md 2020-03-03 19:34:15 +03:00
nikita.movshin
bfb48645f3 Update K/N 2020-03-03 12:53:48 +03:00
Dmitry Gridin
facddfc77c ExperimentalFixesFactory: OptIn shouldn't be added for old version
#KT-36478

(cherry picked from commit ecb7478794)
2020-03-03 14:50:39 +07:00
Natalia Selezneva
9922e745f7 .gradle.kts: fix freezes by avoiding fs walking
^KT-36502 Fixed
2020-03-02 16:35:44 +03:00
Ilya Goncharov
0cf79f851b [Gradle, JS] Fix timeout for debug
#KT-37035 fixed

(cherry picked from commit 7719dfca4a)
2020-02-26 11:58:19 +03:00
Dmitry Gridin
0f22b3cd43 Tests: fix some tests in formatter for AS
(cherry picked from commit 50c2c38624)
2020-02-26 14:43:34 +07:00
Dmitry Gridin
ead89cb080 Formatter: fix indent after trailing comma in calls
#KT-36917 Fixed

(cherry picked from commit ca598b6465)
2020-02-26 14:37:42 +07:00
Dmitry Gridin
f5528bca0b Formatter: shouldn't format property chains
(cherry picked from commit feaa53c4f2)
2020-02-26 11:52:33 +07:00
Dmitry Savvinov
e7d1dac7f0 Remove accidentally committed dependency on kotlin-gradle-testing.xml
This dependency is not needed in 1.3.70 and actually leads to duplicate
EP registration
2020-02-25 18:53:15 +03:00
Zalim Bashorov
ffc3d7ffc6 [JS DCE] Add an ability to define overwriting strategy when copying dependencies in dev-mode
* CLI option "-Xdev-mode-overwriting-strategy"
* System Property "kotlin.js.dce.devmode.overwriting.strategy"

Possible values: "older", "all".

#KT-36349 Fixed

(cherry picked from commit 6f61ea7f67)
2020-02-21 20:47:50 +03:00
Dmitry Savvinov
1f9b772053 Disable platform-specific checkers in common 2020-02-21 14:05:48 +03:00
Dmitry Savvinov
df2b049b85 Add test on platform checks in project without that target 2020-02-21 14:05:29 +03:00
Konstantin Tskhovrebov
d6c7b7bd5d Fix class name for test suite descriptor.
Issue #KT-36725 Fixed
Issue #KT-36716 Fixed
Issue #KT-36726 Fixed
2020-02-20 18:55:35 +03:00
Vladimir Dolzhenko
e9f42c04c1 Move copy/paste resource bundles to Kotlin
#EA-224686 #KT-36877 Fixed
2020-02-20 14:16:06 +01:00
Yan Zhulanow
9f2a5898c5 Update changelog (EAP 3) 2020-02-20 16:43:01 +09:00
nikita.movshin
62a0cd3d87 Update K/N 2020-02-19 08:44:50 +03:00
Sergey Igushkin
89b75bb158 Fix KT-36804 by eagerly instantiating the Kotlin/Native tasks
This commit partially reverts 970ee4539b.

The Kotlin/Native klib compilation task configuration logic involved
adding dependencies for the compiler plugin artifacts. However, the
compiler plugins classpath, shared across all of the K/N tasks, was
tracked as the tasks' input. This made the following scenario possible:

1. Configuration of some of the Kotlin/Native tasks is avoided at the
   evaluation phase;

2. During task graph construction, one of the tasks are evaluated, and
   to determine their dependencies, Gradle resolves their inputs,
   including the compiler plugins classpath mentioned above;

3. Another K/N task is evaluated afterwards, and the configuration logic
   attempts to add a dependency into the compiler plugin classpath
   configuration, which has already been resolved in (2).
   The build fails.

Fix this by cancelling task configuration avoidance for the K/N tasks.

Issue #KT-36804 Fixed
2020-02-18 17:01:36 +03:00
Nikolay Krasko
a0d64ea859 Make 201 plugin compatible with IDEA trunk (KT-36780)
^KT-36780 Fixed
2020-02-18 15:31:41 +03:00
Abduqodiri Qurbonzoda
40e104ff12 Mark shared global vals to fix K/N worker thread crash
(cherry picked from commit 5a4ce2aa4c)
2020-02-18 12:16:43 +03:00
nikita.movshin
17e43f0c37 Update K/N 2020-02-18 09:54:21 +03:00
Dmitry Savvinov
f7c4afd00d Force-set path to exact project for MPP run configurations
Otherwise, path will be set to the root project. Given that we provide
task names in relative form rather than absolute, that will lead to
launching this task in all subprojects (e.g. task 'jvmTest'). This might
be a huge issue, because when we create run configuration for specific
test method/class, we pass test filter as well. This test filter will
execute in all projects with matched test tasks, so if some other
subproject has similarly-named test task, but doesn't have a suitable
tests for that filter, the whole build will fail.

Note that the ideal fix would involve using fully-qualified task names:
the current approach might lead to isses in advanced scenarious (e.g.
when user selects several test files from different modules -- then, we
won't be able to find one exact project path for the whole test run)

^KT-35038 Fixed
2020-02-17 20:18:17 +03:00
Natalia Selezneva
f6685b30d6 Fix requesting KotlinDslScriptModels for 191
^KT-36756 Fixed
2020-02-17 11:22:40 +03:00
Sergey Rostov
de71c7bd06 .gradle.kts: more clear tooltip for out of project scripts notification
The current text/action/help text may not be clear: action is not related to project import, and help text doesn't make it clear.

#KT-36703 Fixed

(cherry picked from commit 2677fa7472)
2020-02-17 08:46:03 +03:00
Nikolay Krasko
4fe339c7b8 201: Fix icon set in ShowFirAction.kt 2020-02-17 01:43:22 +03:00
Nikolay Krasko
2126837b37 201: Fix usage of picocontainer and openapi 2020-02-17 01:42:30 +03:00
Nikolay Krasko
15fc7dec1f Clean trailing commas in ported commits 2020-02-16 23:37:54 +03:00
Roman Golyshev
556e5662bd KT-33372 Remove renaming file reference to the contents of the file
- There is still a hack with returning null from `getLastFileReference`,
it is here to keep KT-25674 issue fixed
- Overrides of `bindToElement` are removed, they caused renames of the
file references to their contents
- Code of `KotlinFilePathReferenceContributor.kt` is refactored
- ^KT-33372 ^KT-32514 ^KT-36306 Fixed

(cherry picked from commit 3461effd47)
2020-02-16 17:25:38 +03:00
Vladimir Dolzhenko
286cacd55e Add missed create in usage of new annotation highlighting API
Relates to #KT-36712

(cherry picked from commit ba5a335e95)
2020-02-15 08:29:16 +01:00
Natalia Selezneva
35f3a66e83 Fix compilation for AS35 2020-02-14 22:09:03 +03:00
Natalia Selezneva
88f2afdc4a Fix compilation for 1.3.70 2020-02-14 22:09:03 +03:00
Natalia Selezneva
c9b9d51e03 KotlinDslScriptsModel: pass provider mode properly 2020-02-14 22:09:01 +03:00
Natalia Selezneva
478db14ae6 KotlinDslScriptsModel: do not add prepare task for each gradle task invocation
^KT-36090 Fixed
2020-02-14 22:09:01 +03:00
Natalia Selezneva
8ef1b43f8d KotlinDslScriptsModel: pass correlationId during the request
^KT-36200 Fixed
2020-02-14 22:09:00 +03:00
Nikolay Krasko
8e04fafcc9 Remove trailing comma in 1.3.70 2020-02-14 21:21:32 +03:00
Nikolay Krasko
5edbed9ce7 201: Restrict 193 and own plugin for 201
(cherry picked from commit b75d0eb1a1)
2020-02-14 21:21:32 +03:00
Nikolay Krasko
002fa48b5a 201: Additional method getOwnReferences is introduced (bunched)
(cherry picked from commit a983b0bf74)
2020-02-14 21:21:32 +03:00
Nikolay Krasko
df02fb2628 201: Notification group was rewritten to Kotlin (no sam conversion)
(cherry picked from commit c9d97ae555)
2020-02-14 21:21:32 +03:00
Nikolay Krasko
5df8f4b961 201: ExecutionManager.contentManager was rewritten to Kotlin (bunched)
(cherry picked from commit 034243b5e7)
2020-02-14 21:21:31 +03:00
Nikolay Krasko
b7c35148d5 201: Processor<in PsiMethod> used in PsiShortNamesCache
(cherry picked from commit 1cb56ee946)
2020-02-14 21:21:31 +03:00
Nikolay Krasko
8f176d1035 201: Processors changed for UsageInfo and SliceUsage
(cherry picked from commit 9f6f8088e3)
2020-02-14 21:21:31 +03:00
Nikolay Krasko
f16d27c0d9 201: New DynamicBundle.LanguageBundleEP.EP_NAME needed for Java
https://github.com/JetBrains/intellij-community/commits/master/platform/core-api/src/com/intellij/DynamicBundle.java
(cherry picked from commit e23f3b54c6)
2020-02-14 21:21:31 +03:00
Nikolay Krasko
d9de37715e 201: Return JavaCoreApplicationEnvironment subclassing (bunched)
(cherry picked from commit 51244d7b1d)
2020-02-14 21:21:30 +03:00
Nikolay Krasko
3b59638d1c 201: Update version to 201.4515.24-EAP-SNAPSHOT
(cherry picked from commit cfd92f252a)
2020-02-14 21:21:30 +03:00
Nikolay Krasko
10c5cbaf2d 201: uast-tests.jar new dependency (depend on whole idea in tests)
(cherry picked from commit 314474c33b)
2020-02-14 21:21:30 +03:00
Nikolay Krasko
b874a194f1 201: Change of ProblemDescriptorBase.getFixes() return type
15a39d5742
(cherry picked from commit 7a89bd9c90)
2020-02-14 21:21:30 +03:00
Nikolay Krasko
e8d275b14a 201: Raw Class -> Class<?> (bunched)
f8b7e8b0b5
(cherry picked from commit 8cb4a8f5c6)
2020-02-14 21:21:30 +03:00
Nikolay Krasko
86e8d91728 201: PsiElementVisitor.visitElement nullability
(cherry picked from commit 890109beb8)
2020-02-14 21:21:29 +03:00
Nikolay Krasko
5ac0a620ab 201: BinaryFileStubBuilders.EP_NAME dropped (bunched)
(cherry picked from commit 98c6efaed9)
2020-02-14 21:21:29 +03:00
Nikolay Krasko
8c10c0268a 201: ProjectManagerEx.forceCloseProject(project, true) - no second parameter
(cherry picked from commit 2cc4d878a8)
2020-02-14 21:21:29 +03:00
Nikolay Krasko
6599094843 201: MadTestingUtil.enableAllInspections second parameter was removed
(cherry picked from commit 41ca51cb9e)
2020-02-14 21:21:29 +03:00
Nikolay Krasko
de5837acef 201: IdeaTestApplication -> TestApplicationManager in tests
(cherry picked from commit ae1cfff5d2)
2020-02-14 21:21:29 +03:00
Nikolay Krasko
49d7266e45 201: ExternalProjectsManagerImpl.disableProjectWatcherAutoUpdate removed (bunched)
(cherry picked from commit 3eb4d46c3d)
2020-02-14 21:21:28 +03:00
Nikolay Krasko
ffe2eb13f8 201: No PlatformTestCase.myProjectManager anymore (bunched)
(cherry picked from commit 10ce3c58e1)
2020-02-14 21:21:28 +03:00
Nikolay Krasko
832acaf366 201: TemplateManagerImpl.setTemplateTesting() parameter removed
(cherry picked from commit 75f05d8329)
2020-02-14 21:21:28 +03:00
Nikolay Krasko
04bf9d739b 201: Can't instantiate subclass of Task anymore
(cherry picked from commit b17a28381b)
2020-02-14 21:21:28 +03:00
Nikolay Krasko
bbe5c3df24 201: LookupImpl.focusedDegree renamed
(cherry picked from commit 54b1c512c5)
2020-02-14 21:21:27 +03:00
Nikolay Krasko
f02b1d7086 201: "testFramework" and "testFramework.core" libs introduced
(cherry picked from commit 56d960c65b)
2020-02-14 21:21:27 +03:00
Nikolay Krasko
ead0b45443 201: TextEditorWithPreview.java update - no ApiStatus (bunched)
Class should be removed

(cherry picked from commit 641fa1f17c)
2020-02-14 21:21:27 +03:00
Nikolay Krasko
6de44dfa56 201: AbstractProjectResolverExtension.createModule returns nullable
(cherry picked from commit 10aef79434)
2020-02-14 21:21:27 +03:00
Nikolay Krasko
48e904a3c5 201: Tool windows - source incompatible change with Kotlin (bunched)
(cherry picked from commit 066d77f396)
2020-02-14 21:21:27 +03:00
Nikolay Krasko
53e026505c 201: AbstractTreeNode generified in ide.projectView package (bunched)
(cherry picked from commit 4afd7c553b)
2020-02-14 21:21:26 +03:00
Nikolay Krasko
353c525657 201: TreeStructureProvider api changed: AbstractTreeNode<Any -> *>
(cherry picked from commit b425bf9a1b)
2020-02-14 21:21:26 +03:00
Nikolay Krasko
f8b7e76a3b 201: MoveDestination.analyzeModuleConflicts variance in parameter changed
(cherry picked from commit 9261f69dc8)
2020-02-14 21:21:26 +03:00
Nikolay Krasko
f3eebc9aad 201: Print type explicitly as RefactoringBundle.message() not null
(cherry picked from commit 7ea52ebb45)
2020-02-14 21:21:26 +03:00
Nikolay Krasko
b871555b72 201: MoveMultipleElementsViewDescriptor constructor nullability
(cherry picked from commit 4bc10f4c4f)
2020-02-14 21:21:26 +03:00
Nikolay Krasko
ada42cf5d6 201: AbstractNavBarModelExtension.adjustElement nullability (bunched)
(cherry picked from commit 2c72f53937)
2020-02-14 21:21:25 +03:00
Nikolay Krasko
e0c0b91750 201: Update hierarchy to new API (fix bugs introduced by the platform)
193 plugins with old API are affected while being binary compatible.

(cherry picked from commit 78385d5f63)
2020-02-14 21:21:25 +03:00
Nikolay Krasko
766046591b 201: Convert KotlinHierarchyViewTestBase.java because of typealiases
(cherry picked from commit 5e58a66c58)
2020-02-14 21:21:25 +03:00
Nikolay Krasko
08e72ec0d2 201: Rename .java to .kt
(cherry picked from commit 6bd91ec5b0)
2020-02-14 21:21:25 +03:00
Nikolay Krasko
580f0df4a2 201: Convert AbstractHierarchyTest.java because of typealiases
(cherry picked from commit 27467e4db7)
2020-02-14 21:21:25 +03:00
Nikolay Krasko
68cd7922b3 201: Rename .java to .kt
(cherry picked from commit 9f6f6838b8)
2020-02-14 21:21:24 +03:00
Nikolay Krasko
fcf9dd51c8 201: J2K manual
(cherry picked from commit 579dd8f8fe)
2020-02-14 21:21:24 +03:00
Nikolay Krasko
8a49941717 201: Convert KotlinCallHierarchyBrowser and KotlinCallHierarchyBrowser
Need convert to use Kotlin typealias feature.

(cherry picked from commit b92a228fb3)
2020-02-14 21:21:24 +03:00
Nikolay Krasko
2e8d948c88 201: Rename .java to .kt
(cherry picked from commit b795b38794)
2020-02-14 21:21:24 +03:00
Nikolay Krasko
0a46a9a6f9 201: RefactoringHelper.prepareOperation nullability (bunched)
(cherry picked from commit 866c33fbde)
2020-02-14 21:21:23 +03:00
Nikolay Krasko
07ad659769 201: No BinaryFileStubBuilders.EP_NAME anymore (bunched)
(cherry picked from commit 5440a5e228)
2020-02-14 21:21:23 +03:00
Nikolay Krasko
1500631dcf 201: CoreApplicationEnvironment.registerExtensionPointAndExtensions accepts Path
(cherry picked from commit beb70526a2)
2020-02-14 21:21:23 +03:00
Nikolay Krasko
00b6976e7f 201: PsiShortNamesCache.getAllClassNames(HashSet<String>) removed
(cherry picked from commit cf78058cc2)
2020-02-14 21:21:23 +03:00
Nikolay Krasko
457153f0b9 201: ContainerUtil.newTroveSet<T>() removed
(cherry picked from commit 4668518b2f)
2020-02-14 21:21:23 +03:00
Nikolay Krasko
7faf442b39 201: Remove JpsPersistentHashMap (bunched)
(cherry picked from commit 9d3d59fccb)
2020-02-14 21:21:22 +03:00
Nikolay Krasko
295091deb0 201: Processor<String> -> Processor<in String> in PsiShortNamesCache
(cherry picked from commit 1ecd1a293d)
2020-02-14 21:21:22 +03:00
Nikolay Krasko
8b0ae3a8d5 201: picocontainer.jar is removed
(cherry picked from commit 2a71fe97cf)
2020-02-14 21:21:22 +03:00
Nikolay Krasko
e91eb5dea4 201: versions.jar.streamex and versions.jar.gson versions
(cherry picked from commit 354d7306dd)
2020-02-14 21:21:22 +03:00
Nikolay Krasko
a3eed22f90 201: openapi.jar is removed
(cherry picked from commit 162c2f3dc9)
2020-02-14 21:21:22 +03:00
Nikolay Krasko
558898d1c1 201: Introduce 201 platform
(cherry picked from commit c26e1e9c1a)
2020-02-14 21:21:21 +03:00
Nikolay Krasko
4ca62a9baa 201: Create bunch
(cherry picked from commit 0f4fadf104)
2020-02-14 21:21:21 +03:00
Vladimir Dolzhenko
204e564ae6 Use new annotation highlighting API
Fixed #KT-36712

(cherry picked from commit 2e597a3a32)
2020-02-14 15:58:45 +01:00
Igor Yakovlev
dbbc5211f4 Disable facade fake classes with registry key
Fix #KT-35122 #EA-218642 #EA-217640
2020-02-14 17:40:58 +03:00
Shagen Ogandzhanian
01d88b27e1 Update dukat dependency to 0.0.28
(cherry picked from commit 3fcdf6c78c)
2020-02-14 15:16:16 +01:00
Ilya Goncharov
bdfedea231 [Gradle, JS] Migrate on strings
(cherry picked from commit 64f13ab3ae)

#KT-36714 fixed
2020-02-14 16:53:22 +03:00
Ilya Goncharov
801d697e57 [Gradle, JS] Add all possible values of library target as enums
(cherry picked from commit 9b462b76d4)
2020-02-14 16:53:00 +03:00
Ilya Goncharov
ad6c84f649 [Gradle, JS] Add webpack output
(cherry picked from commit fbabbfab44)
2020-02-14 16:52:58 +03:00
Natalia Selezneva
3137add817 GradleScriptInputsWatcher: move long running operation out of EDT
^KT-36502

(cherry picked from commit dc77df1083)
2020-02-14 16:32:26 +03:00
Leonid Startsev
a2f7cf1644 Remove special casing for Unit in kotlinx.serialization
Unignore test since it is in muted list and auto-generated

(cherry picked from commit bdf1441c80)
2020-02-14 15:33:27 +03:00
Mikhail Zarechenskiy
b7231d9b58 Enable new inference in IDE by default 2020-02-14 15:24:03 +03:00
Yan Zhulanow
c418b47a5e Minor: Update generated tests for KT-34569
(cherry picked from commit 36a6eedd9c)
2020-02-14 21:22:32 +09:00
Ivan Gavrilovic
80452f779f KT-35472: Detect when content of annotation processor changes
Even if annotation processor classpath is the same, in case
individual entries change (e.g. bulding annotationo processor
from source), KATP should run non-incrementally.

Test: KaptIncrementalWithIsolatingApt.testUnchangedAnnotationProcessorClasspathButContentChanged
2020-02-14 21:22:32 +09:00
Ivan Gavrilovic
3b45d80f5c KT-36113: Make KAPT classpath snapshot deterministic
When snapshotting a classpath entry, sort information about types
so there is no dependency on the order of entries in jar.

Test: ClasspathAnalyzerTest
2020-02-14 21:22:32 +09:00
Sergey Igushkin
95ec589834 Add a non-public-API mechanism to import free args for MPP source sets
Arguments can be set using a project extra property following the
pattern: `kotlin.mpp.freeCompilerArgsForSourceSet.$sourceSetName`.

Only a compilation's default source set free args are appended to the
compiler args during Gradle builds.

(cherry picked from commit 764bf1cb32)
2020-02-14 14:17:05 +03:00
Sergey Igushkin
11a46c8795 Fix API version parsing: add 1.4 to available values
In Kotlin 1.3, we didn't allow setting language version to 1.4. With
the default language version changed to 1.4, it worked because the
language version had only been checked in the setter of the language
settings, and the default value had not been checked.

(cherry picked from commit a8aa334203)
2020-02-14 14:17:02 +03:00
Sergey Igushkin
4edcf801a1 Fix MPP Gradle tests
* Use `maven { setUrl(...) }` in Groovy DSL
* Configure compilation tasks beforehand
  in testMppBuildWithCompilerPlugins
* Prevent `gradleSettingsScript()` from failing
  when no settings script is found

(cherry picked from commit cd32cef2b6)
2020-02-14 14:16:59 +03:00
Sergey Igushkin
34eb27ab9a Enable KlibBasedMppIT by default and on all host (using Linux targets)
(cherry picked from commit 77f60d6d6c)
2020-02-14 14:16:56 +03:00
Sergey Igushkin
16049dfe69 Compile common code to klib whenever HMPP is enabled
As the HMPP with *.kotlin_metadata was never widespread, we can
immediately move to *.klib compilations whenever a build author
enables HMPP.

(cherry picked from commit 5cc8dfb2a3)
2020-02-14 14:16:54 +03:00
Sergey Igushkin
a265f29532 Rework legacy metadata variant in MPP with source sets metadata
* Make publishing the compatibility variant optional, and don't publish
  the compatibility variant by default -- the library maintainer should
  do this explicitly
* To build the compatibility artifact, compile the commonMain source
  set using a separate compilation (the default `main` compilation,
  while creating a separate `commonMain` compilation; this separation
  is needed to be able to still compile *.kotlin_metadata from
  commonMain even when compiling *.klib from all source sets)
* When the compatibility variant is disabled, clear the dependencies of
  the `main` compilation and disable its Kotlin compilation task
* When the compatibility variant is enabled, exposed it for project
  dependencies resolution as well, so that its artifact can be used by
  the dependent project instead of the granular metadata artifact that
  will contain *.klib (which can't be read by the legacy compiler)
* Refactor the configuration of the metadata compilation dependencies:
  concentrate all the logic in one place and make it process the source
  sets graph lazily.

(cherry picked from commit 0ef8d23f57)
2020-02-14 14:16:52 +03:00
Sergey Igushkin
9d0db2f8eb Export implementation dependencies of Native-shared source sets as API
As the Kotlin/Native compiler always requires transitive dependencies
to be present among the libraries during compilation, it is necessary
to export the implementation dependencies of Native-shared source sets
as if they were API dependencies.

To do that, add the extendsFrom-relationship between the apiElements
configuration of the metadata target (so that Gradle adds the
dependencies to the transitive dependencies graph) and also add the
dependencies to the project structure metadata (so that the consumer
can find out that it's only their corresponding Native-shared source
sets that need these particular transitive dependencies)

(cherry picked from commit 8a08fef2b3)
2020-02-14 14:15:05 +03:00
Sergey Igushkin
12302390ab Use the project name + compilation name for secondary klib compilations
This helps avoid duplicate library names when compiling shared-Native
source sets (the resulting klibs will have a more unique name than just
the source set name which likely repeats between projects)

(cherry picked from commit 81216ceb51)
2020-02-14 14:15:03 +03:00
Abduqodiri Qurbonzoda
db3602d1b1 Scan functions for Sequences and Iterable #KT-7657
(cherry picked from commit ed7b8e9b85)
2020-02-13 21:36:59 +03:00
Ilya Kirillov
4b864e0168 Show experimental features panel only for non-stable plugin versions
Also, use registry as backend for features settings

(cherry picked from commit 531a63bd19)
2020-02-13 15:27:41 +03:00
Vladimir Dolzhenko
453dc53b1d Avoid using quite new ScratchFileService API
Relates to #KT-35918

(cherry picked from commit 918895b88f)
2020-02-13 12:22:30 +01:00
Ilya Kirillov
ab154aa097 Fix compilation for 191 & as35
(cherry picked from commit 40f907ec2f)
2020-02-11 23:53:35 +03:00
Vladimir Dolzhenko
e8575551cb Enforce analysis inside top-level property initializer
Relates to #KT-36460

(cherry picked from commit a0ed2c8640)
2020-02-11 17:00:24 +01:00
Ilya Kirillov
d1c052ae62 Do not render redundant Nullable annotations when generating declarations
#KT-36321 fixed

(cherry picked from commit 0fe5694cb7)
2020-02-11 14:55:24 +03:00
Ilya Kirillov
be9fe86352 Rename by-name parameter usage in function calls when renaming function's parameter
#KT-32999 fixed

(cherry picked from commit 4df8744b34)
2020-02-11 14:55:22 +03:00
Vladimir Dolzhenko
3a23083a92 Use PluginManagerCore instead of PluginManager
Relates to #KT-35918
2020-02-10 20:45:38 +01:00
Vladimir Dolzhenko
a1595675f9 Fixed MoveJavaInnerClassKotlinUsagesHandler after obsolete API drop off
Relates to #KT-35918

(cherry picked from commit b451c25dba)
2020-02-09 20:52:36 +01:00
Vladimir Dolzhenko
641bd35705 Added missed runReadAction to access psi on bg thread
Relates to #KT-24122

(cherry picked from commit 5b48f63bb9)
2020-02-08 15:08:38 +01:00
Vladimir Dolzhenko
f08804a3e5 Fix documentListener leakage in PluginStartupActivity
drop trailing comma
Fix 191, 192 compatibility

Relates to #KT-35918
2020-02-07 22:24:58 +01:00
Vladimir Dolzhenko
1f21c9a712 Cleaned IDEA 193 and below obsolete API
Fixed #KT-35918
2020-02-07 11:10:12 +01:00
Abduqodiri Qurbonzoda
c55ed7ac5f Update number of reachable nodes because of MutableList.removeFirst/Last
(cherry picked from commit b06645d1c0)
2020-02-06 21:28:16 +03:00
Natalia Selezneva
053af9a875 Tests: fix gradle tests for script configuration loading
Introduce `testAffectedGradleProjectFiles` property
to avoid full gradle project import in some tests

(cherry picked from commit e33a81a968)
2020-02-06 10:15:07 +03:00
Natalia Selezneva
5c5966730f Idea compatibility: remove usages of deprecated icons in Call Hierarchy
This also should fix the problem with overlay of icon and text in tree view
2020-02-06 10:15:07 +03:00
Natalia Selezneva
37f54f181e Idea compatibility: remove usages of deprecated icons in REPL, use similar ones 2020-02-06 10:15:07 +03:00
Ilya Matveev
1bfac9fde2 Fix data race in zip FileSystem reference counting
Issue #KT-36076 Fixed

(cherry picked from commit 0725a336fc)
2020-02-05 17:54:07 +07:00
Vladimir Dolzhenko
48429d9fe2 Fix 192 compilation for move remove redundant imports to bg thread
Relates to #KT-24122

(cherry picked from commit 6489b56fb0)
2020-02-04 18:41:22 +01:00
Vladimir Dolzhenko
bae024ed87 Move remove redundant imports to bg thread
#KT-24122 Fixed

(cherry picked from commit dd0613bc7a)
2020-02-04 16:46:59 +01:00
Ilya Goncharov
65e3655e62 [Gradle, JS] Fix test 2020-02-04 16:18:23 +03:00
Ilya Goncharov
3ab0a0d627 [Gradle, JS] Distribution and distributeResources
(cherry picked from commit 60da37404e)
2020-02-04 14:49:15 +03:00
Ilya Goncharov
c0857f79b1 [Gradle, JS] Fix Task Configuration Avoidance
(cherry picked from commit ca150005a8)
2020-02-04 14:48:50 +03:00
Ilya Goncharov
0f8d4ed143 [Gradle, JS] Distribution task depends on processResources
(cherry picked from commit a2b774b186)
2020-02-04 14:48:48 +03:00
Ilya Kirillov
0b97edbca5 Wizard: do not show disable/enable checkbox for new project wizard in AS
#KT-36195 fixed

(cherry picked from commit ed5156ee83)
2020-02-04 14:22:58 +03:00
Ilya Kirillov
8d14259225 Fix change signature refactoring
Do not increase modification count for OutOfCodeBlockTracker when KtTypeCodeFragment is modified

KtTypeCodeFragment is used in UI for providing completion for types.
When OutOfCodeBlockModification happens it invalidates ModuleDescriptors
But change signature relies on them which causes InvalidModuleException

#KT-35903 fixed
#KT-35689 fixed
#KT-34415 fixed
#KT-34415 fixed
2020-02-04 14:08:42 +03:00
Nicolay Mitropolsky
5d6c0c1d72 Uast: fix for Lambda in place call identifiers (KT-35432)
(cherry picked from commit 222ceb7698)
2020-02-04 11:19:35 +03:00
Nicolay Mitropolsky
7cfe41a913 Uast: fixes for Enum identifiers (KT-35432)
(cherry picked from commit ac3a8eb494)
2020-02-04 11:19:35 +03:00
Mikhail Zarechenskiy
53fb90f3d9 [NI] Record substituted generic signature for SAM arguments
#KT-36297 Fixed
2020-02-04 11:05:38 +03:00
Mark Punzalan
12d527bf5c ForLoopsLowering: Fix issue with break/continue in loop over withIndex.
(cherry picked from commit 3ee344b836)
2020-02-04 08:56:48 +01:00
Mikhail Zarechenskiy
28b69d0b3a Regenerate compiler tests 2020-02-04 10:32:08 +03:00
Mikhail Zarechenskiy
db8e045172 Update test data: add missing diagnostics for NI 2020-02-04 10:32:02 +03:00
Mikhail Glukhikh
bcfcb30104 [FIR] Add forgotten test data for old FE test 2020-02-04 10:31:55 +03:00
Dmitriy Novozhilov
b8fed578ca [TEST] Add js runtime to failing box test 2020-02-04 10:31:48 +03:00
Dmitriy Novozhilov
fe31eff855 Add js runtime to failing blackbox test 2020-02-04 10:31:42 +03:00
Dmitriy Novozhilov
a2a298214f [FIR-TEST] Mute failing blackbox test 2020-02-04 10:31:21 +03:00
Dmitriy Dolovov
d5ff419d0e Fix GradleNativeLibrariesInIDENamingTest 2020-02-04 14:19:19 +07:00
Dmitriy Dolovov
097e745b3c Fix: KotlinNativeABICompatibilityChecker.dispose() leads to dead lock
Issue #KT-36040
2020-02-04 14:19:10 +07:00
Yan Zhulanow
fdc700724c Update 1.3.70 changelog for EAP 2 2020-02-03 23:28:05 +09:00
Kirill Shmakov
a0516d6aec Use better wording in plugin advertiser
(cherry picked from commit 46b4620fdd)
2020-02-03 11:41:06 +03:00
Nikolay Krasko
63a3373c52 Leave hack for PsiSubstitutor in AS40 (KT-36039)
KotlinCoreApplicationEnvironment is not expected to be triggered from the plugin.
2020-01-31 01:33:53 +03:00
nikita.movshin
160ed0a438 Update K/N 2020-01-30 11:36:12 +03:00
Nikolay Krasko
7197b918e2 Update to a newer idea to fix bad initialization of PsiSubstitutor (KT-36039)
PsiSubstitutor instantiation doesn't need EmptySubstitutor service anymore.
Remove hack with interface field reassign that doesn't work with JDK >= 12.
2020-01-28 14:58:54 +03:00
Andrey Uskov
a7cabe352a Fixed locking statistics files when multiple gradle daemons started 2020-01-27 19:49:45 +03:00
nikita.movshin
712264aaac Update K/N 2020-01-27 12:01:43 +03:00
Vladimir Ilmov
1f7a27ad8f [coroutine] Coroutine's missing frames added from continuation info. 2020-01-27 09:27:39 +01:00
Ilya Kirillov
19b2247666 Fix as40 compilation: add missing bunch file 2020-01-27 10:31:34 +03:00
Ilya Kirillov
13cf304b0a Use snakeyaml from maven instead of from intellij
As new-project-wizard-cli module is not bundled into the plugin jar

(cherry picked from commit 69e9ae94c6)
2020-01-27 01:43:03 +03:00
Yan Zhulanow
55e6fbd3f1 Imitate behavior of old light classes to fix method run configurations (KT-33787)
The bug appeared when we turned “ultra light classes” on by default. The difference with the old implementation is that PsiClass.getTextRange() returns the correct non-null value. This triggers JavaExecutionUtil#stepIntoSingleClass() to return a light class instead of the original location (of a PsiIdentifier). So AbstractJavaTestConfigurationProducer#isConfigurationFromContext() returns true, and the wrong configuration is reused instead of creating the new one.
By the way, for Java it also returns an identifier because of the PsiTreeUtil.getParentOfType(element, PsiClass.class) != null check.

The proper fix should land in the newer versions of IDEA, however this (hopefully, temporary) hack will fix test method gutters for all platform versions.
2020-01-27 05:09:46 +09:00
Yan Zhulanow
36b81dffb8 Revert "Import Kotlin JUnit run configuration settings from Gradle"
This reverts commit 748cbd7e
2020-01-27 05:09:46 +09:00
Yan Zhulanow
c215ef9003 Partially revert "Prefer Kotlin Gradle test run configurations when possible (KT-33787)"
This commit reverts 987307cf92.
Tests are left behind as the different fix will be provided for KT-33787.
2020-01-27 05:09:46 +09:00
Yan Zhulanow
9f49918ec3 Partially revert "Prefer Kotlin Junit test run configurations when possible (KT-33787)"
This commit reverts parts of ef8b3cb72a.
Tests are left behind as the different fix will be provided for KT-33787.
2020-01-27 05:09:46 +09:00
Yan Zhulanow
b39e65608f Minor: Update copyrights in Fir elements 2020-01-27 05:09:46 +09:00
Dmitry Savvinov
02183148f1 Add IDE support for common klibs 2020-01-25 16:09:09 +03:00
Dmitry Savvinov
3de465b77d Check for presence of ir-folder in klibs additionally for Kotlin/Native 2020-01-25 16:09:08 +03:00
Dmitry Savvinov
953dc87c43 Minor: extract name of ir-folder in klib into const property 2020-01-25 16:09:08 +03:00
Dmitry Savvinov
9b6f405710 Pass proper metadata_version in K2MetadataKlibSerializer
Otherwise newer IDE Plugins will think that it's an old klib and will
refuse to analyze against it
2020-01-25 16:09:07 +03:00
Dmitriy Dolovov
cc0f4d59db Fast check of Kotlin/Native KLIBs by virtual files 2020-01-25 16:08:17 +03:00
Vladimir Ilmov
6e879206b0 [coroutine] debugger extension signature fixed for 193 bunch 2020-01-24 20:16:04 +01:00
Ilya Gorbunov
e562ce1359 KT-15363 Rename expectedSize to capacity and edit docs
(cherry picked from commit 7bb504321c)
2020-01-24 21:24:26 +03:00
Ilya Gorbunov
1c3e0da8d4 KT-15363 Fix failing test: missing capacity parameter check in JS
Partially restore JVM map capacity implementation

(cherry picked from commit 14351446d7)
2020-01-24 21:24:26 +03:00
Ilya Gorbunov
f46b37ec5d KT-15363 Collection builders: improve tests and samples
(cherry picked from commit 4aa7d45a5a)
2020-01-24 21:24:25 +03:00
Fleshgrinder
b239f0e8e1 KT-15363 Collection Builders
Added container builders for lists, sets, and maps.
The new experimental type inference only works for the simple builders
with a single generic type. The versions with nullability and the maps
still require explicit specification of the types. Obviously explicit
specification is required for all users who are not using the new
experimental inference. Improving the type inference is something that
should be done separately and many things – including these builders –
will benefit from it, however, this is not a blocker for these builders
in my opinion.

(cherry picked from commit bf9d3d87a6)
2020-01-24 21:24:25 +03:00
Ilya Gorbunov
b120cb8ae3 Advance bootstrap to 1.3.70-eap-145 2020-01-24 21:23:22 +03:00
Sergey Igushkin
85116652c9 Fix KlibBasedMppIT test compilation error (missing import)
(cherry picked from commit 1f42951152)
2020-01-24 20:51:57 +03:00
Sergey Igushkin
d3e283f438 Fix the K/N stdlib leaking into other common source sets
The Kotlin/Native stdlib was added to the shared-native source sets
in order for the IDE to import the stdlib dependency.

However, it was added to the '*Implementation' configuration, from
where it was also collected for the dependency source set
visibility inference algorithm. The current implementation of source
sets visibility inference only works for module dependencies and is
not quite suitable for local file dependencies. The implementation
should likely be fixed, but for now, it's enough to add the dependency
directly to the place where the visibility inference results are
taken from by the IDE during import, i.e. to the
'*ImplementationDependenciesMetadata' configurations.

Also, since all tests were flawed by the leakin K/N stdlib, the
K2Metadata/Klib compiler mistakenly didn't include its own built-ins
to the module dependencies (and everything worked because the K/N
built-ins were there). Now that the K/N doesn't leak, the compiler
must add its own built-ins.

(cherry picked from commit d1826374a6)
2020-01-24 19:02:52 +03:00
Sergey Igushkin
7324a5ea0e Common klib support in the Kotlin Gradle plugin (KT-32677)
Refactor the Kotlin/Native compilations and tasks to support
Kotlin/Native-shared source sets compilation within the metadata target.

Provide the feature flag kotlin.mpp.enableCommonKlibs that enables
the following behavior:
* compilation of Kotlin/Native-shared source sets to a klib using
the Kotlin/Native compiler.
* compilation of common source sets (not just Kotlin/Native) into a
klib rather than *.kotlin_metadata

Issue #KT-32677 Fixed

(cherry picked from commit 970ee4539b)
2020-01-24 19:02:48 +03:00
Anton Yalyshev
48bd96b95c Enable FUS for Code Completion in 1.3.70
(cherry picked from commit 90fe1bb1ab)
2020-01-24 18:31:51 +03:00
Vyacheslav Gerasimov
ca8504a482 Build: Add :compiler:ir.serialization.common to kotlin-plugin.jar
:compiler:ir.serialization.jvm contains classes depending on this module
which makes idea plugin verifier to fail.

 #KT-36103
2020-01-24 18:09:14 +03:00
Vsevolod Tolstopyatov
17bf57fd81 KT-36118 Introduce AbstractCoroutineContextKey and corresponding extensions required by its implementors
* It enables subtyping relationship for keys and elements, allowing type-safe and concise manipulations on the context when complex hierarchies of elements (e.g. implementors of ContinuationInterceptor) are present
    * It unblocks possibility to implement suspendCancellableCoroutine in stdlib
    * Implementing proper polymorphic get and minusKey in AbstractCoroutineContextElement is impossible because it will introduce source-incompatible change
    * ContinuationInterceptor get and minusKey are adjusted in a completely backwards-compatible way
2020-01-24 18:04:02 +03:00
Mikhail Zarechenskiy
9f9c2b0135 Regenerate tests after rebase 2020-01-24 17:21:04 +03:00
Mikhail Zarechenskiy
ccbf2fc603 Fix project compilation after rebase 2020-01-24 17:17:40 +03:00
Mikhail Zarechenskiy
d7295ced58 [NI] Fix issue with returning non-deparenthesized lambdas from labmdas
#KT-36080 Fixed
2020-01-24 17:17:39 +03:00
Denis Zharkov
d0d1ea2b4b NI: Fix resolution ambiguity for references returned from lambda
^KT-32267 Fixed
2020-01-24 17:17:39 +03:00
Pavel Kirpichenkov
2120e68db0 [NI] Soften restictions on using Nothing as proper constraint for full call completion
Consider lower `Nothing` constraint non-proper only if there is a dependant not analyzed postponed atom.
Early completion to `Nothing` provides data flow info for smart casts.

KT-35668 Fixed
2020-01-24 17:17:39 +03:00
Mikhail Zarechenskiy
9a6a88b191 [NI] Fix adapting arguments for callable references with receivers
#KT-35912 Fixed
2020-01-24 17:17:39 +03:00
Dmitriy Novozhilov
288f817dbf [NI] Add collecting forgotten type variables from callable references 2020-01-24 17:17:38 +03:00
Dmitriy Novozhilov
646b29f890 [NI] Add missing type variables to common system in builder inference 2020-01-24 17:17:38 +03:00
Pavel Kirpichenkov
55c9713e54 [NI] Make behaviour of anonymous functions consistent with lambdas
Fix completion of anonymous functions with expression body without expected type.
Premature completion led to losing type info from outer calls.
Also report type mismatches on empty lambda expressions.

KT-34729 In progress
2020-01-24 17:17:38 +03:00
Pavel Kirpichenkov
a3cd1f23ab [NI] Check stub types in result type
An uninferred parameter stub may leak through calculation of CST(Inv<Uninferred Stub>, Nothing) into a result type.
A stub type in the result type means a type error. So we can afford recalculating
CST with stub-containing types filtered out, since its an error anyway.
This prevents stub types leakages and helps with reporting type error diagnostics.

KT-35914 Fixed
KT-35943 Fixed
2020-01-24 17:17:37 +03:00
Victor Petukhov
8d04ba0611 NI: Prefer nullable lower bound to flexible one when substitution of type variable is performed and remember flexibility of type parameters based on flexibility of its upper bounds
^KT-32435 Fixed
2020-01-24 17:17:37 +03:00
Victor Petukhov
3051bcf878 Temporary change sinceVersion to null for ProhibitVarargAsArrayAfterSamArgument
It will be set to `KOTLIN_1_5` as it will be added.
2020-01-24 17:17:36 +03:00
Mikhail Zarechenskiy
3457b3f4a4 [NI] Fix CST calculation for covariant type projections 2020-01-24 17:17:36 +03:00
Pavel Kirpichenkov
a97751ee89 [NI] Refactor OnlyInputType annotation check
Hold position consumed during incorporation in Constraint instead of ConstraintPosition.
2020-01-24 17:17:36 +03:00
Pavel Kirpichenkov
3c48218097 [NI] Update filtering of constraints with equal types
Make check for synthetic nullability constraint status before skipping
new constraint with nonunique type.
2020-01-24 17:17:36 +03:00
Pavel Kirpichenkov
2878800030 [NI] Consider synthetic lower nullability constraint non-proper 2020-01-24 17:17:36 +03:00
Denis Zharkov
5260916cb3 NI: Fix exception during callable references overload resolution
^KT-35847 Fixed
2020-01-24 17:17:35 +03:00
Dmitriy Novozhilov
976ae1c967 [NI] Fix resolve of lambdas with expected function type with receiver
#KT-30245
2020-01-24 17:17:35 +03:00
Dmitriy Novozhilov
ec1aa0689c [NI] Improve completing callable references with type variable as expected type
#KT-32462 Fixed
2020-01-24 17:17:35 +03:00
Denis Zharkov
87c2f30b99 Fix project compilation after fix for KT-35920
See KT-35931 for a feature request allowing to write IrConstImpl::int
2020-01-24 17:17:34 +03:00
Denis Zharkov
11fbf77b9f NI: Do not resolve static callable references on generic types
As they weren't resolved in old inference

^KT-35920 Fixed
2020-01-24 17:17:34 +03:00
Denis Zharkov
392e84f538 NI: Fix callable references resolution when LHS is generic nested class
In case of null qualifier, we should not look into any static scope
NB: factory::createCallableProcessor returns NoExplicitReceiver processor
in case of null-receiver, that makes resolving the call in the test as
`property(::key)` that matches to the property itself, thus leading to
overload resolution ambiguity

^KT-35887 Fixed
2020-01-24 17:17:34 +03:00
Pavel Kirpichenkov
a290524f89 [NI] Restore old behaviour of AbstractPartialBodyResolveTest
Smartcasts between partial and full resolution mode should almost never match,
comparing smartcasted types in test runner is incorrect in general case.
Mute failing test until decision about correct behaviour (KT-35922).
2020-01-24 17:17:33 +03:00
Pavel Kirpichenkov
4ecfcc0340 [minor] Move quickFixUtil to util package 2020-01-24 17:17:33 +03:00
Pavel Kirpichenkov
0c02064363 Remove dependencies on data flow aware expression type in BindingContext
`BindingContext.getType`'s behaviour on argument expression has been different for OI and NI for some time.
New inference used to rewrite argument's type after smartcast, which led to missing subsequent smartcasts in some cases.
This commit makes retrieval of smartcasted argument type explicit.
2020-01-24 17:17:33 +03:00
Pavel Kirpichenkov
430f9b0e6e [NI] Add restored smart casts to spec tests
KT-35668 Fixed
2020-01-24 17:17:33 +03:00
Pavel Kirpichenkov
75a575b49f [NI] Restore missing smart casts after another smart cast in call
Expression type serves as a part of a key for retrieving smart cast info.
Rewriting expression type with SmartCastManager leads to incorrect processing of following smartcasts for same expression, therefore it was removed.

KT-32507 Fixed
KT-32358 Fixed
2020-01-24 17:17:33 +03:00
Dmitriy Novozhilov
640f734657 [NI] Use new type substitutor instead of old in completion of callable references
It's necessary because of new type substitutor is eager than odl, so
  if there is a substitution of type parameter deep inside type arguments
  then second substitutor wins against first

#KT-35896 Fixed
2020-01-24 17:17:32 +03:00
Dmitriy Novozhilov
0cff128038 [NI] Postpone calls with not enough information in builder inference 2020-01-24 17:17:32 +03:00
Denis Zharkov
6a5f88ac0b NI: In subtyping do not intersect arguments for non-covariant types
It partially reverts 7898922066
because it's not obvious that it's a safe operation
for invariant/contravariant types.

Also, there's a necessary fix in prepareReceiverRegardingCaptureTypes
to make types order stable
Otherwise test bareTypesWithStarProjections becomes flaky.

Also, the changes in bareTypesWithStarProjections.kt are also expected
because the type of the expression `coneSymbol` after the second "if" is
FirVariableSymbol<*> & FirPropertySymbol & AbstractFirBasedSymbol<*>
thus we fix D in the call `coneSymbol.phasedFir()` to FirVariableSymbol<*>
because it's the first type in the list
(see the next line after the last changed in AbstractTypeChecker)
2020-01-24 17:17:32 +03:00
Denis Zharkov
11302532c5 NI: Fix regression for star-projections approximation
See the test added

^KT-35703 Fixed
2020-01-24 17:17:32 +03:00
Denis Zharkov
0f7ad244db NI: Fix smart-cast related regression
See the test and the issue for the clarification
After the change 7898922066
the expected type for "a" in expression "foo(a)" is A<E & B<*>>
But we have the original type A<E> and smart-casted enriched type A<B<*>>
(non of them is a subtype of A<E & B<*>>)
and fail in checkTypeInternal when checking types in during completion

^KT-35844 Fixed
2020-01-24 17:17:31 +03:00
Pavel Kirpichenkov
154f28175f [NI] discriminate Nothing for reified parameters
Related issues: KT-32836, KT-35728
2020-01-24 17:17:31 +03:00
Mikhail Zarechenskiy
cbca609d45 [NI] Fix ambiguity when there are no applicable candidates
#KT-35064 Fixed
2020-01-24 17:17:31 +03:00
Dmitriy Novozhilov
0ceeac0c63 [NI] Use infered delegate expression type if there is no resolved call in trace
#KT-35707 Fixed
2020-01-24 17:17:30 +03:00
Pavel Kirpichenkov
79b9a058e5 [NI] Decrease only input types check diagnostic level to warning 2020-01-24 17:17:30 +03:00
Pavel Kirpichenkov
4c128c7735 [NI] Report "not enough information" on callable references in lambdas
^KT-34314 Fixed
2020-01-24 17:17:30 +03:00
Ilya Chernikov
5eb94e4903 [NI] Convert extension lambda to the non-extension one, if needed 2020-01-24 17:17:30 +03:00
Pavel Kirpichenkov
7da991f76b [NI] Remove hack for special functions
Treating special functions for `if`, `when`, `try`, `?:` as not accepting `Nothing` result type is incorrect.
Making so leads to cases with uninferred `Nothing` result type for inner calls and lost data flow info.
2020-01-24 17:17:29 +03:00
Dmitriy Novozhilov
a8ad8e0e29 [NI] Don't replace context dependency for blocks with expected type
#KT-35702 Fixed
2020-01-24 17:17:29 +03:00
Denis Zharkov
3e7b2beac9 NI: Fix type mismatch caused by smartcast
^KT-25434 Fixed
2020-01-24 17:17:29 +03:00
Denis Zharkov
7c4d79e6ee Fix bare typed smartcasts in NI
Star projections should be replaced with star projections
not for their expansions

See the test
2020-01-24 17:17:28 +03:00
Denis Zharkov
eb2c17992c Remove effectively dead code in AbstractTypeCheckerContext 2020-01-24 17:17:28 +03:00
Denis Zharkov
0fd6c5c628 NI: Approximate captured-for-star-projections to *
^KT-35602 Fixed
2020-01-24 17:17:28 +03:00
Dmitriy Novozhilov
84913a71b0 Cleanup and reformart DelegatedPropertyResolver.kt 2020-01-24 17:17:28 +03:00
Dmitriy Novozhilov
c5a96f7c11 [NI] Fix completion of error delegates with receiver with type parameters 2020-01-24 17:17:28 +03:00
Dmitriy Novozhilov
aba050fc1b [NI] Don't resolve delegates twice
#KT-31219 Fixed
#KT-31679 Fixed
#KT-32249 Fixed
2020-01-24 17:17:27 +03:00
Dmitriy Novozhilov
68ea4f7d09 [NI] Improve completing calls with multiple postponed arguments 2020-01-24 17:17:27 +03:00
Victor Petukhov
df81249d59 NI: don't filter flexible types during CST calculation and force return as result the first of such types
^KT-35658 Fixed
2020-01-24 17:17:27 +03:00
Dmitriy Novozhilov
19bf96a8b1 [NI] Add constraint K <: T from constraint K <: CapturedType(in T)
#KT-33263 Fixed
2020-01-24 17:17:27 +03:00
Dmitriy Novozhilov
4ec6b4eca9 [NI] Fix substitution in completion of callable references in coroutine inference 2020-01-24 17:17:26 +03:00
Pavel Kirpichenkov
e193e42e07 [NI] Discriminate Nothing? result type from nullability constraints
Nullability constraints should not be chosen when proper
argument constraints for variables in contravariant position present.

^KT-32106 Fixed
^KT-33166 Fixed
2020-01-24 17:17:26 +03:00
Pavel Kirpichenkov
9e9d953728 [NI] Disallow full completion based on lower Nothing constraint 2020-01-24 17:17:26 +03:00
Pavel Kirpichenkov
41debe5806 [NI] Support fixation to subtype in completion mode calculator
Allow full compltion mode for return type depending on type parameters in
contravariant position only if they have proper equality constraint.
2020-01-24 17:17:25 +03:00
Pavel Kirpichenkov
409bbfca7c [NI] Remove direcion calculator from variable fixation
Force constraint system completer to always fix variable with unknown position.
This makes inferred type for in parameters less specific, but OI infers to
subtype in such cases, so NI won't infer to less specific types than before.
2020-01-24 17:17:25 +03:00
Pavel Kirpichenkov
c4d2abcdef [NI] Implement algorithm for completion mode selection
Current selection of completion mode for call is not always correct in case of full mode,
and sometimes too conservative in case of partial mode. Updated algorithm checks constraints
wrt position of type variables in return type and in other related constraints.
Full completion happens if proper constraint requirements are satisfied for variables.
2020-01-24 17:17:25 +03:00
Pavel Kirpichenkov
79c4390aa6 [NI] Remove Nothing result type restriction in most cases
Make Nothing as result type not suitable only for if, when, try and ?: special functions.
2020-01-24 17:17:25 +03:00
Mikhail Zarechenskiy
2386132d6f [NI] Don't discriminate Nothing-type from resulting ones
^KT-32106 Fixed
2020-01-24 17:17:24 +03:00
Mikhail Zarechenskiy
d53af5a7e7 Fix incorrect use of language feature
See #KT-34889 for details
2020-01-24 17:17:24 +03:00
Dmitriy Novozhilov
281f87c934 [NI] Approximate intersection type in type argument to star if it's necessary
#KT-32196 Fixed
2020-01-24 17:17:24 +03:00
Dmitriy Novozhilov
85564530e3 [NI] Infer type variable to Nothing if all upper constraints are from upper bounds
#KT-32196 Fixed
2020-01-24 17:17:24 +03:00
Ilya Chernikov
65a4ea9de3 [NI] Fix inference if inner system has only by "uninteresting" constraint
#KT-32250 fixed
2020-01-24 17:17:23 +03:00
Ilya Chernikov
a11ab4ef83 [minor] [NI] Additional test for loosing type annotations on extension functions
taken from KT-34820
2020-01-24 17:17:23 +03:00
Denis Zharkov
20fb8cc43b NI: Report incompatible receiver of callable reference
^KT-35535 Fixed
2020-01-24 17:17:23 +03:00
Denis Zharkov
1ebae512c5 NI: Fix property references overload ambiguity
^KT-35213 Fixed
2020-01-24 17:17:22 +03:00
Pavel Kirpichenkov
ff23b094f3 [NI] Fix issues with star projection uncapturing
Prevent stack overflow during uncapturing of star projection
for parameter with recursive upper bound.
Uncapture star projections for flexible type parameters with
respect to flexible upper bound.

^KT-35210 Fixed
2020-01-24 17:17:22 +03:00
Pavel Kirpichenkov
a15ee1b5fc [NI] Preserve constraint position for OnlyInputType during incorporation
Variable with complex dependency on other variable loses its
original constraint position when variable it depends on is fixed.
To prevent that, original input position is saved in incorporation
position.
2020-01-24 17:17:22 +03:00
Pavel Kirpichenkov
cf936fe372 [NI] Fix OnlyInputTypes for captured types
Uncapture projections recursively for cases when captured type is not
top-level type or first level type argument
2020-01-24 17:17:22 +03:00
Natalia Selezneva
1fae69264c build.gradle.kts: change notification text 2020-01-24 15:59:54 +03:00
Ilya Goncharov
32d5999508 [IDEA] Use withType instead of isAssignableFrom
#KT-36093 fixed

(cherry picked from commit fa811c731f)
2020-01-24 15:27:18 +03:00
Ilya Goncharov
a51b9b59a9 [IDEA] Check assignable from task to KotlinTest class
(cherry picked from commit 6dc9109736)
2020-01-24 15:27:15 +03:00
Ilya Goncharov
0cdb337870 [IDEA] Use GradleVersion fqn to use it in case when there is no import
(cherry picked from commit 6b860206bd)
2020-01-24 15:27:10 +03:00
Ilya Goncharov
543a3a9d2a [IDEA] Preload KotlinTest class instead of loop finding
(cherry picked from commit c3951d394b)
2020-01-24 15:27:07 +03:00
Ilya Goncharov
1df47400f1 [IDEA] Add check on gradle version not to broke Gradle older 4.0
(cherry picked from commit 2c4cfd2fb8)
2020-01-24 15:27:03 +03:00
Shagen Ogandzhanian
a8cb0fd281 Update dukat dependency to 0.0.26
(cherry picked from commit de07d3387b)
2020-01-24 12:20:14 +01:00
Kevin Bierhoff
c776b7be8c suppress duplicate @Override annotations
(cherry picked from commit 6d32b3256b)
2020-01-24 18:56:10 +09:00
Yan Zhulanow
bf47acd232 Revert "Remove deprecated method from CommandLineProcessor"
This reverts commit 508330e0bb.

An external plugin depends on the deprecated API: com.jereksel.jailbreakk:0.0.2.

(cherry picked from commit 632fe18db6)
2020-01-24 18:46:30 +09:00
Yan Zhulanow
3742726579 Kapt, minor: Add extra case for property initializers
(cherry picked from commit 9bf63f5399)
2020-01-24 18:46:26 +09:00
Yan Zhulanow
26dd649a57 Minor: Fix deprecation notice in KotlinIndicesHelperExtension
(cherry picked from commit 9782f6808d)
2020-01-24 18:46:24 +09:00
Yan Zhulanow
5ec9aa709d Kapt: Support all kinds of constant types (KT-35536)
(cherry picked from commit 520f9a6da5)
2020-01-24 18:46:17 +09:00
Ivan Gavrilovic
50c4f480b6 KT-35536: Fix enum constants in KAPT
Enum constants are Pair, so make sure to unpack them correctly.

(cherry picked from commit eab6864269)
2020-01-24 18:46:08 +09:00
Yan Zhulanow
1570196dc1 Pill: Fix gradle-api artifacts attaching after migration to compileClasspath/runtimeClasspath
(cherry picked from commit 532e879d5c)
2020-01-24 18:44:08 +09:00
Yan Zhulanow
7f8fe34a36 Pill: Support Kotlin JUnit configurations
(cherry picked from commit ea957872eb)
2020-01-24 18:44:05 +09:00
Yan Zhulanow
29224ad4d4 Pill: Remove robolectric classpath passing
(cherry picked from commit 66cd78fbc0)
2020-01-24 18:44:03 +09:00
Yan Zhulanow
1eac5518f8 Pill: Support api/implementation configurations
(cherry picked from commit 5fe06ceb06)
2020-01-24 18:44:02 +09:00
Natalia Selezneva
4dbd5e9885 Scripts: clear manual configuration loading state after project import
^KT-35268

(cherry picked from commit a55a0d94de)
2020-01-24 12:03:08 +03:00
Natalia Selezneva
b7a651fe01 Provide a notification for gradle script that aren't related to any gradle project (KT-35268)
Add action to load/reload configuration for them manually
^KT-35268 Fixed

(cherry picked from commit 858698cf9a)
2020-01-24 12:03:05 +03:00
Natalia Selezneva
fc05b8edbb Implement persistent storage for script class path roots (KT-35886)
Save absolute paths instead of getCanonicalPath usages

^KT-34444
^KT-35886 Fixed

(cherry picked from commit a373ab96d4)
2020-01-24 12:03:03 +03:00
Anton Yalyshev
c0b8b10976 Properly handle a case when Code Style settings = null
(cherry picked from commit 0f049fd536)
2020-01-24 11:33:23 +03:00
Anton Yalyshev
a4c3267c7b Add bunches for unsupported versions
(cherry picked from commit 6d49f36cd6)
2020-01-24 11:33:23 +03:00
Anton Yalyshev
18e7741546 Add Formatter settings tracking to FUS
(cherry picked from commit 1d7dcf3633)
2020-01-24 11:33:23 +03:00
Anton Yalyshev
4d89903b48 Add languageVersion tracking to FUS
(cherry picked from commit 7c0d8ad6c7)
2020-01-24 11:33:22 +03:00
Andrey Uskov
c49bf7ddb1 Added project size and metrics collectors in gradle plugin 2020-01-24 11:22:32 +03:00
Ilya Kirillov
5918bbde21 Wizard: change new wizard title 2020-01-24 09:22:48 +03:00
Ilya Kirillov
9c467c01d9 Wizard: make new wizard to be second in the Kotlin group 2020-01-24 09:22:47 +03:00
Ilya Kirillov
ca0a398a31 Wizard: add FUS statistic collection 2020-01-24 09:22:45 +03:00
Ilya Kirillov
339fd2ae58 Wizard: allow simple js template to be used with JsSingleplatformModuleConfigurator 2020-01-24 09:22:44 +03:00
Ilya Kirillov
ebd825ac8c Wizard: fix removing template in UI 2020-01-24 09:22:43 +03:00
Ilya Kirillov
c87d48eedd Wizard: allow enabling new wizard in UI 2020-01-24 09:22:41 +03:00
Ilya Kirillov
f83f48c803 Wizard: fix tests 2020-01-24 09:22:40 +03:00
Ilya Kirillov
e2f81ee85b Wizard: fix adding dependencies to targets 2020-01-24 09:22:39 +03:00
Ilya Kirillov
0d63c35ee0 Wizard: temporary hide sourcesets editing for users 2020-01-24 09:22:38 +03:00
Ilya Kirillov
ef675dba06 Wizard: fix incorrectly added classpath dependency for Android with Groovy dsl 2020-01-24 09:22:36 +03:00
Ilya Kirillov
70d26bff46 Wizard: put pluginManagement section in the beginning of settings.gradle file 2020-01-24 09:22:35 +03:00
Ilya Kirillov
7da178c345 Wizard: add support of creating run configurations
#KT-36043 fixed
2020-01-24 09:22:33 +03:00
Ilya Kirillov
c2b02afe29 Wizard: add support of react js to the js template 2020-01-24 09:22:32 +03:00
Ilya Kirillov
8882c2e958 Wizard: fix not added dependencies for MPP modules 2020-01-24 09:22:31 +03:00
Ilya Kirillov
9c6e561349 Wizard: fix text of module configurators which is shown in module editor 2020-01-24 09:22:29 +03:00
Ilya Kirillov
6309710c0e Wizard: add support of JS singleplatform projects 2020-01-24 09:22:28 +03:00
Ilya Kirillov
d2602cd5bf Wizard: automatically determine Kotlin version based on Kotlin plugin version
For snapshot plugin just take the latest eap or stable version
2020-01-24 09:22:26 +03:00
Ilya Kirillov
142600f91f Wizard: remove empty border from module settings 2020-01-24 09:22:25 +03:00
Ilya Kirillov
5efb9934a3 Wizard: remove unused function 2020-01-24 09:22:24 +03:00
Ilya Kirillov
36bd7791b2 Wizard: fix incorrectly added modules to the tree 2020-01-24 09:22:23 +03:00
Ilya Kirillov
c6b6f07d3d Wizard: move "validation error" string from message to title 2020-01-24 09:22:21 +03:00
Ilya Kirillov
5e08272f25 Wizard: add validation for project name 2020-01-24 09:22:20 +03:00
Ilya Kirillov
15469c4f8d Wizard: do not suggest invalid groupId 2020-01-24 09:22:19 +03:00
Ilya Kirillov
12a18a8860 Wizard: do not show expert panel form wizard 2020-01-24 09:22:18 +03:00
Ilya Kirillov
46b824ade3 Wizard: remove duplicated string validator 2020-01-24 09:22:16 +03:00
Ilya Kirillov
d2175822e8 Wizard: add validators for POM data 2020-01-24 09:22:15 +03:00
Ilya Kirillov
0faa152537 Wizard: Show message when module has no configurable settings 2020-01-24 09:22:14 +03:00
Ilya Kirillov
051d6afae6 Wizard: Move test framework settings to module configurators 2020-01-24 09:22:12 +03:00
Ilya Kirillov
d4c458e77a Wizard: Move module templates to modules: separate SourcetModuleIR to MultiplatformModuleIR & SourcesetIR 2020-01-24 09:22:11 +03:00
Ilya Kirillov
b864bfe08f Wizard: move module templates to modules 2020-01-24 09:22:10 +03:00
Ilya Kirillov
cf2fa7f27a Wizard: add module dependencies for JPS 2020-01-24 09:22:08 +03:00
Ilya Kirillov
fabb1fed09 Wizard: add kotlin native console application template 2020-01-24 09:22:07 +03:00
Ilya Kirillov
f8ca0d031f Wizard: do not print binaries specification for all native targets
#KT-35719 fixed
2020-01-24 09:22:06 +03:00
Ilya Kirillov
0b8af7d6f8 Wizard: sort & distinct imports in Gradle build files 2020-01-24 09:22:04 +03:00
Ilya Kirillov
78f4a35317 Wizard: move fqName to import in NativeTargetConfigurator 2020-01-24 09:22:03 +03:00
Ilya Kirillov
dfa09aa5ba Wizard: add irs for build files from targets 2020-01-24 09:21:59 +03:00
Ilya Kirillov
540aabc357 Wizard: do not add empty gradle project to settings.gradle 2020-01-24 09:21:58 +03:00
Ilya Kirillov
bd2ed53e33 Wizard: use settings.gradle instead of .kts for Groovy DSL Gradle projects
#KT-35694 fixed
2020-01-24 09:21:57 +03:00
Ilya Kirillov
1450c0ad83 Wizard: print repositories for Maven
#KT-35715 fixed
2020-01-24 09:21:55 +03:00
Ilya Kirillov
3b74c305c8 Wizard: retrieve repositories from artifacts 2020-01-24 09:21:54 +03:00
Ilya Kirillov
ad359f0198 Wizard: correctly add Kotlin dependencies to singleplatform modules with gradle dsl build system
#KT-35695 fixed
2020-01-24 09:21:53 +03:00
Ilya Kirillov
0413c73574 Wizard: fix adding invalid dependencies for maven build files
#KT-35711 fixed
2020-01-24 09:21:52 +03:00
Ilya Kirillov
259d85fdbb Wizard: allow dashes for module names
#KT-35584 fixed
2020-01-24 09:21:51 +03:00
Ilya Kirillov
8c5c5345ff Wizard: Use default Java source roots for JPS projects
#KT-35710 fixed
2020-01-24 09:21:49 +03:00
Ilya Kirillov
c14152eeb0 Wizard: rework UI components for settings
#KT-35712 fixed
2020-01-24 09:21:48 +03:00
Ilya Kirillov
b3ca8308d9 Wizard: fix incorrect ktor repository
#KT-35718 fixed
2020-01-24 09:21:47 +03:00
Ilya Kirillov
bad2a3a946 Wizard: remove redundant return in native target configuration
#KT-35720 fixed
2020-01-24 09:21:42 +03:00
Ilya Kirillov
ab47d3d508 Wizard: fix swapped artifactId and groupId fields titles
#KT-35690 fixed
2020-01-24 09:21:41 +03:00
Ilya Kirillov
59537803d5 Wizard: do not overwrite existing artifactId & groupId settings
#KT-35713 fixed
2020-01-24 09:21:40 +03:00
Ilya Kirillov
2acafe32d0 Fix 191 & as35 compilation
(cherry picked from commit c311a66e5e)
2020-01-24 09:21:20 +03:00
Ilya Kirillov
586a1d3c8f Fix "Protected function call from public-API inline function is prohibited" error
(cherry picked from commit d6daaf14f8)
2020-01-24 09:21:19 +03:00
Ilya Kirillov
d0634d2b6f Fix compilation for AS
(cherry picked from commit 06dc2caf41)
2020-01-24 09:21:18 +03:00
Nikolay Krasko
9cf23713fd Allow @author usage in ...projectWizard.settings.version.maven package
(cherry picked from commit 1f878049eb)
2020-01-24 09:18:51 +03:00
Ilya Kirillov
8815f67511 Fix class not found exception in gradle wizard tests
(cherry picked from commit 830f0c6137)
2020-01-24 09:18:22 +03:00
Ilya Kirillov
a275716dd6 Wizard: introduce unit test mode
(cherry picked from commit 1ab405a86c)
2020-01-24 09:18:21 +03:00
Ilya Kirillov
3b83af751a Wizard: fix android tests
(cherry picked from commit 1c30572844)
2020-01-24 09:18:20 +03:00
Ilya Kirillov
845251f2da Wizard: fix wrong checking for project kind in UI
(cherry picked from commit b2166dc40d)
2020-01-24 09:18:19 +03:00
Ilya Kirillov
a927841af1 Wizard: disable abbility to switch between targets in existing module
(cherry picked from commit c1ce215b5d)
2020-01-24 09:18:18 +03:00
Ilya Kirillov
e47bfec05e Wizard: add suggested module names for js targets
(cherry picked from commit 7204ab091a)
2020-01-24 09:18:17 +03:00
Ilya Kirillov
820a90c3bc Wizard: do not allow to create more than one target of each type
(cherry picked from commit fc9f63d49f)
2020-01-24 09:18:16 +03:00
Ilya Kirillov
a7099c6c30 Wizard: add additional applicability checker for template
(cherry picked from commit aa2992e84a)
2020-01-24 09:18:15 +03:00
Ilya Kirillov
c7e97c2861 Wizard: remove unused android service
(cherry picked from commit 40367635cc)
2020-01-24 09:18:13 +03:00
Ilya Kirillov
1e2c56380a Wizard: format templates code
(cherry picked from commit af174b4f74)
2020-01-24 09:18:12 +03:00
Ilya Kirillov
83c559cf49 Wizard: add simple js template
(cherry picked from commit b29e6d0c69)
2020-01-24 09:18:11 +03:00
Ilya Kirillov
09a771dad0 Wizard: do not print duplicated repositories
(cherry picked from commit 5d56f3d28b)
2020-01-24 09:18:09 +03:00
Ilya Kirillov
d80512dd98 Wizard: introduce interceptors for module templates
(cherry picked from commit 32a151f561)
2020-01-24 09:18:07 +03:00
Ilya Kirillov
d8df582975 Wizard: add simple JS client template
(cherry picked from commit 8bf9c31880)
2020-01-24 09:18:05 +03:00
Ilya Kirillov
a1ece3b529 Wizard: add basic ktor server template
(cherry picked from commit 56fccce305)
2020-01-24 09:18:02 +03:00
Ilya Kirillov
388668edf7 Wizard: introduce ServicesManager & correctly handle disabled gradle & maven Idea plugins
(cherry picked from commit f927fb3471)
2020-01-24 09:18:00 +03:00
Ilya Kirillov
03c1eee25d Wizard: change wizard title to experimental
(cherry picked from commit 9011eecfdf)
2020-01-24 09:17:59 +03:00
Ilya Kirillov
24fc714e01 Wizard: Create parent group for current and experimental project wizard
(cherry picked from commit b10e157147)
2020-01-24 09:17:57 +03:00
Ilya Kirillov
aad67ddbda Wizard: show experimental new project wizard only by registry flag
(cherry picked from commit 8684b0d6c1)
2020-01-24 09:17:56 +03:00
Ilya Kirillov
aeab899542 Wizard: Add initial version of the new project wizard
(cherry picked from commit aca193ddd2)
2020-01-24 09:17:55 +03:00
Abduqodiri Qurbonzoda
cdf89677fb Optimize ArrayDeque tests run time
(cherry picked from commit e89893b6fd)
2020-01-24 05:57:18 +03:00
Ilya Gorbunov
d17908b9ce ArrayDeque: avoid triggering JDK 1.6 bug in tests
Use System.arraycopy instead of Arrays.copyOfRange to
avoid triggering JDK-7174363 bug in copyOfRange.

Fix package of ArrayDequeTest

(cherry picked from commit 8733d5f9ed)
2020-01-24 05:56:54 +03:00
Abduqodiri Qurbonzoda
a00c12d876 Add removeFirst(OrNull) and removeLast(OrNull) methods to MutableList
(cherry picked from commit e459542e6f)
2020-01-24 05:56:25 +03:00
Abduqodiri Qurbonzoda
d8193a5a9f Common ArrayDeque
(cherry picked from commit b6849efd47)
2020-01-24 05:56:02 +03:00
Vladimir Dolzhenko
2af2140f70 Track changes of non physical files with incOutOfBlockModificationCount
To invalidate synthetic file cache have to increment
incOutOfBlockModificationCount on valuable psi changes

#KT-35186 Fixed

(cherry picked from commit 6352cded1b)
2020-01-23 21:24:16 +01:00
Vladimir Dolzhenko
20f5ad2be5 Track changes of non physical files with incOutOfBlockModificationCount
To invalidate synthetic file cache have to increment
incOutOfBlockModificationCount on valuable psi changes

#KT-35186 Fixed

(cherry picked from commit 6352cded1b)
2020-01-23 21:22:38 +01:00
Andrey Uskov
9eb8700d3a Added FUS extensions and new metrics for reporting statistics from gradle 2020-01-23 20:36:47 +03:00
Andrey Uskov
b5202dc104 Added tests to gradle statistics reporter 2020-01-23 20:36:36 +03:00
Andrey Uskov
937a8947cd Metric description and anonymization rules added
Added metrics and their anonymization rules added. Persisted gradle
statistical information will not contain any sensitive information.
#KT-33404 Fixed
2020-01-23 20:36:28 +03:00
Andrey Uskov
ae1be18241 Collecting performance information in Gradle plugin supported
The build performance information is collected during the build
when the Kotlin Gradle plugin is applied. Only hashed values are
saved if they may contain sensitive information. Numeric metrics
obtained on the basis of user's project are saved with random seed.
Persisted information is saved in gradleUserHomeDir.

#KT-33404 Fixed
2020-01-23 20:36:23 +03:00
Andrey Uskov
c0d1b76b62 Open files leak on incremental compilation fixed
#KT-25206 Fixed
2020-01-23 20:36:18 +03:00
Andrey Uskov
0db48ed660 Do not show warnings when some projects are not generated before import
#KT-35442 Fixed
2020-01-23 20:36:14 +03:00
Vladimir Ilmov
765dc2dc28 AsyncStackTraceContext extra logging removed 2020-01-23 15:26:47 +01:00
Vladimir Ilmov
35f4dc57a1 Coroutine debugger starting even if registry key set to false - fixed 2020-01-23 15:26:47 +01:00
Vladimir Ilmov
9a23886042 [coroutine] ComboBox disabled as in progress 2020-01-23 15:26:47 +01:00
Vladimir Ilmov
823cc41123 [coroutine] Exception fixed for SUSPEND coroutines. 2020-01-23 15:26:47 +01:00
Vladimir Ilmov
21ba1f2455 Flaky ConcurrentModificationException in NewMultiplatformProjectImportingTest.testFileCollectionDependency fixed 2020-01-23 15:26:47 +01:00
Vladimir Ilmov
0fac6d2d50 POC coroutine panel removed 2020-01-23 15:26:47 +01:00
Vladimir Ilmov
0903e0dcdc [debug] coroutine's stack frame locations pre-calculated on initialization 2020-01-23 15:26:46 +01:00
Vladimir Ilmov
cd39237566 CodeConformanceTest @author mention in sources fixed 2020-01-23 15:26:46 +01:00
Vladimir Ilmov
a934b348e1 Coroutine as35 compatibility patch also added to 191. 2020-01-23 15:26:46 +01:00
Vladimir Ilmov
abd956c123 CoroutineAsyncStackTraceProvider stack corruption fix 2020-01-23 15:26:46 +01:00
Vladimir Ilmov
ab727cbfbf coroutine debugger toolbar added 2020-01-23 15:26:46 +01:00
Vladimir Ilmov
9f1d8f38a3 coroutine debugger logic moved to jvm-debugger-coroutine module 2020-01-23 15:26:46 +01:00
Vladimir Ilmov
58bbf6a57a [coroutine][debugger] implementation basing on X-* approach
XCoroutine view added for direct comparison with Coroutines
2020-01-23 15:26:46 +01:00
Vladimir Ilmov
8ed20ce667 [coroutine][debugger] refactoring being done
X-view approach added for review, thread groups added
2020-01-23 15:26:46 +01:00
Leonid Startsev
90fe752ae9 Do not include annotations and KDoc into NO_EXPLICIT_VISIBILITY_IN_API_MODE report range
Rename positioning strategy to better reflect its behavior.
#KT-36021 Fixed

(cherry picked from commit 43858e8169)
2020-01-23 17:17:15 +03:00
Leonid Startsev
7b82c0e90b Fix unavailable 'Specify visibility explicitly' quickfix
in explicit API mode due to incorrect cast.
Add tests for applying this quickfix.
#KT-36020 Fixed

(cherry picked from commit 4285c6045a)
2020-01-23 17:17:05 +03:00
Leonid Startsev
dcb5df4f48 Search for standard serializers in both internal and root packages
To allow graduate migration of some classes (e.g. IntSerializer)
from kotlinx.serialization.internal.* to kotlinx.serialization.*

(cherry picked from commit 9e8f21cc20)
2020-01-23 12:42:30 +03:00
Leonid Startsev
38965ccf51 Pass actual serializable properties count in the generated code
to SerialClassDescImpl.
This is needed to optimize space allocation.

(cherry picked from commit db4273d677)
2020-01-23 12:42:06 +03:00
Leonid Startsev
b695f2b8fe Refactor plugin-generated call to EnumSerializer():
support new values() argument.
Get rid of old @JvmOverloads requirements in runtime.

(cherry picked from commit 9558538d15)
2020-01-23 12:41:54 +03:00
Vladimir Dolzhenko
f0535a787f Put a proper version of ProgressIndicatorUtils.kt.192
Relates to #KT-33939
2020-01-23 08:57:56 +01:00
Vladimir Dolzhenko
f95d9ca024 Handle kdoc case for Introduce import alias inspection
#EA-210889 Fixed
2020-01-22 22:26:01 +01:00
Vladimir Dolzhenko
59df5711aa Show Review Added Imports on paste action
Fixed multi-caret selection in kotlin-to-kotlin copy-paste processor

Relates to #KT-33939

(cherry picked from commit db8b0a6593)
2020-01-22 17:23:05 +01:00
Vladimir Dolzhenko
036f88424a Fixed ProgressIndicatorUtils.kt for 201
#KT-36008 Fixed
Relates to #KT-33939

(cherry picked from commit 1911cbb077)
2020-01-22 17:22:49 +01:00
Vladimir Dolzhenko
b49b795bd2 ProgressIndicatorUtils.kt for 191 is added
Relates to #KT-33939

(cherry picked from commit c0c929c449)
2020-01-22 17:22:09 +01:00
Vladimir Dolzhenko
ce829cb220 Reworked k2k copy-paste action.
Get rid of resolve from copy phase, paste phase performs resolve in bg

#KT-33939 Fixed

(cherry picked from commit 5730a21e7b)
2020-01-22 17:22:00 +01:00
Ilya Matveev
4ec1ec7fd9 Gradle, native: Allow setting destination directory for binaries
Issue #KT-29395 fixed
2020-01-22 17:41:00 +07:00
Ilya Matveev
0611e79d98 Gradle, native: Don't pass to compiler missing klib files
We don't compile a klib if there are no sources for it (NO-SOURCE
checks). So, we need to take this fact into account and don't
pass such libraries to compiler in dependent modules. See also:
GH-2617 in the K/N repo.

This patch checks that a klib file exists before passing it to the
compiler.
2020-01-22 17:40:59 +07:00
Ilya Matveev
90ef8f9b55 Gradle, tests: Skip building in native binaries test for Groovy DSL
This test is one of the most time-consuming tests because
it builds a lot of final native binaries. Moreover, it exists
in two versions: for Groovy DSL and for Kotlin DSL. The only
difference between these versions is build script DSL.

This patch disables project building for the Groovy DSL version to
reduce total test execution time. Now this test only checks that
project configuration is successful. But it's enough to detect DSL
problems.
2020-01-22 17:40:58 +07:00
Ilya Matveev
9b5bd0dd5d Gradle, native: Support exporting dependencies for static and shared libs
Issue #KT-35352 fixed
2020-01-22 17:40:57 +07:00
Yaroslav Chernyshev
17d3f1d075 [Gradle, Native] Implement custom name for generated framework for XCode
(cherry picked from commit 401baa35ab)
2020-01-22 10:53:21 +03:00
Natalia Selezneva
1af05fd600 Fix script configurations for gradle project without source roots in 193 and as40
GradleKtsImportTest:testEmpty fixed
(cherry picked from commit b38836c488)
2020-01-22 09:51:48 +03:00
Natalia Selezneva
9a36ec0219 KotlinDslScriptModel request shouldn't fail the gradle build
(cherry picked from commit f0cb51a5bc)
2020-01-22 09:51:48 +03:00
Natalia Selezneva
f3bb45c59c as36: Update to AS 3.6 RC (192.7142.36.36.6071332)
^KT-36005 Fixed

(cherry picked from commit 606279b462)
2020-01-22 09:51:48 +03:00
Natalia Selezneva
a9ba149554 Remove unnecessary bunch file for AS4.0
(cherry picked from commit 4699ba758e)
2020-01-22 09:51:48 +03:00
Natalia Selezneva
521d3eee70 Scripting: do not call getConfiguration inside ScriptClassRootsCache
We already have all configurations inside `all` property.
If script doesn't have loaded configuration getting script sdk - ask for configuration explicitly to avoid situations when configuration is already loaded but not yet saved in memory cache

Looks related to KT-35590
^KT-35590

(cherry picked from commit a24e62eaf7)
2020-01-22 09:51:47 +03:00
Vladimir Dolzhenko
195104f7cf Store addUnambiguousImportsOnTheFly in kotlin code insight settings
store optimizeImportsOnTheFly in kotlin code insight workspace settings

#KT-36034 Fixed
2020-01-21 17:56:18 +01:00
Alexander Podkhalyuzin
a1ec739727 Now using Kotlin setting instead of Java one in 191 as well 2020-01-21 17:55:49 +01:00
Ilya Chernikov
8e812c2685 Add only non-jdk classpath entries from the compiler to script
remove unnecessary manifest classpath entries in the saved compiled
script jar
2020-01-21 15:12:03 +01:00
Ilya Chernikov
19ddcc0895 Use scripting cache earlier in the pipeline:
before initializing compiler and processing callbacks
2020-01-21 15:12:03 +01:00
Ilya Chernikov
6b25f14bfd Speed up REPL package member declaration provider
about 10-15% on specific test
also preparing test infrastructure for it
2020-01-21 15:12:03 +01:00
Ilya Chernikov
794c22b758 [minor] fix typo in function name 2020-01-21 15:12:03 +01:00
Ilya Chernikov
401f659734 Immplement default cache in main-kts 2020-01-21 15:12:03 +01:00
Ilya Chernikov
874d08b04e Get rid of kotlinx.coroutines usage in saved script runner
to reduce dpendencies for the save dscipt running
2020-01-21 15:12:03 +01:00
Ilya Chernikov
995699cc36 Fix ivy mapping to the maven repos in main-kts 2020-01-21 15:12:03 +01:00
Ilya Chernikov
c9d0e97eaf Implement automatic loading of .main.kts scripts support
also fix discovery from ScriptDefinitionsProvider
2020-01-21 15:12:03 +01:00
Ilya Chernikov
afed7fde01 Check REPL snippet syntax before calling analysis
restores the behaviour of the GenericRepl implementation and fixes
issues then invalid code is being compiled
#KT-34888 fixed
2020-01-21 15:12:02 +01:00
Ilya Gorbunov
464c8782c2 Rename Clock to TimeSource, ClockMark to TimeMark
Step 2: rename classes and interfaces.
Provide deprecated typealiases to smooth migration.

(cherry picked from commit 1336da8453)
2020-01-21 16:07:52 +03:00
Ilya Gorbunov
57c5d0ee83 Rename Clock to TimeSource, ClockMark to TimeMark
Step 1: rename files

(cherry picked from commit a11a25087a)
2020-01-21 16:07:52 +03:00
Elena Lepilkina
2abdeaf365 Update K/N version 2020-01-21 14:05:59 +03:00
Zalim Bashorov
c544749e14 [Build] Remove the property to skip JS IR BE tests
It's no longer needed since we going to start building libraries using the new BE,
so we have to be sure that everything works well in releases branches too.

(cherry picked from commit 9cf1a2b404)
2020-01-21 00:09:36 +03:00
Zalim Bashorov
86441a95c4 [JS BE] Fix is check with Function
#KT-33149 fixed

(cherry picked from commit ee06678484)
2020-01-21 00:09:36 +03:00
Igor Chevdar
2c2aa081e4 [kotlin-native-plugin] Enabled compiler daemon 2020-01-20 18:43:14 +03:00
Leonid Startsev
7993a02d9f Support SerializerFactory in Native
kotlinx.serialization plugin now adds additional function to companions
of generic classes in order to overcome lack of reflection. This
helps retrieving generic serializers from KType.

(cherry picked from commit 137c500e3a)
2020-01-20 14:57:12 +03:00
Nikolay Krasko
5db3ae7680 Switch to 193 platform 2020-01-20 13:46:44 +03:00
Nikolay Krasko
7e3ba2f976 Update 193 to 193.6015.22-EAP-SNAPSHOT 2020-01-20 13:44:42 +03:00
Nikolay Krasko
3d632163d8 Advance version to 193.5662.53
(cherry picked from commit 80d5723a07)
2020-01-20 13:44:42 +03:00
Nikolay Krasko
7562bc44d2 Mute TCServiceMessageOutputStreamHandlerTest for 193 platform (KT-35938)
(cherry picked from commit b4ae1645ec)
2020-01-20 13:44:42 +03:00
Nikolay Krasko
513f8b26d5 JUnit 4 runner for ignoring muted tests
(cherry picked from commit fd8ff463bb)
2020-01-20 13:44:42 +03:00
Nikolay Krasko
059b0b4e8c Run tests in kotlin-gradle-plugin in repository working dir
Unify with other modules and make GradleNodeModuleBuilderTest work under
JPS.

(cherry picked from commit 6963c81b40)
2020-01-20 13:44:42 +03:00
Mikhael Bogdanov
6100899487 Minor. Convert test
(cherry picked from commit 52ac8d788d)
2020-01-20 10:57:47 +01:00
Mikhael Bogdanov
01b1567723 Don't generate type annotations on synthetic accessors
#KT-35843 Fixed

(cherry picked from commit 70d71f0f07)
2020-01-20 10:57:35 +01:00
Mikhael Bogdanov
3bb25c889a Support field type annotations
#KT-35843 Fixed

(cherry picked from commit 1032e3a17c)
2020-01-20 10:57:22 +01:00
Mikhael Bogdanov
a4b3912ea7 Support type annotations
#KT-35843 Fixed

(cherry picked from commit 2ed0cb2a89)
2020-01-20 10:57:06 +01:00
victor.petukhov
04ad28046a Fix isNegated psi method in KtWhenConditionInRange
^KT-34395 Fixed

(cherry picked from commit fc7b836151)
2020-01-17 19:26:17 +03:00
Victor Petukhov
982d86b4a3 Workaround an inliner problem upon which the compiler code itself stumbled
^KT-35856 Fixed

(cherry picked from commit 5917591205)
2020-01-17 19:26:07 +03:00
Sergey Igushkin
c5fdddb719 Support serializing a module's own descriptors without dependencies
The KlibMetadataSerializer used to serialize all package fragments that a module
could provide, including those coming from the module's dependencies. In order
to produce a klib from a module that is analyzed by the K2MetadataCompiler, the
serializer needs to take just the own package fragments of the module, excluding
those of the dependencies.

(cherry picked from commit 1129b2d3eb)
2020-01-17 18:51:11 +03:00
Sergey Igushkin
65b4680521 Support generating a klib from common code with K2MetadataCompiler
(cherry picked from commit ed6034e449)
2020-01-17 18:51:10 +03:00
Sergey Igushkin
820be03e25 Allow not providing IR to serialize a klib with just the frontend metadata
(cherry picked from commit 28e0089259)
2020-01-17 18:51:08 +03:00
Sergey Igushkin
a1909b10ef Fix non-existing files passed in classpath to Kotlin/JS compiler
(cherry picked from commit 38feadcfe8)
2020-01-17 18:31:51 +03:00
Nikolay Krasko
f184c4d2ac Simplify adding Kotlin sdk by inlining internals of ProjectSdksModel
Because of using cloning sdks inside ProjectSdksModel tests fail with sdk leaked errors.

(cherry picked from commit c7d39b612c)
2020-01-17 18:25:08 +03:00
Nikolay Krasko
48cd03a66c Better fix for compiler plugin test initialization
The previous one didn't work in 191.
Also revert changes in tests-common module.

(cherry picked from commit 70067bc9bf)
2020-01-17 18:25:08 +03:00
Nikolay Krasko
919092558c Mute flaky JavaAgainstKotlin.testUsingMutableInterfaces
(cherry picked from commit ddda93ad96)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
1d1453197b Enable mute tests feature for BuiltInDecompilerTest
(cherry picked from commit e20c66011a)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
7e0e94736e Mute flaky step over tests on Android Studio
(cherry picked from commit 28e23f0aa8)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
4c89c4bccc Mute GradleMigrateTest.testMigrateStdlib in AS
(cherry picked from commit 11e4b710b5)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
44fd8a8a16 Mute tests for preferring JDK classes in completion and auto-import in 191 and 192 (KT-35709)
BasicCompletionWeigherTestGenerated.testPreferFromJdk
AutoImports.testAmbiguousNamePreferFromJdk

(cherry picked from commit 77edfed764)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
a64f0366b1 Fix test data for QuickFixTestGenerated.SupertypeInitialization in 191
(cherry picked from commit 74e2c98426)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
be7ae53b40 Mute JavaToKotlinConverterSingleFileTestGenerated in 191
(cherry picked from commit 0d48855333)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
d4bb1f3f42 Fix UpdateConfigurationQuickFixTest.testEnableCoroutinesFacet test
(cherry picked from commit 28eb6a223d)
2020-01-17 18:25:07 +03:00
Nikolay Krasko
e9d6cce9a3 Split tests to common and platform parts
(cherry picked from commit 4c28e0dec3)
2020-01-17 18:25:06 +03:00
Nikolay Krasko
2e436a2c25 Minor: sort tests in mute database
(cherry picked from commit 570b522e8e)
2020-01-17 18:25:06 +03:00
Nikolay Krasko
ad0884e0cb Port muting database from master
(cherry picked from commit 8014a6509e)
(cherry picked from commit 482cb07420)
(cherry picked from commit 9d54d1ec40)
(cherry picked from commit c5d4213a5c)
(cherry picked from commit c935078f05)
(cherry picked from commit c848212ae9)
(cherry picked from commit 08ade450ff)
(cherry picked from commit f41b588f70)
(cherry picked from commit 712517a02e)
(cherry picked from commit 5f25242cbf)
(cherry picked from commit 3520d5b81d)
(cherry picked from commit 18b1d64adc)
(cherry picked from commit c11f36cf1d)
(cherry picked from commit 84604b91bf)
(cherry picked from commit 1058f04c53)
(cherry picked from commit 1e3736ec1e)
(cherry picked from commit 6613b73657)
(cherry picked from commit dca5ff10c7)
(cherry picked from commit d80fdf307f)
(cherry picked from commit d2909814c2)
(cherry picked from commit 03bd80b1ba)
(cherry picked from commit 3210e1d44c)
(cherry picked from commit 1682ace428)
(cherry picked from commit 9206f1cfb2)
(cherry picked from commit 1e14c48742)
(cherry picked from commit 0884681662)
(cherry picked from commit c372dc7f0a)
(cherry picked from commit 9b68008208)
(cherry picked from commit d575df56e9)
(cherry picked from commit 1b9bae0cca)
(cherry picked from commit bf79b660c4)
(cherry picked from commit 2f129ea435)
(cherry picked from commit 7a94b1d88b)
(cherry picked from commit 5583b57ed7)
(cherry picked from commit 70ff3d36d0)
2020-01-17 18:25:06 +03:00
Yan Zhulanow
899d1c844e Remove changelog for previous releases 2020-01-17 21:10:16 +09:00
Dmitry Gridin
cabe30f973 idea: cleanup code
(cherry picked from commit 8dbbd64beb)
2020-01-17 17:29:23 +07:00
Ilya Matveev
5585074266 Gradle, native: Don't use an arg file when compiler daemon is enabled
We pass compiler flags using an arg file if the compiler is executed
in a separate process because Windows limits maximal command line
length (see https://github.com/JetBrains/kotlin-native/issues/1999).

But for the compiler daemon we pass the args directly to the compiler
entry point method. So we can abandon using an arg file here.
2020-01-17 12:45:50 +07:00
Ilya Matveev
fd89b9000b Gradle, native: Escape spaces in K/N compiler args
We use an argument file to pass arguments to the K/N compiler.
Earlier each line of such a file was treated by the compiler
as a separate argument. But this logic was updated some time
ago and now content for this file is treated as a space separated
list of arguments.

This patch takes this into account at the Gradle side and quotes
arguments written to the arg file.

Issue #KT-35934 Fixed
2020-01-17 12:45:49 +07:00
Abduqodiri Qurbonzoda
96059aead3 Create method Collection.randomOrNull() #KT-35347
(cherry picked from commit 3cad1bbb51)
2020-01-16 22:56:28 +03:00
Sergey Rostov
db8be3fc8a AbstractScriptConfigurationLoadingTest: add asserting messages
(cherry picked from commit 07041574da)
2020-01-16 19:17:42 +03:00
Sergey Rostov
287cbd8382 .gralde.kts: optimize getAffectedGradleProjectFiles (EA-220597 fixed)
(cherry picked from commit 40914e79ee)
2020-01-16 19:17:41 +03:00
Alexander Udalov
13aea1382e Revert "JVM/JVM_IR: fix mapping of KClass in annotation classes"
This reverts commit 7cd55c85e6.

Since we don't have much time for carrying out the deprecation policy,
KT-35207 will be supported since 1.4-M1.
2020-01-16 17:02:06 +01:00
Alexander Udalov
8f09dcbe9b Keep annotation FQ name in experimental API diagnostics
This fixes compilation of ExperimentalFixesFactory where this FQ name
is used to construct a correct quick fix instance.

(cherry picked from commit b5afdc7553)
2020-01-16 17:01:06 +01:00
Alexander Udalov
f9f286dd8c Deprecate Experimental/UseExperimental in favor of RequiresOptIn/OptIn
(cherry picked from commit 514bf3eec0)
2020-01-16 17:01:06 +01:00
Alexander Udalov
fd879cb4f5 Support custom message in RequiresOptIn
#KT-34648 Fixed

(cherry picked from commit f954a6c812)
2020-01-16 17:01:05 +01:00
Alexander Udalov
73d3b7632c Rename UseExperimental->OptIn, Experimental->RequiresOptIn in quickfix and IDE tests
(cherry picked from commit 9187a85aaf)
2020-01-16 17:01:05 +01:00
Alexander Udalov
82b18c9291 Fix compiler and IDE tests on Experimental/RequiresOptIn
See cdbabf224f, e009c7064e

(cherry picked from commit 16db3a8b5f)
2020-01-16 17:01:05 +01:00
Alexander Udalov
cd668eae98 Rename UseExperimental->OptIn, Experimental->RequiresOptIn in Gradle plugin
(cherry picked from commit da077b5353)
2020-01-16 17:01:05 +01:00
Alexander Udalov
e821a7c516 Rename UseExperimental->OptIn, Experimental->RequiresOptIn in stdlib kdocs
(cherry picked from commit 8f94a2bb75)
2020-01-16 17:01:05 +01:00
Alexander Udalov
e35f1c4bbc Rename UseExperimental->OptIn, Experimental->RequiresOptIn in compiler tests
(cherry picked from commit 7742a3b697)
2020-01-16 17:01:04 +01:00
Alexander Udalov
834fc4d457 Rename Experimental/UseExperimental in compiler diagnostic messages
#KT-34647

(cherry picked from commit b839b905b5)
2020-01-16 17:01:04 +01:00
Alexander Udalov
deced92e8d Fix NPE in ExperimentalUsageChecker in corner case
Since there's no nullability assertion, null could end up in this list
and cause NPE further at `reportNotAcceptedExperimentalities`. This
could happen if a declaration was annotated with WasExperimental, the
marker was annotated with the new RequiresOptIn, and API version 1.2 was
used.

No new tests are added because 1.2 is obsolete and WasExperimental is
internal.

(cherry picked from commit d547af00aa)
2020-01-16 17:01:04 +01:00
Alexander Udalov
1c047daeae Add -Xopt-in command line argument
As per https://github.com/Kotlin/KEEP/pull/201

(cherry picked from commit e009c7064e)
2020-01-16 17:01:04 +01:00
Alexander Udalov
adec550d1a Introduce RequiresOptIn and OptIn annotations
RequiresOptIn should be used now instead of Experimental, OptIn instead
of UseExperimental. See https://github.com/Kotlin/KEEP/pull/201.

This change adds the new declarations only to the stdlib, and supports
them in the compiler. Because of the way compiler loads annotations, we
need to bootstrap it first before deprecating the old annotations and
updating tests.

 #KT-34647 Fixed

(cherry picked from commit cdbabf224f)
2020-01-16 17:01:04 +01:00
Alexander Udalov
35258657af Deprecate -Xexperimental compiler argument
This option is not widely used and its implementation relies on a
complicated mechanism of a module-wide metadata, which is not properly
supported in the IDE (see IdeModuleAnnotationsResolver).

 #KT-34649 Fixed

(cherry picked from commit 33bc3db144)
2020-01-16 17:01:03 +01:00
Vyacheslav Gerasimov
6d8148f64b Build: Add missing com.github.node-gradle.node plugin versions
(cherry picked from commit fa1c6c9697)
2020-01-16 18:52:25 +03:00
Vyacheslav Gerasimov
5ca2a9b79f Build: Add kotlinPluginPublication to idea-gradle-tooling-api
(cherry picked from commit a0e73bffa0)
2020-01-16 18:52:14 +03:00
Dmitry Gridin
fb10a6de3a KtScratchExecutionSession: fix compilation for 191
(cherry picked from commit 09acdb655d)
2020-01-16 18:40:12 +07:00
Dmitry Gridin
353404705f KotlinDebuggerCaches: fix INRE
#EA-219472 Fixed

(cherry picked from commit 898308c7ba)
2020-01-16 18:40:09 +07:00
Dmitry Gridin
33251ee2ee KotlinConsoleRunner: fix INRE
#EA-219478 Fixed

(cherry picked from commit 3f500c6e92)
2020-01-16 18:40:07 +07:00
Dmitry Gridin
2dcf96cd71 IDEKotlinAsJavaSupport: fix INRE
#EA-213321 Fixed

(cherry picked from commit 02beb72ab1)
2020-01-16 18:38:09 +07:00
Dmitry Gridin
c82520e1bf KotlinFunctionBreakpoint: fix INRE
#KT-35316 Fixed
#EA-219418 Fixed

(cherry picked from commit 4d7fe78a51)
2020-01-16 18:38:05 +07:00
Dmitry Gridin
286149efe5 KotlinNativeModuleConfigurator: fix INRE
#EA-219416 Fixed

(cherry picked from commit 09bcfab047)
2020-01-16 18:38:04 +07:00
Dmitry Gridin
4be844bbe7 KtScratchExecutionSession: fix INRE
#EA-218701 Fixed

(cherry picked from commit 86f9253fa0)
2020-01-16 18:38:01 +07:00
Dmitry Gridin
de7f8c34c8 KotlinVariableInplaceIntroducer: fix PIEAE
#EA-209820 Fixed

(cherry picked from commit 78f7ed2c27)
2020-01-16 18:37:58 +07:00
Dmitry Gridin
6b4d2ed7db JavaToKotlinAction: fix KNPE
#EA-215300 Fixed

(cherry picked from commit 580885245d)
2020-01-16 18:36:50 +07:00
Dmitry Gridin
83ed2150a5 idea: fix some ControlFlowException
#EA-219412 Fixed

(cherry picked from commit 34dcc72e7f)
2020-01-16 18:36:47 +07:00
Dmitry Gridin
327acd5f5f PerModulePackageCacheService: fix NPE for code injection
#KT-35208 Fixed

(cherry picked from commit 7c9826b60b)
2020-01-16 18:35:05 +07:00
Nicolay Mitropolsky
b31f88a51d 191: Uast: fix compilation for 191
(cherry picked from commit ed57a53ad6)
2020-01-16 10:24:02 +03:00
Nicolay Mitropolsky
72a7bc2beb Uast: KotlinIDERenderLogTest for running UAST tests with ULC
In case of result difference the `-ide`-suffixed testdata is used.
Actually the difference in results is more likely to be a bug
but currently we are fixating at least some behaviour to protect from
 unexpected regressions in Ultra Light Classes.

`object Local` were removed because there is no local objects in actual
 Kotlin syntax

(cherry picked from commit 54285d328f)
2020-01-16 10:24:00 +03:00
Mikhail Zarechenskiy
589a07494d Add feature that allows references to synthetic properties with warning
See KT-35933 for details
2020-01-16 09:46:00 +03:00
Natalia Selezneva
9e3ed92e26 Scripting: use VFS events instead of document changes to track changes outside of IDE (KT-35557)
^KT-35557 Fixed

(cherry picked from commit a653feb2dc)
2020-01-16 09:38:05 +03:00
Natalia Selezneva
bdf3543ebf Simplify check for that gradle script configurations is up to date
Get time stamp for script inputs before gradle import

(cherry picked from commit 6bf0e4b1a9)
2020-01-16 09:38:04 +03:00
Natalia Selezneva
cf3c505097 Implement persistent storage for time stamps of files that affect build script configuration (KT-3556)
^KT-3556 Fixed

(cherry picked from commit 3dfbd824e4)
2020-01-16 09:38:04 +03:00
Natalia Selezneva
426815b8ae Scripting: extract API to check if script is related to any gradle project
KT-35268 cannot be implemented without explicit action for loading configurations for script outside of project model

^KT-35268
^KT-34625

(cherry picked from commit ecb05ace91)
2020-01-16 09:38:04 +03:00
Natalia Selezneva
d3bcbcc7eb Tests: switch off script configuration update in MutlifileRefactoringTests
(cherry picked from commit feda832eb7)
2020-01-16 09:38:04 +03:00
Natalia Selezneva
0ef8ecea02 Scripting: remove unexpected cache clear
(cherry picked from commit 233d400e93)
2020-01-16 09:38:04 +03:00
Sergey Igushkin
b9888d160b Deprecate 1.2.x MPP Gradle plugins
Issue #KT-31570 Fixed
2020-01-16 00:00:28 +03:00
Sergey Igushkin
0cb15d8c88 Support Gradle instant execution for Kapt tasks
* In the Kotlin/JVM tasks, move the compiler arguments setup logic to
  a separate class, so that it can be reused by the Kapt tasks without
  directly referencing the Kotlin/JVM tasks

* In the Kapt tasks, carefully capture the values using the Provider API
  so that the task can be serialized for Instant Execution and then
  deserialized and executed without relying on the project model

Issue #KT-35181 Fixed

(cherry picked from commit f9acc0ab88)
2020-01-15 23:55:49 +03:00
Ilmir Usmanov
0ddeb3975c Unconditionally remove $$forInline suffix from enclosing method
when transforming objects with suspend functions/lambdas, which
capture crossinline suspend lambdas. Since functions with the
suffix have a counterpart without the suffix, for java interop
and reflection call purposes, it is safe change.
 #KT-31242 Fixed
2020-01-15 15:12:57 +01:00
Ilya Kirillov
bbb0788e4a New J2K: fix exception when met PsiLambdaParameterType
#KT-35431 fixed

(cherry picked from commit a10f37dd50)
2020-01-15 14:18:25 +03:00
Ilya Kirillov
0dcec158ec New J2K: fix converting multiline comment with /* inside
#KT-18001 fixed
#KT-35081 fixed

(cherry picked from commit 5be80be74d)
2020-01-15 14:18:24 +03:00
Ilya Kirillov
b3654b7d03 New J2K: add missing line break between property and getter
#KT-35739 fixed

(cherry picked from commit a87de01c74)
2020-01-15 14:18:24 +03:00
Ilya Kirillov
47ee2452aa New J2K: fix incorrectly removed line break before constructor comment
That caused class body brace to be under the comment

#KT-35478 fixed

(cherry picked from commit b83a529b77)
2020-01-15 14:18:23 +03:00
Ilya Kirillov
3990d7337a New J2K: correctly convert compound Java assignment expression
#KT-35476 fixed

(cherry picked from commit 7bfad12e6a)
2020-01-15 14:18:23 +03:00
Ilya Kirillov
0b7f44d5ea New J2K: fix UninitializedPropertyAccessException when calculating type of anonymous class
#KT-35395 fixed

(cherry picked from commit 6a8a68a263)
2020-01-15 14:18:22 +03:00
Ilya Kirillov
62eaad300a New J2K: Fix SOE in nj2k Java declarations printer
(cherry picked from commit 7882f566be)
2020-01-15 14:18:22 +03:00
Ilya Kirillov
77cc29b42d New J2K: remove initializer from property without backing field
#KT-33637 fixed

(cherry picked from commit 14a8d3726d)
2020-01-15 14:18:21 +03:00
Leonid Startsev
85dd870693 Supply correct Native platform for module descriptor while compiling from CLI
(cherry picked from commit 9bd966c123)
2020-01-15 12:51:07 +03:00
Leonid Startsev
dddab06b9f Support .decodeSequentially call on JVM and Native and remove READ_ALL handling from all platforms
Fix codegen test

Ignore JVM IR codegen test for a while since it requires updated kotlinx-serialization-runtime in classpath

(cherry picked from commit f2026a49bb)
2020-01-15 12:50:49 +03:00
Yaroslav Chernyshev
49f7aa38ea [Gradle, Native] Added subspecs support in CocoaPods plugin
#KT-32750 fixed
2020-01-15 15:42:59 +07:00
Alexander Gorshenev
797dd80ee5 Allow parallel access to klib zip filesystem 2020-01-14 19:12:30 +03:00
Nicolay Mitropolsky
2d8701a2d9 Uast: fake light method for uast is created only when containing class exists (KT-35310, EA-219604)
(cherry picked from commit 23c2a5c830)
2020-01-14 17:05:29 +03:00
Nicolay Mitropolsky
3330db8c7b Uast: the returnType support for light methods for reified functions (KT-35610)
(cherry picked from commit ed4e73c8e9)
2020-01-14 17:05:27 +03:00
Nicolay Mitropolsky
c54f55d460 Uast: properly handling annotations on destructured variables (KT-35673, EA-220128)
(cherry picked from commit c04ba009e6)
2020-01-14 17:05:26 +03:00
Vladimir Dolzhenko
6aa9fe6def IAE: RangeMarkerImpl.<init>
#EA-141884 Fixed
2020-01-14 13:11:22 +01:00
Vladimir Dolzhenko
e972901b9c Access index under runReadActionInSmartMode in ProbablyContractedCallableNamesImpl
#EA-219476 Fixed
2020-01-14 13:11:10 +01:00
Vladimir Dolzhenko
c5a669ead4 Improve investigation info in KtDotQualifiedExpression
Relates to #EA-212081
2020-01-14 13:11:01 +01:00
Vladimir Dolzhenko
5d4ab93db3 Access index under runReadActionInSmartMode in KotlinRuntimeLibraryUtil
#EA-220414 Fixed
2020-01-14 13:10:52 +01:00
Vladimir Dolzhenko
550d057fc8 Edit kdoc reference in Introducing import alias
#KT-35837 Fixed
2020-01-14 13:10:41 +01:00
Vladimir Dolzhenko
c26522dfd2 Handle kdoc case for Introduce import alias inspection
#EA-210889 Fixed
2020-01-14 13:10:30 +01:00
Vladimir Dolzhenko
5f6f2f8af9 Module info has to be read under readAction in KotlinConfigurationCheckerComponent
#EA-209610 Fixed
2020-01-14 13:09:57 +01:00
Vladimir Dolzhenko
bc5ffe14a9 Improve investigation info in PackageCodegenImpl
Relates to #EA-218779
2020-01-14 13:09:46 +01:00
Vladimir Dolzhenko
dc8b3ffd8a Handle \r line endings in plaintext j2k
#KT-35831 #EA-209568 Fixed
2020-01-14 13:09:35 +01:00
Vladimir Dolzhenko
e1beebde08 Handle java ctor case for Introduce import alias inspection
#KT-35824 #EA-218654 Fixed
2020-01-14 13:09:23 +01:00
Vladimir Dolzhenko
edfe97a165 Add more investigation info to diagnoseUnknownModuleInfo
Relates to #EA-220276
2020-01-14 13:09:08 +01:00
Vladimir Dolzhenko
0e66b5ed9d Add disposable to document listener in ScratchEditorSyncHighlighter
#EA-220382 Fixed
2020-01-14 13:08:32 +01:00
Vladimir Dolzhenko
803df7d7a1 Fix renaming class according to a file name when file name has no name (but extension)
#EA-219715 Fixed
2020-01-14 13:08:23 +01:00
Vladimir Dolzhenko
4f3e26e7be Commit documents before createResourceReference in KotlinAndroidAddStringResource
#EA-127016 Fixed
2020-01-14 13:08:09 +01:00
Vladimir Dolzhenko
87477fe15a Add more investigation info to getFilesForElements
Relates to #EA-209630
2020-01-14 13:08:00 +01:00
Vladimir Dolzhenko
175d0da3e8 Module info has to be read under readAction in scriptDefinitionsFromDependencies
#EA-220355 Fixed
2020-01-14 13:07:46 +01:00
Vladimir Dolzhenko
3eb3e55d6f Module info has to be read under readAction in KotlinNativeABICompatibilityChecker
#EA-220356 Fixed
2020-01-14 13:07:37 +01:00
Ilya Gorbunov
85b931b64a Rewrite UnderMigration and MigrationStatus in Java
to remove dependency on kotlin-stdlib.

#KT-33141

(cherry picked from commit 0764a065e8)
2020-01-14 14:34:08 +03:00
Miguel Serra
5a9e771197 KT-20357: Add samples for linkedSetOf
(cherry picked from commit 4fa5e2d85c)
2020-01-14 14:34:08 +03:00
Tillmann Berg
94b82080bc KT-20357: Add sample for reduce, reduceRight and their indexed counterparts
(cherry picked from commit 95300ae31d)
2020-01-14 14:34:08 +03:00
Ilya Gorbunov
cd7a6989ec Add more reduceOrNull tests
- Test for unsigned arrays
- Update binary api dump with the new functions

(cherry picked from commit 6d092b5f71)
2020-01-14 14:34:08 +03:00
Alfredo Delli Bovi
5bfc9ad010 Add sample for reduceOrNull and reduceRightOrNull
(cherry picked from commit 9546307243)
2020-01-14 14:34:07 +03:00
Alfredo Delli Bovi
f28c13bdcc KT-33761 Add reduceRightOrNull
(cherry picked from commit 06008c40ab)
2020-01-14 14:34:07 +03:00
Alfredo Delli Bovi
773cdf314f KT-33761 Add reduceOrNull
(cherry picked from commit f5d696d3c4)
2020-01-14 14:34:07 +03:00
Abduqodiri Qurbonzoda
cc8dcef9aa Rename Appendable methods parameters
(cherry picked from commit b868e6f8da)
2020-01-14 14:34:07 +03:00
Ilmir Usmanov
16d78e45a7 Disable tail-call optimization for suspend functions with Unit return type
if it overrides functions with another return type.
Otherwise, we cannot determine on call site that the function returns Unit
and cannot { POP, PUSH Unit } in order to avoid the situation when callee's
continuation resumes with non-unit result. The observed behavior is that
suspend function, which should return Unit, suddenly returns other value.
 #KT-35262: Fixed
2020-01-14 12:21:23 +01:00
Ilya Matveev
4d0c015575 IDEA plugin: Don't create iOS test in the share lib project template
Since 1.3.70 an iOS simulator test task is created by the MPP Gradle
plugin out of the box. So we stop creating such a task manually in
the shared library project template.

Issue #KT-35560 Fixed.
2020-01-14 17:44:08 +07:00
Vladimir Dolzhenko
787192fc0d Drop UNREACHABLE_CODE eager text range calculation
#KT-35242 Fixed

(cherry picked from commit 272ca002d7)
2020-01-14 11:25:00 +01:00
Ilya Chernikov
49791a3207 Allow only single expression eval in cli compiler and kotlin runner
#KT-35740 fixed
also add tests and drop logger usage in the cli dependencies manager:
the logger is normally unitialized in the usage scenarios, but related
warnings are annoying.

(cherry picked from commit 995c6a32b8)
2020-01-14 07:59:51 +01:00
Ilya Chernikov
8c24a860c1 [minor] "fix" fir testdata for KT-30245 test, todo: fix problems in fir accordingly
(cherry picked from commit 9da536c202)
2020-01-14 07:59:51 +01:00
Ilya Chernikov
a014725187 [NI] Convert extension lambda to the non-extension one, if needed
#KT-30245 fixed
2020-01-14 07:59:51 +01:00
Ilya Goncharov
7fa0f15a11 [Gradle, JS] Actualize node and yarn version
#KT-35599 fixed

(cherry picked from commit 74889ef3ad)
2020-01-13 19:17:09 +03:00
Ilya Goncharov
f05288848c [Gradle, JS] Add check on run and dist task
- Check existence of compile output file to prevent fail in case of NO-SOURCE

#KT-31894 fixed

(cherry picked from commit 24e3310393)
2020-01-13 19:17:09 +03:00
Vyacheslav Gerasimov
4efebea5db Build: Specify version explicitly for com.github.node-gradle.node 2020-01-13 15:48:10 +03:00
Yan Zhulanow
804c57d90a Update Changelog: add entries for 1.3.70 EAP 1 2020-01-13 17:33:30 +09:00
Yan Zhulanow
464076b5d1 Update Changelog: add entries from 1.3.60/61 2020-01-13 17:31:48 +09:00
nikita.movshin
116e34a0ae Update K/N version 2019-12-26 19:46:21 +03:00
Vyacheslav Gerasimov
0d60f2b5b9 as40: Minor: Fix copyright header in AbstractModelBuilderTest.java
(cherry picked from commit 5a9070b6da)
2019-12-26 16:40:55 +03:00
Vyacheslav Gerasimov
21c3050e96 as40: Fix duplicate registration of kotlin-copyright
(cherry picked from commit 3d79e4609e)
2019-12-26 16:40:55 +03:00
Vyacheslav Gerasimov
ba57ab531b Build: Fix android-wizardTemplate-plugin dependencies
Present only in AS 3.6

(cherry picked from commit 7b1c4e72ba)
2019-12-26 16:40:55 +03:00
Vyacheslav Gerasimov
4ca8140d50 as40: Fix test compilation for AS 4.0 C7 2019-12-26 16:40:54 +03:00
Vyacheslav Gerasimov
e2edf54c86 as40: Fix KotlinDslScriptModelProvider and KotlinDslScriptModelResolver for AS 4.0 C7 2019-12-26 16:40:54 +03:00
Vyacheslav Gerasimov
923c1b1bf0 as40: Upgrade to AS 4.0 C7 2019-12-26 16:40:54 +03:00
Vyacheslav Gerasimov
675806569a Build: Use tar.gz extension for linux AS distributions 2019-12-26 16:40:54 +03:00
Vyacheslav Gerasimov
1e1ffcc4b4 Build: Add Ide.AS40 constant
(cherry picked from commit eda27ab298)
2019-12-26 16:40:54 +03:00
Vyacheslav Gerasimov
04a63cc87b Build: Add as40 to .bunch
(cherry picked from commit 19233ee120)
2019-12-26 16:40:54 +03:00
Alexander Gorshenev
c07d04e459 Don't search for expects when not given -Xmpp-klibs 2019-12-26 11:34:56 +03:00
nikita.movshin
0c71dde729 Update K/N version 2019-12-25 17:37:06 +03:00
Igor Chevdar
15384c9230 [native-gradle-plugin] Disabled cache building for iOS devices 2019-12-25 15:52:06 +05:00
nikita.movshin
415750c393 Update K/N version 2019-12-24 11:31:25 +03:00
Igor Chevdar
14f670f058 [kotlin-native-plugin] Disabled compiler daemon for now 2019-12-23 16:24:20 +03:00
Igor Chevdar
6886f1390d [kotlin-native-plugin] Two fixes:
* Added property to select the cache kind (none, dynamic, static)
* Fixed the check if the cache needs to be rebuilt
2019-12-23 13:32:03 +03:00
Mikhail Zarechenskiy
23c61dfb54 Fix ambiguity between Java and Kotlin SAM candidates
Because of incorrect flag we generated synthetic SAM candidates and got ambiguity when feature `SamConversionPerArgument` was enabled (Gradle case) because candidates for Java were duplicated

 #KT-35579 Fixed
2019-12-23 12:48:43 +03:00
Igor Yakovlev
895f2d609b Fix allopen call from UL methods
Fixed #KT-35577
2019-12-20 18:28:50 +03:00
Ilya Kirillov
1feda25af3 New J2K: Fix not converted jetbrains nullability annotations for types
it became broken after annotation started to be assigned to type elements
instead of declarations after 4da7d11

#KT-34987 fixed

(cherry picked from commit 92f8432b1e)
2019-12-20 13:05:34 +03:00
Roman Artemev
e4c06a63e7 Update bootstrap to #1.3.70-eap-17 2019-12-19 15:30:47 +03:00
nikita.movshin
7887cfdf99 Update K/N version 2019-12-19 14:39:39 +03:00
nikita.movshin
ae87b0a83e Update K/N version 2019-12-19 11:00:57 +03:00
Igor Chevdar
2cf6f0b00d [IR Serialization] Removed native-specific hack in mangler 2019-12-18 14:48:03 +03:00
Zalim Bashorov
2427764a87 [IDE, klib] Support in IDE klibs with dynamic type 2019-12-17 22:05:08 +03:00
Alexander Gorshenev
ae996c4819 Properly mute (and unmute) tests for unrelated backends 2019-12-17 20:57:39 +03:00
Alexander Gorshenev
c97abf79fc Reconciled -Xklib-mpp with commonizer 2019-12-17 20:57:39 +03:00
Alexander Gorshenev
5525b1cef5 Expect/actual support in klibs under -Xklib-mpp 2019-12-17 20:57:39 +03:00
Roman Artemev
c397da5e3f [KLIB] Fix references to type made from TypeParameter in KotlinMangler
- promote ABI version

(cherry picked from commit cad3cb1bbe)
2019-12-17 19:37:53 +03:00
Svyatoslav Kuzmich
a71f272b59 [JS IR BE] Support typeOf 2019-12-17 19:17:28 +03:00
Svyatoslav Kuzmich
644d25e3e5 [JS IR] Properly report compiler errors
Report compiler errors using message collector
Instead of crashing with stack trace
2019-12-17 19:17:28 +03:00
Roman Artemev
85949ab82d [JS IR] Fix external fields naming
(cherry picked from commit 0b7c11c96e)
2019-12-17 17:37:24 +03:00
Roman Artemev
d8e6937891 [JS IR] Fix state machine builder
(cherry picked from commit 02db5ea0eb)
2019-12-17 17:37:24 +03:00
Roman Golyshev
ea7b929543 Add ML completion jar to the resulting plugin jar
- Without it, ML completion jar will not be present in the runtime, causing errors when ML completion is enabled
- This step should have been done in 28ec74648e commit

(cherry picked from commit 8e53ccb852)
2019-12-17 16:35:38 +03:00
Dmitry Gridin
3365dfa5ae KotlinImportOptimizer: should use with isIndeterminate=false
#KT-34928 Fixed

(cherry picked from commit cdabff1941)
2019-12-17 20:20:39 +07:00
Igor Chevdar
33c7df6457 [IR] Remapped some forgotten types during IR copying 2019-12-17 15:50:45 +03:00
Mikhael Bogdanov
3e219f4ebf Keep original casts during reification to avoid VerifyError
#KT-26435 Fixed

(cherry picked from commit 03c2350e79)
2019-12-17 12:48:16 +01:00
Igor Chevdar
eb0ba37e88 [gradle-native-plugin] Build static caches instead of dynamic 2019-12-17 14:38:38 +03:00
Natalia Selezneva
759d1da0df Fix configuration for AS 3.5
(cherry picked from commit e77d8657f4)
2019-12-17 09:30:02 +03:00
4135 changed files with 102481 additions and 41066 deletions

14
.bunch
View File

@@ -1,7 +1,9 @@
192
193
191
183_191
as34_183_191
as35_191
as36
201
192
191_192
183_191_192
as34_183_191_192
as35_191_192
as36_192
as40

7
.idea/dictionaries/sergey_igushkin.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="sergey.igushkin">
<words>
<w>klib</w>
</words>
</dictionary>
</component>

10
.idea/misc.xml generated
View File

@@ -12,14 +12,8 @@
<item index="2" class="java.lang.String" itemvalue="org.gradle.api.tasks.options.Option" />
</list>
</component>
<component name="FacetAutodetectingManager">
<autodetection-disabled>
<facet-type id="Python">
<modules>
<module name="Jet" />
</modules>
</facet-type>
</autodetection-disabled>
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="IdProvider" IDEtalkID="71A301FF1940049D6D82F12C40F1E1D5" />
<component name="JavadocGenerationManager">

File diff suppressed because it is too large Load Diff

View File

@@ -23,8 +23,9 @@ dependencies {
testCompile(commonDep("junit:junit"))
testCompile(protobufFull())
testCompile(kotlinStdlib())
testCompileOnly(intellijDep()) { includeJars("openapi") }
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testRuntime(project(":kotlin-reflect"))
}

View File

@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.utils.Printer
import java.io.File
abstract class BasicMap<K : Comparable<K>, V>(
storageFile: File,
internal val storageFile: File,
keyDescriptor: KeyDescriptor<K>,
valueExternalizer: DataExternalizer<V>
) {

View File

@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.utils.Printer
import java.io.File
abstract class BasicMap<K : Comparable<K>, V>(
storageFile: File,
internal val storageFile: File,
keyDescriptor: KeyDescriptor<K>,
valueExternalizer: DataExternalizer<V>
) {

View File

@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.annotations.TestOnly
import java.io.File
import java.io.IOException
open class BasicMapsOwner(val cachesDir: File) {
private val maps = arrayListOf<BasicMap<*, *>>()
@@ -35,16 +36,35 @@ open class BasicMapsOwner(val cachesDir: File) {
}
open fun clean() {
maps.forEach { it.clean() }
forEachMapSafe("clean", BasicMap<*, *>::clean)
}
open fun close() {
maps.forEach { it.close() }
forEachMapSafe("close", BasicMap<*, *>::close)
}
open fun flush(memoryCachesOnly: Boolean) {
maps.forEach { it.flush(memoryCachesOnly) }
forEachMapSafe("flush") { it.flush(memoryCachesOnly) }
}
@TestOnly fun dump(): String = maps.joinToString("\n\n") { it.dump() }
private fun forEachMapSafe(actionName: String, action: (BasicMap<*, *>) -> Unit) {
val actionExceptions = LinkedHashMap<String, Exception>()
maps.forEach {
try {
action(it)
} catch (e: Exception) {
actionExceptions[it.storageFile.name] = e
}
}
if (actionExceptions.isNotEmpty()) {
val desc = "Could not $actionName incremental caches in $cachesDir: ${actionExceptions.keys.joinToString(", ")}"
val allIOExceptions = actionExceptions.all { it is IOException }
val ex = if (allIOExceptions) IOException(desc) else Exception(desc)
actionExceptions.forEach { (_, e) -> ex.addSuppressed(e) }
throw ex
}
}
@TestOnly
fun dump(): String = maps.joinToString("\n\n") { it.dump() }
}

View File

@@ -79,11 +79,10 @@ class CachingLazyStorage<K, V>(
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
} finally {
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized

View File

@@ -0,0 +1,106 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -8,7 +8,7 @@ buildscript {
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap("1.3.70-dev-1806", cacheRedirectorEnabled))
kotlinBootstrapFrom(BootstrapOption.BintrayBootstrap("1.3.70-eap-145", cacheRedirectorEnabled))
repositories {
bootstrapKotlinRepo?.let(::maven)
@@ -171,7 +171,7 @@ extra["versions.completion-ranking-kotlin"] = "0.0.2"
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.3.70-dev-13747"
extra["versions.kotlin-native"] = "1.3.72"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
@@ -189,11 +189,11 @@ extra["IntellijCoreDependencies"] =
"jdom",
"jna",
"log4j",
"picocontainer",
if (Platform[201].orHigher()) null else "picocontainer",
"snappy-in-java",
"streamex",
"trove4j"
)
).filterNotNull()
extra["compilerModules"] = arrayOf(
@@ -621,11 +621,20 @@ tasks {
)
}
register("idea-new-project-wizard-tests") {
dependsOn("dist")
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
)
}
register("idea-plugin-tests") {
dependsOn("dist")
dependsOn(
"idea-plugin-main-tests",
"idea-plugin-additional-tests"
"idea-plugin-additional-tests",
"idea-new-project-wizard-tests"
)
}

View File

@@ -0,0 +1,8 @@
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8
cacheRedirectorEnabled=true
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50
intellijUltimateEnabled=false

View File

@@ -115,8 +115,7 @@ val repoDir = File(customDepsRepoDir, customDepsOrg)
dependencies {
if (androidStudioRelease != null) {
val extension = if (androidStudioOs == "linux" &&
(androidStudioRelease.startsWith("3.5") || androidStudioRelease.startsWith("3.6")))
val extension = if (androidStudioOs == "linux")
"tar.gz"
else
"zip"

View File

@@ -26,7 +26,7 @@ fun CompatibilityPredicate.or(other: CompatibilityPredicate): CompatibilityPredi
}
enum class Platform : CompatibilityPredicate {
P183, P191, P192, P193;
P183, P191, P192, P193, P201;
val version: Int = name.drop(1).toInt()
@@ -45,10 +45,12 @@ enum class Ide(val platform: Platform) : CompatibilityPredicate {
IJ191(Platform.P191),
IJ192(Platform.P192),
IJ193(Platform.P193),
IJ201(Platform.P201),
AS34(Platform.P183),
AS35(Platform.P183),
AS36(Platform.P192);
AS36(Platform.P192),
AS40(Platform.P193);
val kind = Kind.values().first { it.shortName == name.take(2) }
val version = name.dropWhile { !it.isDigit() }.toInt()

View File

@@ -24,7 +24,9 @@ import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.*
import org.gradle.kotlin.dsl.DependencyHandlerScope
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.register
import java.io.File
private fun Project.kotlinBuildLocalDependenciesDir(): File =
@@ -171,6 +173,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-XX:ReservedCodeCacheSize=240m",
"-XX:+HeapDumpOnOutOfMemoryError",
"-ea",
"-Didea.platform.prefix=Idea",
"-Didea.debug.mode=true",
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",

View File

@@ -130,14 +130,13 @@ fun parse(project: Project, libraries: List<PLibrary>, context: ParserContext):
*/
private val CONFIGURATION_MAPPING = mapOf(
listOf("runtimeClasspath") to Scope.RUNTIME,
listOf("compile", "embedded") to Scope.COMPILE,
listOf("compileOnly") to Scope.PROVIDED
listOf("compileClasspath", "compileOnly") to Scope.PROVIDED,
listOf("embedded") to Scope.COMPILE
)
private val TEST_CONFIGURATION_MAPPING = mapOf(
listOf("runtimeClasspath", "testRuntimeClasspath") to Scope.RUNTIME,
listOf("compile", "testCompile") to Scope.COMPILE,
listOf("compileOnly", "testCompileOnly") to Scope.PROVIDED,
listOf("compileClasspath", "testCompileClasspath", "compileOnly", "testCompileOnly") to Scope.PROVIDED,
listOf("jpsTest") to Scope.TEST
)

View File

@@ -231,6 +231,7 @@ class JpsCompatiblePlugin : Plugin<Project> {
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
val runManagerComponent = rootElement.getOrCreateChild("component", "name" to "RunManager")
val junitConfiguration = runManagerComponent.getOrCreateChild(
"configuration",
"default" to "true",
@@ -238,7 +239,14 @@ class JpsCompatiblePlugin : Plugin<Project> {
"factoryName" to "JUnit"
)
junitConfiguration.apply {
val kotlinJunitConfiguration = runManagerComponent.getOrCreateChild(
"configuration",
"default" to "true",
"type" to "KotlinJUnit",
"factoryName" to "Kotlin JUnit"
)
fun Element.applyJUnitTemplate() {
getOrCreateChild("option", "name" to "WORKING_DIRECTORY").setAttribute("value", "file://\$PROJECT_DIR\$")
getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams ->
var options = vmParams.getAttributeValue("value", "")
@@ -251,18 +259,12 @@ class JpsCompatiblePlugin : Plugin<Project> {
options = if (value == null) optionsWithoutNewValue else (optionsWithoutNewValue + listOf("-D$name=$value"))
}
val robolectricClasspath = project.rootProject
.project(":plugins:android-extensions-compiler")
.configurations.getByName("robolectricClasspath")
.files.joinToString(File.pathSeparator)
if (options.none { it == "-ea" }) {
options += "-ea"
}
addOrReplaceOptionValue("idea.home.path", platformDirProjectRelative)
addOrReplaceOptionValue("ideaSdk.androidPlugin.path", platformDirProjectRelative + "/plugins/android/lib")
addOrReplaceOptionValue("robolectric.classpath", robolectricClasspath)
addOrReplaceOptionValue("use.jps", "true")
addOrReplaceOptionValue("kotlinVersion", project.rootProject.extra["kotlinVersion"].toString())
@@ -281,6 +283,9 @@ class JpsCompatiblePlugin : Plugin<Project> {
}
}
junitConfiguration.applyJUnitTemplate()
kotlinJunitConfiguration.applyJUnitTemplate()
val output = XMLOutputter().also {
it.format = Format.getPrettyFormat().apply {
setEscapeStrategy { Verifier.isHighSurrogate(it) || it == '"' }

View File

@@ -13,7 +13,10 @@ dependencies {
compile(project(":kotlin-reflect"))
compile(projectTests(":compiler:tests-common"))
compile(commonDep("junit:junit"))
compileOnly(intellijDep()) { includeJars("openapi") }
Platform[193].orLower {
compileOnly(intellijDep()) { includeJars("openapi") }
}
testCompile(project(":compiler:incremental-compilation-impl"))
testCompile(project(":core:descriptors"))
@@ -21,7 +24,11 @@ dependencies {
testCompile(project(":compiler:frontend.java"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
testCompile(intellijDep()) { includeJars("openapi", "util", "idea", "idea_rt", "groovy-all", rootProject = rootProject) }
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", "groovy-all", rootProject = rootProject) }
Platform[191].orLower {
testCompile(intellijDep()) { includeJars("jps-builders") }
}

View File

@@ -41,7 +41,7 @@ public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
}
@Override
protected void runTest() throws Throwable {
protected void runTest() {
doTest();
}

View File

@@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
import org.jetbrains.kotlin.config.JvmTarget;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.*;
@@ -87,17 +88,23 @@ public abstract class AnnotationCodegen {
private final InnerClassConsumer innerClassConsumer;
private final KotlinTypeMapper typeMapper;
private final ModuleDescriptor module;
private final GenerationState state;
private AnnotationCodegen(@NotNull InnerClassConsumer innerClassConsumer, @NotNull GenerationState state) {
this.innerClassConsumer = innerClassConsumer;
this.typeMapper = state.getTypeMapper();
this.module = state.getModule();
this.state = state;
}
/**
* @param returnType can be null if not applicable (e.g. {@code annotated} is a class)
*/
public void genAnnotations(@Nullable Annotated annotated, @Nullable Type returnType) {
public void genAnnotations(
@Nullable Annotated annotated,
@Nullable Type returnType,
@Nullable KotlinType typeForTypeAnnotations
) {
if (annotated == null) return;
Set<String> annotationDescriptorsAlreadyPresent = new HashSet<>();
@@ -125,13 +132,14 @@ public abstract class AnnotationCodegen {
}
}
String descriptor = genAnnotation(annotation);
String descriptor = genAnnotation(annotation, null, false);
if (descriptor != null) {
annotationDescriptorsAlreadyPresent.add(descriptor);
}
}
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent);
generateTypeAnnotations(annotated, typeForTypeAnnotations);
}
private void generateAdditionalAnnotations(
@@ -184,15 +192,17 @@ public abstract class AnnotationCodegen {
}
private static boolean isInvisibleFromTheOutside(@Nullable DeclarationDescriptor descriptor) {
if (descriptor instanceof CallableMemberDescriptor && KotlinTypeMapper.isAccessor((CallableMemberDescriptor) descriptor)) {
return true;
}
if (isAccessor(descriptor)) return true;
if (descriptor instanceof MemberDescriptor) {
return AsmUtil.getVisibilityAccessFlag((MemberDescriptor) descriptor) == Opcodes.ACC_PRIVATE;
}
return false;
}
private static boolean isAccessor(@Nullable Annotated descriptor) {
return descriptor instanceof CallableMemberDescriptor && KotlinTypeMapper.isAccessor((CallableMemberDescriptor) descriptor);
}
private void generateNullabilityAnnotation(@Nullable KotlinType type, @NotNull Set<String> annotationDescriptorsAlreadyPresent) {
if (type == null) return;
@@ -321,7 +331,11 @@ public abstract class AnnotationCodegen {
}
@Nullable
private String genAnnotation(@NotNull AnnotationDescriptor annotationDescriptor) {
private String genAnnotation(
@NotNull AnnotationDescriptor annotationDescriptor,
@Nullable TypePath path,
boolean isTypeAnnotation
) {
ClassDescriptor classDescriptor = getAnnotationClass(annotationDescriptor);
assert classDescriptor != null : "Annotation descriptor has no class: " + annotationDescriptor;
RetentionPolicy rp = getRetentionPolicy(classDescriptor);
@@ -339,7 +353,9 @@ public abstract class AnnotationCodegen {
innerClassConsumer.addInnerClassInfoFromAnnotation(classDescriptor);
String asmTypeDescriptor = typeMapper.mapType(annotationDescriptor.getType()).getDescriptor();
AnnotationVisitor annotationVisitor = visitAnnotation(asmTypeDescriptor, rp == RetentionPolicy.RUNTIME);
AnnotationVisitor annotationVisitor = isTypeAnnotation
? visitTypeAnnotation(asmTypeDescriptor, path, rp == RetentionPolicy.RUNTIME)
: visitAnnotation(asmTypeDescriptor, rp == RetentionPolicy.RUNTIME);
genAnnotationArguments(annotationDescriptor, annotationVisitor);
annotationVisitor.visitEnd();
@@ -552,6 +568,11 @@ public abstract class AnnotationCodegen {
@NotNull
abstract AnnotationVisitor visitAnnotation(String descr, boolean visible);
@NotNull
AnnotationVisitor visitTypeAnnotation(String descr, TypePath path, boolean visible) {
throw new RuntimeException("Not implemented");
}
public static AnnotationCodegen forClass(
@NotNull ClassVisitor cv,
@NotNull InnerClassConsumer innerClassConsumer,
@@ -577,6 +598,12 @@ public abstract class AnnotationCodegen {
AnnotationVisitor visitAnnotation(String descr, boolean visible) {
return safe(mv.visitAnnotation(descr, visible));
}
@NotNull
@Override
AnnotationVisitor visitTypeAnnotation(String descr, TypePath path, boolean visible) {
return safe(mv.visitTypeAnnotation(TypeReference.newTypeReference(TypeReference.METHOD_RETURN).getValue(), path, descr, visible));
}
};
}
@@ -591,6 +618,12 @@ public abstract class AnnotationCodegen {
AnnotationVisitor visitAnnotation(String descr, boolean visible) {
return safe(fv.visitAnnotation(descr, visible));
}
@NotNull
@Override
AnnotationVisitor visitTypeAnnotation(String descr, TypePath path, boolean visible) {
return safe(fv.visitTypeAnnotation(TypeReference.newTypeReference(TypeReference.FIELD).getValue(), path, descr, visible));
}
};
}
@@ -606,6 +639,12 @@ public abstract class AnnotationCodegen {
AnnotationVisitor visitAnnotation(String descr, boolean visible) {
return safe(mv.visitParameterAnnotation(parameter, descr, visible));
}
@NotNull
@Override
AnnotationVisitor visitTypeAnnotation(String descr, TypePath path, boolean visible) {
return safe(mv.visitTypeAnnotation(TypeReference.newFormalParameterReference(parameter).getValue(), path, descr, visible));
}
};
}
@@ -627,4 +666,22 @@ public abstract class AnnotationCodegen {
private static AnnotationVisitor safe(@Nullable AnnotationVisitor av) {
return av == null ? NO_ANNOTATION_VISITOR : av;
}
private void generateTypeAnnotations(@NotNull Annotated annotated, @Nullable KotlinType type) {
if (isAccessor(annotated) ||
type == null ||
state.getTarget() == JvmTarget.JVM_1_6 ||
!state.getConfiguration().getBoolean(JVMConfigurationKeys.EMIT_JVM_TYPE_ANNOTATIONS)) {
return;
}
Iterable<TypePathInfo> infos =
new TypeAnnotationCollector().collectTypeAnnotations(type, TypeReference.METHOD_FORMAL_PARAMETER);
for (TypePathInfo info : infos) {
for (AnnotationDescriptor annotationDescriptor : info.getAnnotations()) {
genAnnotation(annotationDescriptor, info.getPath(), true);
}
}
}
}

View File

@@ -150,7 +150,11 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) {
FunctionCodegen.getThrownExceptions(functionDescriptor, typeMapper)
)
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(functionDescriptor, signature.returnType)
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(
functionDescriptor,
signature.returnType,
functionDescriptor.returnType
)
if (state.classBuilderMode == ClassBuilderMode.KAPT3) {
mv.visitAnnotation(ANNOTATION_TYPE_DESCRIPTOR_FOR_JVM_OVERLOADS_GENERATED_METHODS, false)

View File

@@ -4495,10 +4495,16 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// We can use the $$delegatedProperties array as in non-inline functions and upon inlining, detect elements at what indices
// of that array are used in the inline function body, load the corresponding initializing bytecode from <clinit> of the
// container class (where the PropertyReferenceNImpl instance is created), copy and adapt it at the call site
//noinspection ConstantConditions
StackValue value = context.getFunctionDescriptor().isInline()
? generatePropertyReference(variable.getDelegate(), variableDescriptor, variableDescriptor, null)
: PropertyCodegen.getDelegatedPropertyMetadata(variableDescriptor, bindingContext);
StackValue value;
if (PropertyCodegen.isDelegatedPropertyWithOptimizedMetadata(variableDescriptor, bindingContext)) {
value = PropertyCodegen.getOptimizedDelegatedPropertyMetadataValue();
} else if (context.getFunctionDescriptor().isInline()) {
//noinspection ConstantConditions
value = generatePropertyReference(variable.getDelegate(), variableDescriptor, variableDescriptor, null);
}
else {
value = PropertyCodegen.getDelegatedPropertyMetadata(variableDescriptor, bindingContext);
}
value.put(K_PROPERTY_TYPE, null, v);
metadataVar.storeSelector(K_PROPERTY_TYPE, null, v);
}

View File

@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.codegen.state.TypeMapperUtilsKt;
import org.jetbrains.kotlin.config.JvmDefaultMode;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor;
import org.jetbrains.kotlin.load.java.BuiltinMethodsWithSpecialGenericSignature;
@@ -56,7 +55,10 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.TypeUtils;
import org.jetbrains.org.objectweb.asm.*;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
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.commons.Method;
import org.jetbrains.org.objectweb.asm.util.TraceMethodVisitor;
@@ -301,7 +303,9 @@ public class FunctionCodegen {
annotationsOwner = functionDescriptor;
}
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(annotationsOwner, asmMethod.getReturnType());
AnnotationCodegen.forMethod(mv, memberCodegen, state)
.genAnnotations(annotationsOwner, asmMethod.getReturnType(), functionDescriptor.getReturnType());
generateParameterAnnotations(annotationsOwner, mv, jvmSignature, memberCodegen, state);
}
@@ -531,7 +535,7 @@ public class FunctionCodegen {
continue;
}
Annotated annotated =
ParameterDescriptor annotated =
kind == JvmMethodParameterKind.VALUE
? iterator.next()
: kind == JvmMethodParameterKind.RECEIVER
@@ -540,8 +544,9 @@ public class FunctionCodegen {
if (annotated != null) {
//noinspection ConstantConditions
AnnotationCodegen.forParameter(i - syntheticParameterCount, mv, innerClassConsumer, state)
.genAnnotations(annotated, parameterSignature.getAsmType());
int parameterIndex = i - syntheticParameterCount;
AnnotationCodegen.forParameter(parameterIndex, mv, innerClassConsumer, state)
.genAnnotations(annotated, parameterSignature.getAsmType(), annotated.getReturnType());
}
}
}

View File

@@ -232,7 +232,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
writeEnclosingMethod();
AnnotationCodegen.forClass(v.getVisitor(), this, state).genAnnotations(descriptor, null);
AnnotationCodegen.forClass(v.getVisitor(), this, state).genAnnotations(descriptor, null, null);
generateEnumEntries();
}
@@ -905,7 +905,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
type.getDescriptor(), typeMapper.mapFieldSignature(property.getType(), property),
info.defaultValue);
AnnotationCodegen.forField(fv, this, state).genAnnotations(property, type);
AnnotationCodegen.forField(fv, this, state).genAnnotations(property, type, null);
//This field are always static and final so if it has constant initializer don't do anything in clinit,
//field would be initialized via default value in v.newField(...) - see JVM SPEC Ch.4
@@ -1087,7 +1087,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
int isDeprecated = KotlinBuiltIns.isDeprecated(descriptor) ? ACC_DEPRECATED : 0;
FieldVisitor fv = v.newField(JvmDeclarationOriginKt.OtherOrigin(enumEntry, descriptor), ACC_PUBLIC | ACC_ENUM | ACC_STATIC | ACC_FINAL | isDeprecated,
descriptor.getName().asString(), classAsmType.getDescriptor(), null, null);
AnnotationCodegen.forField(fv, this, state).genAnnotations(descriptor, null);
AnnotationCodegen.forField(fv, this, state).genAnnotations(descriptor, null, null);
}
initializeEnumConstants(enumEntries);

View File

@@ -261,7 +261,7 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
int flags = ACC_DEPRECATED | ACC_STATIC | ACC_SYNTHETIC | AsmUtil.getVisibilityAccessFlag(descriptor);
MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(descriptor), flags, syntheticMethod.getName(),
syntheticMethod.getDescriptor(), null, null);
AnnotationCodegen.forMethod(mv, this, state).genAnnotations(new AnnotatedImpl(annotations), Type.VOID_TYPE);
AnnotationCodegen.forMethod(mv, this, state).genAnnotations(new AnnotatedImpl(annotations), Type.VOID_TYPE, null);
mv.visitCode();
mv.visitInsn(Opcodes.RETURN);
mv.visitEnd();

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.codegen;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.SmartList;
@@ -37,6 +38,7 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.lazy.descriptors.PackageDescriptorUtilKt;
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments;
import org.jetbrains.org.objectweb.asm.Type;
import java.util.ArrayList;
@@ -44,6 +46,8 @@ import java.util.Collection;
import java.util.List;
public class PackageCodegenImpl implements PackageCodegen {
private static final Logger LOG = Logger.getInstance(PackageCodegenImpl.class);
private final GenerationState state;
private final Collection<KtFile> files;
private final PackageFragmentDescriptor packageFragment;
@@ -147,10 +151,13 @@ public class PackageCodegenImpl implements PackageCodegen {
for (KtFile file : files) {
PackageFragmentDescriptor fragment =
PackageDescriptorUtilKt.findPackageFragmentForFile(state.getModule(), file);
assert fragment != null : "package fragment is null for " + file + "\n" + file.getText();
assert expectedPackageFqName.equals(fragment.getFqName()) :
"expected package fq name: " + expectedPackageFqName + ", actual: " + fragment.getFqName();
if (fragment == null) {
LOG.error(new KotlinExceptionWithAttachments(
"package fragment is not found for module:" + state.getModule() + " file:" + file)
.withAttachment("file.kt", file.getText()));
} else if (!expectedPackageFqName.equals(fragment.getFqName())) {
LOG.error("expected package fq name: " + expectedPackageFqName + ", actual: " + fragment.getFqName());
}
if (!fragments.contains(fragment)) {
fragments.add(fragment);

View File

@@ -86,7 +86,7 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
}
}
Annotated annotatedFile = new AnnotatedImpl(Annotations.Companion.create(fileAnnotationDescriptors));
AnnotationCodegen.forClass(v.getVisitor(), this, state).genAnnotations(annotatedFile, null);
AnnotationCodegen.forClass(v.getVisitor(), this, state).genAnnotations(annotatedFile, null, null);
}
@Override

View File

@@ -270,7 +270,7 @@ public class PropertyCodegen {
PropertyGetterDescriptor getter = descriptor.getGetter();
assert getter != null : "Annotation property should have a getter: " + descriptor;
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, getter, asmMethod);
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(getter, asmMethod.getReturnType());
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(getter, asmMethod.getReturnType(), null);
KtExpression defaultValue = loadAnnotationArgumentDefaultValue(parameter, descriptor, expectedAnnotationConstructor);
if (defaultValue != null) {
@@ -417,7 +417,8 @@ public class PropertyCodegen {
);
if (annotatedField != null) {
AnnotationCodegen.forField(fv, memberCodegen, state).genAnnotations(annotatedField, type);
AnnotationCodegen.forField(fv, memberCodegen, state)
.genAnnotations(annotatedField, type, propertyDescriptor.getType());
}
}
}
@@ -563,13 +564,24 @@ public class PropertyCodegen {
return codegen.invokeFunction(resolvedCall, receiver);
}
public static boolean isDelegatedPropertyWithOptimizedMetadata(
@NotNull VariableDescriptorWithAccessors descriptor,
@NotNull BindingContext bindingContext
) {
return Boolean.TRUE == bindingContext.get(DELEGATED_PROPERTY_WITH_OPTIMIZED_METADATA, descriptor);
}
public static @NotNull StackValue getOptimizedDelegatedPropertyMetadataValue() {
return StackValue.constant(null, K_PROPERTY_TYPE);
}
@NotNull
public static StackValue getDelegatedPropertyMetadata(
@NotNull VariableDescriptorWithAccessors descriptor,
@NotNull BindingContext bindingContext
) {
if (Boolean.TRUE == bindingContext.get(DELEGATED_PROPERTY_WITH_OPTIMIZED_METADATA, descriptor)) {
return StackValue.constant(null, K_PROPERTY_TYPE);
if (isDelegatedPropertyWithOptimizedMetadata(descriptor, bindingContext)) {
return getOptimizedDelegatedPropertyMetadataValue();
}
Type owner = bindingContext.get(DELEGATED_PROPERTY_METADATA_OWNER, descriptor);

View File

@@ -51,7 +51,7 @@ class ScriptCodegen private constructor(
typeMapper.mapSupertype(it.defaultType, null).internalName
}.toTypedArray()
)
AnnotationCodegen.forClass(v.visitor, this, state).genAnnotations(scriptDescriptor, null)
AnnotationCodegen.forClass(v.visitor, this, state).genAnnotations(scriptDescriptor, null, null)
}
override fun generateBody() {
@@ -99,7 +99,8 @@ class ScriptCodegen private constructor(
OtherOrigin(scriptDeclaration, scriptDescriptor.unsubstitutedPrimaryConstructor),
ACC_PUBLIC, jvmSignature.asmMethod.name, jvmSignature.asmMethod.descriptor, null, null)
AnnotationCodegen.forMethod(mv, this, state).genAnnotations(scriptDescriptor.unsubstitutedPrimaryConstructor, asmMethod.returnType)
AnnotationCodegen.forMethod(mv, this, state)
.genAnnotations(scriptDescriptor.unsubstitutedPrimaryConstructor, asmMethod.returnType, null)
if (state.classBuilderMode.generateBodies) {
mv.visitCode()

View File

@@ -797,7 +797,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
if (valueArgument == null || newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) == null) continue;
valueParametersWithSAMConversion.add(valueParameter.getOriginal());
valueParametersWithSAMConversion.add(valueParameter);
}
writeSamValueForValueParameters(valueParametersWithSAMConversion, newResolvedCall.getValueArgumentsByIndex());

View File

@@ -475,7 +475,8 @@ class CoroutineCodegenForLambda private constructor(
shouldPreserveClassInitialization = constructorCallNormalizationMode.shouldPreserveClassInitialization,
containingClassInternalName = v.thisName,
isForNamedFunction = false,
languageVersionSettings = languageVersionSettings
languageVersionSettings = languageVersionSettings,
disableTailCallOptimizationForFunctionReturningUnit = false
)
return if (forInline) AddEndLabelMethodVisitor(
MethodNodeCopyingMethodVisitor(

View File

@@ -63,6 +63,10 @@ class CoroutineTransformerMethodVisitor(
// These two are needed to report diagnostics about suspension points inside critical section
private val element: KtElement,
private val diagnostics: DiagnosticSink,
// Since tail-call optimization of functions with Unit return type relies on ability of call-site to recognize them,
// in order to ignore return value and push Unit, when we cannot ensure this ability, for example, when the function overrides function,
// returning Any, we need to disable tail-call optimization for these functions.
private val disableTailCallOptimizationForFunctionReturningUnit: Boolean,
// It's only matters for named functions, may differ from '!isStatic(access)' in case of DefaultImpls
private val needDispatchReceiver: Boolean = false,
// May differ from containingClassInternalName in case of DefaultImpls
@@ -111,7 +115,8 @@ class CoroutineTransformerMethodVisitor(
val examiner = MethodNodeExaminer(
languageVersionSettings,
containingClassInternalName,
methodNode
methodNode,
disableTailCallOptimizationForFunctionReturningUnit
)
if (examiner.allSuspensionPointsAreTailCalls(suspensionPoints)) {
examiner.replacePopsBeforeSafeUnitInstancesWithCoroutineSuspendedChecks()
@@ -899,7 +904,8 @@ class CoroutineTransformerMethodVisitor(
private class MethodNodeExaminer(
val languageVersionSettings: LanguageVersionSettings,
val containingClassInternalName: String,
val methodNode: MethodNode
val methodNode: MethodNode,
disableTailCallOptimizationForFunctionReturningUnit: Boolean
) {
private val sourceFrames: Array<Frame<SourceValue>?> =
MethodTransformer.analyze(containingClassInternalName, methodNode, IgnoringCopyOperationSourceInterpreter())
@@ -912,25 +918,27 @@ private class MethodNodeExaminer(
private val meaningfulPredecessorsCache = hashMapOf<AbstractInsnNode, List<AbstractInsnNode>>()
init {
// retrieve all POP insns
val pops = methodNode.instructions.asSequence().filter { it.opcode == Opcodes.POP }
// for each of them check that all successors are PUSH Unit
val popsBeforeUnitInstances = pops.map { it to it.meaningfulSuccessors() }
.filter { (_, succs) -> succs.all { it.isUnitInstance() } }
.map { it.first }.toList()
for (pop in popsBeforeUnitInstances) {
val units = pop.meaningfulSuccessors()
val allUnitsAreSafe = units.all { unit ->
// check no other predecessor exists
unit.meaningfulPredecessors().all { it in popsBeforeUnitInstances } &&
// check they have only returns among successors
unit.meaningfulSuccessors().all { it.opcode == Opcodes.ARETURN }
if (!disableTailCallOptimizationForFunctionReturningUnit) {
// retrieve all POP insns
val pops = methodNode.instructions.asSequence().filter { it.opcode == Opcodes.POP }
// for each of them check that all successors are PUSH Unit
val popsBeforeUnitInstances = pops.map { it to it.meaningfulSuccessors() }
.filter { (_, succs) -> succs.all { it.isUnitInstance() } }
.map { it.first }.toList()
for (pop in popsBeforeUnitInstances) {
val units = pop.meaningfulSuccessors()
val allUnitsAreSafe = units.all { unit ->
// check no other predecessor exists
unit.meaningfulPredecessors().all { it in popsBeforeUnitInstances } &&
// check they have only returns among successors
unit.meaningfulSuccessors().all { it.opcode == Opcodes.ARETURN }
}
if (!allUnitsAreSafe) continue
// save them all to the properties
popsBeforeSafeUnitInstances += pop
safeUnitInstances += units
units.flatMapTo(areturnsAfterSafeUnitInstances) { it.meaningfulSuccessors() }
}
if (!allUnitsAreSafe) continue
// save them all to the properties
popsBeforeSafeUnitInstances += pop
safeUnitInstances += units
units.flatMapTo(areturnsAfterSafeUnitInstances) { it.meaningfulSuccessors() }
}
}

View File

@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.psi.KtFunction
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.types.typeUtil.isUnit
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.kotlin.utils.sure
import org.jetbrains.org.objectweb.asm.MethodVisitor
@@ -100,10 +101,27 @@ open class SuspendFunctionGenerationStrategy(
shouldPreserveClassInitialization = constructorCallNormalizationMode.shouldPreserveClassInitialization,
needDispatchReceiver = originalSuspendDescriptor.dispatchReceiverParameter != null,
internalNameForDispatchReceiver = containingClassInternalNameOrNull(),
languageVersionSettings = languageVersionSettings
languageVersionSettings = languageVersionSettings,
disableTailCallOptimizationForFunctionReturningUnit = originalSuspendDescriptor.returnType?.isUnit() == true &&
originalSuspendDescriptor.overriddenDescriptors.isNotEmpty() &&
!originalSuspendDescriptor.allOverriddenFunctionsReturnUnit()
)
}
private fun FunctionDescriptor.allOverriddenFunctionsReturnUnit(): Boolean {
val visited = mutableSetOf<FunctionDescriptor>()
fun bfs(descriptor: FunctionDescriptor): Boolean {
if (!visited.add(descriptor)) return true
if (descriptor.original.returnType?.isUnit() != true) return false
for (parent in descriptor.overriddenDescriptors) {
if (!bfs(parent)) return false
}
return true
}
return bfs(this)
}
private fun containingClassInternalNameOrNull() =
originalSuspendDescriptor.containingDeclaration.safeAs<ClassDescriptor>()?.let(state.typeMapper::mapClass)?.internalName

View File

@@ -253,11 +253,7 @@ class AnonymousObjectTransformer(
// Since $$forInline functions are not generated if retransformation is the last one (i.e. call site is not inline)
// link to the function in OUTERCLASS field becomes invalid. However, since $$forInline function always has no-inline
// companion without the suffix, use it.
if (info.isSuspend && info.isInlineOrInsideInline) {
visitor.visitOuterClass(info.ownerClassName, info.functionName?.removeSuffix(FOR_INLINE_SUFFIX), info.functionDesc)
} else {
visitor.visitOuterClass(info.ownerClassName, info.functionName, info.functionDesc)
}
visitor.visitOuterClass(info.ownerClassName, info.functionName?.removeSuffix(FOR_INLINE_SUFFIX), info.functionDesc)
}
private fun inlineMethodAndUpdateGlobalResult(

View File

@@ -222,7 +222,11 @@ class ReifiedTypeInliner<KT : KotlinTypeMarker>(
generateAsCast(InstructionAdapter(newMethodNode), kotlinType, asmType, safe, languageVersionSettings)
instructions.insert(insn, newMethodNode.instructions)
instructions.remove(stubCheckcast)
// Keep stubCheckcast to avoid VerifyErrors on 1.8+ bytecode,
// it's safe to remove cast to Object as FrameMap will use it as default value for merged branches
if (stubCheckcast.desc == AsmTypes.OBJECT_TYPE.internalName) {
instructions.remove(stubCheckcast)
}
// TODO: refine max stack calculation (it's not always as big as +4)
maxStackSize = max(maxStackSize, 4)

View File

@@ -17,11 +17,20 @@ import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.kotlin.FileBasedKotlinClass
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.header.ReadKotlinClassHeaderAnnotationVisitor
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.*
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.deserialization.getName
import org.jetbrains.kotlin.utils.addToStdlib.cast
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.*
import org.jetbrains.org.objectweb.asm.tree.*
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceInterpreter
@@ -108,7 +117,8 @@ class CoroutineTransformer(
languageVersionSettings = state.languageVersionSettings,
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
containingClassInternalName = classBuilder.thisName,
isForNamedFunction = false
isForNamedFunction = false,
disableTailCallOptimizationForFunctionReturningUnit = false
)
)
@@ -137,6 +147,8 @@ class CoroutineTransformer(
ArrayUtil.toStringArray(node.exceptions)
)
) {
// If the node already has state-machine, it is safer to generate state-machine.
val disableTailCallOptimization = methods.find { it.name == name && it.desc == node.desc }?.let { isStateMachine(it) } ?: false
val stateMachineBuilder = surroundNoinlineCallsWithMarkers(
node,
CoroutineTransformerMethodVisitor(
@@ -149,7 +161,8 @@ class CoroutineTransformer(
containingClassInternalName = classBuilder.thisName,
isForNamedFunction = true,
needDispatchReceiver = true,
internalNameForDispatchReceiver = classBuilder.thisName
internalNameForDispatchReceiver = classBuilder.thisName,
disableTailCallOptimizationForFunctionReturningUnit = disableTailCallOptimization
)
)

View File

@@ -0,0 +1,90 @@
/*
* Copyright 2010-2019 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
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.load.kotlin.FileBasedKotlinClass
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
import org.jetbrains.kotlin.types.*
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.TypePath
class TypePathInfo(
val path: TypePath?,
val annotations: List<AnnotationDescriptor>
)
private class State(val type: Int, val path: MutableList<String>) {
val results = arrayListOf<TypePathInfo>()
fun addStep(step: String) {
path.add(step)
}
fun removeStep(step: String) {
path.removeAt(path.lastIndex)
}
fun rememberAnnotations(annotations: List<AnnotationDescriptor>) {
results.add(TypePathInfo(TypePath.fromString(path.joinToString("")), annotations))
}
}
class TypeAnnotationCollector {
private lateinit var state: State
fun collectTypeAnnotations(kotlinType: KotlinType, annotationType: Int): ArrayList<TypePathInfo> {
state = State(annotationType, arrayListOf())
kotlinType.collectTypeAnnotations()
return state.results
}
private fun KotlinType.collectTypeAnnotations() {
if (isFlexible()) {
return upperIfFlexible().collectTypeAnnotations()
} else if ((this.constructor.declarationDescriptor as? ClassDescriptor)?.isInner == true) {
//skip inner classes for now it's not clear should type annotations on outer be supported or not
return
}
typeAnnotations.takeIf { it.isNotEmpty() }?.let { state.rememberAnnotations(it) }
arguments.forEachIndexed { index, type ->
//skip in/out variance for now it's not clear should type annotations on wildcard bound be supported or not
if (type.projectionKind == Variance.INVARIANT) {
when {
KotlinBuiltIns.isArray(this) -> type.type.process("[")
else -> type.type.process("$index;")
}
}
}
}
fun KotlinType.process(step: String) {
state.addStep(step)
this.collectTypeAnnotations()
state.removeStep(step)
}
private val KotlinType.typeAnnotations
get() = annotations.filter {
//We only generate annotations which have the TYPE_USE Java target.
// Those are type annotations which were compiled with JVM target bytecode version 1.8 or greater
(it.annotationClass as? DeserializedClassDescriptor)?.let { classDescriptor ->
((classDescriptor.source as? KotlinJvmBinarySourceElement)?.binaryClass as? FileBasedKotlinClass)?.classVersion ?: 0 >= Opcodes.V1_8
} ?: true
}
}

View File

@@ -67,7 +67,10 @@ dependencies {
testCompileOnly(project(it))
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "util", "asm-all", rootProject = rootProject) }
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompileOnly(intellijDep()) { includeJars("idea", "idea_rt", "util", "asm-all", rootProject = rootProject) }
Platform[192].orHigher {
testRuntimeOnly(intellijPluginDep("java"))

View File

@@ -24,6 +24,10 @@ dependencies {
compile(project(":compiler:fir:resolve"))
compile(project(":compiler:fir:java"))
compile(project(":compiler:fir:fir2ir"))
compile(project(":kotlin-util-klib"))
compile(project(":kotlin-util-io"))
compile(project(":compiler:ir.serialization.common"))
compile(toolsJar())
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }

View File

@@ -17,10 +17,8 @@
package org.jetbrains.kotlin.analyzer.common
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.analyzer.*
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.container.StorageComponentContainer
@@ -30,6 +28,7 @@ import org.jetbrains.kotlin.container.useInstance
import org.jetbrains.kotlin.context.ModuleContext
import org.jetbrains.kotlin.context.ProjectContext
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.CompositePackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.frontend.di.configureModule
@@ -38,7 +37,6 @@ import org.jetbrains.kotlin.load.kotlin.MetadataFinderFactory
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.CommonPlatforms
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.TargetPlatformVersion
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker
@@ -60,14 +58,20 @@ class CommonResolverForModuleFactory(
private val platformParameters: CommonAnalysisParameters,
private val targetEnvironment: TargetEnvironment,
private val targetPlatform: TargetPlatform,
private val shouldCheckExpectActual: Boolean
private val shouldCheckExpectActual: Boolean,
private val commonDependenciesContainer: CommonDependenciesContainer? = null
) : ResolverForModuleFactory() {
private class SourceModuleInfo(
override val name: Name,
override val capabilities: Map<ModuleDescriptor.Capability<*>, Any?>,
private val dependencies: Iterable<ModuleInfo>,
override val expectedBy: List<ModuleInfo>,
private val modulesWhoseInternalsAreVisible: Collection<ModuleInfo>,
private val dependOnOldBuiltIns: Boolean
) : ModuleInfo {
override fun dependencies() = listOf(this)
override fun dependencies() = listOf(this, *dependencies.toList().toTypedArray() )
override fun modulesWhoseInternalsAreVisible(): Collection<ModuleInfo> = modulesWhoseInternalsAreVisible
override fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns =
if (dependOnOldBuiltIns) ModuleInfo.DependencyOnBuiltIns.LAST else ModuleInfo.DependencyOnBuiltIns.NONE
@@ -101,10 +105,13 @@ class CommonResolverForModuleFactory(
languageVersionSettings, CommonPlatforms.defaultCommonPlatform, CommonPlatformAnalyzerServices, shouldCheckExpectActual
)
val packageFragmentProviders = listOf(
container.get<ResolveSession>().packageFragmentProvider,
container.get<MetadataPackageFragmentProvider>()
)
val packageFragmentProviders =
/** If this is a dependency module that [commonDependenciesContainer] knows about, get the package fragments from there */
commonDependenciesContainer?.packageFragmentProviderForModuleInfo(moduleInfo)?.let(::listOf)
?: listOf(
container.get<ResolveSession>().packageFragmentProvider,
container.get<MetadataPackageFragmentProvider>()
)
return ResolverForModule(CompositePackageFragmentProvider(packageFragmentProviders), container)
}
@@ -113,9 +120,17 @@ class CommonResolverForModuleFactory(
fun analyzeFiles(
files: Collection<KtFile>, moduleName: Name, dependOnBuiltIns: Boolean, languageVersionSettings: LanguageVersionSettings,
capabilities: Map<ModuleDescriptor.Capability<*>, Any?> = emptyMap(),
dependenciesContainer: CommonDependenciesContainer? = null,
metadataPartProviderFactory: (ModuleContent<ModuleInfo>) -> MetadataPartProvider
): AnalysisResult {
val moduleInfo = SourceModuleInfo(moduleName, capabilities, dependOnBuiltIns)
val moduleInfo = SourceModuleInfo(
moduleName,
capabilities,
dependenciesContainer?.moduleInfos?.toList().orEmpty(),
dependenciesContainer?.refinesModuleInfos.orEmpty(),
dependenciesContainer?.friendModuleInfos.orEmpty(),
dependOnBuiltIns
)
val project = files.firstOrNull()?.project ?: throw AssertionError("No files to analyze")
val multiplatformLanguageSettings = object : LanguageVersionSettings by languageVersionSettings {
@@ -128,21 +143,25 @@ class CommonResolverForModuleFactory(
CommonAnalysisParameters(metadataPartProviderFactory),
CompilerEnvironment,
CommonPlatforms.defaultCommonPlatform,
shouldCheckExpectActual = false
shouldCheckExpectActual = false,
dependenciesContainer
)
@Suppress("NAME_SHADOWING")
val resolver = ResolverForSingleModuleProject(
val resolver = ResolverForSingleModuleProject<ModuleInfo>(
"sources for metadata serializer",
ProjectContext(project, "metadata serializer"),
moduleInfo,
resolverForModuleFactory,
GlobalSearchScope.allScope(project),
languageVersionSettings = multiplatformLanguageSettings,
syntheticFiles = files
syntheticFiles = files,
knownDependencyModuleDescriptors = dependenciesContainer?.moduleInfos
?.associateWith(dependenciesContainer::moduleDescriptorForModuleInfo).orEmpty()
)
val moduleDescriptor = resolver.descriptorForModule(moduleInfo)
val container = resolver.resolverForModule(moduleInfo).componentProvider
container.get<LazyTopDownAnalyzer>().analyzeDeclarations(TopDownAnalysisMode.TopLevelDeclarations, files)
@@ -152,6 +171,16 @@ class CommonResolverForModuleFactory(
}
}
interface CommonDependenciesContainer {
val moduleInfos: List<ModuleInfo>
fun moduleDescriptorForModuleInfo(moduleInfo: ModuleInfo): ModuleDescriptor
fun packageFragmentProviderForModuleInfo(moduleInfo: ModuleInfo): PackageFragmentProvider?
val friendModuleInfos: List<ModuleInfo>
val refinesModuleInfos: List<ModuleInfo>
}
private fun createContainerToResolveCommonCode(
moduleContext: ModuleContext,
bindingTrace: BindingTrace,

View File

@@ -175,6 +175,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var useExperimental: Array<String>? by FreezableVar(null)
@Argument(
value = "-Xopt-in",
valueDescription = "<fq.name>",
description = "Enable usages of API that requires opt-in with an opt-in requirement marker with the given fully qualified name"
)
var optIn: Array<String>? by FreezableVar(null)
@Argument(
value = "-Xproper-ieee754-comparisons",
description = "Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types"
@@ -313,6 +320,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var useMixedNamedArguments: Boolean by FreezableVar(false)
@Argument(
value = "-Xklib-mpp",
description = "Enable experimental support for multi-platform klib libraries"
)
var klibBasedMpp: Boolean by FreezableVar(false)
@Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default")
var disableDefaultScriptingPlugin: Boolean by FreezableVar(false)
@@ -328,8 +341,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
put(AnalysisFlags.multiPlatformDoNotCheckActual, noCheckActual)
put(AnalysisFlags.experimental, experimental?.toList().orEmpty())
put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty())
put(AnalysisFlags.klibBasedMpp, klibBasedMpp)
val experimentalFqNames = experimental?.toList().orEmpty()
if (experimentalFqNames.isNotEmpty()) {
put(AnalysisFlags.experimental, experimentalFqNames)
collector.report(CompilerMessageSeverity.WARNING, "'-Xexperimental' is deprecated and will be removed in a future release")
}
put(AnalysisFlags.useExperimental, useExperimental?.toList().orEmpty() + optIn?.toList().orEmpty())
put(AnalysisFlags.explicitApiVersion, apiVersion != null)
put(AnalysisFlags.allowResultReturnType, allowResultReturnType)
ExplicitApiMode.fromString(explicitApi)?.also { put(AnalysisFlags.explicitApiMode, it) } ?: collector.report(

View File

@@ -1,21 +1,13 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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.common.arguments
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies.ALL
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies.OLDER
class K2JSDceArguments : CommonToolArguments() {
companion object {
@JvmStatic private val serialVersionUID = 0L
@@ -48,4 +40,16 @@ class K2JSDceArguments : CommonToolArguments() {
)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
var devMode: Boolean by FreezableVar(false)
@Argument(
value = "-Xdev-mode-overwriting-strategy",
valueDescription = "{$OLDER|$ALL}",
description = "Overwriting strategy during copy dependencies in development mode"
)
var devModeOverwritingStrategy: String? by NullableStringFreezableVar(null)
}
object DevModeOverwritingStrategies {
const val OLDER = "older"
const val ALL = "all"
}

View File

@@ -50,7 +50,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
var noReflect: Boolean by FreezableVar(false)
@Argument(value = "-Xexpression", description = "Evaluate the given string as a Kotlin script")
var expressions: Array<String>? by FreezableVar(null)
var expression: String? by FreezableVar(null)
@Argument(
value = "-script-templates",
@@ -289,6 +289,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var allowNoSourceFiles: Boolean by FreezableVar(false)
@Argument(
value = "-Xemit-jvm-type-annotations",
description = "Emit JVM type annotations in bytecode"
)
var emitJvmTypeAnnotations: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics

View File

@@ -40,4 +40,18 @@ class K2MetadataCompilerArguments : CommonCompilerArguments() {
description = "Enable in JPS"
)
var enabledInJps: Boolean by FreezableVar(false)
@Argument(
value = "-Xfriend-paths",
valueDescription = "<path>",
description = "Paths to output directories for friend modules (whose internals should be visible)"
)
var friendPaths: Array<String>? by FreezableVar(null)
@Argument(
value = "-Xfriend-paths",
valueDescription = "<path>",
description = "Paths to output directories for friend modules (whose internals should be visible)"
)
var refinesPaths: Array<String>? by FreezableVar(null)
}

View File

@@ -31,10 +31,7 @@ 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.IncrementalResultsConsumer
import org.jetbrains.kotlin.ir.backend.js.compile
import org.jetbrains.kotlin.ir.backend.js.generateKLib
import org.jetbrains.kotlin.ir.backend.js.jsPhases
import org.jetbrains.kotlin.ir.backend.js.jsResolveLibraries
import org.jetbrains.kotlin.ir.backend.js.*
import org.jetbrains.kotlin.js.config.EcmaVersion
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.js.config.JsConfig
@@ -185,31 +182,39 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
else
outputFilePath
generateKLib(
project = config.project,
files = sourcesFiles,
configuration = config.configuration,
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
outputKlibPath = outputKlibPath,
nopack = arguments.irProduceKlibDir
)
try {
generateKLib(
project = config.project,
files = sourcesFiles,
configuration = config.configuration,
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
outputKlibPath = outputKlibPath,
nopack = arguments.irProduceKlibDir
)
} catch (e: JsIrCompilationError) {
return COMPILATION_ERROR
}
}
if (arguments.irProduceJs) {
val phaseConfig = createPhaseConfig(jsPhases, arguments, messageCollector)
val compiledModule = compile(
projectJs,
sourcesFiles,
config.configuration,
phaseConfig,
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
mainArguments = mainCallArguments,
generateFullJs = !arguments.irDce,
generateDceJs = arguments.irDce
)
val compiledModule = try {
compile(
projectJs,
sourcesFiles,
config.configuration,
phaseConfig,
allDependencies = resolvedLibraries,
friendDependencies = friendDependencies,
mainArguments = mainCallArguments,
generateFullJs = !arguments.irDce,
generateDceJs = arguments.irDce
)
} catch (e: JsIrCompilationError) {
return COMPILATION_ERROR
}
val jsCode = if (arguments.irDce) compiledModule.dceJsCode!! else compiledModule.jsCode!!
outputFile.writeText(jsCode)
@@ -370,7 +375,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
}
fun messageCollectorLogger(collector: MessageCollector) = object : Logger {
override fun warning(message: String)= collector.report(STRONG_WARNING, message)
override fun warning(message: String) = collector.report(STRONG_WARNING, message)
override fun error(message: String) = collector.report(ERROR, message)
override fun log(message: String) = collector.report(LOGGING, message)
override fun fatal(message: String): Nothing {

View File

@@ -1,23 +1,13 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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.js.dce
import org.jetbrains.kotlin.cli.common.CLITool
import org.jetbrains.kotlin.cli.common.ExitCode
import org.jetbrains.kotlin.cli.common.arguments.DevModeOverwritingStrategies
import org.jetbrains.kotlin.cli.common.arguments.K2JSDceArguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
@@ -63,7 +53,13 @@ class K2JSDce : CLITool<K2JSDceArguments>() {
return if (!arguments.devMode) {
performDce(files, arguments, messageCollector)
} else {
copyFiles(files)
val devModeOverwritingStrategy =
arguments.devModeOverwritingStrategy ?:
System.getProperty("kotlin.js.dce.devmode.overwriting.strategy", DevModeOverwritingStrategies.OLDER)
val overwriteOnlyOlderFiles = devModeOverwritingStrategy == DevModeOverwritingStrategies.OLDER
copyFiles(files, overwriteOnlyOlderFiles)
ExitCode.OK
}
}
@@ -96,21 +92,22 @@ class K2JSDce : CLITool<K2JSDceArguments>() {
return ExitCode.OK
}
private fun copyFiles(files: List<InputFile>) {
private fun copyFiles(files: List<InputFile>, overwriteOnlyOlderFiles: Boolean) {
for (file in files) {
copyResource(file.resource, File(file.outputPath))
copyResource(file.resource, File(file.outputPath), overwriteOnlyOlderFiles)
file.sourceMapResource?.let { sourceMap ->
val sourceMapTarget = File(file.outputPath + ".map")
val inputFile = File(sourceMap.name)
if (!inputFile.exists() || !mapSourcePaths(inputFile, sourceMapTarget)) {
copyResource(sourceMap, sourceMapTarget)
copyResource(sourceMap, sourceMapTarget, overwriteOnlyOlderFiles)
}
}
}
}
private fun copyResource(resource: InputResource, targetFile: File) {
if (targetFile.exists() && resource.lastModified() < targetFile.lastModified()) return
private fun copyResource(resource: InputResource, targetFile: File, overwriteOnlyOlderFiles: Boolean) {
// TODO shouldn't it be "<="?
if (overwriteOnlyOlderFiles && targetFile.exists() && resource.lastModified() < targetFile.lastModified()) return
targetFile.parentFile.mkdirs()
resource.reader().use { input ->

View File

@@ -42,9 +42,17 @@ object Main {
var collectingExpressions = false
var needsCompiler = false
val arguments = arrayListOf<String>()
val expressions = arrayListOf<String>()
var expression: String? = null
var noReflect = false
fun setExpression(expr: String) {
if (expression == null) {
expression = expr
} else {
throw RunnerException("Only single -e/-expression argument supported")
}
}
var i = 0
while (i < args.size) {
val arg = args[i]
@@ -58,7 +66,7 @@ object Main {
if (collectingExpressions) {
if ("-expression" == arg || "-e" == arg) {
expressions.add(next())
setExpression(next())
i++
continue
} else {
@@ -89,7 +97,7 @@ object Main {
}
}
else if ("-expression" == arg || "-e" == arg) {
expressions.add(next())
setExpression(next())
collectingExpressions = true
needsCompiler = true
}
@@ -125,8 +133,8 @@ object Main {
classpath.addPath(KOTLIN_HOME.toString() + "/lib/kotlin-reflect.jar")
}
if (expressions.isNotEmpty()) {
runner = ExpressionRunner(expressions)
if (expression != null) {
runner = ExpressionRunner(expression!!)
} else if (runner == null) {
runner = ReplRunner()
needsCompiler = true

View File

@@ -147,14 +147,11 @@ class ScriptRunner(private val path: String) : RunnerWithCompiler() {
}
}
class ExpressionRunner(private val code: List<String>) : RunnerWithCompiler() {
class ExpressionRunner(private val code: String) : RunnerWithCompiler() {
override fun run(classpath: List<URL>, arguments: List<String>, compilerClasspath: List<URL>) {
val compilerArgs = ArrayList<String>().apply {
addClasspathArgIfNeeded(classpath)
code.forEach {
add("-Xexpression")
add(it)
}
add("-Xexpression=$code")
addAll(arguments)
}
runCompiler(compilerClasspath, compilerArgs)

View File

@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.cli.common.messages.*
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.STRONG_WARNING
import org.jetbrains.kotlin.cli.jvm.compiler.CompileEnvironmentException
import org.jetbrains.kotlin.cli.jvm.compiler.setupIdeaStandaloneExecution
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageFeature.Kind.BUG_FIX
import org.jetbrains.kotlin.config.LanguageFeature.State.ENABLED
@@ -204,6 +205,9 @@ abstract class CLITool<A : CommonToolArguments> {
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
}
setupIdeaStandaloneExecution()
val exitCode = doMainNoExit(compiler, args)
if (exitCode != ExitCode.OK) {
exitProcess(exitCode.code)

View File

@@ -23,6 +23,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
) {
put(CommonConfigurationKeys.DISABLE_INLINE, arguments.noInline)
put(CommonConfigurationKeys.USE_FIR, arguments.useFir)
put(CommonConfigurationKeys.KLIB_MPP, arguments.klibBasedMpp)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)

View File

@@ -77,7 +77,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
configuration.configureAdvancedJvmOptions(arguments)
if (arguments.buildFile == null && !arguments.version && !arguments.allowNoSourceFiles &&
(arguments.script || arguments.expressions != null || arguments.freeArgs.isEmpty())) {
(arguments.script || arguments.expression != null || arguments.freeArgs.isEmpty())) {
// script or repl
if (arguments.script && arguments.freeArgs.isEmpty()) {
@@ -92,7 +92,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
)
projectEnvironment.registerExtensionsFromPlugins(configuration)
if (arguments.script || arguments.expressions != null) {
if (arguments.script || arguments.expression != null) {
val scriptingEvaluator = ScriptEvaluationExtension.getInstances(projectEnvironment.project).find { it.isAccepted(arguments) }
if (scriptingEvaluator == null) {
messageCollector.report(ERROR, "Unable to evaluate script, no scripting plugin loaded")

View File

@@ -5,39 +5,72 @@
package org.jetbrains.kotlin.cli.jvm.compiler;
import com.intellij.codeInsight.ContainerProvider;
import com.intellij.codeInsight.JavaContainerProvider;
import com.intellij.codeInsight.folding.JavaCodeFoldingSettings;
import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsBase;
import com.intellij.codeInsight.folding.impl.JavaFoldingBuilderBase;
import com.intellij.codeInsight.runner.JavaMainMethodProvider;
import com.intellij.core.CoreApplicationEnvironment;
import com.intellij.core.JavaCoreApplicationEnvironment;
import com.intellij.core.CoreJavaDirectoryService;
import com.intellij.core.CorePsiPackageImplementationHelper;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.ide.highlighter.JavaClassFileType;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.LanguageASTFactory;
import com.intellij.lang.MetaLanguage;
import com.intellij.lang.folding.LanguageFolding;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.lang.java.JavaParserDefinition;
import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileTypes.FileTypeExtensionPoint;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.fileTypes.PlainTextLanguage;
import com.intellij.openapi.fileTypes.PlainTextParserDefinition;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.psi.FileContextProvider;
import com.intellij.psi.*;
import com.intellij.psi.augment.PsiAugmentProvider;
import com.intellij.psi.augment.TypeAnnotationModifier;
import com.intellij.psi.compiled.ClassFileDecompilers;
import com.intellij.psi.impl.LanguageConstantExpressionEvaluator;
import com.intellij.psi.impl.PsiExpressionEvaluator;
import com.intellij.psi.impl.PsiSubstitutorFactoryImpl;
import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
import com.intellij.psi.impl.search.MethodSuperSearcher;
import com.intellij.psi.impl.source.tree.JavaASTFactory;
import com.intellij.psi.impl.source.tree.PlainTextASTFactory;
import com.intellij.psi.meta.MetaDataContributor;
import com.intellij.psi.presentation.java.*;
import com.intellij.psi.search.searches.SuperMethodsSearch;
import com.intellij.psi.stubs.BinaryFileStubBuilders;
import com.intellij.util.QueryExecutor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem;
// Mostly a placeholder for the functionality added to the bunch 193
public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnvironment {
/**
* adapted from com.intellij.core.JavaCoreApplicationEnvironment
* TODO: initiate removal original from com.intellij.core since it seems that there are no usages left
*/
public class KotlinCoreApplicationEnvironment extends CoreApplicationEnvironment {
public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) {
Extensions.cleanRootArea(parentDisposable);
registerExtensionPoints();
return new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode);
}
private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) {
super(parentDisposable, unitTestMode);
registerExtensionPoints();
registerExtensions();
}
private static void registerExtensionPoints() {
private void registerExtensionPoints() {
ExtensionsArea area = Extensions.getRootArea();
CoreApplicationEnvironment.registerExtensionPoint(area, BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class);
@@ -56,6 +89,59 @@ public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnviron
IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(area);
}
private void registerExtensions() {
registerFileType(JavaClassFileType.INSTANCE, "class");
registerFileType(JavaFileType.INSTANCE, "java");
registerFileType(ArchiveFileType.INSTANCE, "jar;zip");
registerFileType(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess");
addExplicitExtension(LanguageASTFactory.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextASTFactory());
registerParserDefinition(new PlainTextParserDefinition());
addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileViewProviderFactory());
addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder());
addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new JavaASTFactory());
registerParserDefinition(new JavaParserDefinition());
addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator());
addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider());
myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper());
myApplication.registerService(PsiSubstitutorFactory.class, new PsiSubstitutorFactoryImpl());
myApplication.registerService(JavaDirectoryService.class, createJavaDirectoryService());
myApplication.registerService(JavaVersionService.class, new JavaVersionService());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiPackage.class, new PackagePresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiClass.class, new ClassPresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiMethod.class, new MethodPresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider());
addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider());
registerApplicationService(JavaCodeFoldingSettings.class, new JavaCodeFoldingSettingsBase());
addExplicitExtension(LanguageFolding.INSTANCE, JavaLanguage.INSTANCE, new JavaFoldingBuilderBase() {
@Override
protected boolean shouldShowExplicitLambdaType(@NotNull PsiAnonymousClass anonymousClass, @NotNull PsiNewExpression expression) {
return false;
}
@Override
protected boolean isBelowRightMargin(@NotNull PsiFile file, int lineLength) {
return false;
}
});
registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class);
addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher());
}
// overridden in upsource
protected CoreJavaDirectoryService createJavaDirectoryService() {
return new CoreJavaDirectoryService();
}
@Nullable
@Override
protected VirtualFileSystem createJrtFileSystem() {

View File

@@ -0,0 +1,64 @@
/*
* Copyright 2010-2019 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.codeInsight.ContainerProvider;
import com.intellij.codeInsight.runner.JavaMainMethodProvider;
import com.intellij.core.CoreApplicationEnvironment;
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.extensions.ExtensionsArea;
import com.intellij.openapi.fileTypes.FileTypeExtensionPoint;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.psi.FileContextProvider;
import com.intellij.psi.augment.PsiAugmentProvider;
import com.intellij.psi.augment.TypeAnnotationModifier;
import com.intellij.psi.compiled.ClassFileDecompilers;
import com.intellij.psi.meta.MetaDataContributor;
import com.intellij.psi.stubs.BinaryFileStubBuilders;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem;
// Mostly a placeholder for the functionality added to the bunch 193
public class KotlinCoreApplicationEnvironment extends JavaCoreApplicationEnvironment {
public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) {
Extensions.cleanRootArea(parentDisposable);
registerExtensionPoints();
return new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode);
}
private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) {
super(parentDisposable, unitTestMode);
}
private static void registerExtensionPoints() {
ExtensionsArea area = Extensions.getRootArea();
CoreApplicationEnvironment.registerExtensionPoint(area, BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class);
CoreApplicationEnvironment.registerExtensionPoint(area, FileContextProvider.EP_NAME, FileContextProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, MetaDataContributor.EP_NAME, MetaDataContributor.class);
CoreApplicationEnvironment.registerExtensionPoint(area, PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider.class);
CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler.class);
CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier.class);
CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage.class);
IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(area);
}
@Nullable
@Override
protected VirtualFileSystem createJrtFileSystem() {
return new CoreJrtFileSystem();
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2010-2019 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.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

@@ -216,7 +216,7 @@ class KotlinCoreEnvironment private constructor(
)
val (initialRoots, javaModules) =
classpathRootsResolver.convertClasspathRoots(configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS))
classpathRootsResolver.convertClasspathRoots(configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS))
this.initialRoots.addAll(initialRoots)
if (!configuration.getBoolean(JVMConfigurationKeys.SKIP_RUNTIME_VERSION_CHECK) && messageCollector != null) {
@@ -228,7 +228,7 @@ class KotlinCoreEnvironment private constructor(
}
val (roots, singleJavaFileRoots) =
initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
initialRoots.partition { (file) -> file.isDirectory || file.extension != JavaFileType.DEFAULT_EXTENSION }
// REPL and kapt2 update classpath dynamically
rootsIndex = JvmDependenciesDynamicCompoundIndex().apply {
@@ -421,6 +421,7 @@ class KotlinCoreEnvironment private constructor(
fun createForProduction(
parentDisposable: Disposable, configuration: CompilerConfiguration, configFiles: EnvironmentConfigFiles
): KotlinCoreEnvironment {
setupIdeaStandaloneExecution()
val appEnv = getOrCreateApplicationEnvironmentForProduction(parentDisposable, configuration)
val projectEnv = ProjectEnvironment(parentDisposable, appEnv)
val environment = KotlinCoreEnvironment(projectEnv, configuration, configFiles)
@@ -516,8 +517,6 @@ class KotlinCoreEnvironment private constructor(
}
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
workaroundIbmJdkStaxReportCdataEventIssue()
fun File.hasConfigFile(configFile: String): Boolean =
if (isDirectory) File(this, "META-INF" + File.separator + configFile).exists()
else try {
@@ -528,7 +527,7 @@ class KotlinCoreEnvironment private constructor(
false
}
val pluginRoot =
val pluginRoot: File =
configuration.get(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT)?.let(::File)
?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) }
// hack for load extensions when compiler run directly from project directory (e.g. in tests)
@@ -538,39 +537,7 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
)
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea())
}
private fun workaroundIbmJdkStaxReportCdataEventIssue() {
if (!SystemInfo.isIbmJvm) return
// On IBM JDK, XMLInputFactory does not support "report-cdata-event" property, but JDOMUtil sets it unconditionally in the
// static XML_INPUT_FACTORY field and fails with an exception (Logger.error throws exception in the compiler) if unsuccessful.
// Until this is fixed in the platform, we workaround the issue by setting that field to a value that does not attempt
// to set the unsupported property.
// See IDEA-206446 for more information
val field = JDOMUtil::class.java.getDeclaredField("XML_INPUT_FACTORY")
field.isAccessible = true
Field::class.java.getDeclaredField("modifiers")
.apply { isAccessible = true }
.setInt(field, field.modifiers and Modifier.FINAL.inv())
field.set(null, object : NotNullLazyValue<XMLInputFactory>() {
override fun compute(): XMLInputFactory {
val factory: XMLInputFactory = try {
// otherwise wst can be used (in tests/dev run)
val clazz = Class.forName("com.sun.xml.internal.stream.XMLInputFactoryImpl")
clazz.newInstance() as XMLInputFactory
} catch (e: Exception) {
// ok, use random
XMLInputFactory.newFactory()
}
factory.setProperty(XMLInputFactory.IS_COALESCING, true)
factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false)
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false)
return factory
}
})
registerExtensionPointAndExtensionsEx(pluginRoot, configFilePath, Extensions.getRootArea())
}
@JvmStatic
@@ -714,5 +681,4 @@ class KotlinCoreEnvironment private constructor(
}
}
}
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.cli.jvm.compiler
import com.intellij.codeInsight.ExternalAnnotationsManager
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.*
class MockExternalAnnotationsManager : ExternalAnnotationsManager() {
override fun chooseAnnotationsPlace(element: PsiElement): AnnotationPlace = AnnotationPlace.NOWHERE
override fun chooseAnnotationsPlaceNoUi(element: PsiElement): AnnotationPlace = AnnotationPlace.NOWHERE
override fun isExternalAnnotationWritable(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean = false
override fun isExternalAnnotation(annotation: PsiAnnotation): Boolean = false
override fun findExternalAnnotationsFiles(listOwner: PsiModifierListOwner): List<PsiFile>? = null
override fun findExternalAnnotation(listOwner: PsiModifierListOwner, annotationFQN: String): PsiAnnotation? = null
override fun findExternalAnnotations(listOwner: PsiModifierListOwner): Array<out PsiAnnotation>? = null
override fun annotateExternally(
listOwner: PsiModifierListOwner,
annotationFQName: String,
fromFile: PsiFile,
value: Array<out PsiNameValuePair>?
) {
throw UnsupportedOperationException("not implemented")
}
override fun deannotate(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean {
throw UnsupportedOperationException("not implemented")
}
override fun editExternalAnnotation(
listOwner: PsiModifierListOwner,
annotationFQN: String,
value: Array<out PsiNameValuePair>?
): Boolean {
throw UnsupportedOperationException("not implemented")
}
override fun hasAnnotationRootsForFile(file: VirtualFile): Boolean = false
override fun findDefaultConstructorExternalAnnotations(aClass: PsiClass, annotationFQN: String): List<PsiAnnotation> = emptyList()
override fun findDefaultConstructorExternalAnnotations(aClass: PsiClass): List<PsiAnnotation> = emptyList()
override fun findExternalAnnotations(listOwner: PsiModifierListOwner, annotationFQN: String): List<PsiAnnotation> = emptyList()
}

View File

@@ -0,0 +1,9 @@
/*
* Copyright 2010-2018 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
fun setupIdeaStandaloneExecution() {
}

View File

@@ -0,0 +1,14 @@
/*
* Copyright 2010-2018 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
fun setupIdeaStandaloneExecution() {
System.getProperties().setProperty("idea.home.path", System.getProperty("java.io.tmpdir"))
System.getProperties().setProperty("project.structure.add.tools.jar.to.new.jdk", "false")
System.getProperties().setProperty("psi.track.invalidation", "true")
System.getProperties().setProperty("psi.incremental.reparse.depth.limit", "1000")
System.getProperties().setProperty("ide.hide.excluded.files", "false")
}

View File

@@ -0,0 +1,16 @@
/*
* 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.core.CoreApplicationEnvironment
import com.intellij.openapi.extensions.ExtensionsArea
import java.io.File
// BUNCH: 193
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
@Suppress("MissingRecentApi")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginFile, fileName, area)
}

View File

@@ -0,0 +1,18 @@
/*
* 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.core.CoreApplicationEnvironment
import com.intellij.openapi.extensions.ExtensionsArea
import java.io.File
import java.nio.file.FileSystems
// BUNCH: 193
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
val pluginRoot = FileSystems.getDefault().getPath(pluginFile.path)
@Suppress("MissingRecentApi")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, fileName, area)
}

View File

@@ -26,7 +26,9 @@ interface JvmContentRoot : ContentRoot {
val file: File
}
data class JvmClasspathRoot(override val file: File) : JvmContentRoot
data class JvmClasspathRoot(override val file: File, val isSdkRoot: Boolean) : JvmContentRoot {
constructor(file: File) : this(file, false)
}
data class JavaSourceRoot(override val file: File, val packagePrefix: String?) : JvmContentRoot
@@ -41,7 +43,7 @@ fun CompilerConfiguration.addJvmClasspathRoots(files: List<File>) {
}
fun CompilerConfiguration.addJvmSdkRoots(files: List<File>) {
addAll(CLIConfigurationKeys.CONTENT_ROOTS, 0, files.map(::JvmClasspathRoot))
addAll(CLIConfigurationKeys.CONTENT_ROOTS, 0, files.map { file -> JvmClasspathRoot(file, true) })
}
val CompilerConfiguration.jvmClasspathRoots: List<File>

View File

@@ -0,0 +1,13 @@
/*
* 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.config
import org.jetbrains.kotlin.config.CompilerConfigurationKey
object K2MetadataConfigurationKeys {
val FRIEND_PATHS = CompilerConfigurationKey.create<List<String>>("friend module paths")
val REFINES_PATHS = CompilerConfigurationKey.create<List<String>>("refined module paths")
}

View File

@@ -152,6 +152,7 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
arguments.noExceptionOnExplicitEqualsForBoxedNull
)
put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
put(JVMConfigurationKeys.EMIT_JVM_TYPE_ANNOTATIONS, arguments.emitJvmTypeAnnotations)
if (!JVMConstructorCallNormalizationMode.isSupportedValue(arguments.constructorCallNormalizationMode)) {
getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(

View File

@@ -0,0 +1,59 @@
/*
* Copyright 2010-2019 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.metadata
import org.jetbrains.kotlin.analyzer.common.CommonDependenciesContainer
import org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.name.Name
import java.io.File
internal val KotlinCoreEnvironment.destDir: File?
get() = configuration.get(CLIConfigurationKeys.METADATA_DESTINATION_DIRECTORY)
internal fun runCommonAnalysisForSerialization(
environment: KotlinCoreEnvironment,
dependOnBuiltins: Boolean,
dependencyContainer: CommonDependenciesContainer?
): AnalyzerWithCompilerReport? {
if (environment.destDir == null) {
val configuration = environment.configuration
val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify destination via -d")
return null
}
return runCommonAnalysis(environment, dependOnBuiltins, dependencyContainer)
}
private fun runCommonAnalysis(
environment: KotlinCoreEnvironment,
dependOnBuiltins: Boolean,
dependencyContainer: CommonDependenciesContainer?
): AnalyzerWithCompilerReport {
val configuration = environment.configuration
val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
val files = environment.getSourceFiles()
val moduleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>")
val analyzer = AnalyzerWithCompilerReport(messageCollector, configuration.languageVersionSettings)
analyzer.analyzeAndReport(files) {
CommonResolverForModuleFactory.analyzeFiles(
files, moduleName, dependOnBuiltins, configuration.languageVersionSettings,
dependenciesContainer = dependencyContainer
) { content ->
environment.createPackagePartProvider(content.moduleContentScope)
}
}
return analyzer
}

View File

@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.cli.common.messages.MessageUtil
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.K2MetadataConfigurationKeys
import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots
import org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser
import org.jetbrains.kotlin.codegen.CompilationException
@@ -73,6 +74,10 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage)
configuration.putIfNotNull(K2MetadataConfigurationKeys.FRIEND_PATHS, arguments.friendPaths?.toList())
configuration.putIfNotNull(K2MetadataConfigurationKeys.REFINES_PATHS, arguments.refinesPaths?.toList())
val destination = arguments.destination
if (destination != null) {
if (destination.endsWith(".jar")) {
@@ -101,7 +106,11 @@ class K2MetadataCompiler : CLICompiler<K2MetadataCompilerArguments>() {
try {
val metadataVersion =
configuration.get(CommonConfigurationKeys.METADATA_VERSION) as? BuiltInsBinaryVersion ?: BuiltInsBinaryVersion.INSTANCE
MetadataSerializer(metadataVersion, true).serialize(environment)
if (arguments.klibBasedMpp) {
K2MetadataKlibSerializer(metadataVersion).serialize(environment)
} else {
MetadataSerializer(metadataVersion, true).serialize(environment)
}
} catch (e: CompilationException) {
collector.report(EXCEPTION, OutputMessageUtil.renderException(e), MessageUtil.psiElementToMessageLocation(e.element))
return ExitCode.INTERNAL_ERROR

View File

@@ -0,0 +1,229 @@
/*
* Copyright 2010-2019 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.metadata
import org.jetbrains.kotlin.analyzer.*
import org.jetbrains.kotlin.analyzer.common.CommonDependenciesContainer
import org.jetbrains.kotlin.analyzer.common.CommonPlatformAnalyzerServices
import org.jetbrains.kotlin.backend.common.serialization.DescriptorTable
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataMonolithicSerializer
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion
import org.jetbrains.kotlin.builtins.DefaultBuiltIns
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRoot
import org.jetbrains.kotlin.cli.jvm.config.K2MetadataConfigurationKeys
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.descriptors.konan.DeserializedKlibModuleOrigin
import org.jetbrains.kotlin.konan.util.KlibMetadataFactories
import org.jetbrains.kotlin.library.KotlinAbiVersion
import org.jetbrains.kotlin.library.KotlinLibrary
import org.jetbrains.kotlin.library.KotlinLibraryVersioning
import org.jetbrains.kotlin.library.SerializedMetadata
import org.jetbrains.kotlin.library.impl.buildKoltinLibrary
import org.jetbrains.kotlin.library.impl.createKotlinLibrary
import org.jetbrains.kotlin.library.metadata.parseModuleHeader
import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.CommonPlatforms
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.resolve.CompilerDeserializationConfiguration
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.storage.StorageManager
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
internal class K2MetadataKlibSerializer(private val metadataVersion: BuiltInsBinaryVersion) {
fun serialize(environment: KotlinCoreEnvironment) {
val configuration = environment.configuration
val dependencyContainer = KlibMetadataDependencyContainer(
configuration,
LockBasedStorageManager("K2MetadataKlibSerializer")
)
val analyzer = runCommonAnalysisForSerialization(environment, true, dependencyContainer)
if (analyzer == null || analyzer.hasErrors()) return
val (_, moduleDescriptor) = analyzer.analysisResult
val destDir = checkNotNull(environment.destDir)
performSerialization(configuration, moduleDescriptor, destDir)
}
private fun performSerialization(
configuration: CompilerConfiguration,
module: ModuleDescriptor,
destDir: File
) {
val serializedMetadata: SerializedMetadata = KlibMetadataMonolithicSerializer(
configuration.languageVersionSettings,
metadataVersion,
DescriptorTable.createDefault(),
skipExpects = false,
includeOnlyModuleContent = true
).serializeModule(module)
val versions = KotlinLibraryVersioning(
abiVersion = KotlinAbiVersion.CURRENT,
libraryVersion = null,
compilerVersion = KotlinCompilerVersion.getVersion(),
metadataVersion = KlibMetadataVersion.INSTANCE.toString(),
irVersion = null
)
buildKoltinLibrary(
emptyList(),
serializedMetadata,
null,
versions,
destDir.absolutePath,
configuration[CommonConfigurationKeys.MODULE_NAME]!!,
nopack = true,
manifestProperties = null,
dataFlowGraph = null
)
}
}
private class KlibMetadataDependencyContainer(
private val configuration: CompilerConfiguration,
private val storageManager: StorageManager
) : CommonDependenciesContainer {
private val kotlinLibraries = run {
val classpathFiles =
configuration.getList(CLIConfigurationKeys.CONTENT_ROOTS).filterIsInstance<JvmClasspathRoot>().map(JvmContentRoot::file)
val klibFiles = classpathFiles
.filter { it.extension == "klib" || it.isDirectory }
klibFiles.map { createKotlinLibrary(org.jetbrains.kotlin.konan.file.File(it.absolutePath)) }
}
private val friendPaths = configuration.get(K2MetadataConfigurationKeys.FRIEND_PATHS).orEmpty().toSet()
private val refinesPaths = configuration.get(K2MetadataConfigurationKeys.REFINES_PATHS).orEmpty().toSet()
private val builtIns
get() = DefaultBuiltIns.Instance
private class KlibModuleInfo(
override val name: Name,
val kotlinLibrary: KotlinLibrary,
private val dependOnKlibModules: List<ModuleInfo>
) : ModuleInfo {
override fun dependencies(): List<ModuleInfo> = dependOnKlibModules
override fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns = ModuleInfo.DependencyOnBuiltIns.LAST
override val platform: TargetPlatform
get() = CommonPlatforms.defaultCommonPlatform
override val analyzerServices: PlatformDependentAnalyzerServices
get() = CommonPlatformAnalyzerServices
}
private val moduleDescriptorsForKotlinLibraries: Map<KotlinLibrary, ModuleDescriptorImpl> =
kotlinLibraries.keysToMap { library ->
val moduleHeader = parseModuleHeader(library.moduleHeaderData)
val moduleName = Name.special(moduleHeader.moduleName)
val moduleOrigin = DeserializedKlibModuleOrigin(library)
MetadataFactories.DefaultDescriptorFactory.createDescriptor(
moduleName, storageManager, builtIns, moduleOrigin
)
}.also { result ->
val resultValues = result.values.toList()
val dependenciesForModuleDescriptors = resultValues + builtIns.builtInsModule
resultValues.forEach { module ->
module.setDependencies(dependenciesForModuleDescriptors)
}
}
private val moduleInfosImpl: List<KlibModuleInfo> = mutableListOf<KlibModuleInfo>().apply {
addAll(
moduleDescriptorsForKotlinLibraries.map { (kotlinLibrary, moduleDescriptor) ->
KlibModuleInfo(moduleDescriptor.name, kotlinLibrary, this@apply)
}
)
}
override val moduleInfos: List<ModuleInfo> get() = moduleInfosImpl
override val friendModuleInfos: List<ModuleInfo> = moduleInfosImpl.filter {
it.kotlinLibrary.libraryFile.absolutePath in friendPaths
}
override val refinesModuleInfos: List<ModuleInfo> = moduleInfosImpl.filter {
it.kotlinLibrary.libraryFile.absolutePath in refinesPaths
}
override fun moduleDescriptorForModuleInfo(moduleInfo: ModuleInfo): ModuleDescriptor {
if (moduleInfo !in moduleInfos)
error("Unknown module info $moduleInfo")
moduleInfo as KlibModuleInfo
// Ensure that the package fragment provider has been created and the module descriptor has been
// initialized with the package fragment provider:
packageFragmentProviderForModuleInfo(moduleInfo)
return moduleDescriptorsForKotlinLibraries.getValue(moduleInfo.kotlinLibrary)
}
override fun packageFragmentProviderForModuleInfo(
moduleInfo: ModuleInfo
): PackageFragmentProvider? {
if (moduleInfo !in moduleInfos)
return null
moduleInfo as KlibModuleInfo
return packageFragmentProviderForKotlinLibrary(moduleInfo.kotlinLibrary)
}
private val klibMetadataModuleDescriptorFactory by lazy {
KlibMetadataModuleDescriptorFactoryImpl(
MetadataFactories.DefaultDescriptorFactory,
MetadataFactories.DefaultPackageFragmentsFactory,
MetadataFactories.flexibleTypeDeserializer
)
}
private fun packageFragmentProviderForKotlinLibrary(
library: KotlinLibrary
): PackageFragmentProvider {
val languageVersionSettings = configuration.languageVersionSettings
val libraryModuleDescriptor = moduleDescriptorsForKotlinLibraries.getValue(library)
val packageFragmentNames = parseModuleHeader(library.moduleHeaderData).packageFragmentNameList
return klibMetadataModuleDescriptorFactory.createPackageFragmentProvider(
library,
packageAccessHandler = null,
packageFragmentNames = packageFragmentNames,
storageManager = LockBasedStorageManager("KlibMetadataPackageFragmentProvider"),
moduleDescriptor = libraryModuleDescriptor,
configuration = CompilerDeserializationConfiguration(languageVersionSettings),
compositePackageFragmentAddend = null
).also {
libraryModuleDescriptor.initialize(it)
}
}
}
private val MetadataFactories =
KlibMetadataFactories(
{ DefaultBuiltIns.Instance },
org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer
)

View File

@@ -16,14 +16,8 @@
package org.jetbrains.kotlin.cli.metadata
import org.jetbrains.kotlin.analyzer.common.CommonResolverForModuleFactory
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
@@ -37,7 +31,6 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.PackageParts
import org.jetbrains.kotlin.metadata.jvm.deserialization.serializeToByteArray
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
@@ -56,28 +49,14 @@ open class MetadataSerializer(
protected var totalFiles = 0
fun serialize(environment: KotlinCoreEnvironment) {
val configuration = environment.configuration
val messageCollector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
val files = environment.getSourceFiles()
val moduleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>")
val analyzer = runCommonAnalysisForSerialization(environment, dependOnOldBuiltIns, dependencyContainer = null)
val destDir = configuration.get(CLIConfigurationKeys.METADATA_DESTINATION_DIRECTORY) ?: run {
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify destination via -d")
return
}
val analyzer = AnalyzerWithCompilerReport(messageCollector, configuration.languageVersionSettings)
analyzer.analyzeAndReport(files) {
CommonResolverForModuleFactory.analyzeFiles(files, moduleName, dependOnOldBuiltIns, configuration.languageVersionSettings) { content ->
environment.createPackagePartProvider(content.moduleContentScope)
}
}
if (analyzer.hasErrors()) return
if (analyzer == null || analyzer.hasErrors()) return
val (bindingContext, moduleDescriptor) = analyzer.analysisResult
performSerialization(files, bindingContext, moduleDescriptor, destDir)
val destDir = checkNotNull(environment.destDir)
performSerialization(environment.getSourceFiles(), bindingContext, moduleDescriptor, destDir)
}
protected open fun performSerialization(

View File

@@ -144,7 +144,8 @@ fun ConeKotlinType.lowerBoundIfFlexible() = (this as? ConeFlexibleType)?.lowerBo
class ConeCapturedTypeConstructor(
val projection: ConeKotlinTypeProjection,
var supertypes: List<ConeKotlinType>? = null
var supertypes: List<ConeKotlinType>? = null,
val typeParameterMarker: TypeParameterMarker? = null
) : CapturedTypeConstructorMarker
class ConeCapturedType(
@@ -153,11 +154,15 @@ class ConeCapturedType(
override val nullability: ConeNullability = ConeNullability.NOT_NULL,
val constructor: ConeCapturedTypeConstructor
) : ConeSimpleKotlinType(), CapturedTypeMarker {
constructor(captureStatus: CaptureStatus, lowerType: ConeKotlinType?, projection: ConeKotlinTypeProjection) : this(
constructor(
captureStatus: CaptureStatus, lowerType: ConeKotlinType?, projection: ConeKotlinTypeProjection,
typeParameterMarker: TypeParameterMarker
) : this(
captureStatus,
lowerType,
constructor = ConeCapturedTypeConstructor(
projection
projection,
typeParameterMarker = typeParameterMarker
)
)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -57,7 +57,7 @@ class FirJavaElementFinder(
}
override fun findClasses(qualifiedName: String, scope: GlobalSearchScope): Array<PsiClass> {
return findClass(qualifiedName, scope)?.let(::arrayOf) ?: emptyArray()
return findClass(qualifiedName, scope)?.let { arrayOf(it) } ?: emptyArray()
}
override fun findClass(qualifiedName: String, scope: GlobalSearchScope): PsiClass? {

View File

@@ -297,7 +297,9 @@ class JavaSymbolProvider(
return firJavaConstructor
}
if (javaClassDeclaredConstructors.isEmpty() && javaClass.classKind == ClassKind.CLASS) {
if (javaClassDeclaredConstructors.isEmpty()
&& javaClass.classKind == ClassKind.CLASS
&& javaClass.hasDefaultConstructor()) {
addJavaConstructor(isPrimary = true)
}
for (javaConstructor in javaClassDeclaredConstructors) {

View File

@@ -599,8 +599,8 @@ class ExpressionsConverter(
var isNegate = false
var firExpression: FirExpression = FirErrorExpressionImpl(null, FirSimpleDiagnostic("No range in condition with range", DiagnosticKind.Syntax))
whenCondition.forEachChildren {
when (it.tokenType) {
NOT_IN -> isNegate = true
when {
it.tokenType == OPERATION_REFERENCE && it.asText == NOT_IN.value -> isNegate = true
else -> if (it.isExpression()) firExpression = getAsFirExpression(it)
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -9,8 +9,12 @@ plugins {
}
dependencies {
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompileOnly(intellijDep()) {
includeJars("openapi", "extensions", "idea", "idea_rt", "util", "asm-all", rootProject = rootProject)
includeJars("extensions", "idea_rt", "util", "asm-all", rootProject = rootProject)
}
Platform[191].orLower {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -13,7 +13,10 @@ dependencies {
compileOnly(project(":kotlin-reflect-api"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) }
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "idea_rt", "util", "asm-all", "extensions", rootProject = rootProject) }
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompileOnly(intellijDep()) { includeJars("idea", "idea_rt", "util", "asm-all", "extensions", rootProject = rootProject) }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }

View File

@@ -248,6 +248,11 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
return this.constructor.projection
}
override fun CapturedTypeMarker.typeParameter(): TypeParameterMarker? {
require(this is ConeCapturedType)
return this.constructor.typeParameterMarker
}
override fun DefinitelyNotNullTypeMarker.original(): SimpleTypeMarker {
require(this is ConeDefinitelyNotNullType)
return this.original as SimpleTypeMarker

View File

@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjecto
import org.jetbrains.kotlin.resolve.calls.inference.components.ResultTypeResolver
import org.jetbrains.kotlin.resolve.calls.inference.components.TrivialConstraintTypeInferenceOracle
import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintSystemImpl
import org.jetbrains.kotlin.resolve.calls.tower.KotlinResolutionStatelessCallbacksImpl
import org.jetbrains.kotlin.types.AbstractTypeApproximator
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
import org.jetbrains.kotlin.types.model.SimpleTypeMarker

View File

@@ -90,8 +90,8 @@ class IntegerLiteralTypeApproximationTransformer(
val expectedType: ConeKotlinType? = when {
!leftIsIlt && !rightIsIlt -> return operatorCall.compose()
leftIsIlt && rightIsIlt -> null
leftIsIlt -> rightArgument.typeRef.coneTypeUnsafe()
rightIsIlt -> leftArgument.typeRef.coneTypeUnsafe()
leftIsIlt -> rightArgument.typeRef.coneTypeUnsafe<ConeKotlinType>()
rightIsIlt -> leftArgument.typeRef.coneTypeUnsafe<ConeKotlinType>()
else -> throw IllegalStateException()
}

View File

@@ -164,7 +164,8 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
require(this is ConeKotlinType)
return this.typeArguments.getOrNull(index)
?: StandardClassIds.Any(session.firSymbolProvider).constructType(emptyArray(), false) // TODO wtf
?: session.builtinTypes.anyType
.type//StandardClassIds.Any(session.firSymbolProvider).constructType(emptyArray(), false) // TODO wtf
}
override fun KotlinTypeMarker.asTypeArgument(): TypeArgumentMarker {
@@ -301,31 +302,32 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
override fun captureFromArguments(type: SimpleTypeMarker, status: CaptureStatus): SimpleTypeMarker? {
require(type is ConeKotlinType)
val argumentsCount = type.argumentsCount()
val argumentsCount = type.typeArguments.size
if (argumentsCount == 0) return null
val typeConstructor = type.typeConstructor()
if (argumentsCount != typeConstructor.parametersCount()) return null
if (type.asArgumentList().all(this) { !it.isStarProjection() && it.getVariance() == TypeVariance.INV }) return null
val newArguments = Array(argumentsCount) { index ->
val argument = type.getArgument(index)
if (!argument.isStarProjection() && argument.getVariance() == TypeVariance.INV) return@Array argument as ConeKotlinTypeProjection
if (type.typeArguments.all { it !is ConeStarProjection && it.kind == ProjectionKind.INVARIANT }) return null
val lowerType = if (!argument.isStarProjection() && argument.getVariance() == TypeVariance.IN) {
argument.getType() as ConeKotlinType
val newArguments = Array(argumentsCount) { index ->
val argument = type.typeArguments[index]
if (argument !is ConeStarProjection && argument.kind == ProjectionKind.INVARIANT) return@Array argument
val lowerType = if (argument !is ConeStarProjection && argument.getVariance() == TypeVariance.IN) {
(argument as ConeTypedProjection).type
} else {
null
}
ConeCapturedType(status, lowerType, argument as ConeKotlinTypeProjection)
ConeCapturedType(status, lowerType, argument, typeConstructor.getParameter(index))
}
for (index in 0 until argumentsCount) {
val oldArgument = type.getArgument(index)
val oldArgument = type.typeArguments[index]
val newArgument = newArguments[index]
if (!oldArgument.isStarProjection() && oldArgument.getVariance() == TypeVariance.INV) continue
if (oldArgument !is ConeStarProjection && oldArgument.kind == ProjectionKind.INVARIANT) continue
val parameter = typeConstructor.getParameter(index)
val upperBounds = (0 until parameter.upperBoundCount()).mapTo(mutableListOf()) { paramIndex ->
@@ -460,9 +462,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
override fun TypeParameterMarker.getRepresentativeUpperBound(): KotlinTypeMarker {
require(this is FirTypeParameterSymbol)
return this.fir.bounds.getOrNull(0)?.let { (it as? FirResolvedTypeRef)?.type }
?: ConeClassLikeTypeImpl(
ConeClassLikeLookupTagImpl(ClassId.topLevel(KotlinBuiltIns.FQ_NAMES.any.toSafe())), emptyArray(), true
)
?: session.builtinTypes.nullableAnyType.type
}
override fun KotlinTypeMarker.getSubstitutedUnderlyingType(): KotlinTypeMarker? {
@@ -514,7 +514,8 @@ class ConeTypeCheckerContext(
val substitution =
declaration.typeParameters.zip(type.typeArguments).associate { (parameter, argument) ->
parameter.symbol to ((argument as? ConeTypedProjection)?.type
?: StandardClassIds.Any(session.firSymbolProvider).constructType(emptyArray(), isNullable = true))
?: session.builtinTypes.nullableAnyType
.type)//StandardClassIds.Any(session.firSymbolProvider).constructType(emptyArray(), isNullable = true))
}
substitutorByMap(substitution)
} else {

View File

@@ -1,3 +1,5 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: Function.java
public interface Function<Param, Result> {
@@ -20,7 +22,8 @@ interface PsiMethod {
interface PsiClass
fun test() {
val processor = AdapterProcessor<PsiMethod, PsiClass>(
// TODO: don't forget to implement preservation flexibility of java type parameters in FIR (this is the reason of error here)
val processor = <!INAPPLICABLE_CANDIDATE!>AdapterProcessor<!><PsiMethod, PsiClass>(
Function { method: PsiMethod? -> method?.containingClass }
)
}

View File

@@ -7,7 +7,7 @@ FILE: main.kt
public abstract interface PsiClass : R|kotlin/Any| {
}
public final fun test(): R|kotlin/Unit| {
lval processor: R|AdapterProcessor<PsiMethod, PsiClass>| = R|/AdapterProcessor.AdapterProcessor|<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod|, R|ft<PsiClass, PsiClass?>!|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
lval processor: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/AdapterProcessor.AdapterProcessor]> = <Inapplicable(INAPPLICABLE): [/AdapterProcessor.AdapterProcessor]>#<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod?|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
R|<local>/method|?.R|/PsiMethod.containingClass|
}
))

View File

@@ -4,11 +4,11 @@ FILE: main.kt
R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
}
)
R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Any.toString|()
}
)
R|/MyFunction|<R|kotlin/Any?|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Any?|): R|kotlin/String| {
R|/MyFunction|<R|kotlin/Any?|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Any?|): R|kotlin/String| {
String()
}
)

View File

@@ -10,19 +10,19 @@ FILE: main.kt
R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
}
))
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
}
))
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Any.toString|()
}
))
R|/foo3|<R|kotlin/Int|, R|kotlin/String|>(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
}
), Int(1))
R|/foo3|<R|kotlin/Int|, R|kotlin/String|>(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
}
), Int(2))

View File

@@ -12,11 +12,11 @@ FILE: main.kt
R|<local>/x|.R|kotlin/Any.toString|()
}
)
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|kotlin/String|>(foo3@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/Unit| {
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
}
, Int(1))
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|kotlin/String|>(foo3@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/Unit| {
Q|JavaUsage|.R|/JavaUsage.foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
}
, Int(2))

View File

@@ -13,7 +13,7 @@ FILE: User.kt
protected abstract fun createSettings(): R|T|
public final fun foo(): R|kotlin/Unit| {
this@R|/User|.R|FakeOverride</User.settings: R|T|>| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|T|>(this@R|/User|.R|FakeOverride</User.settings: R|T|>|.R|kotlin/jvm/javaClass|)
this@R|/User|.R|FakeOverride</User.settings: R|T|>| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|ft<T, T?>!|>(this@R|/User|.R|FakeOverride</User.settings: R|T|>|.R|kotlin/jvm/javaClass|)
}
}

View File

@@ -25,6 +25,7 @@ abstract class AbstractFirOldFrontendDiagnosticsTest : AbstractFirDiagnosticsTes
}
override fun runAnalysis(testDataFile: File, testFiles: List<TestFile>, firFiles: List<FirFile>) {
if (testFiles.any { it.directives.containsKey("FIR_IGNORE") }) return
val failure: AssertionError? = try {
doFirResolveTestBench(firFiles, FirTotalResolveTransformer().transformers, gc = false)
null

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -970,6 +970,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/annotations/javaUnrepeatable.kt");
}
@TestMetadata("kotlinAnnotationOnJavaInterface.kt")
public void testKotlinAnnotationOnJavaInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/kotlinAnnotationOnJavaInterface.kt");
}
@TestMetadata("kt1860-negative.kt")
public void testKt1860_negative() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt");
@@ -1789,6 +1794,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.kt");
}
@TestMetadata("constraintFromLHSWithCorrectDirectionError.kt")
public void testConstraintFromLHSWithCorrectDirectionError() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.kt");
}
@TestMetadata("correctInfoAfterArrayLikeCall.kt")
public void testCorrectInfoAfterArrayLikeCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt");
@@ -1839,16 +1849,46 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/kt32256.kt");
}
@TestMetadata("kt32267.kt")
public void testKt32267() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/kt32267.kt");
}
@TestMetadata("kt34314.kt")
public void testKt34314() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314.kt");
}
@TestMetadata("kt34314_lambda.kt")
public void testKt34314_lambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/kt34314_lambda.kt");
}
@TestMetadata("kt35959.kt")
public void testKt35959() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/kt35959.kt");
}
@TestMetadata("kt7430_wrongClassOnLHS.kt")
public void testKt7430_wrongClassOnLHS() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt");
}
@TestMetadata("lambdaResult.kt")
public void testLambdaResult() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/lambdaResult.kt");
}
@TestMetadata("memberExtensionsImportedFromObjectsUnsupported.kt")
public void testMemberExtensionsImportedFromObjectsUnsupported() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.kt");
}
@TestMetadata("noAmbiguityWhenAllReferencesAreInapplicable.kt")
public void testNoAmbiguityWhenAllReferencesAreInapplicable() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/noAmbiguityWhenAllReferencesAreInapplicable.kt");
}
@TestMetadata("noExceptionOnRedCodeWithArrayLikeCall.kt")
public void testNoExceptionOnRedCodeWithArrayLikeCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
@@ -2342,6 +2382,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/generic/kt12286.kt");
}
@TestMetadata("kt35896.kt")
public void testKt35896() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/kt35896.kt");
}
@TestMetadata("kt7470.kt")
public void testKt7470() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/generic/kt7470.kt");
@@ -2410,6 +2455,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/property/extensionPropertyOnNullable.kt");
}
@TestMetadata("extensionsSameName.kt")
public void testExtensionsSameName() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/property/extensionsSameName.kt");
}
@TestMetadata("genericClass.kt")
public void testGenericClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/property/genericClass.kt");
@@ -2488,6 +2538,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWhenNoApplicableCallableReferenceCandidate.kt");
}
@TestMetadata("ambiguityWithBoundExtensionReceiver.kt")
public void testAmbiguityWithBoundExtensionReceiver() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWithBoundExtensionReceiver.kt");
}
@TestMetadata("ambiguousWithVararg.kt")
public void testAmbiguousWithVararg() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/ambiguousWithVararg.kt");
@@ -2513,6 +2568,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/byValType.kt");
}
@TestMetadata("callableReferenceToVarargWithOverload.kt")
public void testCallableReferenceToVarargWithOverload() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/callableReferenceToVarargWithOverload.kt");
}
@TestMetadata("chooseCallableReferenceDependingOnInferredReceiver.kt")
public void testChooseCallableReferenceDependingOnInferredReceiver() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/chooseCallableReferenceDependingOnInferredReceiver.kt");
@@ -2578,6 +2638,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/kt12751.kt");
}
@TestMetadata("kt35887.kt")
public void testKt35887() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/kt35887.kt");
}
@TestMetadata("kt35887_simple.kt")
public void testKt35887_simple() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/kt35887_simple.kt");
}
@TestMetadata("kt35920.kt")
public void testKt35920() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/kt35920.kt");
}
@TestMetadata("kt8596.kt")
public void testKt8596() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/kt8596.kt");
@@ -8022,6 +8097,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt");
}
@TestMetadata("lambdaInLambda2.kt")
public void testLambdaInLambda2() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/lambdaInLambda2.kt");
}
@TestMetadata("prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt")
public void testPrematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/prematurelyAnalyzingLambdaWhileFixingTypeVariableForAnotherArgument.kt");
@@ -8286,6 +8366,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/generics/argumentsForT.kt");
}
@TestMetadata("bareTypesWithStarProjections.kt")
public void testBareTypesWithStarProjections() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/bareTypesWithStarProjections.kt");
}
@TestMetadata("commonSupertypeContravariant.kt")
public void testCommonSupertypeContravariant() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/commonSupertypeContravariant.kt");
@@ -8341,6 +8426,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/generics/kt30590.kt");
}
@TestMetadata("kt34729.kt")
public void testKt34729() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/kt34729.kt");
}
@TestMetadata("kt5508.kt")
public void testKt5508() throws Exception {
runTest("compiler/testData/diagnostics/tests/generics/kt5508.kt");
@@ -9713,6 +9803,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt");
}
@TestMetadata("completionOfMultipleLambdas.kt")
public void testCompletionOfMultipleLambdas() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completionOfMultipleLambdas.kt");
}
@TestMetadata("conflictingSubstitutions.kt")
public void testConflictingSubstitutions() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt");
@@ -9838,6 +9933,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/intersectionTypeMultipleBoundsAsReceiver.kt");
}
@TestMetadata("intersectionWithEnum.kt")
public void testIntersectionWithEnum() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/intersectionWithEnum.kt");
}
@TestMetadata("invokeLambdaAsFunction.kt")
public void testInvokeLambdaAsFunction() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.kt");
@@ -9883,6 +9983,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/kt3184.kt");
}
@TestMetadata("kt32196.kt")
public void testKt32196() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt32196.kt");
}
@TestMetadata("kt32415.kt")
public void testKt32415() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt32415.kt");
@@ -9893,6 +9998,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/kt32434.kt");
}
@TestMetadata("kt32462.kt")
public void testKt32462() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt32462.kt");
}
@TestMetadata("kt33263.kt")
public void testKt33263() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt33263.kt");
}
@TestMetadata("kt35702.kt")
public void testKt35702() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt35702.kt");
}
@TestMetadata("kt6175.kt")
public void testKt6175() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/kt6175.kt");
@@ -9903,6 +10023,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/kt619.kt");
}
@TestMetadata("lambdaArgumentWithLabel.kt")
public void testLambdaArgumentWithLabel() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/lambdaArgumentWithLabel.kt");
}
@TestMetadata("lambdaInValInitializerWithAnonymousFunctions.kt")
public void testLambdaInValInitializerWithAnonymousFunctions() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/lambdaInValInitializerWithAnonymousFunctions.kt");
@@ -9968,6 +10093,31 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/reportAboutUnresolvedReferenceAsUnresolved.kt");
}
@TestMetadata("starApproximation.kt")
public void testStarApproximation() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
}
@TestMetadata("starApproximationBangBang.kt")
public void testStarApproximationBangBang() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/starApproximationBangBang.kt");
}
@TestMetadata("starApproximationFlexible.kt")
public void testStarApproximationFlexible() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/starApproximationFlexible.kt");
}
@TestMetadata("starApproximationFromDifferentTypeParameter.kt")
public void testStarApproximationFromDifferentTypeParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/starApproximationFromDifferentTypeParameter.kt");
}
@TestMetadata("tooEagerSmartcast.kt")
public void testTooEagerSmartcast() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/tooEagerSmartcast.kt");
}
@TestMetadata("tryNumberLowerBoundsBeforeUpperBounds.kt")
public void testTryNumberLowerBoundsBeforeUpperBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/tryNumberLowerBoundsBeforeUpperBounds.kt");
@@ -10158,6 +10308,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitForLastLambdaInLambda.kt");
}
@TestMetadata("coercionToUnitReference.kt")
public void testCoercionToUnitReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt");
}
@TestMetadata("coercionWithExpectedType.kt")
public void testCoercionWithExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt");
@@ -10337,6 +10492,59 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
}
}
@TestMetadata("compiler/testData/diagnostics/tests/inference/completion")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Completion extends AbstractFirOldFrontendDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInCompletion() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/inference/completion"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("anonymousFunction.kt")
public void testAnonymousFunction() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/anonymousFunction.kt");
}
@TestMetadata("basic.kt")
public void testBasic() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/basic.kt");
}
@TestMetadata("equalityConstraintUpstairs.kt")
public void testEqualityConstraintUpstairs() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/equalityConstraintUpstairs.kt");
}
@TestMetadata("kt33166.kt")
public void testKt33166() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/kt33166.kt");
}
@TestMetadata("lambdaWithVariableAndNothing.kt")
public void testLambdaWithVariableAndNothing() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/lambdaWithVariableAndNothing.kt");
}
@TestMetadata("partialForIlt.kt")
public void testPartialForIlt() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/partialForIlt.kt");
}
@TestMetadata("transitiveConstraint.kt")
public void testTransitiveConstraint() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/transitiveConstraint.kt");
}
@TestMetadata("withExact.kt")
public void testWithExact() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/withExact.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/inference/constraints")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -10536,6 +10744,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
public void testNontrivialCallExpression() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/nontrivialCallExpression.kt");
}
@TestMetadata("preferArgumentToNullability.kt")
public void testPreferArgumentToNullability() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferArgumentToNullability.kt");
}
@TestMetadata("preferNothingToBound.kt")
public void testPreferNothingToBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nestedCalls/preferNothingToBound.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/inference/nothingType")
@@ -10555,6 +10773,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/nothingType/complexDependancyOnVariableWithTrivialConstraint.kt");
}
@TestMetadata("discriminateNothingForReifiedParameter.kt")
public void testDiscriminateNothingForReifiedParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/discriminateNothingForReifiedParameter.kt");
}
@TestMetadata("discriminatedNothingAndSmartCast.kt")
public void testDiscriminatedNothingAndSmartCast() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/discriminatedNothingAndSmartCast.kt");
}
@TestMetadata("generateConstraintWithInnerNothingType.kt")
public void testGenerateConstraintWithInnerNothingType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/generateConstraintWithInnerNothingType.kt");
@@ -10570,6 +10798,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/nothingType/implicitNothingConstraintFromReturn.kt");
}
@TestMetadata("inferArgumentToNothingFromNullConstant.kt")
public void testInferArgumentToNothingFromNullConstant() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/inferArgumentToNothingFromNullConstant.kt");
}
@TestMetadata("kt24490.kt")
public void testKt24490() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/kt24490.kt");
@@ -10605,6 +10838,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nestedLambdaInferenceWithIncorporationOfVariables.kt");
}
@TestMetadata("notEnoughInformationAndNothing.kt")
public void testNotEnoughInformationAndNothing() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationAndNothing.kt");
}
@TestMetadata("notEnoughInformationFromNullabilityConstraint.kt")
public void testNotEnoughInformationFromNullabilityConstraint() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/notEnoughInformationFromNullabilityConstraint.kt");
}
@TestMetadata("nothingWithCallableReference.kt")
public void testNothingWithCallableReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nothingWithCallableReference.kt");
@@ -10864,6 +11107,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3174.kt");
}
@TestMetadata("kt32106.kt")
public void testKt32106() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt32106.kt");
}
@TestMetadata("kt32250.kt")
public void testKt32250() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt32250.kt");
}
@TestMetadata("kt32862_both.kt")
public void testKt32862_both() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt32862_both.kt");
@@ -10909,6 +11162,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt3559.kt");
}
@TestMetadata("kt35844.kt")
public void testKt35844() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt35844.kt");
}
@TestMetadata("kt35943.kt")
public void testKt35943() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt35943.kt");
}
@TestMetadata("kt4420.kt")
public void testKt4420() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/regressions/kt4420.kt");
@@ -11098,6 +11361,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/doNotInferFromBoundsOnly.kt");
}
@TestMetadata("flexibilityInCommonSuperTypeCalculation.kt")
public void testFlexibilityInCommonSuperTypeCalculation() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/flexibilityInCommonSuperTypeCalculation.kt");
}
@TestMetadata("flexibilityInCommonSuperTypeCalculation.ni.kt")
public void testFlexibilityInCommonSuperTypeCalculation_ni() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/flexibilityInCommonSuperTypeCalculation.ni.kt");
}
@TestMetadata("intersectUpperBounds.kt")
public void testIntersectUpperBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/upperBounds/intersectUpperBounds.kt");
@@ -14640,6 +14913,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/nullableTypes/elvisOnUnit.kt");
}
@TestMetadata("inferenceFlexibleTToNullable.kt")
public void testInferenceFlexibleTToNullable() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/inferenceFlexibleTToNullable.kt");
}
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/nullAssertOnTypeWithNullableUpperBound.kt");
@@ -14685,6 +14963,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/nullableTypes/safeCallWithInvoke.kt");
}
@TestMetadata("takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt")
public void testTakingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/takingNullabilityFromExplicitTypeArgmentsInsteadOfUsingFlexibleTypes.kt");
}
@TestMetadata("uselessElvis.kt")
public void testUselessElvis() throws Exception {
runTest("compiler/testData/diagnostics/tests/nullableTypes/uselessElvis.kt");
@@ -17390,6 +17673,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/regressions/kt302.kt");
}
@TestMetadata("kt30245.kt")
public void testKt30245() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt30245.kt");
}
@TestMetadata("kt306.kt")
public void testKt306() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt306.kt");
@@ -17425,6 +17713,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/regressions/kt32205.kt");
}
@TestMetadata("kt32507.kt")
public void testKt32507() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt32507.kt");
}
@TestMetadata("kt328.kt")
public void testKt328() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt328.kt");
@@ -17465,6 +17758,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/regressions/kt3535.kt");
}
@TestMetadata("kt35668.kt")
public void testKt35668() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt35668.kt");
}
@TestMetadata("kt3647.kt")
public void testKt3647() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/kt3647.kt");
@@ -17765,6 +18063,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/regressions/SpecififcityByReceiver.kt");
}
@TestMetadata("testNestedSpecialCalls.kt")
public void testTestNestedSpecialCalls() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/testNestedSpecialCalls.kt");
}
@TestMetadata("TypeMismatchOnUnaryOperations.kt")
public void testTypeMismatchOnUnaryOperations() throws Exception {
runTest("compiler/testData/diagnostics/tests/regressions/TypeMismatchOnUnaryOperations.kt");
@@ -18658,6 +18961,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/samConversions/SAMAfterSubstitutionKT.kt");
}
@TestMetadata("samConversionToGeneric.kt")
public void testSamConversionToGeneric() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionToGeneric.kt");
}
@TestMetadata("samConversionsWithSmartCasts.kt")
public void testSamConversionsWithSmartCasts() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/samConversionsWithSmartCasts.kt");
}
@TestMetadata("sameCandidatesFromKotlinAndJavaInOneScope.kt")
public void testSameCandidatesFromKotlinAndJavaInOneScope() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/sameCandidatesFromKotlinAndJavaInOneScope.kt");
}
@TestMetadata("SimpleCorrect.kt")
public void testSimpleCorrect() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/SimpleCorrect.kt");
@@ -22359,6 +22677,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OverrideGetterOnly.kt");
}
@TestMetadata("PartiallySupportedSyntheticJavaPropertyReference.kt")
public void testPartiallySupportedSyntheticJavaPropertyReference() throws Exception {
runTest("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/PartiallySupportedSyntheticJavaPropertyReference.kt");
}
@TestMetadata("SetterHasHigherAccess.kt")
public void testSetterHasHigherAccess() throws Exception {
runTest("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.kt");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -1856,6 +1856,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt3458.kt");
}
@TestMetadata("kt35847.kt")
public void testKt35847() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt35847.kt");
}
@TestMetadata("kt4975.kt")
public void testKt4975() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/kt4975.kt");
@@ -1898,6 +1903,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt29307.kt");
}
@TestMetadata("kt35210.kt")
public void testKt35210() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt35210.kt");
}
@TestMetadata("noInferAndLowPriority.kt")
public void testNoInferAndLowPriority() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.kt");
@@ -1913,6 +1923,16 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/notNullAnnotation.kt");
}
@TestMetadata("onlyInputTypeAndJava.kt")
public void testOnlyInputTypeAndJava() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypeAndJava.kt");
}
@TestMetadata("onlyInputTypeRecursiveBoundAndProjections.kt")
public void testOnlyInputTypeRecursiveBoundAndProjections() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypeRecursiveBoundAndProjections.kt");
}
@TestMetadata("onlyInputTypes.kt")
public void testOnlyInputTypes() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypes.kt");
@@ -1938,6 +1958,21 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCaptured.kt");
}
@TestMetadata("onlyInputTypesCommonConstraintSystem.kt")
public void testOnlyInputTypesCommonConstraintSystem() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.kt");
}
@TestMetadata("onlyInputTypesUpperBound.kt")
public void testOnlyInputTypesUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesUpperBound.kt");
}
@TestMetadata("onlyInputTypesWarning.kt")
public void testOnlyInputTypesWarning() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWarning.kt");
}
@TestMetadata("onlyInputTypesWithVarargs.kt")
public void testOnlyInputTypesWithVarargs() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWithVarargs.kt");
@@ -1953,6 +1988,34 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/resolveWithOnlyInputTypesAnnotation.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inference/delegates")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Delegates extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDelegates() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/inference/delegates"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("kt31219.kt")
public void testKt31219() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt31219.kt");
}
@TestMetadata("kt31679.kt")
public void testKt31679() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt31679.kt");
}
@TestMetadata("kt32249.kt")
public void testKt32249() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/delegates/kt32249.kt");
}
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/inline")

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/

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