Compare commits

...

597 Commits

Author SHA1 Message Date
Nikolay Krasko
0ddb7937ee Use GPG agent for signing in PublishedKotlinModule 2020-08-13 11:42:57 +03:00
Nikolay Krasko
60340bd559 Sign with GnuPG agent 2020-08-13 09:44:39 +03:00
Stanislav Erokhin
923742ee83 Update Kotlin/Native: 1.4 2020-08-12 19:28:52 +03:00
Lilia
3e9162f5f0 Fixed changelog for 1.4.0-rc 2020-08-12 16:49:47 +02:00
Lilia
3115e5b332 Add changelog for 1.4.0 2020-08-12 16:48:24 +02:00
Anton Yalyshev
df2d14040f Add change-notes for 1.4 to 1.4.0 branch 2020-08-12 16:44:17 +03:00
Nikolay Krasko
3f34bc1711 Temporal remove of registerAdditionalResourceBundleInTests hack in as 41 2020-08-12 10:49:24 +03:00
Nikolay Krasko
034b947748 Update maven signing for working with gpg 2 (KTI-314)
Update to maven-gpg-plugin 1.6 and add workaround for https://issues.apache.org/jira/browse/MGPG-59
2020-08-12 09:35:58 +03:00
Sergey Bogolepov
cd005cd919 Update Kotlin/Native: 1.4-rc1-74 2020-08-11 18:29:27 +07:00
Alexey Trilis
d25b099029 Add @SinceKotlin to kotlinx.browser and kotlinx.dom packages
Add @DeprecatedSinceKotlin to kotlin.browser and kotlin.dom packages

(cherry picked from commit d86c14243e)
2020-08-11 12:28:52 +03:00
Ilya Kirillov
74c8d74166 Wizard: fix test data after gradle js support change 2020-08-11 11:16:35 +03:00
Ilya Kirillov
11cee19500 Wizard: update libraries versions 2020-08-11 11:16:34 +03:00
Vyacheslav Gerasimov
e578dc07b9 Build: Remove exclusion of kotlinx-coroutines-core in scripting-common
It breaks available-at feature used in MPP
2020-08-11 10:33:47 +03:00
Mikhail Zarechenskiy
0a755c13af Prohibit using suspend functions as SAM in fun interfaces
#KT-40978 Fixed
2020-08-10 22:12:03 +03:00
Mikhael Bogdanov
425e6db61c Don't generate implicit overrides delegating to Java defaults
#KT-40920 Fixed
2020-08-10 20:06:09 +02:00
Sergey Igushkin
7bdd2785c6 Fix stdlib-by-default with non-compiled source sets (KT-40559)
When a `variantFilter { ... }` is used in Android projects, AGP does not
creates some variants but still creates the source sets which would be
related to those variants.

For source sets that are not included into any compilation, the stdlib
module added by default was kotlin-stdlib-common, and it was added to
the `api` scope.

But AGP checks the `androidTest*Api` configurations and
if it detects any dependencies in them, it reports deprecation warnings.

However, we have plans to prohibit unused source sets at all as they
have no reasonable use cases. So the fix is not to add the stdlib by
default to source sets that participate in no compilations.

Issue #KT-40559 Fixed

(cherry picked from commit 07aee8831e)
2020-08-10 21:54:02 +04:00
Sergey Igushkin
e99b55ef12 Fix source JARs missing in Kotlin/Native targets with HMPP (KT-39051)
With HMPP, a separate implementation of `kotlinComponents` is used which
accidentally ignored the parent's logic for source artifacts.

As a simple fix, copy the parent's logic for source artifacts.

Issue #KT-39051 Fixed

(cherry picked from commit 988480d649)
2020-08-10 21:54:00 +04:00
Valeriy.Vyrva
c6500792b3 Improve docs for createTempDir/createTempFile
#KT-35218

(cherry picked from commit 30ff886754)
2020-08-10 19:11:55 +03:00
Ilya Gorbunov
381e0acf80 Minor: fix toJavaDuration docs
(cherry picked from commit a5178bb826)
2020-08-10 19:11:16 +03:00
Ilya Gorbunov
76f9ed96bc Fix doc wording around covariance/invariance
(cherry picked from commit 99eb7f391b)
2020-08-10 19:11:14 +03:00
Dmitriy Novozhilov
5f83c23859 Disable AllowResultInReturnType feature
#KT-40843
2020-08-10 17:56:48 +03:00
Julian Kotrba
f7f249f19a Make repeat example more expressive
This commit adds the zero-based index of current iteration from the passed HOF "action" of the repeat function to its associated code sample.

KT-20357

(cherry picked from commit 88f508446a)
2020-08-10 16:59:15 +03:00
kvirolainen
36e9a00178 Add samples for flatten, unzip functions
(cherry picked from commit 36984009e9)
2020-08-10 16:58:39 +03:00
Elijah Verdoorn
4d269ea7da Add samples for mapNotNull, find, getOrNull functions
(cherry picked from commit 41d5615608)
2020-08-10 16:58:37 +03:00
Dat Trieu
ba0e47cdf6 KT-20357: Add samples for filter functions
(cherry picked from commit 1009a240f2)
2020-08-10 16:58:22 +03:00
Yan Zhulanow
9147d0d3f6 Move back the 'KotlinStructureViewElement.isPublic' property used externally
Reasoning: Method com.gmail.blueboxware.extsee.kotlin.ExtSeeKotlinStructureViewModel.Companion.PublicElementsFilter.isVisible(com.intellij.ide.util.treeView.smartTree.TreeElement treeNode) : boolean contains an *invokevirtual* instruction referencing an unresolved method org.jetbrains.kotlin.idea.structureView.KotlinStructureViewElement.isPublic()
(cherry picked from commit 5e8e60a399)
2020-08-10 18:20:48 +09:00
Natalia Selezneva
5cf27cdcae Do not hold a lock during loading script templates from dependencies
^KT-40383 Fixed

(cherry picked from commit 8a6cdcba29)
2020-08-07 21:53:22 +02:00
Vladimir Dolzhenko
42bbf1b3f5 Fixed locking granularity in ScriptDefinitionsManager
#KT-34552 Fixed
#KT-39547 Fixed

(cherry picked from commit 45600830d3)
2020-08-07 21:53:22 +02:00
Mikhail Zarechenskiy
368846838b Fix accessibility check for experimental declarations from default scope
#KT-40919 Fixed
2020-08-07 19:13:18 +03:00
Ilmir Usmanov
b6d740b760 Ease field initialization check
Since there is already VAL_REASSIGNMENT diagnostics, we can safely only
for direct assignments.
 #KT-40893 Fixed
2020-08-07 14:38:55 +02:00
Sergey Igushkin
ff6da9b85c Fix typealias usage nullability and annotations lost in deserialization
Issue #KT-40824 Fixed

(cherry picked from commit f6356199d3)
2020-08-07 12:09:46 +04:00
Ilya Goncharov
22507b7f6c [Gradle, JS] Update versions
[Gradle, JS] Update test data

^KT-40884 fixed
2020-08-06 15:28:18 +03:00
Sergey Igushkin
18d1e92c61 Enable compatibility metadata variant by default in HMPP
This by default ensures that libraries published with HMPP are
compatible with non-HMPP consumers (which is the default in 1.4.0).

(cherry picked from commit b5d4e4c44c)
2020-08-06 15:43:18 +04:00
Sergey Igushkin
045cfb3ba7 "Kotlin Multiplatform Projects are an ~experimental~ Alpha feature."
(cherry picked from commit eff5839369)
2020-08-06 15:43:10 +04:00
Mikhail Zarechenskiy
70823f30ec Do not compute SamType too eagerly as it can force member resolution
Internally, during creation of `SamType` the compiler checks if a
 parameter is really can be used as a SAM, so this check involves
 lookup for abstract members, which can force additional computation of
 member scopes. This is totally fine for BE but it can be dangerous
 for light classes computation when not all scopes are processed.

 Note that this issue appeared quite recently after 16f175612e

 #KT-40869 Fixed
2020-08-06 12:23:22 +03:00
Ilya Matveev
386a2ea62c CocoaPods: Fix setting custom framework name
The main scheme of a synthetic project generated for
pod import has the same name as the podspec generated
for the kotlin module (== Gradle project name). But
when starting an Xcode build, we specify the -scheme
argument to a framework name instead of project.name.

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

Issue #KT-40801 fixed

(cherry picked from commit f6d7e7c52a)
2020-08-05 17:19:00 +07:00
Mikhail Zarechenskiy
c45f2f0510 Add compatibility resolve when SAM conversion was applied partially
#KT-40646 Fixed
2020-08-05 12:58:54 +03:00
Victor Petukhov
0491719503 NI: approximate not top-level captured types during code generation
^KT-40693 Fixed
2020-08-05 10:37:28 +03:00
Roman Artemev
f17617d601 [KLIB] Use SoftReference to hold proto memory
- fix metadata memory leak for KT-40345

(cherry picked from commit 851c287105)
2020-08-04 19:13:58 +03:00
Roman Artemev
c42aa572a8 [KLIB] Change KLIB IO API
- Use ReadBuffer instead of native java buffer
 - Use Weak buffers for File IO
 - fix klib memory leak for KT-40345

(cherry picked from commit add0ad6733)
2020-08-04 19:13:58 +03:00
Victor Petukhov
c5b1b7bbce NI: take into account flexible types during capturing arguments from expression
^KT-40544 Fixed

(cherry picked from commit af48f08f9c)
2020-08-04 17:02:12 +03:00
Ilya Kirillov
78e1b58bcb Fix binary compatibility problems in ImportInsertHelper & ShortenReferences 2020-08-04 12:39:55 +03:00
Dmitry Gridin
05d465c522 [configuration] change updater number to 1.4.* and 1.5.*
#KT-40639 Fixed

(cherry picked from commit a5e9401a0a)
2020-08-04 13:45:28 +07:00
Sergey Bogolepov
c5280b6f9d Update Kotlin/Native: 1.4-rc1-61 2020-08-03 20:33:00 +07:00
Nicolay Mitropolsky
8fe31582e1 Uast: don't throw exception if can't get a receiver parameter for annotation (KT-40494)
(cherry picked from commit f7031e65ba)
2020-08-03 10:52:36 +03:00
Dmitry Gridin
cc9bd1ad8c [formatter] fix infinite recursion
Already exists in the new repo: original-hash e7ea6926a8a414ab6082299d99239ad167ab75a2

#KT-40636 Fixed

(cherry picked from commit e8fd69fde1)
2020-08-03 09:27:59 +07:00
Ilya Chernikov
8584f85692 Add JvmDefault to the new EP method for compatibility with older impls 2020-07-31 11:45:46 +02:00
Ilmir Usmanov
5576f34b93 Check whether the field is indeed being initialized
in checkFieldInExactlyOnceLambdaInitialization
 #KT-40691 Fixed
2020-07-31 11:19:45 +02:00
Denis Zharkov
c2a5111d89 Fix incorrect mixed named/positioned arguments in project code
^KT-40404 Fixed
2020-07-30 17:59:31 +03:00
Denis Zharkov
86b8135ca2 Fix incorrect handling of mixed named/positional arguments
^KT-40404 Fixed
2020-07-30 17:59:31 +03:00
nataliya.valtman
df10fce902 KT-40058 NPE from mpp gradle plugin on kotlinx.benchmarks
(cherry picked from commit fde8a34c32)
2020-07-30 14:41:28 +03:00
Alexander Gorshenev
fb178115ed Don't copy default value parameters for fake overrides
#KT-40083 fixed
2020-07-30 13:04:41 +03:00
Ilya Kirillov
4371d2f197 Wizard: fix default template compilation when using JS IR
#KT-39904 fixed
2020-07-30 12:25:29 +03:00
Roman Artemev
2d9bd91a5d [JS IR] Support external delegation in case of JS in psi2ir
- fix FE delegation resolver
 - fix critical KT-40650

(cherry picked from commit 0559e192ee)
2020-07-29 19:59:36 +03:00
Sergey Rostov
05c4d16dee scripting: preload scripting support plugins
Relates to #KT-40242
(cherry picked from commit 45f0328f21)
2020-07-29 15:06:22 +02:00
Sergey Rostov
cbcb33421c scripting, ucache: don't init caches at start up
init it in async instead. all usages will be updated thanks to
highlighting/reindexing that is called after cache is constructed.

#KT-40242 Fixed

(cherry picked from commit b5e04378ed)
2020-07-29 15:06:21 +02:00
Nikolay Krasko
1ce3ff18eb Remove all signing if prebuiltJar passed
Otherwise can't configure kotlin-stdlib-js project when publishing to
Gradle Plugin Portal.
2020-07-29 16:00:06 +03:00
Ilya Goncharov
bfd4eac01b [Gradle, JS] Fix formatting in Gradle Kotlin/JS wizard
^KT-40149 fixed

(cherry picked from commit b4334a3a3b)
2020-07-29 15:20:44 +03:00
Ilya Goncharov
2e4ce37b1e [Gradle, JS] Deprecate produceExecutable
^KT-40568 fixed

(cherry picked from commit 5444ffaf4b)
2020-07-29 15:20:44 +03:00
Ilya Goncharov
0eb85c69a4 [Gradle, JS] Disable binaries.executable by default in wizard
^KT-40461 fixed
2020-07-29 15:20:42 +03:00
Victor Petukhov
69172c053e NI: use the inferred type to check of nullable array for vararg
^KT-40555 Fixed

(cherry picked from commit cca64b8fab)
2020-07-29 13:38:47 +03:00
Vladimir Ilmov
bfb0660683 (CoroutineDebugger) Enable agent for versions 1.3.8.*
Gradle artifact name gets changed from 'kotlinx-coroutines-core' to
'kotlinx-coroutines-core-jvm'. So it should support both.
2020-07-28 00:48:52 +02:00
Lilia
6836d0ae19 Add changelog for 1.4.0-RC 2020-07-24 11:29:19 +02:00
Vyacheslav Gerasimov
2dfd346c06 Build: Remove attributes from builtins runtimeElementsJvm configuration
To prevent gradle selecting it as default
2020-07-23 16:01:55 +03:00
Sergey Bogolepov
5a8c0c6d12 Update Kotlin/Native: 1.4-rc1-40 2020-07-22 20:25:53 +07:00
Alexander Gorshenev
8b60fd7051 [IR FAKE OVERRIDES] Properly account for outer class type parameters
(cherry picked from commit c076d81f0c)
2020-07-22 12:07:51 +03:00
Ilya Gorbunov
8509faddae Package builtins with jvm reflect into IDEA plugin only
Leave builtins with common reflect for stand-alone compiler.

(cherry picked from commit 95cc35f22e)
2020-07-22 11:38:24 +03:00
Stanislav Erokhin
c7b0b53ee9 Serialize jvm reflect into builtIns
Basically this is revert of 427e34fe5a commit
This was done due to the KT-39728.
Also we do pick every file separately, because builtIn serializer
unable to filter expects

(cherry picked from commit 0c094b1719)
2020-07-22 11:16:00 +03:00
Stanislav Erokhin
1fe66ec082 Move KTypeProjection to separate file
(cherry picked from commit 67090e1afb)
2020-07-22 11:15:56 +03:00
Zalim Bashorov
31cb13accd [KJS FE] Change severity of NON_EXPORTABLE_TYPE from error to warning
The change is required to avoid breaking examples using kotlin-wrappers
until we find an acceptable solution for them.

#KT-39873 Fixed
2020-07-21 23:19:56 +03:00
Leonid Startsev
45cc2a2289 Add JarUtil.getJarAttribute to proguard rules
This method is used by serialization plugin to read runtime JAR
manifest.

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

Size increased for about 2kb.

(cherry picked from commit a0154b9851)
2020-07-21 15:40:31 +03:00
Leonid Startsev
40a896cde6 Mute/ignore 'PROVIDED_RUNTIME_TOO_LOW' in tests
(cherry picked from commit e3f42721e9)
2020-07-21 15:40:26 +03:00
Leonid Startsev
d2f2330f13 Implement reading kx.serialization runtime metadata from jar manifest
That allows to check whether current compiler plugin can work with
a given runtime version. Implementation-Version can help to detect whether
runtime version is too low, and Require-Kotlin-Version detects whether
runtime version is too high.

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

 #KT-40036 Fixed

Cache result from getVersionsForCurrentModule in BindingTrace.
Hide check in the IDE, because caching in trace does not work there.

(cherry picked from commit df5f38fec8)
2020-07-21 15:39:38 +03:00
Leonid Startsev
435668a0cc Add new serialization runtime packages
encoding and descriptors. Rename ContextSerializer to Contextual.
Unify getClassFrom*Package functions.

(cherry picked from commit 7db0bf8195)
2020-07-21 15:39:16 +03:00
Vyacheslav Gerasimov
ee2938c66b Build: Add dependency on sign task for :kotlin-stdlib-js:uploadArchives 2020-07-20 22:04:10 +03:00
Victor Petukhov
61d4cac329 NI: decrease fixation priority for variables which have only incorporated from upper bound constraints
^KT-40045 Fixed
^KT-39633 Fixed

(cherry picked from commit b0ac046b05)
2020-07-20 19:21:48 +03:00
Vyacheslav Gerasimov
1fb8f05c8b Build: Fix signing of kotlin-stdlib-js artifacts 2020-07-20 19:01:38 +03:00
Vladimir Ilmov
82895723a2 (CoroutineDebugger) using WeakReference as lastObservedFrame
relates to #KT-40073
2020-07-20 16:47:25 +02:00
Vladimir Ilmov
b35465dd1a (CoroutineDebugger) added support for DebugCoroutineInfoImpl in kotlinx-coroutines-core:1.3.8
relates to #KT-40073
2020-07-20 16:47:25 +02:00
Vladimir Ilmov
662874ba59 (CoroutineDebugger) lv 'task' added to tests in EventLoopImplBase kotlinx-coroutines-core:1.3.7 2020-07-20 16:47:02 +02:00
Vladimir Ilmov
14b1bb596f (CoroutineDebugger) minimum supported version kotlinx-coroutines-core.1.3.8
Workaround for starting agent on windows removed, version upgraded in tests
 #KT-40073 fixed
2020-07-20 16:47:01 +02:00
Ilya Goncharov
f789df4792 [Gradle, JS] Check if not both compiler 2020-07-20 17:33:17 +03:00
Ilya Goncharov
a9dec2824d [Gradle, JS] Rename flag for legacy
[Gradle, JS] binaries executable for legacy by default

[Gradle, JS] Common configure should be last otherwise user settings can
be overwrote

^KT-40320 fixed
2020-07-20 16:48:27 +03:00
Jim Sproch
bce77bc170 Keep members of com.google.common dependencies intact
It is a workaround for KTI-298
#KT-40354 In progress

(cherry picked from commit 814bd48148)
2020-07-20 15:23:08 +03:00
Mikhail Zarechenskiy
5772a53a63 Fix SAM conversion when lambda is the last expression of another lambda
#KT-39691 Fixed
2020-07-20 15:10:06 +03:00
Mikhail Zarechenskiy
4732b74781 Fix references to sam adapted functions, also fix lookup location
#KT-31025 Fixed
2020-07-20 15:10:06 +03:00
Mikhail Zarechenskiy
d8a357cce3 Prohibit adapted reference resolve against reflective types
There are design questions about reflection for adapted references,
 so the current proposal is to prohibit reflection on them and support
 it properly later

 #KT-40406 Fixed
2020-07-20 15:10:05 +03:00
Jim Sproch
847dbf212f Fallback to fileEntry provided by irFile
(cherry picked from commit a4a398239b)
2020-07-20 11:14:24 +03:00
Jim Sproch
11a9a992b2 Make linker visible to compiler plugins
(cherry picked from commit ccbb2eaba9)
2020-07-20 11:14:24 +03:00
Anton Yalyshev
e06be4a7e3 Add change notes for 1.4-M1,2,3,RC builds in 1.4.0 #KT-40311 Fixed 2020-07-19 21:05:11 +03:00
Ilya Matveev
d75ce04357 Update Kotlin/Native: 1.4-rc1-29 2020-07-19 17:27:24 +07:00
Ivan Gavrilovic
5b82d231f8 Create a valid jar in KaptIncrementalWithIsolatingApt test 2020-07-18 05:02:36 +09:00
Ivan Gavrilovic
6c5cb2edf2 KT-34604: Fix race condition in KAPT
KAPT was relying on clearing JarFileFactory to make sure
annotation processing does not hold onto annotation processing
classpath once done. Once KAPT switched to using Gradle workers, multiple
KAPT runs were sharing the same class loader ie. the same version
of JarFileFactory. Clearing the cache resulted in race condition,
as some runs were unable to load processors from jars.

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

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

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

Fixes KT-39876
Test: ClasspathAnalyzerTest
2020-07-18 05:02:35 +09:00
Stanislav Erokhin
f7018888b4 Revert Parcelize commits due to KT-39981
Revert "Parcelize: Fix test code"
This reverts commit 9b7a95b0

Revert "Parcelize: Enable ParcelableDeclarationChecker with the parcelize plugin"
This reverts commit d93e5d3d

Revert "Parcelize: Fall back to readValue/writeValue if no other serializers are available"
This reverts commit f93749ae

Revert "Parcelize: Resolve parcel serializers on demand"
This reverts commit 8d364a8a

Revert "Parcelize: Remap functions in overridden symbols and callable references"
This reverts commit cfe16802

Revert "Fix Parcelize codegen tests following rebase"
This reverts commit b39a6530

Revert "Update Parcelize codegen tests"
This reverts commit 8a9610d3

Revert "Fix Parcelize annotation implementing Parcelable.Creator<T>"
This reverts commit 00ec50ff
2020-07-18 05:02:35 +09:00
Sergey Igushkin
a6c2ad9995 Fix stdlib-by-default failures when configuration has been resolved
Issue #KT-38221

(cherry picked from commit d3f9f4f3e8)
2020-07-17 21:53:22 +04:00
Dmitriy Dolovov
e79ad8c99f [Commonizer] Introduce success marker file in Gradle task
The success marker file is written to the disk only upon successful
commonization. If something goes wrong, this file is not written to
the disk. So the subsequent call of 'runCommonizer' task will be
considered not up-to-date.

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

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

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

^KT-40120
2020-07-17 22:07:18 +07:00
Konstantin Tskhovrebov
a7bd0a7ff4 Add native targets check to "isAllowCommonizer" method.
#KT-40164 Fixed.

(cherry picked from commit cfd91023be)
2020-07-17 16:49:33 +03:00
Ilya Kirillov
0b98e83754 J2K: do not run runUndoTransparentAction outside EDT
#KT-39739 fixed
2020-07-17 15:59:26 +03:00
Ilya Kirillov
5c6b18c6bd Wizard: do not add stdlib for gradle based projects
#KT-40407 fixed
2020-07-17 15:59:26 +03:00
Ilya Kirillov
47969e77dd Wizard: do not add NPM dependencies for Kotlin/JS wrappers
Those dependencies are included now into corresponding libraries

#KT-40377 fixed
2020-07-17 15:59:26 +03:00
Ilya Kirillov
0bf839b830 Wizard: do not add test task for JS when no test framework is chosen
#KT-40378 fixed
2020-07-17 15:59:25 +03:00
Ilya Kirillov
4e957a206b Wizard: do not allow to choose Frontend Application template & JS Library at the same time
#KT-40371 fixed
2020-07-17 15:59:25 +03:00
Ilya Kirillov
0e55d6d3ec Wizard: fix Android SDK path on Windows
#KT-40232 fixed
2020-07-17 15:59:25 +03:00
Abduqodiri Qurbonzoda
ca4284b3c4 Mark with @DeprecatedSinceKotlin #KT-22423 and #KT-28753
(cherry picked from commit a05681001f)
2020-07-17 15:36:42 +03:00
Ilya Gorbunov
0e2f666d19 Specify DeprecatedSinceKotlin for recently deprecated min/max funs
#KT-38854

(cherry picked from commit 87cb6372a0)
2020-07-17 15:36:38 +03:00
Ilya Gorbunov
15ab6ede2c Add stdlib-gen DSL support for DeprecatedSinceKotlin annotation
(cherry picked from commit a9f4479557)
2020-07-17 15:36:36 +03:00
Mikhail Zarechenskiy
76f1b02ba5 Improve message about compatibility warning a bit
Relates to #KT-40111
2020-07-17 14:37:17 +03:00
Mikhail Zarechenskiy
ab8c862e85 Fix delegated property resolve on number literals and proper types
There is no need to update type of delegate expression if it's already
 resolved correctly (doesn't include non-proper types). In almost all
 cases it was fine except number literals as there we didn't box
 expression in backend and got problems at bytecode verification stage

 #KT-40057 Fixed
2020-07-17 14:37:15 +03:00
Mikhail Zarechenskiy
7e0df1e777 Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-17 07:55:54 +03:00
Shagen Ogandzhanian
f4244f2dda Update dukat dependency to 0.5.7
(cherry picked from commit fa1e3169df)
2020-07-16 19:38:41 +02:00
Svyatoslav Kuzmich
7cdc5ba275 [JS IR] .d.ts generation for module systems
Support .d.ts generation for UMD, AMD, CommonJS module kinds in
addition to existing "plain" module kind.
2020-07-16 18:57:30 +03:00
Svyatoslav Kuzmich
d8b3b6fd78 [JS] Add ; after functions in .d.ts
Fixes nit from KT-37752
2020-07-16 18:57:30 +03:00
Svyatoslav Kuzmich
cc73268daa [JS] Prevent default class constructors in d.ts files.
Generate private TypeScript constructor for classes without public
primary Kotlin constructor.
2020-07-16 18:57:30 +03:00
Svyatoslav Kuzmich
325b6dfd9a [JS] Support secondary constructors in JsExport 2020-07-16 18:57:30 +03:00
Abduqodiri Qurbonzoda
feb0767cb1 Replace @LowPriorityInOverloadResolution with @DeprecatedSinceKotlin #KT-37101
(cherry picked from commit d2c9fc41f1)
2020-07-16 18:08:02 +03:00
Abduqodiri Qurbonzoda
8ed2dec1cc Advance bootstrap to 1.4.0-rc-154 2020-07-16 18:07:36 +03:00
Igor Chevdar
df00daa5ae [IR] Supported IrFunctionExpression in ClosureAnnotator
It may be encountered during local classes extraction from inline lambdas
2020-07-16 20:00:49 +05:00
Victor Petukhov
9858d1fe67 NI: add fallback strategy to get lexical scope to checking coroutine call legality
^KT-40247 Fixed
^KT-40337 Fixed
2020-07-16 15:32:39 +03:00
Roman Artemev
daade4ea5d [FIR] Mute test 2020-07-15 19:19:40 +03:00
Roman Artemev
b395a4d270 [KLIB] Fix deserialization of anonymous classes
In case of initializing property or function with anonymous object the
object is being exposed outside its field/function's scope and
accessible on previous level. In this case in `declarations only` mode
we have unbound symbols. Fix is to force body/initializer loading in
such cases.

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

 - Fix KT-40216
 - Add test
2020-07-15 18:37:29 +03:00
Roman Artemev
f5dd22127f [Psi2IR] Improve assertion message 2020-07-15 18:37:28 +03:00
Victor Petukhov
f86992cd75 Don't try to infer postponed variables on lambdas without BuilderInference annotation
^KT-39618 Fixed

(cherry picked from commit b0c96a61ec)
2020-07-15 18:26:11 +03:00
Victor Petukhov
f559b5d54b Add using -Xinline-classes by default in IDE intentions
^KT-34209 Fixed

(cherry picked from commit bf23b39d76)
(cherry picked from commit d2f5fbdd08)
2020-07-15 18:25:54 +03:00
Dmitry Savvinov
02c4aab112 Coerce commonTest to common in HMPP
Otherwise, Android import won't add dependency from androidTest to
commoonTest. See KT-38744 for details

^KT-38744 Fixed
2020-07-15 13:14:25 +07:00
Mikhail Zarechenskiy
f3f7547e30 Don't perform Unit-conversion for functional types with type variables
#KT-40269 Fixed
2020-07-15 00:00:54 +03:00
Mikhail Zarechenskiy
059f496bad Fix rewrite at slice exception for callable references inside flatMap
#KT-40254 Fixed
2020-07-15 00:00:54 +03:00
Vladimir Dolzhenko
876dda6a96 Force perform FULL analysis to avoid redundant analysis for the current open file
#KT-38687 Fixed

(cherry picked from commit 853503d75f)
2020-07-14 21:42:59 +02:00
Zalim Bashorov
c6749451c2 [KJS] Throw exception on recursive types provided to typeOf and provide proper support later within KT-40173
#KT-38140 fixed

(cherry picked from commit 340512e27a)
2020-07-14 18:49:34 +03:00
Zalim Bashorov
af80a0a8cd [Test infra] Take into account transitive compatible targets while checking compatibility.
(cherry picked from commit c552933459)
2020-07-14 18:49:33 +03:00
Zalim Bashorov
47a1822123 [KJS FE] Allow using typeOf with non-reified type parameters
#KT-38771 fixed

(cherry picked from commit ca37c6bfe6)
2020-07-14 18:49:33 +03:00
Ilya Gorbunov
20674b1376 Make common KClass extend common KClassifier
It already does that in all platforms.
Add KClass common API test.

(cherry picked from commit 010e530ac4)
2020-07-14 18:37:43 +03:00
Andrey Uskov
f57adc266a Send use-ir and jvmDefaults compiler arguments from IDE
Relates to KT-39924 and KT-39977

(cherry picked from commit c37f339d8c)
2020-07-14 16:41:03 +03:00
Andrey Uskov
721ee7e3c7 Report jvm-default compiler arguments from Gradle
#KT-39977 Fixed

(cherry picked from commit 550c53c2ac)
2020-07-14 16:41:03 +03:00
Andrey Uskov
6d0c3d4dcd Report use-ir flag from Gradle
#KT-39924 Fixed

(cherry picked from commit e3a5df1aaa)
2020-07-14 16:41:03 +03:00
Sergey Igushkin
1f4b9d894e Add kotlin.stdlib.default.dependency=false to avoid stdlib default dep
(cherry picked from commit 62aed1b53a)
2020-07-14 16:01:45 +04:00
Sergey Igushkin
a50a5bef27 Fix stdlib default dependencies with Android
* In Android test-related source sets, add an implementation dependency,
  not an api one, because adding dependencies to the api configurations
  leads to warnings from AGP

* Add the default stdlib dependency only to the Android main source set,
  as duplicating it elsewhere leads to issue with publishing the project
  with the `maven` plugin (duplicate conf2ScopeMappings)

(cherry picked from commit ad9d011ed0)
2020-07-14 16:01:45 +04:00
Sergey Igushkin
fd19ee374b KT-38221: Stdlib by default; KT-40225 Single dependency on kotlin-test
* Add a DSL property `kotlin.coreLibrariesVersion` that is used as the
  default version for all org.jetbrains.kotlin dependencies instead of
  the plugin version used previously – the pluging version is the
  default now.

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

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

* (minor) Fix _executionSource not updated in KotlinJvmTestRun

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

Issue #KT-38221 Fixed
Issue #KT-40225 Fixed

(cherry picked from commit d83d3304a5)
2020-07-14 16:01:44 +04:00
Natalia Selezneva
dc6788629b gradle.kts: update notification messages after proofreading
(cherry picked from commit e0bc54cd82)
2020-07-14 14:59:44 +03:00
Ilya Goncharov
0a341d303f [Gradle, JS] Fail build in case when mpp or js targets not configured
^KT-40210 fixed
^KT-40300 fixed

(cherry picked from commit 9d362875da)
2020-07-14 14:22:25 +03:00
Ilya Muradyan
a42b6a4d41 Add @JvmDefault for getPossibleSyntheticNestedClassNames
(cherry picked from commit 07b566dd02)
2020-07-14 14:20:57 +03:00
Vladimir Dolzhenko
f5fce1e302 Fixed Add missing module dependency quick fix
#KT-36131 Fixed
2020-07-14 13:16:34 +02:00
Dmitry Savvinov
bd117ce800 Allow depending on Native stdlib even if platforms do not match under HMPP
^KT-40102
2020-07-14 17:21:32 +07:00
Sergey Igushkin
8fcf688905 Fixup for the fix of KT-39809
In the original fix for KT-39809, the Kapt plugin was not given a proper
empty implementation stub: it was added to `Kapt3GradleSubplugin`, while
originally the Kapt subplugin's META-INF/services entry pointed to
`Kapt3KotlinGradleSubplugin`.

This commit makes the correct class implement the legacy interface.

Issue #KT-39809 Fixed

(cherry picked from commit 5ec93fd74c)
2020-07-14 13:30:24 +04:00
Sergey Igushkin
74fb25edb6 Fix resolving dependency on self in HMPP (KT-39037)
Apply a workaround for grade/gradle#13680

Issue #KT-39037 Fixed

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

Issue #KT-32239 Fixed

(cherry picked from commit aebca19fd7)
2020-07-14 13:30:19 +04:00
Yaroslav Chernyshev
06bf203e05 [Gradle, Cocoapods] Fixed bug in scheme name for pods
(cherry picked from commit 07e3dd9ec7)
2020-07-13 16:57:30 +03:00
Steven Schäfer
12c60d9544 JVM IR: Mangle delegated properties with inline class type (KT-40125)
(cherry picked from commit 097e0fb46c)
2020-07-13 14:47:28 +02:00
Dmitry Petrov
9cad15b462 JVM_IR: fix property reference generation for inline class primary val
(cherry picked from commit 761e47264a)
2020-07-13 14:47:28 +02:00
Dmitry Petrov
5ecc1c16a5 JVM_IR: Mangle primary val getter of inline class if required
TODO fix reflection

(cherry picked from commit 8da988b18e)
2020-07-13 14:47:28 +02:00
Steven Schäfer
007ba7dbfb JVM IR: Fix inline class constructor ABI (KT-37013, KT-37015)
(cherry picked from commit 846fc13519)
2020-07-13 14:47:28 +02:00
Mikhail Zarechenskiy
c66f0deff9 Fix presence of Deprecated hidden annotation for reference arguments
#KT-40234 Fixed
2020-07-13 11:30:47 +03:00
Dmitry Savvinov
0d5b8c569c Force expansion to have the same nullability as abbreviation
Note that classifier.underlyingType is always non-nullable, but
abbreviation might be nullable, so we should keep them consistent

^KT-40199 Fixed
2020-07-13 14:13:44 +07:00
Dmitry Savvinov
5c4a1b2552 Add test on signatures with nullable abbreviated types
Currently test fails, see KT-40199
2020-07-13 14:12:47 +07:00
Mikhail Zarechenskiy
67703add94 Introduce compiler key to disable compatibility resolution mechanism
Enable it if one was using new inferene before 1.4

 #KT-40128 Fixed
 #KT-40112 Fixed
 #KT-40113 Fixed

(cherry picked from commit 0c8b847ae6)
2020-07-12 23:59:46 +03:00
Mikhail Zarechenskiy
da1a51ce3a Fix coercion to Unit when variable already have other constraints
Don't add `Unit` if variable has an upper constraint T <: A.

 It's impossible to coerce variable T to Unit as constraint system will
 be always contradictory: T := Unit => Unit should be subtype of A

 #KT-39900 Fixed

(cherry picked from commit 0ee7306d9c)
2020-07-12 23:59:46 +03:00
Mikhail Zarechenskiy
d10a570203 Add compatibility resolve when variable has "bad" intersection type
#KT-39468 Fixed

(cherry picked from commit d51bb2c053)
2020-07-12 23:59:46 +03:00
Ilya Chernikov
0701ea57c7 NI: Optimize some potential hot places
(cherry picked from commit 2656eeb164)
2020-07-12 23:59:46 +03:00
Mikhail Zarechenskiy
61e55c9b4b Update ApiTest.testIrStdlib for JS, an addition to 9be8c5b5
(cherry picked from commit b0b8d40b71)
2020-07-12 23:59:46 +03:00
Vladimir Ilmov
074bff4dc6 (CoroutineDebugger) Restored frame variables isn't shown for 2020.1.
#KT-40172 fixed
2020-07-11 10:24:27 +02:00
Ilya Gorbunov
a2c0e81baa Postpone introducing common StringBuilder.capacity() function
Its support complicates JS StringBuilder implementation with no actual
performance improvements. Benefits of having capacity() function
in common code are also not completely clear.

Relates to KT-33069
#KT-40168

(cherry picked from commit 20683d62a6)
2020-07-10 20:25:14 +03:00
Ilya Gorbunov
0a8b4c6996 Add EXACTLY_ONCE contract to suspendCoroutine* functions
Update line numbers in the affected test.

(cherry picked from commit 2f3e1dcbc6)
2020-07-10 15:47:21 +03:00
Ilya Gorbunov
17e210e19c Add EXACTLY_ONCE contract to functions that call their lambda parameter once
KT-35972

(cherry picked from commit 1a32fdf6d7)
2020-07-10 15:47:21 +03:00
Ilya Gorbunov
8ae480aa4c Fix typo in kotlinx.dom docs
(cherry picked from commit c85432b2f9)
2020-07-10 15:47:21 +03:00
Natalia Selezneva
4d7eeccdf6 *.gradle.kts: get java home from build environment instead of execution settings
Note that getting GradleExecutionSettings may lead to write action
because it link javaHome with existing sdks

^KT-39317

(cherry picked from commit c7c7ffb0e0)
2020-07-10 15:42:35 +03:00
Dmitriy Dolovov
055d2fff1f [Commonizer] Lookup descriptors that doesn't participate in commonization
^KT-40119
2020-07-10 19:14:33 +07:00
Dmitriy Dolovov
7620dffee4 [Commonizer] Use ClassId instead of FqName for addressing classes and TAs
(cherry picked from commit ffd0c69698)
2020-07-10 19:14:28 +07:00
Victor Petukhov
2068d07908 Add skipped ignore directive in test for b08c7eff38 2020-07-10 14:51:50 +03:00
Victor Petukhov
b08c7eff38 NI: introduce simple calls storage (which aren't gone through type inference) in coroutine inference session to further substitute postponed variable
^KT-40151 Fixed

(cherry picked from commit 514ac7dc8f)
2020-07-10 12:12:25 +03:00
Victor Petukhov
e5cce3f3d9 NI: do substitution stub types during updating trace for lambda (these stub types can appear from the builder inference as postponed variables)
^KT-40060 Fixed

(cherry picked from commit c588bc604d)
2020-07-10 12:12:22 +03:00
Victor Petukhov
f580653740 NI: don't collect members if a receiver type is StubType to avoid creating error candidates instead of not crating them at all
^KT-37717 Fixed

(cherry picked from commit eec3a4720c)
2020-07-10 12:12:20 +03:00
Anton Yalyshev
b332174f91 Enable FUS for Code Completion in 1.4.0
(cherry picked from commit bc979a33f7)
2020-07-09 19:55:06 +03:00
Alexander Udalov
c5ecb60ed3 Fix compilation of stdlib when JDK_16 points to JDK 8+
(cherry picked from commit 2be94d9d2f)
2020-07-09 18:45:50 +02:00
Leonid Startsev
8a4e99a718 Add 'Incorrect Transient' diagnostic
when users write @Transient, they get @kotlin.jvm.Transient, because it's always in auto-import.
This annotation does not work with @Serializable classes; @kotlinx.serialization.Transient should be used instead.

Add quickfix for 'incorrect transient' diagnostic:
'Import kotlinx.serialization.Transient'

 #KT-28662 Fixed

(cherry picked from commit 340deb01dd)
2020-07-09 19:39:24 +03:00
Leonid Startsev
12a338fa52 Split ContextualSerialization annotation in two
(cherry picked from commit 6ef597a4ee)
2020-07-09 19:39:07 +03:00
Ilya Kirillov
70b98018c3 Wizard: fix project template list size
(cherry picked from commit f179b39c70)
2020-07-09 18:25:27 +03:00
Ilya Kirillov
37a67d85fd Wizard: update ktor version
#KT-40037 fixed
2020-07-09 18:25:27 +03:00
Ilya Kirillov
feee61b1e3 Wizard: consider RC version as a EAP one
#KT-39871 fixed
2020-07-09 18:25:27 +03:00
Ilya Kirillov
613898bf16 Wizard: add kotlinx repo for projects using kotlinx-html
#KT-40004 fixed
2020-07-09 18:25:27 +03:00
Roman Artemev
68bb96ddaf [IR] Fix synthetic declarations generator to make it produce correct type
- Fix KT-40126
 - Add test

(cherry picked from commit ca44242f37)
2020-07-09 17:35:38 +03:00
Ilya Muradyan
503f8f63da Fix REPL completion for import directives
(cherry picked from commit 2487f9369c)
2020-07-09 16:19:03 +03:00
Stanislav Erokhin
1a140ddf58 Fix since-build version for AS 3.6 and AS 4.0 2020-07-09 15:20:39 +03:00
Ilya Matveev
d2cfabb210 Update K/N version: 1.4-rc1-18 2020-07-09 14:33:36 +07:00
Roman Golyshev
69e45061a0 KT-39869 Remove redundant performDelayedRefactoringRequests call
- In `ObsoleteExperimentalCoroutinesInspection` it is redundant because
it is performed immediately after the single `bindToFqName` call,
so there is no reason to postpone the refactoring and then immediately
invoke it
- In `ObsoleteKotlinJsPackagesInspection` there are no reason to call
it at all (no refactorings are postponed)

(cherry picked from commit 637d3430ff)
2020-07-08 15:38:56 +00:00
Roman Golyshev
46e4a21dfd KT-39869 Add inspection for FQN usages of kotlin.browser package
- `kotlin.dom` does not need this because it contains only extensions
- Add test for launching whole project fix; mute it because currently it
does not pass
  - The test fails because in tests `RefJavaManager` tries to create
  `RefJavaFileImpl` for .kt files. It will try to use UAST, but it
  does not work for JS files. In production this is disabled, so no
  problems occur

(cherry picked from commit 5cf6b860a6)
2020-07-08 15:38:55 +00:00
Roman Golyshev
2b73400c8f KT-39869 Fix review suggestions
- Review: https://jetbrains.team/p/kt/review/1349

(cherry picked from commit 91fa5d38b3)
2020-07-08 15:38:54 +00:00
Roman Golyshev
c6f342bd9e KT-39869 Add ObsoleteKotlinJsPackagesInspection inspection
- This inspection allows to migrate from `kotlin.dom|kotlin.browser`
to `kotlinx.dom|kotlinx.browser` packages respectively
- This inspection is available from the import statements, and also
from the `Run migrations` action
- ^KT-39869 Fixed

(cherry picked from commit 75de352ce2)
2020-07-08 15:38:53 +00:00
Roman Golyshev
46f0c39c58 KT-39869 Move base classes to separate file
(cherry picked from commit ec087e8f3d)
2020-07-08 15:38:52 +00:00
Roman Golyshev
181ecb9e19 KT-39869 Refactor ObsoleteExperimentalCoroutinesInspection.kt
- We need this to reuse the logic for migration inspections

(cherry picked from commit 871bb30dbe)
2020-07-08 15:38:50 +00:00
Ilya Goncharov
a8cdf4bd88 [Gradle, JS] Update version in package.json with file dependency 2020-07-08 16:38:03 +03:00
Lilia
e8ef514f4b Add changelog for 1.4-M3 2020-07-08 13:20:52 +02:00
Ilya Goncharov
d54243609c [Gradle, JS] Output file of public package json as var for changing it
(cherry picked from commit a2d5cda716)

[Gradle, JS] Simplify creation of public package json task

(cherry picked from commit 5c968acb13)

[Gradle, JS] jsJar dependsOn PublicPackageJsonTask

But package.json included into jar only if public npm dependencies exists

(cherry picked from commit f76a1f0e86)

[Gradle, JS] Add test on public package json inside archives (jar and klib)

(cherry picked from commit 03bc61c80a)

^KT-40067 fixed
2020-07-07 13:19:33 +03:00
Yaroslav Chernyshev
34bcc97160 KT-36801 Added forgotten changes for 192 platform
#KT-39989 Fixed

(cherry picked from commit aeed7fe52d)
2020-07-06 21:49:36 +03:00
Ilya Goncharov
fc5328d7a6 [Gradle, JS] Deprecation of frontend plugin
^KT-40048 fixed

(cherry picked from commit cb3d7349a3)
2020-07-06 18:49:17 +03:00
Vladimir Dolzhenko
cf9a881a3f Fix KOTLIN_BUNDLED registration
#KT-39968 Fixed

(cherry picked from commit 1450cf5f63)
2020-07-03 22:18:17 +02:00
Svyatoslav Scherbina
40e29a34b8 Add "Remove annotation" quickfix for @Throws override mismatch 2020-07-03 20:47:32 +03:00
Svyatoslav Scherbina
30b9f63146 Add "Remove annotation" quickfix for empty @Throws 2020-07-03 20:47:30 +03:00
Svyatoslav Scherbina
aa3eb2e3a0 Add quickfix for adding CancellableException to @Throws suspend fun 2020-07-03 20:47:27 +03:00
Svyatoslav Scherbina
91272d042f Add basic support for Native in idea/testdata/multiModuleQuickFix 2020-07-03 20:47:25 +03:00
Vyacheslav Gerasimov
02b4836c17 Build: Encode build number in teamcity build url 2020-07-03 15:35:02 +03:00
Mikhail Zarechenskiy
b342422959 Advance bootstrap to 1.4.0-rc-87 2020-07-02 22:35:58 +03:00
Vyacheslav Gerasimov
c28533aa61 Build: Use project kotlin-reflect in fir tree generator
To avoid unstable dependency substitution depending on local version
2020-07-02 20:47:05 +03:00
Mikhail Zarechenskiy
da924219c0 Advance bootstrap to 1.4.0-rc-83 2020-07-02 20:00:35 +03:00
Mikhail Zarechenskiy
7ac36eff82 Update test data as stdlib now isn't pre-release 2020-07-02 18:35:30 +03:00
Mikhail Zarechenskiy
60a9629b2f Set KotlinCompilerVersion.IS_PRE_RELEASE = false
Since master is 1.4.20 now and branch 1.4.0 is 1.4-RC

 #KT-39860 Fixed
2020-07-02 18:35:15 +03:00
Vsevolod Tolstopyatov
66c5b58420 Introduce CancellationException
#KT-39126 Fixed
2020-07-02 11:14:00 +03:00
Alexander Gorshenev
aa1f689b2f Adapted fake override checker to inheritance from friend module internal interfaces 2020-07-01 20:33:51 +03:00
Denis Zharkov
5fb57511ca Fix incremental compilation for calls to inner classes from supertypes
The problem became actual after 8c2baf0704

(cherry picked from commit 3ce980fd88)
2020-07-01 07:01:51 +03:00
Mikhail Bogdanov
ede7737348 Check target for -Xjvm-default modes
#KT-39925 Fixed

(cherry picked from commit b5b5c8aebc)
2020-06-30 20:12:15 +02:00
Mikhail Bogdanov
6c8544aa97 Write proto flag about compatibility mode
There is no any special aim for this flag now.
  But it could be useful in future in case of compatibility mode deprecation

(cherry picked from commit 3580c7c28c)

 #KT-39943 Fixed
2020-06-30 15:24:56 +02:00
Alexander Gorshenev
42a4f70294 Muted .IncrementalJsKlibCompilerRunnerTestGenerated.ClassHierarchyAffected.testMethodRemoved
until we have full fledged fake override support in klib
2020-06-30 13:50:47 +03:00
Alexander Gorshenev
189dba39a6 Updated extraHelp test data for the new flags 2020-06-30 13:50:42 +03:00
Alexander Gorshenev
2c2799e531 Compute correct signature for fake override properties with type parameters 2020-06-30 13:50:35 +03:00
Alexander Gorshenev
fa274e03dd Fine tuned fake override validator for internals 2020-06-30 13:50:29 +03:00
Alexander Gorshenev
e341ba30c0 Treat internals as publics for fake override construction 2020-06-30 13:50:19 +03:00
Alexander Gorshenev
94d334d92c Fake override construction fallback mode 2020-06-30 13:50:14 +03:00
Alexander Gorshenev
700234ed2a Added -Xdisable-fake-override-validator 2020-06-30 13:50:06 +03:00
Sergey Igushkin
64aa5dcd70 Add back empty stub implementations of KotlinGradleSubplugin (KT-39809)
* If a KotlinGradleSubplugin implements
 KotlinCompilerPluginSupportPlugin, don't apply it as a legacy plugin

* Add the legacy KotlinGradleSubplugin implementations back so that
 when there's JAR hell with META-INF/services in the old artifacts
 pointing to the classes, loading the plugins with ServiceLoader (legacy
 implementation) from the new artifacts would not fail.

* There's a corner case for plugins not in kotlin-gradle-plugin
 If a newer and older version of such a subplugin is used with an older
 version of the Kotlin Gradle plugin, the latter will find the META-INF
 entries and will try to load the subplugins from the new version. With
 the original fix for KT-39809, this would result in silently ignored
 empty stub implementations.

 Given that the Kotlin Gradle plugin can now check if a subplugin
 supports the new API, it's OK to keep the old entries and make the
 stub implementations throw a build error when called, so that improper
 plugin versions are not ignored and are clearly reported.

 Note that this is only necessary for the subplugins not bundled in the
 kotlin-gradle-plugin module, as those will always be in sync with the
 Kotlin version.

Issue #KT-39809 Fixed

(cherry picked from commit 1f5fa5eb7c)
2020-06-30 13:19:54 +03:00
Sergey Igushkin
24a4229d70 Remove kotlin.native.linkFromSources, expose tasks' sources
* Drop the deprecated mode in the Kotlin/Native link
tasks using sources rather than the intermediate
compiled klib.

* Remove the `allSources` and `commonSources`
properties from the KotlinNativeCompilation, use the
tasks' properties instead.

(cherry picked from commit e6bca819d4)
2020-06-30 13:18:45 +03:00
Abduqodiri Qurbonzoda
b2c7055892 Deprecate with error mixed Int/FP contains operator for ranges KT-22423
(cherry picked from commit d3fb9cc5f3)
2020-06-29 18:22:10 +03:00
Abduqodiri Qurbonzoda
5f8b0ffc8d Fix min/maxByOrNull function samples
(cherry picked from commit a04f70fb36)
2020-06-29 18:22:05 +03:00
Mikhail Zarechenskiy
0e43040535 Update tests for completion after adding DeprecatedSinceKotlin 2020-06-29 18:08:09 +03:00
Mikhail Zarechenskiy
4f130321c1 Update ApiTest.testStdlib for JS, an addition to 9be8c5b5 2020-06-29 18:08:09 +03:00
Mikhail Zarechenskiy
29feb78fbc Fix priority for "add import" action wrt DeprecatedSinceKotlin 2020-06-29 18:08:09 +03:00
Mikhail Zarechenskiy
4d659a4d47 Fix completion order & presentation wrt to DeprecatedSinceKotlin 2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
d40d50922a Fix parameter info presentation with regard to DeprecatedSinceKotlin 2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
72de5447d6 Update test data about built-ins 2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
9940ef685b Implement equals/hashCode as this class previously was a data one
Fixes duplicated diagnostics in tests
2020-06-29 18:08:08 +03:00
Mikhail Zarechenskiy
d5b276a80b Prohibit using DeprecatedSinceKotlin outside kotlin subpackage 2020-06-29 18:08:07 +03:00
Mikhail Zarechenskiy
ef9b309d27 Prohibit using DeprecatedSinceKotlin annotation without arguments 2020-06-29 18:08:07 +03:00
Mikhail Zarechenskiy
70ef0b2e4b Reject values of DeprecatedSince.. that are not parseable as a version 2020-06-29 18:08:07 +03:00
Mikhail Zarechenskiy
1a05fc023f Place DeprecatedSinceKotlin annotation under 1.4 version 2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
e505271225 Add various test for DeprecatedSinceKotlin annotation 2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
3b96519d68 Don't perform additional lookups for DeprecatedSinceKotlin annotation
There is no need to check it as `DeprecatedSinceKotlin` can be used
 only along with `Deprecated` annotation
2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
7ea0a2918c Remove message and replaceWith parameters from DeprecatedSinceKotlin 2020-06-29 18:08:06 +03:00
Mikhail Zarechenskiy
55c2a888b1 Introduce declaration checker for DeprecatedSinceKotlin annotation
- DeprecatedSinceKotlin annotation should only be applicable when
   there's `@Deprecated` annotation on the same declaration
 - Deprecation level shouldn't be specified in the relevant
   `@Deprecated` annotation
 - Check that warningSince <= errorSince <= hiddenSince
2020-06-29 18:08:05 +03:00
Alexander Udalov
57efee8d79 Introduce DeprecatedSinceKotlin annotation
This annotation will be used in the standard library to prevent the new
compiler from reporting deprecation diagnostics in case an older API
version is used (where the declaration was not deprecated yet).

 #KT-23575 Fixed
2020-06-29 18:08:05 +03:00
Shagen Ogandzhanian
a386d5c351 Update dukat dependency to 0.5.4
(cherry picked from commit 8a393ec041)
2020-06-29 13:23:38 +02:00
Alexey Trilis
57284816c3 KT-39843 Update project wizard templates after replacing kotlin.browser with kotlinx.browser
#KT-39843 Fixed

(cherry picked from commit 955087868a)
2020-06-29 13:26:10 +03:00
Dmitriy Dolovov
f0ab9358ba [Commonizer] Fast-pass for library fragments absent for some targets
^KT-39897
2020-06-29 17:22:34 +07:00
Andrey Uskov
0cb3c647c2 Escape arguments when Gradle plugin launches out of process compilation
#KT-39755 Fixed

(cherry picked from commit f4e9acb233)
2020-06-28 11:41:31 +03:00
Leonid Startsev
a62a563477 Rename several core entities as a part of kx.serialization abi change
(cherry picked from commit 901d8f3e7a)
2020-06-26 20:32:59 +03:00
Leonid Startsev
669092bf63 Support new ContextSerializer signature
(cherry picked from commit 5208bbcd21)
2020-06-26 20:32:43 +03:00
Ilya Goncharov
aeb93f5a3f [Gradle, JS] Ignore peer dependencies in yarn resolution
^KT-39842 fixed

(cherry picked from commit bd05b447c0)
2020-06-26 16:38:40 +03:00
Ilya Gorbunov
e277fd793d Expose KTypeProjection.STAR constant in a field
#KT-30083

(cherry picked from commit 8dfcebf542)
2020-06-26 16:17:31 +03:00
Ilya Gorbunov
765f62e2e2 Validate arguments of KTypeProjection constructor
#KT-34596 Fixed

(cherry picked from commit 53cbcfac5a)
2020-06-26 16:17:29 +03:00
Ilya Gorbunov
434d13f131 Annotate KTypeProjection factory methods with JvmStatic
#KT-30084 Fixed

(cherry picked from commit d41e8ed4ad)
2020-06-26 16:17:27 +03:00
Ilya Gorbunov
0c999107be Advance bootstrap to 1.4-M3-eap-163 2020-06-26 16:17:26 +03:00
Mikhail Zarechenskiy
e0f0f5da8d Don't silently ignore argument mismatch for provide delegate
#KT-39816 Fixed

(cherry picked from commit a87b25d10e)
2020-06-26 14:29:15 +03:00
Mikhail Zarechenskiy
0bd70f877f Fix ambiguity on reference inside blocks of special functions
#KT-37058 Fixed

(cherry picked from commit ea5fef76d1)
2020-06-26 14:29:11 +03:00
Mikhail Zarechenskiy
0c468e17e0 Fix adaptation for references with default values after varargs
After vararg argument it's possible to pass values only by name, so
 here we modulate this behavior

 #KT-37721 Fixed

(cherry picked from commit c2c139ef4f)
2020-06-26 14:29:08 +03:00
Mikhail Zarechenskiy
16ca988f24 Callable reference adaptation should have dependency on API version 1.4
#KT-38069 Fixed

(cherry picked from commit c5a2ab2512)
2020-06-26 14:29:04 +03:00
Mikhail Zarechenskiy
611fa3a290 Prohibit functional interface constructor references
#KT-36706 Fixed

(cherry picked from commit bc40669598)
2020-06-26 14:29:00 +03:00
Mikhail Zarechenskiy
a74b2f1507 Don't skip constraints from equations with the kind equal
The problem was that we didn't incorporate T == Foo into K <: Inv<out T>.
 It happened because of optimisation that isn't applicable here as we
 already have projection in the initial type

 #KT-39777 Fixed

(cherry picked from commit a5ae1b38b0)
2020-06-26 14:28:57 +03:00
Mikhail Zarechenskiy
904f154cbf Fix coercion to Unit with equal Nothing constraint
#KT-39669 Fixed

(cherry picked from commit e7cee9c6e1)
2020-06-26 14:28:55 +03:00
Mikhail Zarechenskiy
59edd8dd20 Fix overload ambiguity after smartcast to nullable Nothing
#KT-39544 Fixed

(cherry picked from commit a06c8786df)
2020-06-26 14:28:52 +03:00
Ilya Kirillov
6f72dedd3c Wizard: update versions of used libraries for 1.4-M3
#KT-39503 fixed
#KT-39503 fixed

(cherry picked from commit 366a75e222)
2020-06-26 12:28:28 +03:00
Victor Petukhov
c3106be503 Commit trace for callable reference's LHS with reserved syntax like foo?::bar?::bar to avoid the lack of diagnostics reporting
^KT-35075 Fixed
2020-06-26 11:35:19 +03:00
Vladimir Ilmov
38ba0cd93a (CoroutineDebugger) fix for debugger agent doesn't start for -core 1.3.6 and up
Coroutine information will be missing otherwise

 #KT-39808 fix
2020-06-26 10:18:38 +02:00
Ilya Gorbunov
34ca070553 KT-38817 capitalize uses title case for the first char where available
This unifies its behavior with new capitalize overload with Locale.

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
(cherry picked from commit 33150a0809)
2020-06-25 21:47:02 +03:00
Ilya Gorbunov
00dc4046c1 Promote capitalize/decapitalize with Locale to stable
Relates to KT-28933

(cherry picked from commit 9e2f95233c)
2020-06-25 21:47:01 +03:00
Kirill Shmakov
60d415fd3a Fix Android app in template project
(cherry picked from commit b62e22cb01)
2020-06-25 21:45:42 +03:00
Raluca Sauciuc
b4865998de Restore KotlinExplicitMovementProvider in as40
(cherry picked from commit 9c8904f165)
2020-06-25 18:46:43 +02:00
Alexander Udalov
4239214520 Skip unresolved JvmStatic/JvmField annotations in builtins
This is needed to implement KT-30084 and KT-30083 after bootstrap.

(cherry picked from commit 05e8546bdb)
2020-06-25 18:44:37 +03:00
Alexey Trilis
b5b78d897c Fix testdata after changing API of kotlin.browser and kotlin.dom
(cherry picked from commit 593684ecb6)
2020-06-25 14:57:43 +03:00
Ilya Chernikov
fb7f14c551 [minor] clean up main-kts-dependencies 2020-06-25 11:45:54 +02:00
Ilya Chernikov
4140b38c31 Move main-kts cache test to out-of-process compilation
to avoid clashes with coroutine debugger when running
tests from IntelliJ
2020-06-25 11:45:54 +02:00
Ilya Chernikov
ad1cadb94e Fix coroutines core shading in main-kts 2020-06-25 11:45:54 +02:00
Dmitriy Dolovov
83d0043a5f Minor. Fix typo in text printed to users 2020-06-24 13:10:46 +07:00
Ilya Goncharov
b97156094e Fix new project wizard css support for karma
(cherry picked from commit e6539eade5)
2020-06-23 18:47:25 +03:00
Natalia Selezneva
85e3ad5bef Fix freeze during loading script configurations through legacy scripting API
Do not wrap the whole configuration loading process into readAction
^KT-39771 Fixed
2020-06-23 16:06:17 +03:00
Svyatoslav Kuzmich
4e959a5d3c [JS] Fix stack trace capturing from secondary constructors KT-37563 2020-06-23 15:27:33 +03:00
Svyatoslav Kuzmich
ad5df77251 [JS IR] Fix stack trace capturing in secondary constructors (KT-37563)
Call captureStack in primary constructors and generated factories
2020-06-23 15:27:33 +03:00
Svyatoslav Kuzmich
2ff4dd0891 [IR] Add IrRawFunctionReference 2020-06-23 15:27:33 +03:00
Ilya Gorbunov
3255debef3 Fix stdlib-js-ir-for-tests build
Exclude kotlinx.browser and kotlinx.dom packages

(cherry picked from commit b2e70f9c21)
2020-06-23 14:22:07 +03:00
Ilya Goncharov
8d218aefc4 Add enabling css into wizard
#KT-39770 fixed

(cherry picked from commit c9c20bb34c)

Refactor aligning for css support

#KT-39770 fixed

(cherry picked from commit b8aff0660c)

Add CSS support to new project wizard

#KT-39770 fixed

(cherry picked from commit 5676d31a1c)

Kind and css support to single platform JS

#KT-39770 fixed

(cherry picked from commit c2e97a7287)

Update test data

#KT-39770 fixed

(cherry picked from commit 852e860743)

Fix browser settings for webpack tasks

Fix test with css case

cssSettings -> cssSupport
2020-06-23 13:14:16 +03:00
Ilya Goncharov
4a6c5efd5c cssSettings -> cssSupport
(cherry picked from commit 793ada08a9)
2020-06-23 13:10:26 +03:00
Ilya Goncharov
84471282b7 Fix test with css case
(cherry picked from commit 538cf8af56)
2020-06-23 13:10:24 +03:00
Ilya Goncharov
9e7a4af91d Fix browser settings for webpack tasks
(cherry picked from commit 4ad95dbe0c)
2020-06-23 13:10:23 +03:00
Dmitriy Novozhilov
1d3559bac5 [FIR] Fix completing bodies of property setters with delegates
(cherry picked from commit be2ac3bb4f)
2020-06-23 00:52:00 +03:00
Dmitriy Novozhilov
0f195bf65d [FIR] Add transformBody to FirFunction
(cherry picked from commit 8ce28cb509)
2020-06-23 00:52:00 +03:00
Ilya Gorbunov
2c8344a339 Remove kotlin.coroutines.experimental package descriptions
(cherry picked from commit 23dc75fb87)
2020-06-23 00:52:00 +03:00
Ilya Gorbunov
2cb0e1584c Update API dumps
(cherry picked from commit 9d111b9451)
2020-06-23 00:51:59 +03:00
Ilya Gorbunov
f8dd945c4b Drop deprecated jsClass top level and extension functions
Introduce internal toplevel jsClass in js-ir source set instead.
It is needed for JS-IR backend.

(cherry picked from commit 6c8ff25e5d)
2020-06-23 00:51:59 +03:00
Ilya Gorbunov
54b6519694 Drop deprecated MutableMap property delegation operator
(cherry picked from commit 696701d377)
2020-06-23 00:51:59 +03:00
Ilya Gorbunov
9eeb024fa5 Drop deprecated CollectionAssertions.kt
Remove incorrect import from callByWithEmptyVarArg test

(cherry picked from commit 7632910ffd)
2020-06-23 00:06:07 +03:00
Ilya Gorbunov
6ea35d3934 Remove hidden Random.Companion
It was never released as stable since 1.3. Was provided for binary
compatibility with 1.3 prereleases.

(cherry picked from commit 5550dc93a1)
2020-06-23 00:06:05 +03:00
Ilya Gorbunov
51e977fd3d Drop previously deprecated API
- common and JS org.junit.Test from kotlin.test
- kotlin.Synchronized/Volatile from K/JS
- JS 'native' annotation

(cherry picked from commit b55729957e)
2020-06-23 00:06:03 +03:00
Ilya Gorbunov
65806649a6 Increase deprecation level for previously deprecated API
- unsupported common exceptions
- common 'synchronized'
- jquery API
- experimental kotlin.time API
- js Math object
- DefaultAsserter constructor-like fun

(cherry picked from commit e9c4f531eb)
2020-06-23 00:06:02 +03:00
Alexander Gorshenev
02df11bae8 Fix for KT-37761. Don't use mmap. It causes more troubles than it produce benefits 2020-06-22 19:10:05 +03:00
Andrei Klunnyi
1ba824af44 KT-36801 IDE: Unsupported language version values 2020-06-22 15:21:36 +02:00
Yaroslav Chernyshev
5883ee1328 [Gradle, CocoaPods] Improved CocoaPods Integration features with tests
(cherry picked from commit c638043aee)
2020-06-22 14:16:19 +03:00
Roman Artemev
64be011d49 [KLIB IC] Fix dirty declaration detector
- make kjs-stdlib be compiled correctly in IC mode

(cherry picked from commit 2c3d8feb26)
2020-06-22 11:32:05 +03:00
Ilya Gorbunov
81b78aeece Provide flatMapIndexed operation
- similar to flatMap, but transform function takes index and element

#KT-36894

(cherry picked from commit 130987fa1e)
2020-06-19 18:02:17 +03:00
Abduqodiri Qurbonzoda
d70a675e9e Initial template for flatMapIndexed operation
#KT-36894

(cherry picked from commit db93462bcf)
2020-06-19 18:02:16 +03:00
Sergey Igushkin
8d9949f62f Fix compilation of DukatCompilationResolverPlugin after rebase
(cherry picked from commit d9fea52344)
2020-06-19 17:51:37 +03:00
Sergey Igushkin
e341065bef (minor) Fixes for review KT-MR-1290
(cherry picked from commit f7b660b573)
2020-06-19 17:51:35 +03:00
Sergey Igushkin
00fb7058b7 Fixes for task configuration avoidance in Gradle Kotlin/JS support
(cherry picked from commit 10cae9bc5d)
2020-06-19 17:51:32 +03:00
Sergey Igushkin
e6b271b7d6 Move kotlinOptions out of the tasks
(cherry picked from commit 0b7d8c51cb)
2020-06-19 17:51:28 +03:00
Sergey Igushkin
a977e8ea09 Rework ScriptingGradleSubplugin for the new subplugins API
(cherry picked from commit 19ac036ec5)
2020-06-19 17:51:25 +03:00
Sergey Igushkin
9b572295ca Rework AndroidSubplugin for the new subplugins API
(cherry picked from commit cb5aa64a95)
2020-06-19 17:51:23 +03:00
Sergey Igushkin
2d9152b639 Rework SamWithReceiverSubplugin for the new subplugins API
(cherry picked from commit 48153c53ca)
2020-06-19 17:51:19 +03:00
Sergey Igushkin
32b9f83b3a (minor) Suppress a warning about property initialized with ctor param
(cherry picked from commit 120f77416b)
2020-06-19 17:51:15 +03:00
Sergey Igushkin
3a0b98fe6e Rework ExampleSubplugin for the new subplugins API
(cherry picked from commit 66a59df7de)
2020-06-19 17:51:11 +03:00
Sergey Igushkin
844c58e67a Rework SerializationSubplugin for the new subplugins API
(cherry picked from commit a2e4b52747)
2020-06-19 17:51:08 +03:00
Sergey Igushkin
94b8ea4837 Rework NoArgSubplugin for the new subplugins API
(cherry picked from commit 98fc4ab2e1)
2020-06-19 17:51:06 +03:00
Sergey Igushkin
83877b33e8 Rework AllOpenSubplugin for the new subplugins API
(cherry picked from commit f2bc391bdd)
2020-06-19 17:51:03 +03:00
Sergey Igushkin
9cef58cefd Rework Gradle subplugins application in Kotlin/Native
(cherry picked from commit e8a303650c)
2020-06-19 17:51:02 +03:00
Sergey Igushkin
454dced6bb Refactor the Kotlin Android plugin to make it compliant with TCA
Also simplify some of the APIs and move some others which are only used
by kapt to the kapt's codebase.

(cherry picked from commit 06a3376368)
2020-06-19 17:50:58 +03:00
Sergey Igushkin
26bcd82400 Refactor the kapt Gradle plugin to use the new plugins API and TCA
(cherry picked from commit 4dbc6803ba)
2020-06-19 17:50:12 +03:00
Sergey Igushkin
b71942b3dd Introduce new API for Kotlin compiler support Gradle plugins
The old API was too specific for the Kotlin internal use cases and
leaked some abstractions due to the missing target-compilation project
model. One of such leaking abstractions was the Gradle tasks being
exposed to the subplugin, which required the tasks to instantiate
in order for the subplugin to apply. This violated task configuration
avoidance, so the old API could never work in compliance with TCA.

Introduce the new KotlinCompilerPluginSupportPlugin API that uses the
compilations instead of the tasks and is TCA-compliant.

(cherry picked from commit 96ed30a449)
2020-06-19 17:50:10 +03:00
Sergey Igushkin
8a10a21712 Refactor Kotlin classes registration for java-library plugin
(cherry picked from commit 0b2d96c1ef)
2020-06-19 17:50:07 +03:00
Sergey Igushkin
5804ca3437 Use TCA-compliant Gradle APIs in the JS part of the Kotlin Gradle plugin
(cherry picked from commit 58dd0fa3d2)
2020-06-19 17:50:04 +03:00
Sergey Igushkin
587e418ba2 Use TCA-compliant Gradle APIs in the Kotlin Gradle plugin
(cherry picked from commit 58e9b3ae0e)
2020-06-19 17:50:01 +03:00
Sergey Igushkin
a3550c95b7 Add Java tasks to relevant compilation APIs
(cherry picked from commit 84287d77ca)
2020-06-19 17:49:52 +03:00
Sergey Igushkin
144a66347f (minor) Initialize compilations with the precise target type
(cherry picked from commit 1749cb9129)
2020-06-19 17:49:47 +03:00
Sergey Igushkin
ee20744fae Add TaskProvider property for Kotlin compile tasks in compilations
(cherry picked from commit f4e4baa253)
2020-06-19 17:49:29 +03:00
Ilya Gorbunov
d1f8f27b75 Leave StringBuilder.append/insert with non-nullable String parameter
Leave these methods as hidden in order to preserve binary compatibility.

#KT-39504

(cherry picked from commit 606fad64ad)
2020-06-19 17:42:47 +03:00
Sergey Rostov
a372aa2073 gradle scripts: fix isFirstLoadActual and notification typos 2020-06-19 17:01:50 +03:00
Mikhail Zarechenskiy
05c07032ee Fix compatibility resolve for references with multiple outer candidates
#KT-39533 Fixed

(cherry picked from commit 9c8e979308)
2020-06-19 16:55:29 +03:00
Mikhail Zarechenskiy
127156042b Add test for obsolete issue
The issue was fixed in df1595e

 #KT-39630 Fixed

(cherry picked from commit d44a7ff8f9)
2020-06-19 16:55:28 +03:00
Mikhail Zarechenskiy
5e6af8ee02 Enable test for new inference after df1595e4
Follow up KT-37149

(cherry picked from commit a067d138e9)
2020-06-19 16:55:28 +03:00
Mikhail Zarechenskiy
95276fc13b Fix SAM conversions for derived classes
#KT-39535 Fixed
 #KT-37149 Fixed

(cherry picked from commit df1595e4bc)
2020-06-19 16:55:28 +03:00
Mikhail Zarechenskiy
bb87e7817c Add test for obsolete issue
#KT-17341 Obsolete
 #KT-32958 Obsolete

(cherry picked from commit 3921a0ed70)
2020-06-19 16:55:27 +03:00
Sergey Rostov
8cbd4d1240 gradle scripts: custom notification wording gradle with default scripting support (gradle older then 6.0) 2020-06-19 16:39:20 +03:00
Sergey Rostov
f2d2bafd56 gradle scripts: "link project" action implementation 2020-06-19 16:39:20 +03:00
Sergey Rostov
9c34419a77 gradle scripts: temporary disable irrelevant actions when script configuration was not received during import 2020-06-19 16:39:20 +03:00
Abduqodiri Qurbonzoda
c168083ab6 Update js public api dump
(cherry picked from commit 6e5b94f695)
2020-06-19 16:13:51 +03:00
Abduqodiri Qurbonzoda
971142721e Deprecate contains, indexOf, lastIndexOf functions of Float/DoubleArray #KT-28753
(cherry picked from commit c923b2e139)
2020-06-19 16:13:49 +03:00
Abduqodiri Qurbonzoda
214913d21f Compare floating point values asList elements in total order #KT-28753
(cherry picked from commit 97c688057d)
2020-06-19 16:13:48 +03:00
Abduqodiri Qurbonzoda
11e2baac78 Update js public api dump
(cherry picked from commit bf26d87ee9)
2020-06-19 16:13:41 +03:00
Abduqodiri Qurbonzoda
a1b28fd6ce Introduce minWithOrNull and maxWithOrNull extension functions #KT-38854
(cherry picked from commit 16b62b8e65)
2020-06-19 16:13:39 +03:00
Abduqodiri Qurbonzoda
abc6ca2b37 Introduce minByOrNull and maxByOrNull extension functions #KT-38854
(cherry picked from commit 194791a168)
2020-06-19 16:13:37 +03:00
Abduqodiri Qurbonzoda
8e2e1f63c7 Introduce minOrNull and maxOrNull extension functions #KT-39064
(cherry picked from commit 846a7823ad)
2020-06-19 16:13:36 +03:00
Mikhail Bogdanov
87aa084225 Fix test data
(cherry picked from commit 58183b774d)
2020-06-19 15:09:15 +02:00
Alexey Trilis
1f04feddf3 Deprecate kotlin.browser and kotlin.dom packages and provide
replacements in packages kotlinx.dom and kotlinx.browser

KT-39330 Fixed

(cherry picked from commit 99d844dcfb)
2020-06-19 16:03:03 +03:00
Ilya Chernikov
3ad6d5ca35 Add classpaths from all plugin classloaders to the console scripts 2020-06-19 14:57:56 +02:00
Ilya Chernikov
51333d4d0b Load script configuration under read action - avoid possible exception 2020-06-19 14:57:55 +02:00
Natalia Selezneva
595927f687 Filter only valid roots in KotlinScriptDependenciesClassFinder
ClassFinder should return only valid roots,
but in allScriptsDependenciesClassFiles may contain old roots
because they are persistently saved in the storage.
This may cause exception after IDE restart

(cherry picked from commit 44f6a5adcd)
2020-06-19 15:54:18 +03:00
Natalia Selezneva
bff86a335e Add registry key to hide new Load Script Configurations action
(cherry picked from commit d119298232)
2020-06-19 15:54:18 +03:00
Natalia Selezneva
c0c91460d0 Do not start gradle import if it is already in progress
(cherry picked from commit b43014a097)
2020-06-19 15:54:18 +03:00
Natalia Selezneva
2e114dcf35 Floating notification shouldn't be shown during import
It depends on up to date check that is correct only after all caches are updated after import

(cherry picked from commit 66e23c9767)
2020-06-19 15:54:17 +03:00
Dmitriy Dolovov
7fa8e68ca8 [Commonizer] Replace j.u.HashMap by g.t.THashMap to reduce memory usage 2020-06-19 19:35:27 +07:00
Dmitriy Dolovov
923b736f37 [Commonizer] Intern duplicated CirContainingClassDetails instances 2020-06-19 19:24:40 +07:00
Dmitriy Dolovov
5b27cf679f [Commonizer] Intern duplicated CirFunctionModifiers instances 2020-06-19 19:24:34 +07:00
Dmitriy Dolovov
fb9ab023e3 [Commonizer] More detailed progress logging 2020-06-19 19:24:27 +07:00
Dmitriy Dolovov
cb18fc8893 Minor. Replace computeIfAbsent() by getOrPut() 2020-06-19 19:24:21 +07:00
Dmitriy Dolovov
a30370bdcd [Commonizer] Rework preparation of CIR cache in TypeCommonizerTest 2020-06-19 19:24:13 +07:00
Dmitriy Dolovov
2fc3c11f32 [Commonizer] Rework CommonizedGroup API to make it more usable 2020-06-19 19:24:01 +07:00
Dmitriy Dolovov
100b9314cf [Commonizer] Reduce memory consumption during approximation phase
^KT-39320
2020-06-19 19:23:55 +07:00
Ilya Chernikov
de5cfa0812 Clean-up and improve sam-with-receiver test with scripts 2020-06-19 14:11:38 +02:00
Ilya Chernikov
42a7b1ad45 Add serialization plugin test with main-kts 2020-06-19 14:11:37 +02:00
Ilya Chernikov
4272180ad3 Implement non-transitive dependencies resolving in main-kts 2020-06-19 14:11:37 +02:00
Ilya Chernikov
e28b0cbdc3 Add error reporting on the options parsing errors in scripting
also report standard parsing warnings
also fix language version test, since it is not possible anymore
  to use version 1.0
2020-06-19 14:11:36 +02:00
Mathias Quintero
c657aa5f56 Fix annotation construction with array literals
Turns out the issue happens to be that ArrayValue uses a list of values which needs to be translated to an array of the percise type before it is used by callBy

This also addresses handling of arguments after a vararg in an annotation
2020-06-19 14:11:36 +02:00
Efeturi Money
b403081a2f Explicitly handle array annotation args in scripting pre-processing
#KT-35411 fixed
2020-06-19 14:11:35 +02:00
Ilya Muradyan
bb4a35a788 Don't create default importing scopes for REPL snippets
Default scopes should be created only once, for the first snippet.
All following snippets should not create new default importing scopes.
#KT-35651 fixed
2020-06-19 12:59:40 +02:00
Ilya Muradyan
276fb265a8 Allow not to create default importing scopes 2020-06-19 12:59:40 +02:00
Ilya Muradyan
a13faab02b Refactor REPL IDE services testing configuration and add new tests 2020-06-19 12:59:40 +02:00
Ilya Muradyan
150c958782 Support selective filtering of implicits for extensions resolution in REPL 2020-06-19 12:59:40 +02:00
Ilya Muradyan
130d401184 Allow skipping extensions resolution for implicit receivers 2020-06-19 12:59:40 +02:00
Mikhail Bogdanov
44930a59fa Fix compilation
(cherry picked from commit 8bc4407be0)
2020-06-19 12:55:22 +02:00
Mikhail Bogdanov
6e7a79bc16 Report error on missed specialization in compatibility mode
#KT-39603 Fixed

(cherry picked from commit 9c0b96af71)
2020-06-19 12:43:54 +02:00
Mikhail Bogdanov
a2e3166f3e Don't forget about extension parameter in methodSignatureMapping.kt
(cherry picked from commit a150e7b6e5)
2020-06-19 12:43:53 +02:00
Mikhail Bogdanov
c5068c2296 Move common logic from CodegenTestCase to KotlinBaseTest
(cherry picked from commit 929bb0e8d1)
2020-06-19 12:43:52 +02:00
Mikhail Bogdanov
8d8861b887 Make proper check for defaults on delegation to DefaultImpls
(cherry picked from commit 9d48ecfac3)
2020-06-19 12:43:52 +02:00
Mikhail Bogdanov
06e1550924 Generate nullability annotations on this receiver in DefaultImpls. Don't generate nullability annotations in private methods
#KT-36969 Fixed

(cherry picked from commit b8f0ad2111)
2020-06-19 12:43:15 +02:00
Mikhail Bogdanov
8f8f901b2e Don't generate compatibility stubs for @JvmDefaultWithoutCompatibility
(cherry picked from commit 5bdf3d5757)
2020-06-19 12:41:01 +02:00
Mikhail Bogdanov
2321ddad79 Add JvmDefaultWithoutCompatibility annotation
(cherry picked from commit 477cca3c99)
2020-06-19 12:41:01 +02:00
Pavel Kirpichenkov
cf2a554c78 Use bound resolution facade in DeprecationResolver usages
Resolution facade should be used consistently with direct usages of frontend components.
Otherwise they can start processing descriptors from foreign resolvers which leads to memory leaks.

Plain resolution API with provided facade is not suitable as-is for compiled declarations in KotlinIndicesHelper though.
Resolution facade for module sources contained in helper can't handle decompiled
sources from PSI indices (leads to "ModuleInfo not contained in resolver" errors).
That's why "hacked" resolve via import references should be used there.

#KT-39642 Fixed
2020-06-19 12:36:20 +03:00
Pavel Kirpichenkov
1ed04ff939 Fix tests 2020-06-19 12:35:50 +03:00
Dmitry Savvinov
e32308af02 Check for native-shared source-sets properly during facet import
Otherwise they are detected as common source-sets, thus getting
K2MetadataCompilerArguments (instead of FakeK2NativeCompilerArguments),
and the 'applyCompilerArgumentsToFacets' will fail due to check on
javaClass equality

^KT-39657 Fixed
2020-06-19 12:18:21 +03:00
Ilya Goncharov
e126402267 [Gradle, JS] Add webpackConfig for karma
#KT-39654 fixed

(cherry picked from commit ce553f1211)
2020-06-19 11:41:03 +03:00
Ilya Goncharov
c575dae3d9 [Gradle, JS] Disable css support by default
#KT-39654 fixed

(cherry picked from commit 48a4e08d60)
2020-06-19 11:41:02 +03:00
Ilya Goncharov
32606dbd16 [Gradle, JS] Allow to change destDir only for separate task and name it destinationDir
#KT-38331 fixed

(cherry picked from commit 932cf21776)
2020-06-19 11:26:57 +03:00
Ilya Goncharov
3ddfd706a3 [Gradle, JS] AbstractDukatTask -> DukatTask
#KT-38331 fixed

(cherry picked from commit 7386408e94)
2020-06-19 11:26:57 +03:00
Ilya Goncharov
d43975d55a [Gradle, JS] DukatTask -> IntegratedDukatTask
#KT-38331 fixed

(cherry picked from commit 49dd839131)
2020-06-19 11:26:57 +03:00
Ilya Goncharov
c15b9128a7 [Gradle, JS] Add task for separate usage of Dukat with project npm dependencies
#KT-38331 fixed

(cherry picked from commit 46be588f27)
2020-06-19 11:26:57 +03:00
Ilya Kirillov
486b910963 Wizard: group project templates into the categories on the first step
#KT-39700 fixed

(cherry picked from commit 11a680d7d8)
2020-06-19 10:00:32 +03:00
Ilya Kirillov
9b5c01ad6a Wizard: use new icons in UI
(cherry picked from commit bfedeed2c1)
2020-06-19 10:00:31 +03:00
Ilya Kirillov
5c44096828 Wizard: fix ui constants
(cherry picked from commit 7df0dd5032)
2020-06-19 10:00:30 +03:00
Victor Petukhov
4aed5fc5fc NI: clean calls in coroutine inference before the second analysis of += only for right side
^KT-39660 Fixed

(cherry picked from commit ece61915de)
2020-06-18 23:09:53 +03:00
Victor Petukhov
75acd603e4 Revert "Revert "NI: clear calls info in coroutine inference before the second analysis of += right side""
This reverts commit 2fa26fef
2020-06-18 23:09:43 +03:00
Ilya Muradyan
6dae86aa51 Add missing definitelyDoesNotContainName methods
(cherry picked from commit 8c2baf0704)
2020-06-18 22:54:02 +03:00
Ilya Muradyan
984d3cd736 Add missing recordLookup implementations
(cherry picked from commit 573c60ed6b)
2020-06-18 22:54:01 +03:00
Ilya Muradyan
f2a8e6a9cd Compare lookups without respect to their order
(cherry picked from commit 7526ff9484)
2020-06-18 22:54:01 +03:00
Natalia Selezneva
4ac0fa2e95 Run partial import only for specified build root
(cherry picked from commit bf1ad44af9)
2020-06-18 21:17:57 +03:00
Natalia Selezneva
e5544069f7 Workaround for bug in GradleInstallationManager.resolveGradleVersion()
Wrong gradle version when wrapper is used
fixed in 201

(cherry picked from commit 5fe47ffbec)
2020-06-18 21:17:55 +03:00
Natalia Selezneva
c93c6e5d16 Get gradle version and gradle home from corresponding BuildModel after import
GradleProjectSettings that were used, are updated after KotlinDslListener is called,
so it isn't correct to check if kotlinDslModels are supported using it.
Also GradleScriptDefinitionsContributor should use gradle home from BuildModel, not from settings for the same reasons.

^KT-39104 Fixed

(cherry picked from commit 7a47994498)
2020-06-18 21:17:46 +03:00
Natalia Selezneva
f7806558c0 Load script definitions only from production source root and libraries
Exclude not connected to current project roots

EA-210662 Fixed

(cherry picked from commit d1c88798df)
2020-06-18 21:16:57 +03:00
Ilya Matveev
1997bb5207 [Gradle, native] Allow parallel in-process compiler execution
This commit allows parallel in-process execution of the K/N compiler
that was prohibited by 254a978a06.

Issue #KT-38991 fixed
2020-06-18 21:21:03 +07:00
Ilya Matveev
c9215ba09f [klib] Create ZipFileSystem from a Path instead of an URI
Calling FileSystems.newFileSystem(URI, ...) throws a
FileSystemAlreadyExistsException if a ZipFileSystem for this
URI is already created. We still can use a single instance
of ZipFileSystem by calling FileSystems.getFileSystem. In
this case we use reference counting to determine when this
instance can be safely closed.

But we cannot count references if the same ZipFileSystem is used
from different class loaders. This patch fixes this issue by
creating a file system from Path instead of an URI. Contract of
FileSystemProvider.newFileSystem(Path, ...) doesn't imply throwing
FileSystemAlreadyExistsException.

Issue #KT-37443 fixed
2020-06-18 21:21:02 +07:00
Ilya Goncharov
b4aeb89b55 [Gradle, JS] Remove custom source-map-loader
#KT-39377 fixed

(cherry picked from commit 4bbead6200)

[Gradle, JS] Remove trailing commas from webpack config

#KT-39377 fixed

(cherry picked from commit 69b9a2e98a)

[Gradle, JS] Filter warning with source maps

#KT-39377 fixed

(cherry picked from commit 97e4d23d75)

[Gradle, JS] All regular text printed to DEBUG

(cherry picked from commit c5aa35e016)

#KT-39665 fixed
2020-06-18 14:55:24 +03:00
Alexander Udalov
ee2c3b27e2 Fix expected FQ name in JavaTypeTest.nestedTypes
(cherry picked from commit 650469024e)
2020-06-18 13:19:51 +03:00
Ilya Gorbunov
cdfb17bea8 Update public jvm API dump after introduction of javaType
See 9e37b62f62

(cherry picked from commit ec5a04a6c7)
2020-06-18 12:54:48 +03:00
Ilya Gorbunov
942173f3ee Fix OnlyInputType usage in tests where it can be invisible
(cherry picked from commit e13a38a758)
2020-06-18 12:54:48 +03:00
Ilya Gorbunov
463da96885 Do not place copyrights in stdlib api dump .kt files
(cherry picked from commit 95625d0fae)
2020-06-18 12:54:48 +03:00
Florian Kistner
4ccf107ba1 Don't apply copyright notice to Kotlin Ultimate
(cherry picked from commit 71a45e56d7)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
ae33b3c281 Shadow addSuppressed member with an extension
#KT-38777

(cherry picked from commit 41131e46d7)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
7a1b045fea Add SKIP_DCE_DRIVEN directive in JS-IR tests
Otherwise they fail with a compiler exception:
"An operation is not implemented: SAM conversion"

(cherry picked from commit 2fe222e8e7)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
9afbcb3f54 Make ReadOnlyProperty and PropertyDelegateProvider fun interfaces
(cherry picked from commit de6154980d)
2020-06-18 12:54:47 +03:00
Ilya Gorbunov
91b242d8a6 Make Comparator fun interface in Common and JS
(cherry picked from commit d2ea108123)
2020-06-18 12:54:47 +03:00
Igor Chevdar
c5768e2ad0 [IR] Supported extension receivers in SAM conversions 2020-06-18 13:30:53 +05:00
Dmitry Savvinov
17f852e4b4 Make sure that commonizer is enabled before adding -no-default-libs argument
^KT-39632 Fixed
2020-06-18 11:05:09 +03:00
Igor Chevdar
e601006043 Added a test 2020-06-18 12:51:02 +05:00
Igor Chevdar
8af22c9c35 [IR] Supported IrEnumEntry
Fixes https://youtrack.jetbrains.com/issue/KT-38996
2020-06-18 12:50:50 +05:00
Ilya Gorbunov
7fe7f5e50a Increase memory for Kotlin compile daemon to 2200M
(cherry picked from commit 388e619d90)
2020-06-18 09:07:42 +03:00
Ilya Gorbunov
84d27b4710 Advance bootstrap to 1.4-M3-eap-102 2020-06-18 09:07:42 +03:00
Stanislav Erokhin
d9a03db329 Revert "Add missing definitelyDoesNotContainName methods"
This reverts commit d324cd91
2020-06-18 07:50:31 +03:00
Vladimir Ilmov
68864eaf72 (CoroutineDebugger) -core jar has precedence over -debug
#KT-39412 fixed
 #KT-39648 fixed
2020-06-17 23:52:01 +02:00
Stanislav Erokhin
2fa26fefa0 Revert "NI: clear calls info in coroutine inference before the second analysis of += right side"
This reverts commit cd469bcaf5.
2020-06-17 20:20:02 +03:00
Alexander Udalov
3d3a9ad0b8 Use experimental javaType in full reflect where it's not supported yet
#KT-22936 Fixed
 #KT-34344 Fixed

(cherry picked from commit 117aae8a6b)
2020-06-17 18:34:42 +02:00
Alexander Udalov
0bd07c51db Support KType.javaType in stdlib
#KT-32241 Fixed

(cherry picked from commit 9e37b62f62)
2020-06-17 18:34:40 +02:00
Sergey Rostov
2c2f22cc90 gradle.kts standalone scripts: show actions inside single notification 2020-06-17 16:52:56 +03:00
Sergey Rostov
fbd3092bbb gradle.kts legacy: out of project script notification 2020-06-17 16:52:56 +03:00
Sergey Rostov
9f081cfeaa minor: rename GradleScriptNotificationProvider 2020-06-17 16:52:56 +03:00
Sergey Rostov
55747fb64f gradle.kts: check gradle version before loading from fs cache 2020-06-17 16:52:56 +03:00
Sergey Rostov
8cae8fcc10 default scripting support: remove notifications after script definitions update 2020-06-17 16:52:56 +03:00
Sergey Rostov
5a7ef83963 gradle.kts: update notification only after caches updated 2020-06-17 16:52:56 +03:00
Sergey Rostov
90f3ed5a1e GradleScriptConfigurationsImportingFeature 2020-06-17 16:52:56 +03:00
Sergey Rostov
65969b4018 gradle.kts postponed loading: hide notifaction right after click on action 2020-06-17 16:52:55 +03:00
Sergey Rostov
c88c8ae145 gradle.kts standalone scripts: load configuration after switching without prompt 2020-06-17 16:52:55 +03:00
Sergey Rostov
d14795139f gradle.kts, minor: cleanup & simplify code 2020-06-17 16:52:55 +03:00
Sergey Rostov
85e512faab gradle.kts legacy: don't start loading without prompt on first opening 2020-06-17 16:52:55 +03:00
Sergey Rostov
d3f5725e75 gradle.kts: update notifications when scripting support was changed 2020-06-17 16:52:55 +03:00
Sergey Rostov
efe47e8573 GradleBuildRootsManager: check gradle version change in gradle-wrapper.properties 2020-06-17 16:52:55 +03:00
Sergey Rostov
45c87dc15a scriptConfigurationsNeedToBeUpdatedBalloon registry key 2020-06-17 16:52:55 +03:00
Sergey Rostov
61c0261b94 GradleBuildRootsManager: update notifications in corner cases
- notification for all visible editors should be updates on each change,
since it may depend on last modified ts.
- notifications should be updated only for active editors, not all opened
- we should recheck it on editor activation too
- analyzer should be restarted on roots update only
2020-06-17 16:52:55 +03:00
Sergey Rostov
247453df3b GradleBuildRootsManager: implement getScriptFirstSeenTs 2020-06-17 16:52:54 +03:00
Sergey Rostov
c5661daa72 GradleScriptNotifications: suggest to import and link gradle project 2020-06-17 16:52:54 +03:00
Sergey Rostov
56c2495999 GradleScriptNotifications: extract and fix i18n strings 2020-06-17 16:52:54 +03:00
Sergey Rostov
e6d5fdc81f GradleBuildRootsManager: fix for autoload 2020-06-17 16:52:54 +03:00
Sergey Rostov
f7f4a7d532 GradleScriptNotifications: typo in code 2020-06-17 16:52:54 +03:00
Sergey Rostov
e9637abb24 GradleBuildRoot: ability to detect if file was existed before import 2020-06-17 16:52:54 +03:00
Sergey Rostov
d98e3a4d08 GradleBuildRootsManager, minor: fix notifications 2020-06-17 16:52:54 +03:00
Sergey Rostov
855ff3d4cd GradleBuildRoot: require LastModifiedFiles explicitly 2020-06-17 16:52:54 +03:00
Sergey Rostov
b39f184868 GradleBuildRoot: remove classes nesting 2020-06-17 16:52:53 +03:00
Sergey Rostov
133b4cbf1a gradle.kts: standalone scripts support (without ui and persistence) 2020-06-17 16:52:53 +03:00
Sergey Rostov
61ae186631 scripting: drop ManualConfigurationLoading and kotlin.gradle.scripts.useIdeaProjectImport registry flag 2020-06-17 16:52:53 +03:00
Sergey Rostov
38de675fef LastModifiedFiles: fix concurrency 2020-06-17 16:52:53 +03:00
Sergey Rostov
3393a222df GradleBuildRoot: std scripts under project roots should be treated as new 2020-06-17 16:52:53 +03:00
Sergey Rostov
74b3af0a2c GradleBuildRoot: add projects from settings
Fir the cases when they are missed absent in imported data
2020-06-17 16:52:53 +03:00
Sergey Rostov
3957be447a GradleBuildRoot: extract GradleBuildRootsLocator for testing 2020-06-17 16:52:53 +03:00
Ilya Chernikov
a37df6ec3f Fix SamWithReceiver tests for scripts, add tests...
that use new script definition and ability to load
annotations from script definition
2020-06-17 15:10:38 +02:00
Ilya Chernikov
bf40aaf596 Process compiler plugins and options in scripting compiler
#KT-37766 fixed
2020-06-17 15:10:37 +02:00
Ilya Chernikov
7088aabc6b [minor] Add serialization plugin to kotlin paths 2020-06-17 15:10:37 +02:00
Sergey Igushkin
19ddaf5089 VariantAwareDependenciesIT.kt: remove compile/runtime/... configurations
(cherry picked from commit e4e70f1b5b)
2020-06-17 13:40:58 +03:00
Sergey Igushkin
ea29eb9ec2 Fixup BuildCacheRelocationIT: Gradle 5.6.1 -> 5.6.4 (AGP requirement)
(cherry picked from commit 52b29b53bc)
2020-06-17 13:40:57 +03:00
Sergey Igushkin
14b3b3c7a3 Fix BuildCacheIT and BuildCacheRelocationIT
* Adjust the log checks for newer Gradle versions
* Use AGP 3.6.0 and Gradle 5.6.1 as the older version

(cherry picked from commit 603bae398f)
2020-06-17 13:40:56 +03:00
Sergey Igushkin
098921a249 Fix unused source sets missing in compilationsBySourceSets (KT-39304)
Issue #KT-39304 Fixed

(cherry picked from commit f7ed3139ab)
2020-06-17 13:40:48 +03:00
Vladimir Ilmov
4685c99cbd (CoroutineDebugger) fails to start in gradle mode
#KT-39634 fixed
2020-06-17 10:10:19 +02:00
Mikhail Glukhikh
168e1e00cf Add more detailed exception message in KtExpression.isUsedAsExpression
(cherry picked from commit d385a9b29e)
2020-06-17 10:51:16 +03:00
Ilya Chernikov
78d6ce2672 Add script definition for extension scripts and...
IDE consoles.
2020-06-17 09:33:26 +02:00
Victor Petukhov
af203f1a70 Use lexical scope from trace during checking suspend context if the analysis of engaged parent function isn't completed
^KT-39461 Fixed

(cherry picked from commit 901b794af3)
2020-06-17 10:30:23 +03:00
Victor Petukhov
cd469bcaf5 NI: clear calls info in coroutine inference before the second analysis of += right side
^KT-39376 Fixed

(cherry picked from commit 982cbf1148)
2020-06-17 10:30:17 +03:00
Dmitriy Dolovov
c818a33b29 IDE perf tests for K/N: Re-enable PerformanceNativeProjectsTest 2020-06-17 12:04:31 +07:00
Dmitriy Dolovov
da0c5a867c IDE perf tests for K/N: Add assertion on failed Gradle project import 2020-06-17 12:04:26 +07:00
Dmitriy Dolovov
24f8c14b8c IDE perf tests for K/N: Switch to 1.4-M2 2020-06-17 12:04:19 +07:00
Dmitriy Dolovov
9f07c0c568 [Commonizer] Fix incorrect merging KLIB dependencies
^KT-39609
2020-06-17 11:38:54 +07:00
Ilya Muradyan
5d5c83f26d Fix build error messages
(cherry picked from commit 9db9e2ad57)
2020-06-16 18:25:19 +02:00
Alexander Gorshenev
4cd3459bc3 Allow dynamic types in ir fake override substitution arguments 2020-06-16 18:59:03 +03:00
Ilya Goncharov
88817213ee [Gradle, JS] Rename generateKotlinExternals on generateExternals
(cherry picked from commit 6316949e36)

[Gradle, JS] In npm dependency extension use default generate value from properties

(cherry picked from commit eb6e797001)
2020-06-16 18:35:33 +03:00
Ilya Chernikov
c0cbe42165 Convert contributed descriptors to list...
without this `KDocCompletionTestGenerated,testExtensionsFQLink`, which
most likely point to some broken contract in the test.

(cherry picked from commit d7df249480)
2020-06-16 13:50:35 +02:00
Dmitriy Dolovov
7579d19fb4 [Commonizer] Fallback for const val properties with different values 2020-06-16 15:04:37 +07:00
Abduqodiri Qurbonzoda
433983cd00 Promote ArrayDeque and MutableList.removeFirst/LastOrNull to stable
(cherry picked from commit b93c49afae)
2020-06-16 04:16:10 +03:00
Ilya Gorbunov
62d508c024 Add run configuration for stdlib-js ApiTest
(cherry picked from commit d5ae06e7ed)
2020-06-16 00:42:30 +03:00
Ilya Gorbunov
654644519d Use fixed versions of node.js and npm packages in tests
(cherry picked from commit 05f9154bdd)
2020-06-16 00:42:30 +03:00
Ilya Gorbunov
b202b183fe Allow shadowing member addSuppressed with extension
#KT-38777

(cherry picked from commit 535534cf66)
2020-06-16 00:42:29 +03:00
Valeriy.Vyrva
9c869ef21b Create SortedMap with Comparator and items
KT-34142

(cherry picked from commit c023a02884)
2020-06-16 00:42:29 +03:00
Mikhail Bogdanov
d6b710edef Don't use labels for caching
Avoid new objects creation

(cherry picked from commit fe4bb24a3e)
2020-06-15 18:46:07 +02:00
Mikhail Bogdanov
25436a5ae2 Fix compilation with ASM 8
General rule to use linkedLabel or linkWithLabel
  when label from node is reused in other instructions.
  If label is not linked then it will point to another labelNode when visited

  #KT-39013 Fixed

(cherry picked from commit db50afeafe)
2020-06-15 18:46:02 +02:00
Dmitriy Dolovov
1ec64d23e1 [Commonizer] More precise approximation of callables 2020-06-15 16:14:21 +07:00
Dmitriy Dolovov
66770a3026 [Commonizer] Stats collector: support aggregated stats 2020-06-15 16:14:15 +07:00
Dmitriy Dolovov
3810278af2 [Commonizer] Update stats collector: report receivers & parameters 2020-06-15 16:14:08 +07:00
Dmitriy Dolovov
db83afe407 Minor. Rename excludes list 2020-06-15 16:13:25 +07:00
Anton Bannykh
7356a66ae0 JS stdlib api test: various changes
- Setting -Doverwrite.output=true updates gold data
- Big packages don't get split into chunks
- Unique lines in the API are marked with /*∆*/ and diff test is removed
- Annotations on separate lines and other dump format tweaks
- Test data moved to libraries/stdlib/api/
- Minor visibility fix to Enum members

(cherry picked from commit 04ab8943d6)
2020-06-15 11:51:41 +03:00
Igor Chevdar
a5972eb0cf Added a test on possible name clash for SAM wrappers 2020-06-15 12:49:27 +05:00
Igor Chevdar
20b6ec857a [IR] Improved tuning of SAM wrapper visibility 2020-06-15 12:49:15 +05:00
Lilia
4ec68832eb Add changelog for 1.4-M2 2020-06-12 14:14:49 +02:00
Ilmir Usmanov
386645d9ef Forbid val field initialization inside EXACLTY_ONCE lambda
unless the lambda is inline. This way, final field will remain final.
2020-06-12 05:53:37 +02:00
Konstantin Tskhovrebov
a52bde34aa Revert "Add tests for setup native run gutters."
This reverts commit d61e40e4

(cherry picked from commit 032d017c4f)
2020-06-11 17:29:52 +03:00
Nikolay Krasko
69bca4f0fe 202: Restrict compatibility for 201 plugin
(cherry picked from commit bc20464bad)
2020-06-11 16:01:31 +03:00
Nikolay Krasko
23bcd4b247 AS41: Fix problems with initialization of Android plugin in tests
org/intellij/images/fileTypes/ImageFileTypeManager
java.lang.NoClassDefFoundError: org/intellij/images/fileTypes/ImageFileTypeManager
	at org.jetbrains.android.AndroidPlugin.lambda$registerWebpSupport$1(AndroidPlugin.java:50)

(cherry picked from commit 6babc73320)
2020-06-11 16:01:31 +03:00
Nikolay Krasko
2343845ce7 202: Fix compilation in DefaultDiagnosticReporter
(cherry picked from commit 7190b3400f)
2020-06-11 16:01:30 +03:00
Nikita Bobko
133626fb1d 202: Fix compilation
(cherry picked from commit ff7576f8e4)
2020-06-11 16:01:30 +03:00
Nikita Bobko
045d502005 202: Fix compilation because of CoreJarVirtualFile
CoreJarVirtualFile is now package private. And seems that
most of VirtualFiles return system independent path

(cherry picked from commit eb67c4519d)
2020-06-11 16:01:30 +03:00
Nikolay Krasko
559612e5c0 202: Disable check for broken plugins in tests
Otherwise is is an exception in PluginManagerCore
because of brokenPlugins.txt file.

(cherry picked from commit 256bd8d594)
2020-06-11 16:01:30 +03:00
Nikolay Krasko
06c071c158 202: Add fastutil dependency to compiler for to make proguard work
(cherry picked from commit 143cad78bf)
2020-06-11 16:01:29 +03:00
Nikolay Krasko
999ed15719 202: Update dependencies
(cherry picked from commit cc709a2ef9)
2020-06-11 16:01:29 +03:00
Nikolay Krasko
702d7c3722 202: Update to the latest EAP
(cherry picked from commit 8485532856)
2020-06-11 16:01:29 +03:00
Ilya Chernikov
dac21d9fbc Optimize AllUnderImportScope 2020-06-11 13:21:54 +02:00
Ilya Chernikov
39bf821844 Optimize resolution scope queries from the synthetic scopes
now required descriptors are queried in advance and passed to the
methods, to avoid multiple same name queries in a row
2020-06-11 13:21:54 +02:00
Ilya Chernikov
268d42a2fd Optimize scopes handling inside ChainedMemberScope 2020-06-11 13:21:53 +02:00
Ilya Chernikov
85b823fba3 Optimize scopes handling inside LexicalChainedScope 2020-06-11 13:21:53 +02:00
Ilya Chernikov
0c2824f1cc Optimize data handling inside scopes 2020-06-11 13:21:53 +02:00
Ilya Chernikov
be8983ee34 Optimize LazyScopeAdapter internals 2020-06-11 13:21:53 +02:00
Ilya Muradyan
62b6c9a277 Fix importing scopes problem for scripting REPL
We don't need to add any importing scopes for a snippet if it doesn't
contain import directives. This fix optimizes performance by reducing
importing scopes count.
2020-06-11 13:21:53 +02:00
Ilya Muradyan
d324cd91c1 Add missing definitelyDoesNotContainName methods
Some implementations of definitelyDoesNotContainName method were
missing that led to performance problems during symbols resolution
using TowerResolver.

Relates to KT-39139.
2020-06-11 13:21:53 +02:00
Ilya Muradyan
e9d3faffec Add overload to comply with the contract
Method getVariableNames() should return all variable names, but in the
inherited implementation it doesn't return resX names which represent
result fields.
2020-06-11 13:21:53 +02:00
Ilya Muradyan
4843d998ea [minor] Fix typo in comment 2020-06-11 13:21:52 +02:00
Ilya Matveev
362ea857de Update K/N: 1.4-M3-eap-10 2020-06-11 11:02:38 +07:00
Ilya Chernikov
3689f76e22 [minor] Fix textdata after reapplying commit w\ CompilerMessageLocation
(cherry picked from commit 69d5635aae)
2020-06-10 17:20:34 +02:00
Mathias Quintero
0a19571d5d Add options param to external dependencies resolver API 2020-06-10 17:19:57 +02:00
Mathias Quintero
ec84ae6dfa Add API to get locations of collected script annotations
#KT-38404 fixed

also:
- Add wrapper class for the location combined with the location id
- Add source code location parameters to external dependency resolvers
- Add tests for locations in annotations
- Add tests for order of annotation resolution for dependencies resolvers
2020-06-10 17:19:56 +02:00
Konstantin Tskhovrebov
a00a85869c Add tests for setup native run gutters.
(cherry picked from commit d61e40e49b)
2020-06-10 16:01:18 +03:00
Konstantin Tskhovrebov
8ddc96778e Fix for 192: enable native run gutters only if gradle plugin exists.
Fixed #KT-39465

(cherry picked from commit 39e1f03cd1)
2020-06-10 16:01:16 +03:00
Ilya Goncharov
861e20267f [Gradle, JS] Fix name of publication in both mode
(cherry picked from commit 18914ac9a5)
2020-06-10 14:58:19 +03:00
Ilya Goncharov
c6316ddf77 [Gradle, JS] Fix isMain in js targets
(cherry picked from commit 60d62148e8)
2020-06-10 14:58:18 +03:00
Ilya Goncharov
e70e8fd10b [Gradle, JS] Remove Native Only isMainCompilation only
(cherry picked from commit b72f7c3021)
2020-06-10 14:58:16 +03:00
Ilya Goncharov
5df39478f6 [Gradle, JS] Use common isMain for KotlinCompilation
(cherry picked from commit 2d068a42f4)
2020-06-10 14:58:15 +03:00
Dmitriy Dolovov
245ce4b114 Minor. Remove unused code 2020-06-10 18:41:32 +07:00
Dmitriy Dolovov
a4ca2b8618 [Commonizer] Speed-up serialization of commonized member scopes 2020-06-10 18:15:59 +07:00
Ilya Goncharov
a85e4fbf0b [Gradle, JS] Fix error message for both executable 2020-06-10 11:23:51 +03:00
Alexander Udalov
e87abaee3b Minor, remove unneeded check in ClosureCodegen
Actually we do need to generate delegates to DefaultImpls even for Java
SAM wrappers, so this condition is incorrect. However, this never worked
properly anyway because of KT-12466.

(cherry picked from commit e3a23aed33)
2020-06-09 20:02:32 +02:00
Mikhail Zarechenskiy
1f9a5834c3 Delay check for possibly deferred return type for reference candidate
This issue appeared after recently added new overload for flatMapTo.
 Before that, we picked candidate returning List<T> and completed
 inference, now we also check one more flatMapTo, which is here is
 incorrect and as a result we go into outer scope. Outer scope contains
 one property with deferred type, which introduced error about
 "typechecker has run into recursive problem" even it isn't applicable
 by receiver.

 So, the fix is to check receiver first and only then check return
 type of a candidate.

 #KT-39470 Fixed
2020-06-09 17:52:42 +03:00
Konstantin Tskhovrebov
5ab46e9f6c Add test for check expect/actual gutters at same module.
(cherry picked from commit 21f7cd5d8f)
2020-06-09 17:00:53 +03:00
Konstantin Tskhovrebov
4d37e55fa7 Fix expect/actual gutters for declarations in the same module.
Fixed #KT-33510.

(cherry picked from commit a6161c6f22)
2020-06-09 17:00:52 +03:00
Alexander Udalov
0763a6d20b JVM IR: generate delegates to DefaultImpls for fun interfaces
(cherry picked from commit 6adad1055b)
2020-06-09 12:08:38 +02:00
Alexander Udalov
61ede55319 Generate delegates to DefaultImpls in fun interface wrappers
#KT-37436 Fixed

(cherry picked from commit fc1217ba07)
2020-06-09 12:08:36 +02:00
Alexander Udalov
f66ab1d1f9 JVM IR: generate InnerClasses attribute for nested classes in annotation arguments
#KT-38853

(cherry picked from commit 77e479fda8)
2020-06-09 11:41:28 +02:00
Alexander Udalov
eb24189adb Handle IllegalArgumentException in trimMargin intrinsics on JVM
#KT-38537 Fixed

(cherry picked from commit 2793187bda)
2020-06-09 11:20:40 +02:00
Dmitriy Novozhilov
6e73a708fe Enable ContractsOnCallsWithImplicitReceiver in 1.4
#KT-28672 Fixed
2020-06-09 11:22:16 +03:00
Dmitriy Dolovov
748fb7307c [Commonizer] Update stats collector to report lifted up declarations 2020-06-09 11:09:20 +07:00
Dmitriy Dolovov
2f2b9fec50 [Commonizer] Drop useless annotation tests
^KMM-238
^KMM-53
2020-06-09 11:09:15 +07:00
Dmitriy Dolovov
4602865376 [Commonizer] Refactor/simplify marker interfaces 2020-06-09 11:09:10 +07:00
Dmitriy Dolovov
b6be9bed04 [Commonizer] Drop useless "allowPrivate" flag in VisibilityCommonizer 2020-06-09 11:09:05 +07:00
Dmitriy Dolovov
4fe6ea243b [Commonizer] Source-based tests on lifting up identical type aliases
^KMM-55
2020-06-09 11:09:00 +07:00
Dmitriy Dolovov
2c4221d75b [Commonizer] Unit tests on lifting up identical type aliases
^KMM-55
2020-06-09 11:08:55 +07:00
Dmitriy Dolovov
3364b9f0ac [Commonizer] Lift up identical type aliases
^KMM-55
2020-06-09 11:08:50 +07:00
Dmitriy Dolovov
0ca7c542c9 [Commonizer] Process expect/actual cross-module dependencies in source-based tests 2020-06-09 11:08:44 +07:00
Dmitriy Dolovov
a7cf8b656c [Commonizer] Clean-up in AbstractCommonizationFromSourcesTest 2020-06-09 11:08:39 +07:00
Dmitriy Dolovov
fcbf587434 [Commonizer] Minor. Fixed typo 2020-06-09 11:08:34 +07:00
Dmitriy Dolovov
59130061c0 [Commonizer] Minor. Improve error reporting 2020-06-09 11:08:29 +07:00
Dmitriy Dolovov
01983eeee1 [Commonizer] Move fqNameWithTypeParameters extension val into CirType 2020-06-09 11:08:24 +07:00
Dmitriy Dolovov
610ea3d53f [Commonizer] Move some extension functions into CirFunctionOrProperty 2020-06-09 11:08:19 +07:00
Dmitriy Dolovov
9214ee454e [Commonizer] Simplify detection if property is lifted up 2020-06-09 11:08:13 +07:00
Alexander Gorshenev
e0e9518bb8 Fixing a bug with private accessors in IR fake override construction 2020-06-08 20:56:14 +03:00
Abduqodiri Qurbonzoda
e540cfd1a5 Deprecate old CharArray to String conversion api #KT-31343
(cherry picked from commit 6a2fed33d3)
2020-06-08 20:08:23 +03:00
Abduqodiri Qurbonzoda
a027df67c1 Promote scanReduce deprecation level to error
(cherry picked from commit 820353ee0e)
2020-06-08 20:08:20 +03:00
Abduqodiri Qurbonzoda
b860872df5 Promote randomOrNull, reduceOrNull, scan to stable
(cherry picked from commit 4e820edd1f)
2020-06-08 20:08:18 +03:00
Abduqodiri Qurbonzoda
b03970ba08 Remove experimental status from Array.associateWith
(cherry picked from commit 094dbf4c2d)
2020-06-08 20:08:15 +03:00
Abduqodiri Qurbonzoda
500414ae5a Promote String <-> utf8 and CharArray conversions to stable
(cherry picked from commit 46297645a4)
2020-06-08 20:08:13 +03:00
Abduqodiri Qurbonzoda
bd1dcb72e3 Promote KClass.cast/safeCast, KAnnotatedElement.hasAnnotation() to stable
(cherry picked from commit e3fb74b656)
2020-06-08 20:08:12 +03:00
Dmitry Petrov
7ca0547d1d Bootstrap: 1.4.20-dev-117 2020-06-08 15:36:55 +03:00
Konstantin Tskhovrebov
311df7bcb0 Hide commonizer import error message for unsupported kotlin plugin.
(cherry picked from commit c3802891fc)
2020-06-08 15:10:50 +03:00
Pavel Kirpichenkov
ae6e459015 Avoid persisting default anchor configuration
#KT-24309 In Progress
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
0e45def480 Update library to source analysis mode configuration
Persist analysis flag in the same xml where anchor mapping reside instead
of using properties. This makes it possible to save config in VCS.

#KT-24309 In Progress
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
7990399e0d Clean up API of AbstractResolverForProject
Resolution anchors are IDE-specific.
Creating dedicated methods for them in AbstractResolverForProject leads to meaningless
implementation in non-IDE resolvers. Now this method is implemented only
for IDE resolver and accessed through JvmPlatformParameters.

#KT-24309 In Progress
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
15bbac7e75 Optimize synchronization for resolution anchors
Use volatile state instead of synchronized access to it.
This should be enough as the component's state is only read
by the component users and never changed.
2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
5aa7adcd01 Add cancelation check when building anchor mappings 2020-06-08 11:31:51 +03:00
Pavel Kirpichenkov
123c3e4c78 Changes after review
- Replace leaking ModuleResolverTracker with use of ModuleDescriptor.Capabilies
- Provide API for retrieving ResolverForProject from ResolutionFacade
- Update names
2020-06-08 11:31:50 +03:00
Pavel Kirpichenkov
c2495dbe5f Introduce components for library-to-source resolution in IDE
#KT-24309 In progress
2020-06-08 11:31:50 +03:00
Mikhail Zarechenskiy
2d78aa2148 Update forgotten FIR test
(cherry picked from commit a086d9f7df)
2020-06-08 00:00:31 +03:00
Mikhail Zarechenskiy
bc34d69d56 Don't apply Unit-conversion for expressions that return Nothing type
(cherry picked from commit 22b558110d)
2020-06-08 00:00:28 +03:00
Mikhail Zarechenskiy
b74e24b819 Don't allow coercing receivers from signed to unsigned constants
(cherry picked from commit e72401c5f4)
2020-06-08 00:00:25 +03:00
Mikhail Zarechenskiy
47e76c260b Introduce call checker for Unit-conversions
(cherry picked from commit bfa648972f)
2020-06-08 00:00:22 +03:00
Mikhail Zarechenskiy
441e86e892 Allow suspend-conversion for callable references as part of adaptation
(cherry picked from commit 6b0a803d14)
2020-06-08 00:00:19 +03:00
Mikhail Zarechenskiy
14cd518aa9 Fix chained conversions for subtypes of functional types
(cherry picked from commit 6b58be377e)
2020-06-08 00:00:16 +03:00
Mikhail Zarechenskiy
74b35939fa Introduce Unit-conversions for simple arguments
(cherry picked from commit 71cbe97688)
2020-06-08 00:00:13 +03:00
Mikhail Zarechenskiy
8d91ce5774 Refactoring: rename files to avoid "util" suffixes
(cherry picked from commit f08a45f2d4)
2020-06-08 00:00:09 +03:00
Mikhail Zarechenskiy
dc2440185b Narrow down the range for compatibility warning to callee expression
(cherry picked from commit a4af833d55)
2020-06-08 00:00:07 +03:00
Mikhail Zarechenskiy
2262f0a4ef Refactoring: rename method to make it more specific
(cherry picked from commit 4bd622c1c5)
2020-06-08 00:00:04 +03:00
Mikhail Zarechenskiy
65b282bada Compatibility warning for references to companion via name (KT-13934)
(cherry picked from commit 718f23b34f)
2020-06-08 00:00:00 +03:00
Anton Bannykh
a62fbd7fa1 JS: fix explicit cross-module SAM constructor calls
(cherry picked from commit bd2a0563ad)
2020-06-06 17:48:45 +03:00
Anton Bannykh
d08260d60c Add stdlib API test + remove some extra IR stdlib API's
(cherry picked from commit a18bfad53a)
2020-06-06 17:48:45 +03:00
Ilya Muradyan
56cf876cb8 Add info about the end of range in scripting REPL compiler messages 2020-06-05 22:05:01 +02:00
Ilya Chernikov
61f8953bd3 Extract interface from CompilerMessageLocation to ease extension
The CompilerMessageLocation is an implicit part of the binary daemon
protocol so changing it breaks compatibility with older daemons.
This change allows to extend location for non-daemon uses without
breaking the binary protocol.
2020-06-05 22:05:00 +02:00
Ilya Kirillov
b185884005 Wizard: use cache redirector on project importing tests
(cherry picked from commit 8a4521864e)
2020-06-05 13:04:23 +03:00
Ilya Kirillov
eba09719d2 Wizard: download latest dev version for tests from bintray
(cherry picked from commit cce5a9a1ca)
2020-06-05 13:04:22 +03:00
Dmitry Petrov
70e928f4d9 Fix stdlib compilation after updated @JvmName check
Previously, extension receiver type was not taken into account when
checking for @JvmName annotation applicability to possibly mangled
functions (such functions, however, were mangled).
This bug was fixed, but, unfortunately, not before such functions were
added to stdlib ('sumOf' family).
2020-06-05 10:43:52 +03:00
Dmitry Petrov
7029e78ca2 Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.

(cherry picked from commit 202bbdf8dd)
2020-06-05 10:38:49 +03:00
Roman Artemev
a394de00c5 [JS IR] Greenify failing (in 1.4.0 branch) tests 2020-06-04 16:53:20 +03:00
Roman Artemev
d29251f507 [PLUGIN API] Implement custom linkage for plugin extensions
(cherry picked from commit 5eae262264)
2020-06-04 15:32:49 +03:00
Roman Artemev
e61f5956cb [PLUGIN API] Add extension point to customize linkage process
(cherry picked from commit a401374ed4)
2020-06-04 15:32:48 +03:00
Roman Artemev
740bbaeb8c [IR] Move IrProvider and 'IrDeserializer' into separate package
(cherry picked from commit f9c2c846f7)
2020-06-04 15:32:48 +03:00
Alexander Udalov
6851607a04 JVM IR: do not generate DefaultImpls delegate for collection fake overrides
In the newly added test, prior to this change, JVM IR was generating
DefaultImpls classes with calls to things like
`kotlin/collections/MutableList$DefaultImpls.spliterator` and other
default methods present in JDK 8+. This obviously didn't make much
sense. Although these weren't explicitly mentioned anywhere in the
bytecode, they caused some validation tools to report errors (e.g.
animalsniffer used in arrow).

(cherry picked from commit 5647a935a2)
2020-06-04 14:28:07 +02:00
Ilya Goncharov
5b5684cd5d [Gradle, JS] Fix test after changing type of IR link task on mode
(cherry picked from commit 74e4a817cb)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
a6a9427757 [Gradle, JS] Webpack on file providers for task configuration avoidance
(cherry picked from commit 426f164e02)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
52dace2970 [Gradle, JS] Make destinationDir as var
(cherry picked from commit 01f3e4b083)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
3716d2c4e7 [Gradle, JS] Use RegularFile to not explicit dependsOn
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit 402dfd5da7)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
4f96393f14 [Gradle, JS] Add dependency on dce task
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit e27bd04ba2)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
6995eb87df [Gradle, JS] JsBinaryType to KotlinJsBinaryType
(cherry picked from commit d3260bca27)
2020-06-04 11:07:06 +03:00
Ilya Goncharov
f94653fd49 [Gradle, JS] KotlinJsType to KotlinJsMode
(cherry picked from commit d27ad99daa)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
007b3d97d6 [Gradle, JS] Move common part of webpack configuration to separate fun
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit a5e46568ee)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
b8918eab5d [Gradle, JS] Add resolveFromModulesFirst to build tasks
(cherry picked from commit ef63d6f84c)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
aaa2747a4e [Gradle, JS] Use property for webpack entry
(cherry picked from commit d4d8495840)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
5c40432b4e [Gradle, JS] Add dce to development
^KT-32273 fixed
^KT-36451 fixed
^KT-37258 fixed

(cherry picked from commit 65db6bb2a5)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
6fe1c56c32 [Gradle, JS] Use API form Gradle 5.0
(cherry picked from commit 9d8eb65a5e)
2020-06-04 11:07:05 +03:00
Ilya Goncharov
130eeff06e [Gradle, JS] Add index.html to Kotlin DSL wizard
^KT-39275 fixed

(cherry picked from commit bd194686df)
2020-06-04 11:06:45 +03:00
Ilya Goncharov
385498aa78 [Gradle, JS] Fix grammar in methods for JS import
(cherry picked from commit 890da492fb)
2020-06-04 11:05:59 +03:00
Ilya Goncharov
6ec97cc85f [Gradle, JS] Fix grammar on comment
(cherry picked from commit bc4d7e0020)
2020-06-04 11:05:59 +03:00
Mikhail Bogdanov
328db2f0bf Remove compatibility hack
(cherry picked from commit 4f8ad6bdcb)
2020-06-04 08:03:22 +02:00
Vyacheslav Gerasimov
357203fb11 Build: Remove identifying info from build scans 2020-06-03 19:33:25 +03:00
Henrik Tunedal
f8693209ab Use system-specific user cache directory in main-kts
#KT-38222 fixed
2020-06-03 11:18:33 +02:00
Henrik Tunedal
1e9ee7014b Improve hashing of script files 2020-06-03 11:18:33 +02:00
2129 changed files with 99931 additions and 31031 deletions

1
.gitignore vendored
View File

@@ -58,5 +58,4 @@ kotlin-ultimate/
node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
libraries/tools/kotlin-source-map-loader/lib/
local.properties

View File

@@ -13,6 +13,21 @@
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>

View File

@@ -0,0 +1,21 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.js.test.ApiTest&quot; -Poverwrite.output=true" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":js:js.tests:test" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>

View File

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

11102
ChangeLog.md

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.compilerRunner
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
@@ -25,7 +25,7 @@ class MessageCollectorToOutputItemsCollectorAdapter(
private val delegate: MessageCollector,
private val outputCollector: OutputItemsCollector
) : MessageCollector by delegate {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
// TODO: consider adding some other way of passing input -> output mapping from compiler, e.g. dedicated service
OutputMessageUtil.parseOutputMessage(message)?.let {
outputCollector.add(it.sourceFiles, it.outputFile)

View File

@@ -187,7 +187,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.4-M3-dev-15627"
extra["versions.kotlin-native"] = "1.4"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
@@ -200,7 +200,11 @@ extra["intellijSeparateSdks"] = intellijSeparateSdks
extra["IntellijCoreDependencies"] =
listOf(
if (Platform[191].orHigher()) "asm-all-7.0.1" else "asm-all",
when {
Platform[202].orHigher() -> "asm-all-8.0.1"
Platform[191].orHigher() -> "asm-all-7.0.1"
else -> "asm-all"
},
"guava",
"jdom",
"jna",

View File

@@ -105,7 +105,7 @@ dependencies {
implementation("com.github.jengelman.gradle.plugins:shadow:${rootProject.extra["versions.shadow"]}")
implementation("net.sf.proguard:proguard-gradle:6.2.2")
implementation("org.jetbrains.intellij.deps:asm-all:7.0.1")
implementation("org.jetbrains.intellij.deps:asm-all:8.0.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
}

View File

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

View File

@@ -46,6 +46,7 @@ open class PublishedKotlinModule : Plugin<Project> {
configure<SigningExtension> {
isRequired = signingRequired
sign(configurations["archives"])
useGpgCmd()
}
tasks.named<Sign>("signArchives").configure {

View File

@@ -108,6 +108,10 @@ fun Project.projectTest(
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
if (Platform[202].orHigher()) {
systemProperty("idea.ignore.disabled.plugins", "true")
}
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<Any?, *>

View File

@@ -29,7 +29,13 @@ dependencies {
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", "groovy-all", rootProject = rootProject) }
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", rootProject = rootProject) }
Platform[202].orHigher {
testCompile(intellijDep()) { includeJars("groovy", rootProject = rootProject) }
}
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
Platform[191].orLower {
testCompile(intellijDep()) { includeJars("jps-builders") }
}

View File

@@ -294,7 +294,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
val keyConfiguration = CompilerConfiguration()
CodegenTestCase.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val compiler = if (isJvm8Target) {
@@ -303,7 +303,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
println("Creating new configuration by $key")
CodegenTestCase.updateConfigurationByDirectivesInTestFiles(testFiles, this)
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
}

View File

@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.backend.common
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.backend.common.bridges.findInterfaceImplementation
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
@@ -24,6 +23,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.util.getExceptionMessage
import org.jetbrains.kotlin.util.getNonPrivateTraitMembersForDelegation
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments
@@ -55,14 +55,8 @@ object CodegenUtil {
@JvmOverloads
fun getNonPrivateTraitMethods(descriptor: ClassDescriptor, copy: Boolean = true): Map<FunctionDescriptor, FunctionDescriptor> {
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
for (declaration in DescriptorUtils.getAllDescriptors(descriptor.defaultType.memberScope)) {
if (declaration !is CallableMemberDescriptor) continue
val traitMember = findInterfaceImplementation(declaration)
if (traitMember == null ||
Visibilities.isPrivate(traitMember.visibility) ||
traitMember.visibility == Visibilities.INVISIBLE_FAKE) continue
for ((declaration, traitMember) in getNonPrivateTraitMembersForDelegation(descriptor)) {
assert(traitMember.modality !== Modality.ABSTRACT) { "Cannot delegate to abstract trait method: $declaration" }
// inheritedMember can be abstract here. In order for FunctionCodegen to generate the method body, we're creating a copy here
@@ -93,20 +87,18 @@ object CodegenUtil {
private fun mapMembers(
inherited: CallableMemberDescriptor,
traitMember: CallableMemberDescriptor
): LinkedHashMap<FunctionDescriptor, FunctionDescriptor> {
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
if (traitMember is SimpleFunctionDescriptor) {
result[traitMember] = inherited as FunctionDescriptor
} else if (traitMember is PropertyDescriptor) {
): Map<FunctionDescriptor, FunctionDescriptor> = when (traitMember) {
is SimpleFunctionDescriptor -> mapOf(traitMember to inherited as FunctionDescriptor)
is PropertyDescriptor -> linkedMapOf<FunctionDescriptor, FunctionDescriptor>().also { result ->
for (traitAccessor in traitMember.accessors) {
for (inheritedAccessor in (inherited as PropertyDescriptor).accessors) {
if (inheritedAccessor::class.java == traitAccessor::class.java) { // same accessor kind
result.put(traitAccessor, inheritedAccessor)
if ((inheritedAccessor is PropertyGetterDescriptor) == (traitAccessor is PropertyGetterDescriptor)) {
result[traitAccessor] = inheritedAccessor
}
}
}
}
return result
else -> error("Unexpected member: $inherited")
}
@JvmStatic

View File

@@ -24,6 +24,8 @@ import org.jetbrains.kotlin.resolve.OverridingUtil
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
import org.jetbrains.kotlin.resolve.descriptorUtil.isTypeRefinementEnabled
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.util.findImplementationFromInterface
import org.jetbrains.kotlin.util.findInterfaceImplementation
fun <Signature> generateBridgesForFunctionDescriptor(
descriptor: FunctionDescriptor,
@@ -81,60 +83,4 @@ open class DescriptorBasedFunctionHandle(val descriptor: FunctionDescriptor) : F
override fun toString(): String {
return descriptor.toString()
}
}
/**
* Given a fake override in a class, returns an overridden declaration with implementation in trait, such that a method delegating to that
* trait implementation should be generated into the class containing the fake override; or null if the given function is not a fake
* override of any trait implementation or such method was already generated into the superclass or is a method from Any.
*/
fun findInterfaceImplementation(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
if (descriptor.kind.isReal) return null
if (isOrOverridesSynthesized(descriptor)) return null
val implementation = findImplementationFromInterface(descriptor) ?: return null
val immediateConcreteSuper = firstSuperMethodFromKotlin(descriptor, implementation) ?: return null
if (!DescriptorUtils.isInterface(immediateConcreteSuper.containingDeclaration)) {
// If this implementation is already generated into the superclass, we need not generate it again, it'll be inherited
return null
}
return immediateConcreteSuper
}
/**
* Given a fake override, returns an overridden non-abstract function from an interface which is the actual implementation of this function
* that should be called when the given fake override is called.
*/
fun findImplementationFromInterface(descriptor: CallableMemberDescriptor): CallableMemberDescriptor? {
val overridden = OverridingUtil.getOverriddenDeclarations(descriptor)
val filtered = OverridingUtil.filterOutOverridden(overridden)
val result = filtered.firstOrNull { it.modality != Modality.ABSTRACT } ?: return null
if (DescriptorUtils.isClassOrEnumClass(result.containingDeclaration)) return null
return result
}
/**
* Given a fake override and its implementation (non-abstract declaration) somewhere in supertypes,
* returns the first immediate super function of the given fake override which overrides that implementation.
* The returned function should be called from TImpl-bridges generated for the given fake override.
*/
fun firstSuperMethodFromKotlin(
descriptor: CallableMemberDescriptor,
implementation: CallableMemberDescriptor
): CallableMemberDescriptor? {
return descriptor.overriddenDescriptors.firstOrNull { overridden ->
overridden.modality != Modality.ABSTRACT &&
(overridden == implementation || OverridingUtil.overrides(
overridden,
implementation,
overridden.module.isTypeRefinementEnabled(),
true
))
}
}
}

View File

@@ -105,6 +105,15 @@ public abstract class AnnotationCodegen {
@Nullable Annotated annotated,
@Nullable Type returnType,
@Nullable KotlinType typeForTypeAnnotations
) {
genAnnotations(annotated, returnType, typeForTypeAnnotations, null);
}
public void genAnnotations(
@Nullable Annotated annotated,
@Nullable Type returnType,
@Nullable KotlinType typeForTypeAnnotations,
@Nullable DeclarationDescriptorWithVisibility parameterContainer
) {
if (annotated == null) return;
@@ -139,22 +148,23 @@ public abstract class AnnotationCodegen {
}
}
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent);
generateAdditionalAnnotations(annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
generateTypeAnnotations(annotated, typeForTypeAnnotations);
}
private void generateAdditionalAnnotations(
@NotNull Annotated annotated,
@Nullable Type returnType,
@NotNull Set<String> annotationDescriptorsAlreadyPresent
@NotNull Set<String> annotationDescriptorsAlreadyPresent,
@Nullable DeclarationDescriptorWithVisibility parameterContainer
) {
if (annotated instanceof CallableDescriptor) {
generateAdditionalCallableAnnotations((CallableDescriptor) annotated, returnType, annotationDescriptorsAlreadyPresent);
generateAdditionalCallableAnnotations((CallableDescriptor) annotated, returnType, annotationDescriptorsAlreadyPresent, parameterContainer);
}
else if (annotated instanceof FieldDescriptor) {
generateAdditionalCallableAnnotations(
((FieldDescriptor) annotated).getCorrespondingProperty(), returnType, annotationDescriptorsAlreadyPresent
);
((FieldDescriptor) annotated).getCorrespondingProperty(), returnType, annotationDescriptorsAlreadyPresent,
parameterContainer);
}
else if (annotated instanceof ClassDescriptor) {
generateAdditionalClassAnnotations(annotationDescriptorsAlreadyPresent, (ClassDescriptor) annotated);
@@ -164,11 +174,15 @@ public abstract class AnnotationCodegen {
private void generateAdditionalCallableAnnotations(
@NotNull CallableDescriptor descriptor,
@Nullable Type returnType,
@NotNull Set<String> annotationDescriptorsAlreadyPresent
@NotNull Set<String> annotationDescriptorsAlreadyPresent,
@Nullable DeclarationDescriptorWithVisibility parameterContainer
) {
// No need to annotate privates, synthetic accessors and their parameters
if (isInvisibleFromTheOutside(descriptor)) return;
if (descriptor instanceof ValueParameterDescriptor && isInvisibleFromTheOutside(descriptor.getContainingDeclaration())) return;
if (descriptor instanceof ParameterDescriptor &&
isInvisibleFromTheOutside(parameterContainer != null ? parameterContainer : descriptor.getContainingDeclaration())) {
return;
}
// No need to annotate annotation methods since they're always non-null
if (descriptor instanceof PropertyGetterDescriptor &&

View File

@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.backend.common.bridges.ImplKt;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.psi.synthetics.SyntheticClassOrObjectDescriptor;
@@ -38,6 +39,8 @@ import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedS
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind.CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL;
import static org.jetbrains.kotlin.util.DeclarationUtilKt.findImplementationFromInterface;
import static org.jetbrains.kotlin.util.DeclarationUtilKt.findInterfaceImplementation;
public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject> {
@NotNull
@@ -124,7 +127,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
for (DeclarationDescriptor memberDescriptor : DescriptorUtils.getAllDescriptors(descriptor.getDefaultType().getMemberScope())) {
if (memberDescriptor instanceof CallableMemberDescriptor) {
CallableMemberDescriptor member = (CallableMemberDescriptor) memberDescriptor;
if (!member.getKind().isReal() && ImplKt.findInterfaceImplementation(member) == null) {
if (!member.getKind().isReal() && findInterfaceImplementation(member) == null) {
if (member instanceof FunctionDescriptor) {
functionCodegen.generateBridges((FunctionDescriptor) member);
}
@@ -219,21 +222,32 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
protected void generateDelegatesToDefaultImpl() {
if (isJvmInterface(descriptor)) return;
boolean isErasedInlineClass = InlineClassesUtilsKt.isInlineClass(descriptor) && kind == OwnerKind.ERASED_INLINE_CLASS;
JvmKotlinType receiverType = new JvmKotlinType(typeMapper.mapType(descriptor), descriptor.getDefaultType());
for (Map.Entry<FunctionDescriptor, FunctionDescriptor> entry : CodegenUtil.getNonPrivateTraitMethods(descriptor).entrySet()) {
FunctionDescriptor interfaceFun = entry.getKey();
//skip java 8 default methods
if (!CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(interfaceFun) &&
!JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefault(
DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(interfaceFun), state.getJvmDefaultMode()
)
) {
generateDelegationToDefaultImpl(interfaceFun, entry.getValue());
}
generateDelegationToDefaultImpl(entry.getKey(), entry.getValue(), receiverType, functionCodegen, state, isErasedInlineClass);
}
}
private void generateDelegationToDefaultImpl(@NotNull FunctionDescriptor interfaceFun, @NotNull FunctionDescriptor inheritedFun) {
public static void generateDelegationToDefaultImpl(
@NotNull FunctionDescriptor interfaceFun,
@NotNull FunctionDescriptor inheritedFun,
@NotNull JvmKotlinType receiverType,
@NotNull FunctionCodegen functionCodegen,
@NotNull GenerationState state,
boolean isErasedInlineClass
) {
CallableMemberDescriptor actualImplementation =
interfaceFun.getKind().isReal() ? interfaceFun : findImplementationFromInterface(interfaceFun);
assert actualImplementation != null : "Can't find actual implementation for " + interfaceFun;
// Skip Java 8 default methods
if (CodegenUtilKt.isDefinitelyNotDefaultImplsMethod(actualImplementation) ||
JvmAnnotationUtilKt.isCallableMemberCompiledToJvmDefault(actualImplementation, state.getJvmDefaultMode())) {
return;
}
KotlinTypeMapper typeMapper = state.getTypeMapper();
functionCodegen.generateMethod(
new JvmDeclarationOrigin(
CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL, descriptorToDeclaration(interfaceFun), interfaceFun, null
@@ -248,7 +262,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
DeclarationDescriptor declarationInheritedFun = inheritedFun.getContainingDeclaration();
PsiElement classForInheritedFun = descriptorToDeclaration(declarationInheritedFun);
if (classForInheritedFun instanceof KtDeclaration) {
codegen.markLineNumber((KtElement) classForInheritedFun, false);
codegen.markLineNumber(classForInheritedFun, false);
}
ClassDescriptor containingTrait = (ClassDescriptor) containingDeclaration;
@@ -282,18 +296,15 @@ public abstract class ClassBodyCodegen extends MemberCodegen<KtPureClassOrObject
InstructionAdapter iv = codegen.v;
Type[] myArgTypes = signature.getAsmMethod().getArgumentTypes();
Type[] toArgTypes = defaultImplsMethod.getArgumentTypes();
boolean isErasedInlineClass =
InlineClassesUtilsKt.isInlineClass(descriptor) && kind == OwnerKind.ERASED_INLINE_CLASS;
int myArgI = 0;
int argVar = 0;
Type receiverType = typeMapper.mapType(descriptor);
KotlinType interfaceKotlinType = ((ClassDescriptor) inheritedFun.getContainingDeclaration()).getDefaultType();
StackValue.local(argVar, receiverType, descriptor.getDefaultType())
StackValue.local(argVar, receiverType.getType(), receiverType.getKotlinType())
.put(OBJECT_TYPE, interfaceKotlinType, iv);
if (isErasedInlineClass) myArgI++;
argVar += receiverType.getSize();
argVar += receiverType.getType().getSize();
int toArgI = 1;

View File

@@ -185,6 +185,12 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
generateBridges();
generateClosureBody();
if (samType != null) {
SamWrapperCodegen.generateDelegatesToDefaultImpl(
asmType, classDescriptor, samType.getClassDescriptor(), functionCodegen, state
);
}
this.constructor = generateConstructor();
if (isConst(closure)) {

View File

@@ -1585,7 +1585,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
assert topOfStack == tryWithFinallyBlockStackElement : "Top element of stack doesn't equals processing finally block";
KtTryExpression jetTryExpression = tryWithFinallyBlockStackElement.expression;
Label finallyStart = new Label();
Label finallyStart = linkedLabel();
v.mark(finallyStart);
tryWithFinallyBlockStackElement.addGapLabel(finallyStart);
addGapLabelsForNestedTryCatchWithoutFinally(state, nestedTryBlocksWithoutFinally, finallyStart);
@@ -2835,7 +2835,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
KotlinType approximatedType =
CapturedTypeConstructorKt.isCaptured(type) ?
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
(KotlinType) approximator.approximateToSuperType(
type, TypeApproximatorConfiguration.InternalTypesApproximation.INSTANCE
) : null;

View File

@@ -70,7 +70,6 @@ import java.io.StringWriter;
import java.util.*;
import java.util.stream.Collectors;
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isNullableAny;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.generateBridgeForMainFunctionIfNecessary;
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION;
@@ -493,11 +492,11 @@ public class FunctionCodegen {
@NotNull FunctionDescriptor functionDescriptor,
@NotNull MethodVisitor mv,
@NotNull JvmMethodSignature jvmSignature,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull MemberCodegen<?> memberCodegen,
@NotNull GenerationState state
) {
generateParameterAnnotations(
functionDescriptor, mv, jvmSignature, functionDescriptor.getValueParameters(), innerClassConsumer, state
functionDescriptor, mv, jvmSignature, functionDescriptor.getValueParameters(), memberCodegen, state
);
}
@@ -506,7 +505,7 @@ public class FunctionCodegen {
@NotNull MethodVisitor mv,
@NotNull JvmMethodSignature jvmSignature,
@NotNull List<ValueParameterDescriptor> valueParameters,
@NotNull InnerClassConsumer innerClassConsumer,
@NotNull MemberCodegen<?> memberCodegen,
@NotNull GenerationState state
) {
if (isAccessor(functionDescriptor)) return;
@@ -517,6 +516,7 @@ public class FunctionCodegen {
Asm7UtilKt.visitAnnotableParameterCount(mv, kotlinParameterTypes.size() - syntheticParameterCount);
boolean isDefaultImpl = OwnerKind.DEFAULT_IMPLS == memberCodegen.context.getContextKind();
for (int i = 0; i < kotlinParameterTypes.size(); i++) {
JvmMethodParameterSignature parameterSignature = kotlinParameterTypes.get(i);
JvmMethodParameterKind kind = parameterSignature.getKind();
@@ -529,13 +529,14 @@ public class FunctionCodegen {
? iterator.next()
: kind == JvmMethodParameterKind.RECEIVER
? JvmCodegenUtil.getDirectMember(functionDescriptor).getExtensionReceiverParameter()
: null;
: isDefaultImpl && kind == JvmMethodParameterKind.THIS ? JvmCodegenUtil.getDirectMember(functionDescriptor)
.getDispatchReceiverParameter() : null;
if (annotated != null) {
//noinspection ConstantConditions
int parameterIndex = i - syntheticParameterCount;
AnnotationCodegen.forParameter(parameterIndex, mv, innerClassConsumer, state)
.genAnnotations(annotated, parameterSignature.getAsmType(), annotated.getReturnType());
AnnotationCodegen.forParameter(parameterIndex, mv, memberCodegen, state)
.genAnnotations(annotated, parameterSignature.getAsmType(), annotated.getReturnType(), functionDescriptor);
}
}
}
@@ -607,7 +608,7 @@ public class FunctionCodegen {
true, mv,
method.getAsmMethod(),
method.getOwner().getInternalName(),
true);
true, signature.getReturnType());
methodEnd = new Label();
}
else {
@@ -711,8 +712,7 @@ public class FunctionCodegen {
@NotNull JvmDefaultMode jvmDefaultMode
) {
return OwnerKind.DEFAULT_IMPLS == context.getContextKind() &&
JvmAnnotationUtilKt
.isCompiledToJvmDefault(DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(functionDescriptor),
JvmAnnotationUtilKt.isCompiledToJvmDefault(DescriptorUtils.unwrapFakeOverrideToAnyDeclaration(functionDescriptor),
jvmDefaultMode) &&
jvmDefaultMode.isCompatibility();
}
@@ -850,7 +850,8 @@ public class FunctionCodegen {
@NotNull Method asmMethod,
@NotNull String classToDelegateTo,
int opcode,
boolean isInterface
boolean isInterface,
@NotNull Type returnType
) {
InstructionAdapter iv = new InstructionAdapter(mv);
Type[] argTypes = asmMethod.getArgumentTypes();
@@ -872,7 +873,8 @@ public class FunctionCodegen {
paramIndex += argType.getSize();
}
iv.visitMethodInsn(opcode, classToDelegateTo, asmMethod.getName(), asmMethod.getDescriptor(), isInterface);
iv.areturn(asmMethod.getReturnType());
StackValue.onStack(asmMethod.getReturnType()).coerceTo(returnType, null, iv);
iv.areturn(returnType);
}
private static void generateDelegateToStaticErasedVersion(
@@ -911,7 +913,19 @@ public class FunctionCodegen {
@NotNull String classToDelegateTo,
boolean isInterfaceMethodCall
) {
generateDelegateToMethodBody(isStatic ? 0 : 1, mv, asmMethod, classToDelegateTo, Opcodes.INVOKESTATIC, isInterfaceMethodCall);
generateDelegateToStaticMethodBody(isStatic, mv, asmMethod, classToDelegateTo, isInterfaceMethodCall, asmMethod.getReturnType());
}
private static void generateDelegateToStaticMethodBody(
boolean isStatic,
@NotNull MethodVisitor mv,
@NotNull Method asmMethod,
@NotNull String classToDelegateTo,
boolean isInterfaceMethodCall,
@NotNull Type returnType
) {
generateDelegateToMethodBody(isStatic ? 0 : 1, mv, asmMethod, classToDelegateTo, Opcodes.INVOKESTATIC, isInterfaceMethodCall, returnType);
}
private static boolean needIndexForVar(JvmMethodParameterKind kind) {
@@ -1064,18 +1078,6 @@ public class FunctionCodegen {
);
}
public static boolean isMethodOfAny(@NotNull FunctionDescriptor descriptor) {
String name = descriptor.getName().asString();
List<ValueParameterDescriptor> parameters = descriptor.getValueParameters();
if (parameters.isEmpty()) {
return name.equals("hashCode") || name.equals("toString");
}
else if (parameters.size() == 1 && name.equals("equals")) {
return isNullableAny(parameters.get(0).getType());
}
return false;
}
@NotNull
public static String[] getThrownExceptions(@NotNull FunctionDescriptor function, @NotNull KotlinTypeMapper typeMapper) {
return ArrayUtil.toStringArray(CollectionsKt.map(
@@ -1669,7 +1671,9 @@ public class FunctionCodegen {
if (JvmAnnotationUtilKt.isCompiledToJvmDefault(memberDescriptor, mode)) {
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
(kind == OwnerKind.DEFAULT_IMPLS && (isSynthetic || mode.isCompatibility()));
(kind == OwnerKind.DEFAULT_IMPLS &&
(isSynthetic || //TODO: move synthetic method generation into interface
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
} else {
switch (kind) {
case DEFAULT_IMPLS: return true;

View File

@@ -17,8 +17,7 @@
package org.jetbrains.kotlin.codegen
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.backend.common.bridges.findImplementationFromInterface
import org.jetbrains.kotlin.backend.common.bridges.firstSuperMethodFromKotlin
import org.jetbrains.kotlin.util.findImplementationFromInterface
import org.jetbrains.kotlin.codegen.context.ClassContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.JvmMethodExceptionTypes
@@ -29,6 +28,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKind
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.kotlin.util.firstSuperMethodFromKotlin
import org.jetbrains.org.objectweb.asm.MethodVisitor
import org.jetbrains.org.objectweb.asm.Opcodes.*

View File

@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.load.java.descriptors.JavaForKotlinOverridePropertyD
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.jvm.annotations.isCompiledToJvmDefault
import org.jetbrains.kotlin.resolve.jvm.annotations.hasPlatformDependentAnnotation
import org.jetbrains.kotlin.util.findImplementationFromInterface
import org.jetbrains.kotlin.util.findInterfaceImplementation
class DescriptorBasedFunctionHandleForJvm(
descriptor: FunctionDescriptor,

View File

@@ -422,14 +422,6 @@ public class PropertyCodegen {
}
modifiers |= getVisibilityForBackingField(propertyDescriptor, isDelegate);
// If val is initialized in EXACTLY_ONCE closure, other class from the same package initializes it
// so, its visibility should be package private and not final
if (!propertyDescriptor.isVar() &&
bindingContext.get(BindingContext.FIELD_CAPTURED_IN_EXACLY_ONCE_CLOSURE, propertyDescriptor) != null
) {
modifiers &= ~(ACC_PRIVATE | ACC_FINAL);
}
if (AsmUtil.isPropertyWithBackingFieldCopyInOuterClass(propertyDescriptor)) {
ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
parentBodyCodegen.addCompanionObjectPropertyToCopy(propertyDescriptor, defaultValue);

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.*;
@@ -32,6 +33,7 @@ import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.scopes.MemberScope;
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.util.OperatorNameConventions;
@@ -42,6 +44,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import org.jetbrains.org.objectweb.asm.commons.Method;
import java.util.Collections;
import java.util.Map;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
@@ -87,7 +90,7 @@ public class SamWrapperCodegen {
boolean isKotlinFunInterface = !(samType.getClassDescriptor() instanceof JavaClassDescriptor);
ClassDescriptor classDescriptor = new ClassDescriptorImpl(
ClassDescriptorImpl classDescriptor = new ClassDescriptorImpl(
samType.getClassDescriptor().getContainingDeclaration(),
fqName.shortName(),
Modality.FINAL,
@@ -97,6 +100,8 @@ public class SamWrapperCodegen {
/* isExternal = */ false,
LockBasedStorageManager.NO_LOCKS
);
classDescriptor.initialize(MemberScope.Empty.INSTANCE, Collections.emptySet(), null);
// e.g. compare(T, T)
SimpleFunctionDescriptor erasedInterfaceFunction = samType.getOriginalAbstractMethod().copy(
classDescriptor,
@@ -135,12 +140,17 @@ public class SamWrapperCodegen {
null);
generateConstructor(asmType, functionAsmType, cv);
generateMethod(asmType, functionAsmType, cv, erasedInterfaceFunction, functionType);
ClassContext context = state.getRootContext().intoClass(classDescriptor, OwnerKind.IMPLEMENTATION, state);
FunctionCodegen functionCodegen = new FunctionCodegen(context, cv, state, parentCodegen);
generateMethod(asmType, functionAsmType, erasedInterfaceFunction, functionType, functionCodegen);
if (isKotlinFunInterface) {
generateGetFunctionDelegate(cv, asmType, functionAsmType);
generateEquals(cv, asmType, functionAsmType, samAsmType);
generateHashCode(cv, asmType, functionAsmType);
generateDelegatesToDefaultImpl(asmType, classDescriptor, samType.getClassDescriptor(), functionCodegen, state);
}
cv.done();
@@ -171,25 +181,22 @@ public class SamWrapperCodegen {
}
private void generateMethod(
Type ownerType,
Type functionType,
ClassBuilder cv,
SimpleFunctionDescriptor erasedInterfaceFunction,
KotlinType functionJetType
@NotNull Type ownerType,
@NotNull Type functionType,
@NotNull SimpleFunctionDescriptor erasedInterfaceFunction,
@NotNull KotlinType functionKotlinType,
@NotNull FunctionCodegen functionCodegen
) {
// using root context to avoid creating ClassDescriptor and everything else
FunctionCodegen codegen = new FunctionCodegen(state.getRootContext().intoClass(
(ClassDescriptor) erasedInterfaceFunction.getContainingDeclaration(), OwnerKind.IMPLEMENTATION, state), cv, state, parentCodegen);
FunctionDescriptor invokeFunction =
functionJetType.getMemberScope().getContributedFunctions(OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND).iterator().next().getOriginal();
FunctionDescriptor invokeFunction = functionKotlinType.getMemberScope().getContributedFunctions(
OperatorNameConventions.INVOKE, NoLookupLocation.FROM_BACKEND
).iterator().next().getOriginal();
StackValue functionField = StackValue.field(functionType, ownerType, FUNCTION_FIELD_NAME, false, StackValue.none());
codegen.genSamDelegate(erasedInterfaceFunction, invokeFunction, functionField);
functionCodegen.genSamDelegate(erasedInterfaceFunction, invokeFunction, functionField);
// generate sam bridges
// TODO: erasedInterfaceFunction is actually not an interface function, but function in generated class
SimpleFunctionDescriptor originalInterfaceErased = samType.getOriginalAbstractMethod();
ClosureCodegen.generateBridgesForSAM(originalInterfaceErased, erasedInterfaceFunction, codegen);
ClosureCodegen.generateBridgesForSAM(originalInterfaceErased, erasedInterfaceFunction, functionCodegen);
}
private static void generateEquals(
@@ -248,6 +255,31 @@ public class SamWrapperCodegen {
FunctionCodegen.endVisit(iv, "getFunctionDelegate of SAM wrapper");
}
public static void generateDelegatesToDefaultImpl(
@NotNull Type asmType,
@NotNull ClassDescriptor classDescriptor,
@NotNull ClassDescriptor funInterface,
@NotNull FunctionCodegen functionCodegen,
@NotNull GenerationState state
) {
JvmKotlinType receiverType = new JvmKotlinType(asmType, classDescriptor.getDefaultType());
for (DeclarationDescriptor descriptor : DescriptorUtils.getAllDescriptors(funInterface.getDefaultType().getMemberScope())) {
if (!(descriptor instanceof CallableMemberDescriptor)) continue;
CallableMemberDescriptor member = (CallableMemberDescriptor) descriptor;
if (member.getModality() == Modality.ABSTRACT ||
Visibilities.isPrivate(member.getVisibility()) ||
member.getVisibility() == Visibilities.INVISIBLE_FAKE ||
DescriptorUtils.isMethodOfAny(member)) continue;
for (Map.Entry<FunctionDescriptor, FunctionDescriptor> entry : CodegenUtil.INSTANCE.copyFunctions(
member, member, classDescriptor, Modality.OPEN, Visibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, false
).entrySet()) {
ClassBodyCodegen.generateDelegationToDefaultImpl(entry.getKey(), entry.getValue(), receiverType, functionCodegen, state, false);
}
}
}
@NotNull
private FqName getWrapperName(
@NotNull KtFile containingFile,

View File

@@ -821,20 +821,17 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
Map<ValueParameterDescriptor, ResolvedValueArgument> arguments = newResolvedCall.getValueArguments();
for (ValueParameterDescriptor valueParameter : arguments.keySet()) {
SamType samType = SamType.createByValueParameter(valueParameter);
if (samType == null) continue;
ResolvedValueArgument argument = arguments.get(valueParameter);
if (argument instanceof ExpressionValueArgument) {
ValueArgument valueArgument = ((ExpressionValueArgument) argument).getValueArgument();
if (valueArgument != null && newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) != null) {
recordSamTypeOnArgumentExpression(samType, valueArgument);
recordSamTypeOnArgumentExpression(valueParameter, valueArgument);
}
} else if (argument instanceof VarargValueArgument) {
VarargValueArgument varargValueArgument = (VarargValueArgument) argument;
for (ValueArgument valueArgument : varargValueArgument.getArguments()) {
if (valueArgument != null && newResolvedCall.getExpectedTypeForSamConvertedArgument(valueArgument) != null) {
recordSamTypeOnArgumentExpression(samType, valueArgument);
recordSamTypeOnArgumentExpression(valueParameter, valueArgument);
}
}
}
@@ -872,6 +869,13 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
}
}
private void recordSamTypeOnArgumentExpression(ValueParameterDescriptor valueParameter, ValueArgument valueArgument) {
SamType samType = SamType.createByValueParameter(valueParameter);
if (samType == null) return;
recordSamTypeOnArgumentExpression(samType, valueArgument);
}
private void recordSamTypeOnArgumentExpression(SamType samType, ValueArgument valueArgument) {
KtExpression argumentExpression = valueArgument.getArgumentExpression();
assert argumentExpression != null : valueArgument.asElement().getText();

View File

@@ -60,6 +60,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes.*
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.commons.Method
import org.jetbrains.org.objectweb.asm.tree.LabelNode
import java.util.*
fun generateIsCheck(
@@ -666,3 +667,22 @@ private fun generateLambdaForRunSuspend(
lambdaBuilder.done()
return lambdaBuilder.thisName
}
internal fun LabelNode.linkWithLabel(): LabelNode {
// Remember labelNode in label and vise versa.
// Before ASM 8 there was JB patch in MethodNode that makes such linking in constructor of LabelNode.
//
// protected LabelNode getLabelNode(final Label label) {
// if (!(label.info instanceof LabelNode)) {
// //label.info = new LabelNode(label); //[JB: needed for Coverage agent]
// label.info = new LabelNode(); //ASM 8
// }
// return (LabelNode) label.info;
// }
if (label.info == null) {
label.info = this
}
return this
}
fun linkedLabel(): Label = LabelNode().linkWithLabel().label

View File

@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.codegen.optimization.common.*
import org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackMethodTransformer
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
import org.jetbrains.kotlin.codegen.linkWithLabel
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
@@ -750,7 +751,7 @@ class CoroutineTransformerMethodVisitor(
suspendMarkerVarIndex: Int,
suspendPointLineNumber: LineNumberNode?
): LabelNode {
val continuationLabel = LabelNode()
val continuationLabel = LabelNode().linkWithLabel()
val continuationLabelAfterLoadedResult = LabelNode()
val suspendElementLineNumber = lineNumber
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)

View File

@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.codegen.inline
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.linkWithLabel
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
@@ -15,6 +16,7 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.tree.LabelNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
class InlineCodegenForDefaultBody(
@@ -27,7 +29,7 @@ class InlineCodegenForDefaultBody(
) : CallGenerator {
private val sourceMapper: SourceMapper = codegen.parentCodegen.orCreateSourceMapper
private val methodStartLabel = Label()
private val methodStartLabel = linkedLabel()
init {
assert(InlineUtil.isInline(function)) {

View File

@@ -33,6 +33,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.linkedLabel;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.*;
import static org.jetbrains.kotlin.codegen.inline.MethodInlinerUtilKt.getNextMeaningful;
@@ -198,7 +199,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
//Creating temp node for finally block copy with some additional instruction
MethodNode finallyBlockCopy = createEmptyMethodNode();
Label newFinallyStart = new Label();
Label insertedBlockEnd = new Label();
Label insertedBlockEnd = linkedLabel();
boolean generateAloadAstore = nonLocalReturnType != Type.VOID_TYPE && !finallyInfo.isEmpty();
if (generateAloadAstore) {

View File

@@ -102,7 +102,7 @@ class MethodInliner(
}
//substitute returns with "goto end" instruction to keep non local returns in lambdas
val end = Label()
val end = linkedLabel()
val isTransformingAnonymousObject = nodeRemapper is RegeneratedLambdaFieldRemapper
transformedNode = doInline(transformedNode)
if (!isTransformingAnonymousObject) {

View File

@@ -66,16 +66,10 @@ class SourceMapCopier(val parent: SourceMapper, private val smap: SMAP, val call
return mappedLineNumber
}
val newLineNumber = if (lineNumber == 65100) {
// TODO This is a compatibility hack for reading bytecode generated by 1.4-M1. Once the bootstrap
// compiler is updated to a newer version, it can be removed (as newer bytecode explicitly lists
// this range in the SMAP).
parent.mapSyntheticLineNumber(InlineOnlySmapSkipper.LOCAL_VARIABLE_INLINE_ARGUMENT_SYNTHETIC_LINE_NUMBER)
} else {
val range = lastVisitedRange?.takeIf { lineNumber in it } ?: smap.findRange(lineNumber) ?: return -1
lastVisitedRange = range
parent.mapLineNumber(range.mapDestToSource(lineNumber), callSite ?: range.callSite)
}
val range = lastVisitedRange?.takeIf { lineNumber in it } ?: smap.findRange(lineNumber) ?: return -1
lastVisitedRange = range
val newLineNumber = parent.mapLineNumber(range.mapDestToSource(lineNumber), callSite ?: range.callSite)
visitedLines.put(lineNumber, newLineNumber)
return newLineNumber
}

View File

@@ -33,7 +33,11 @@ class TrimMargin : IntrinsicMethod() {
val marginPrefix = argument.valueArgument?.getArgumentExpression()
?.let { codegen.getCompileTimeConstant(it) as? StringValue }
?.value ?: return null
literalText.trimMargin(marginPrefix)
try {
literalText.trimMargin(marginPrefix)
} catch (e: IllegalArgumentException) {
return null
}
}
else -> error("Unknown value argument type ${argument::class}: $argument")
}

View File

@@ -30,7 +30,7 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
private class TransformerForMethod(val methodNode: MethodNode) {
val instructions = methodNode.instructions
val newLabelNodes = SmartIdentityTable<Label, LabelNode>()
val newLabelNodes = SmartIdentityTable<LabelNode, LabelNode>()
fun transform() {
if (rewriteLabelInstructions()) {
@@ -48,11 +48,11 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
if (thisNode is LabelNode) {
val prevNode = thisNode.previous
if (prevNode is LabelNode) {
newLabelNodes[thisNode.label] = prevNode
newLabelNodes[thisNode] = prevNode
removedAnyLabels = true
thisNode = instructions.removeNodeGetNext(thisNode)
} else {
newLabelNodes[thisNode.label] = thisNode
newLabelNodes[thisNode] = thisNode
thisNode = thisNode.next
}
} else {
@@ -145,12 +145,12 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
}
private fun getNew(oldLabelNode: LabelNode): LabelNode {
return newLabelNodes[oldLabelNode.label]
return newLabelNodes[oldLabelNode]
?: throw IllegalStateException("Label wasn't found during iterating through instructions")
}
private fun getNewOrOld(oldLabelNode: LabelNode): LabelNode =
newLabelNodes[oldLabelNode.label] ?: oldLabelNode
newLabelNodes[oldLabelNode] ?: oldLabelNode
}
}

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen.optimization.nullCheck
import org.jetbrains.kotlin.codegen.coroutines.withInstructionAdapter
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
import org.jetbrains.kotlin.codegen.linkWithLabel
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
import org.jetbrains.kotlin.codegen.optimization.common.debugText
import org.jetbrains.kotlin.codegen.optimization.common.isInsn
@@ -269,7 +270,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
// <...> -- v is null here
val jumpsIfNull = insn.opcode == Opcodes.IFNULL
val originalLabel = insn.label
val originalLabel = insn.label.linkWithLabel()
originalLabels[insn] = originalLabel
insn.label = synthetic(LabelNode(Label()))
@@ -342,7 +343,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
val originalLabel: LabelNode?
val insertAfterNotNull: AbstractInsnNode
if (jumpsIfInstance) {
originalLabel = next.label
originalLabel = next.label.linkWithLabel()
originalLabels[next] = next.label
val newLabel = synthetic(LabelNode(Label()))
methodNode.instructions.add(newLabel)

View File

@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPrivateApi
import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations
import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmDefaultAnnotation
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.DescriptorSerializer.Companion.writeVersionRequirement
@@ -93,7 +94,13 @@ class JvmSerializerExtension @JvmOverloads constructor(
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
if (jvmDefaultMode.forAllMethodsWithBody && isInterface(descriptor)) {
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
proto.setExtension(
JvmProtoBuf.jvmClassFlags,
JvmFlags.getClassFlags(
jvmDefaultMode.forAllMethodsWithBody,
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
)
)
}
}
@@ -202,7 +209,10 @@ class JvmSerializerExtension @JvmOverloads constructor(
versionRequirementTable?.writeInlineParameterNullCheckRequirement(proto::addVersionRequirement)
}
if (requiresFunctionNameManglingForReturnType(descriptor)) {
if (requiresFunctionNameManglingForReturnType(descriptor) &&
!DescriptorUtils.hasJvmNameAnnotation(descriptor) &&
!requiresFunctionNameManglingForParameterTypes(descriptor)
) {
versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
}
}
@@ -267,7 +277,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
versionRequirementTable?.writeInlineParameterNullCheckRequirement(proto::addVersionRequirement)
}
if (requiresFunctionNameManglingForReturnType(descriptor)) {
if (!DescriptorUtils.hasJvmNameAnnotation(descriptor) && requiresFunctionNameManglingForReturnType(descriptor)) {
versionRequirementTable?.writeFunctionNameManglingForReturnTypeRequirement(proto::addVersionRequirement)
}
}

View File

@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.codegen.coroutines.unwrapInitialDescriptorForSuspendFunction
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
@@ -24,10 +25,13 @@ fun getManglingSuffixBasedOnKotlinSignature(
if (descriptor is ConstructorDescriptor) return null
if (InlineClassDescriptorResolver.isSynthesizedBoxOrUnboxMethod(descriptor)) return null
// Don't mangle functions with '@JvmName' annotation.
// Some stdlib functions ('Result.success', 'Result.failure') are annotated with '@JvmName' as a workaround for forward compatibility.
if (DescriptorUtils.hasJvmNameAnnotation(descriptor)) return null
// If a function accepts inline class parameters, mangle its name.
val actualValueParameterTypes = listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type }
if (requiresFunctionNameManglingForParameterTypes(actualValueParameterTypes)) {
return "-" + md5base64(collectSignatureForMangling(actualValueParameterTypes))
if (requiresFunctionNameManglingForParameterTypes(descriptor)) {
return "-" + md5base64(collectSignatureForMangling(descriptor))
}
// If a class member function returns inline class value, mangle its name.
@@ -42,8 +46,10 @@ fun getManglingSuffixBasedOnKotlinSignature(
return null
}
private fun collectSignatureForMangling(types: List<KotlinType>) =
types.joinToString { getSignatureElementForMangling(it) }
private fun collectSignatureForMangling(descriptor: CallableMemberDescriptor): String {
val types = listOfNotNull(descriptor.extensionReceiverParameter?.type) + descriptor.valueParameters.map { it.type }
return types.joinToString { getSignatureElementForMangling(it) }
}
private fun getSignatureElementForMangling(type: KotlinType): String = buildString {
val descriptor = type.constructor.declarationDescriptor ?: return ""

View File

@@ -67,7 +67,7 @@ class BuiltInsSerializer(dependOnOldBuiltIns: Boolean) : MetadataSerializer(Buil
PrintingMessageCollector(System.err, MessageRenderer.PLAIN_RELATIVE_PATHS, false),
false
) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
// Only report diagnostics without a particular location because there's plenty of errors in built-in sources
// (functions without bodies, incorrect combination of modifiers, etc.)
if (location == null) {

View File

@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.serialization.builtins
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.serialization.AnnotationSerializer
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
import org.jetbrains.kotlin.types.KotlinType
@@ -31,20 +32,29 @@ class BuiltInsSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeriali
"CharRange" to "kotlin/ranges/CharRange"
)
override fun createAnnotationSerializer(): AnnotationSerializer = object : AnnotationSerializer(stringTable) {
override fun ignoreAnnotation(type: KotlinType): Boolean =
type.presentableName == "JvmStatic" || type.presentableName == "JvmField" || super.ignoreAnnotation(type)
}
override val metadataVersion: BinaryVersion
get() = BuiltInsBinaryVersion.INSTANCE
override fun shouldUseTypeTable(): Boolean = true
override fun serializeErrorType(type: KotlinType, builder: ProtoBuf.Type.Builder) {
val unwrapped = type.unwrap()
if (unwrapped !is UnresolvedType) {
throw UnsupportedOperationException("Error types which are not UnresolvedType instances are not supported here: $unwrapped")
}
val className = shortNameToClassId[unwrapped.presentableName]
?: throw UnsupportedOperationException("Unsupported unresolved type: $unwrapped")
val className = shortNameToClassId[type.presentableName]
?: throw UnsupportedOperationException("Unsupported unresolved type: ${type.unwrap()}")
builder.className = stringTable.getQualifiedClassNameIndex(className, false)
}
private val KotlinType.presentableName: String
get() {
val unwrapped = unwrap()
if (unwrapped !is UnresolvedType) {
throw UnsupportedOperationException("Error types which are not UnresolvedType instances are not supported here: $unwrapped")
}
return unwrapped.presentableName
}
}

View File

@@ -340,6 +340,12 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var explicitApi: String by FreezableVar(ExplicitApiMode.DISABLED.state)
@Argument(
value = "-Xdeserialize-fake-overrides",
description = "Fallback to deserializing fake overrides"
)
var deserializeFakeOverrides: Boolean by FreezableVar(false)
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
@@ -382,6 +388,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED)
put(LanguageFeature.SamConversionPerArgument, LanguageFeature.State.ENABLED)
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
}
if (inlineClasses) {
@@ -461,6 +468,8 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
if (!functionReferenceWithDefaultValueFeaturePassedExplicitly)
put(LanguageFeature.FunctionReferenceWithDefaultValueAsOtherType, LanguageFeature.State.ENABLED)
put(LanguageFeature.DisableCompatibilityModeForNewInference, LanguageFeature.State.ENABLED)
}
if (featuresThatForcePreReleaseBinaries.isNotEmpty()) {

View File

@@ -169,6 +169,9 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xenable-js-scripting", description = "Enable experimental support of .kts files using K/JS (with -Xir only)")
var enableJsScripting: Boolean by FreezableVar(false)
@Argument(value = "-Xdisable-fake-override-validator", description = "Disable IR fake override validator")
var disableFakeOverrideValidator: Boolean by FreezableVar(false)
override fun checkIrSupport(languageVersionSettings: LanguageVersionSettings, collector: MessageCollector) {
if (!isIrBackendEnabled()) return

View File

@@ -18,24 +18,61 @@ package org.jetbrains.kotlin.cli.common.messages
import java.io.Serializable
interface CompilerMessageSourceLocation : Serializable {
val path: String
val line: Int
val column: Int
val lineEnd: Int get() = -1
val columnEnd: Int get() = -1
val lineContent: String?
}
data class CompilerMessageLocation private constructor(
val path: String,
val line: Int,
val column: Int,
val lineContent: String?
) : Serializable {
override val path: String,
override val line: Int,
override val column: Int,
override val lineContent: String?
) : CompilerMessageSourceLocation {
override fun toString(): String =
path + (if (line != -1 || column != -1) " ($line:$column)" else "")
path + (if (line != -1 || column != -1) " ($line:$column)" else "")
companion object {
@JvmStatic
fun create(path: String?): CompilerMessageLocation? =
create(path, -1, -1, null)
create(path, -1, -1, null)
@JvmStatic
fun create(path: String?, line: Int, column: Int, lineContent: String?): CompilerMessageLocation? =
if (path == null) null else CompilerMessageLocation(path, line, column, lineContent)
if (path == null) null else CompilerMessageLocation(path, line, column, lineContent)
private val serialVersionUID: Long = 8228357578L
}
}
data class CompilerMessageLocationWithRange private constructor(
override val path: String,
override val line: Int,
override val column: Int,
override val lineEnd: Int,
override val columnEnd: Int,
override val lineContent: String?
) : CompilerMessageSourceLocation {
override fun toString(): String =
path + (if (line != -1 || column != -1) " ($line:$column)" else "")
companion object {
@JvmStatic
fun create(
path: String?,
lineStart: Int,
columnStart: Int,
lineEnd: Int?,
columnEnd: Int?,
lineContent: String?
): CompilerMessageLocationWithRange? =
if (path == null) null else CompilerMessageLocationWithRange(path, lineStart, columnStart, lineEnd ?: -1, columnEnd ?: -1, lineContent)
private val serialVersionUID: Long = 8228357578L
}
}

View File

@@ -36,7 +36,7 @@ public class FilteringMessageCollector implements MessageCollector {
}
@Override
public void report(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
public void report(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
if (!decline.test(severity)) {
messageCollector.report(severity, message, location);
}

View File

@@ -24,7 +24,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class GroupingMessageCollector implements MessageCollector {
@@ -32,7 +31,7 @@ public class GroupingMessageCollector implements MessageCollector {
private final boolean treatWarningsAsErrors;
// Note that the key in this map can be null
private final Multimap<CompilerMessageLocation, Message> groupedMessages = LinkedHashMultimap.create();
private final Multimap<CompilerMessageSourceLocation, Message> groupedMessages = LinkedHashMultimap.create();
public GroupingMessageCollector(@NotNull MessageCollector delegate, boolean treatWarningsAsErrors) {
this.delegate = delegate;
@@ -48,7 +47,7 @@ public class GroupingMessageCollector implements MessageCollector {
public void report(
@NotNull CompilerMessageSeverity severity,
@NotNull String message,
@Nullable CompilerMessageLocation location
@Nullable CompilerMessageSourceLocation location
) {
if (CompilerMessageSeverity.VERBOSE.contains(severity)) {
delegate.report(severity, message, location);
@@ -78,9 +77,9 @@ public class GroupingMessageCollector implements MessageCollector {
report(CompilerMessageSeverity.ERROR, "warnings found and -Werror specified", null);
}
List<CompilerMessageLocation> sortedKeys =
List<CompilerMessageSourceLocation> sortedKeys =
CollectionsKt.sortedWith(groupedMessages.keySet(), Comparator.nullsFirst(CompilerMessageLocationComparator.INSTANCE));
for (CompilerMessageLocation location : sortedKeys) {
for (CompilerMessageSourceLocation location : sortedKeys) {
for (Message message : groupedMessages.get(location)) {
if (!hasExplicitErrors || message.severity.isError() || message.severity == CompilerMessageSeverity.STRONG_WARNING) {
delegate.report(message.severity, message.message, message.location);
@@ -91,7 +90,7 @@ public class GroupingMessageCollector implements MessageCollector {
groupedMessages.clear();
}
private static class CompilerMessageLocationComparator implements Comparator<CompilerMessageLocation> {
private static class CompilerMessageLocationComparator implements Comparator<CompilerMessageSourceLocation> {
public static final CompilerMessageLocationComparator INSTANCE = new CompilerMessageLocationComparator();
// First, output all messages without any location information. Then, only those with the file path.
@@ -104,7 +103,7 @@ public class GroupingMessageCollector implements MessageCollector {
// foo.kt:42: error: bad line
// foo.kt:42:43: error: bad character
@Override
public int compare(CompilerMessageLocation o1, CompilerMessageLocation o2) {
public int compare(CompilerMessageSourceLocation o1, CompilerMessageSourceLocation o2) {
if (o1.getColumn() == -1 && o2.getColumn() != -1) return -1;
if (o1.getColumn() != -1 && o2.getColumn() == -1) return 1;
@@ -118,9 +117,9 @@ public class GroupingMessageCollector implements MessageCollector {
private static class Message {
private final CompilerMessageSeverity severity;
private final String message;
private final CompilerMessageLocation location;
private final CompilerMessageSourceLocation location;
private Message(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
private Message(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
this.severity = severity;
this.message = message;
this.location = location;

View File

@@ -19,13 +19,13 @@ package org.jetbrains.kotlin.cli.common.messages
interface MessageCollector {
fun clear()
fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation? = null)
fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation? = null)
fun hasErrors(): Boolean
companion object {
val NONE: MessageCollector = object : MessageCollector {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
// Do nothing
}

View File

@@ -63,8 +63,8 @@ private interface ArgsConverter<T> {
}
fun tryConvertSingle(parameter: KParameter, arg: NamedArgument<T>): Result
fun tryConvertVararg(parameter: KParameter, firstArg: NamedArgument<T>, restArgsIt: Iterator<NamedArgument<T>>): Result
fun tryConvertTail(parameter: KParameter, firstArg: NamedArgument<T>, restArgsIt: Iterator<NamedArgument<T>>): Result
fun tryConvertVararg(parameter: KParameter, firstArg: NamedArgument<T>, restArgs: Sequence<NamedArgument<T>>): Result
fun tryConvertTail(parameter: KParameter, firstArg: NamedArgument<T>, restArgs: Sequence<NamedArgument<T>>): Result
}
private enum class ArgsTraversalState { UNNAMED, NAMED, TAIL }
@@ -77,7 +77,7 @@ private fun <T> tryCreateCallableMapping(
val res = mutableMapOf<KParameter, Any?>()
var state = ArgsTraversalState.UNNAMED
val unboundParams = callable.parameters.toMutableList()
val argIt = args.iterator()
val argIt = LookAheadIterator(args.iterator())
while (argIt.hasNext()) {
if (unboundParams.isEmpty()) return null // failed to match: no param left for the arg
val arg = argIt.next()
@@ -102,7 +102,11 @@ private fun <T> tryCreateCallableMapping(
res[par] = cvtRes.v
} else if (par.type.jvmErasure.java.isArray) {
// try vararg
val cvtVRes = converter.tryConvertVararg(par, arg, argIt)
// Collect all the arguments that do not have a name
val unnamed = argIt.sequenceUntil { it.name != null }
val cvtVRes = converter.tryConvertVararg(par, arg, unnamed)
if (cvtVRes is ArgsConverter.Result.Success) {
res[par] = cvtVRes.v
} else return null // failed to match: no suitable param for unnamed arg
@@ -121,7 +125,7 @@ private fun <T> tryCreateCallableMapping(
ArgsTraversalState.TAIL -> {
assert(arg.name == null)
val par = unboundParams.removeAt(unboundParams.lastIndex)
val cvtVRes = converter.tryConvertTail(par, arg, argIt)
val cvtVRes = converter.tryConvertTail(par, arg, argIt.asSequence())
if (cvtVRes is ArgsConverter.Result.Success) {
if (argIt.hasNext()) return null // failed to match: not all tail args are consumed
res[par] = cvtVRes.v
@@ -162,7 +166,7 @@ private class StringArgsConverter : ArgsConverter<String> {
override fun tryConvertVararg(
parameter: KParameter,
firstArg: NamedArgument<String>,
restArgsIt: Iterator<NamedArgument<String>>
restArgs: Sequence<NamedArgument<String>>
): ArgsConverter.Result {
fun convertPrimitivesArray(type: KType, args: Sequence<String?>): Any? =
when (type.classifier) {
@@ -179,7 +183,7 @@ private class StringArgsConverter : ArgsConverter<String> {
val parameterType = parameter.type
if (parameterType.jvmErasure.java.isArray) {
val argsSequence = sequenceOf(firstArg.value) + restArgsIt.asSequence().map { it.value }
val argsSequence = sequenceOf(firstArg.value) + restArgs.map { it.value }
val primArrayArgCandidate = convertPrimitivesArray(parameterType, argsSequence)
if (primArrayArgCandidate != null)
return ArgsConverter.Result.Success(primArrayArgCandidate)
@@ -195,9 +199,9 @@ private class StringArgsConverter : ArgsConverter<String> {
override fun tryConvertTail(
parameter: KParameter,
firstArg: NamedArgument<String>,
restArgsIt: Iterator<NamedArgument<String>>
restArgs: Sequence<NamedArgument<String>>
): ArgsConverter.Result =
tryConvertVararg(parameter, firstArg, restArgsIt)
tryConvertVararg(parameter, firstArg, restArgs)
}
private class AnyArgsConverter : ArgsConverter<Any> {
@@ -218,18 +222,33 @@ private class AnyArgsConverter : ArgsConverter<Any> {
else -> null
}
if (value::class.isSubclassOf(parameter.type.jvmErasure)) return ArgsConverter.Result.Success(value)
fun evaluateValue(arg: Any): Any? {
if (arg::class.isSubclassOf(parameter.type.jvmErasure)) return arg
return convertPrimitivesArray(parameter.type, arg)
}
return convertPrimitivesArray(parameter.type, value)?.let { ArgsConverter.Result.Success(it) }
?: ArgsConverter.Result.Failure
evaluateValue(value)?.let { return ArgsConverter.Result.Success(it) }
// Handle the scenario where [arg::class] is an Array<Any>
// but it's values could all still be valid
val parameterKClass = parameter.type.classifier as? KClass<*>
val arrayComponentType = parameterKClass?.java?.takeIf { it.isArray}?.componentType?.kotlin
if (value is Array<*> && arrayComponentType != null) {
// TODO: Idea! Maybe we should check if the values in the array are compatible with [arrayComponentType]
// if they aren't perhaps we should fail silently
convertAnyArray(arrayComponentType, value.asSequence())?.let(::evaluateValue)?.let { return ArgsConverter.Result.Success(it) }
}
return ArgsConverter.Result.Failure
}
override fun tryConvertVararg(
parameter: KParameter, firstArg: NamedArgument<Any>, restArgsIt: Iterator<NamedArgument<Any>>
parameter: KParameter, firstArg: NamedArgument<Any>, restArgs: Sequence<NamedArgument<Any>>
): ArgsConverter.Result {
val parameterType = parameter.type
if (parameterType.jvmErasure.java.isArray) {
val argsSequence = sequenceOf(firstArg.value) + restArgsIt.asSequence().map { it.value }
val argsSequence = sequenceOf(firstArg.value) + restArgs.map { it.value }
val arrayElementType = parameterType.arguments.firstOrNull()?.type
val arrayArgCandidate = convertAnyArray(arrayElementType?.classifier, argsSequence)
if (arrayArgCandidate != null)
@@ -242,7 +261,7 @@ private class AnyArgsConverter : ArgsConverter<Any> {
override fun tryConvertTail(
parameter: KParameter,
firstArg: NamedArgument<Any>,
restArgsIt: Iterator<NamedArgument<Any>>
restArgs: Sequence<NamedArgument<Any>>
): ArgsConverter.Result =
tryConvertSingle(parameter, firstArg)
}
@@ -266,3 +285,38 @@ private fun <T> convertAnyArrayImpl(classifier: KClassifier?, args: Sequence<T?>
}
return result
}
/*
An iterator that allows us to read the next value without consuming it.
*/
private class LookAheadIterator<T>(private val iterator: Iterator<T>) : Iterator<T> {
private var currentLookAhead: T? = null
override fun hasNext(): Boolean {
return currentLookAhead != null || iterator.hasNext()
}
override fun next(): T {
currentLookAhead?.let { value ->
currentLookAhead = null
return value
}
return iterator.next()
}
fun nextWithoutConsuming(): T {
return currentLookAhead ?: iterator.next().also { currentLookAhead = it }
}
}
/*
Will return a sequence with the values of the iterator until the predicate evaluates to true.
*/
private fun <T> LookAheadIterator<T>.sequenceUntil(predicate: (T) -> Boolean): Sequence<T> = sequence {
while (hasNext()) {
if (predicate(nextWithoutConsuming()))
break
yield(next())
}
}

View File

@@ -322,6 +322,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
}
configuration.put(JSConfigurationKeys.PRINT_REACHABILITY_INFO, arguments.irDcePrintReachabilityInfo)
configuration.put(JSConfigurationKeys.DISABLE_FAKE_OVERRIDE_VALIDATOR, arguments.disableFakeOverrideValidator)
}
override fun executableScriptFileName(): String {

View File

@@ -26,6 +26,7 @@ fun <A : CommonCompilerArguments> CompilerConfiguration.setupCommonArguments(
put(CommonConfigurationKeys.EXPECT_ACTUAL_LINKER, arguments.expectActualLinker)
putIfNotNull(CLIConfigurationKeys.INTELLIJ_PLUGIN_ROOT, arguments.intellijPluginRoot)
put(CommonConfigurationKeys.REPORT_OUTPUT_FILES, arguments.reportOutputFiles)
put(CommonConfigurationKeys.DESERIALIZE_FAKE_OVERRIDES, arguments.deserializeFakeOverrides)
val metadataVersionString = arguments.metadataVersion
if (metadataVersionString != null) {

View File

@@ -31,6 +31,6 @@ interface MessageCollectorBasedReporter : DiagnosticMessageReporter {
override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report(
AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity),
render,
MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic))
MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumnRange(diagnostic))
)
}

View File

@@ -0,0 +1,36 @@
/*
* 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.cli.common.messages
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
/**
* This class behaviour is the same as [MessageCollector.report] in [AnalyzerWithCompilerReport.reportDiagnostic].
*/
class DefaultDiagnosticReporter(override val messageCollector: MessageCollector) : MessageCollectorBasedReporter
interface MessageCollectorBasedReporter : DiagnosticMessageReporter {
val messageCollector: MessageCollector
override fun report(diagnostic: Diagnostic, file: PsiFile, render: String) = messageCollector.report(
AnalyzerWithCompilerReport.convertSeverity(diagnostic.severity),
render,
MessageUtil.psiFileToMessageLocation(file, file.name, DiagnosticUtils.getLineAndColumn(diagnostic))
)
}

View File

@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.cli.common.messages
class GradleStyleMessageRenderer : MessageRenderer {
override fun render(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?): String {
override fun render(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?): String {
val prefix = when (severity) {
CompilerMessageSeverity.WARNING, CompilerMessageSeverity.STRONG_WARNING -> "w"
CompilerMessageSeverity.ERROR, CompilerMessageSeverity.EXCEPTION -> "e"

View File

@@ -32,7 +32,7 @@ public interface MessageRenderer {
MessageRenderer WITHOUT_PATHS = new PlainTextMessageRenderer() {
@Nullable
@Override
protected String getPath(@NotNull CompilerMessageLocation location) {
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
return null;
}
@@ -45,7 +45,7 @@ public interface MessageRenderer {
MessageRenderer PLAIN_FULL_PATHS = new PlainTextMessageRenderer() {
@NotNull
@Override
protected String getPath(@NotNull CompilerMessageLocation location) {
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
return location.getPath();
}
@@ -60,7 +60,7 @@ public interface MessageRenderer {
@NotNull
@Override
protected String getPath(@NotNull CompilerMessageLocation location) {
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
return FileUtilsKt.descendantRelativeTo(new File(location.getPath()), cwd).getPath();
}
@@ -75,7 +75,7 @@ public interface MessageRenderer {
@Nullable
@Override
protected String getPath(@NotNull CompilerMessageLocation location) {
protected String getPath(@NotNull CompilerMessageSourceLocation location) {
return FileUtil.toSystemIndependentName(
FileUtilsKt.descendantRelativeTo(new File(location.getPath()), cwd).getPath()
);
@@ -91,7 +91,7 @@ public interface MessageRenderer {
String renderPreamble();
String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location);
String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location);
String renderUsage(@NotNull String usage);

View File

@@ -32,21 +32,23 @@ public class MessageUtil {
private MessageUtil() {}
@Nullable
public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) {
public static CompilerMessageSourceLocation psiElementToMessageLocation(@Nullable PsiElement element) {
if (element == null) return null;
PsiFile file = element.getContainingFile();
return psiFileToMessageLocation(file, "<no path>", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange()));
return psiFileToMessageLocation(file, "<no path>", DiagnosticUtils.getLineAndColumnRangeInPsiFile(file, element.getTextRange()));
}
@Nullable
public static CompilerMessageLocation psiFileToMessageLocation(
public static CompilerMessageSourceLocation psiFileToMessageLocation(
@NotNull PsiFile file,
@Nullable String defaultValue,
@NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn
@NotNull PsiDiagnosticUtils.LineAndColumnRange range
) {
VirtualFile virtualFile = file.getVirtualFile();
String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue;
return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent());
PsiDiagnosticUtils.LineAndColumn start = range.getStart();
PsiDiagnosticUtils.LineAndColumn end = range.getEnd();
return CompilerMessageLocationWithRange.create(path, start.getLine(), start.getColumn(), end.getLine(), end.getColumn(), start.getLineContent());
}
@NotNull

View File

@@ -0,0 +1,54 @@
/*
* 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.cli.common.messages;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils;
import org.jetbrains.kotlin.diagnostics.PsiDiagnosticUtils;
import static com.intellij.openapi.util.io.FileUtil.toSystemDependentName;
public class MessageUtil {
private MessageUtil() {}
@Nullable
public static CompilerMessageLocation psiElementToMessageLocation(@Nullable PsiElement element) {
if (element == null) return null;
PsiFile file = element.getContainingFile();
return psiFileToMessageLocation(file, "<no path>", DiagnosticUtils.getLineAndColumnInPsiFile(file, element.getTextRange()));
}
@Nullable
public static CompilerMessageLocation psiFileToMessageLocation(
@NotNull PsiFile file,
@Nullable String defaultValue,
@NotNull PsiDiagnosticUtils.LineAndColumn lineAndColumn
) {
VirtualFile virtualFile = file.getVirtualFile();
String path = virtualFile != null ? virtualFileToPath(virtualFile) : defaultValue;
return CompilerMessageLocation.create(path, lineAndColumn.getLine(), lineAndColumn.getColumn(), lineAndColumn.getLineContent());
}
@NotNull
public static String virtualFileToPath(@NotNull VirtualFile virtualFile) {
return toSystemDependentName(virtualFile.getPath());
}
}

View File

@@ -58,7 +58,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
}
@Override
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
StringBuilder result = new StringBuilder();
int line = location != null ? location.getLine() : -1;
@@ -156,7 +156,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
}
@Nullable
protected abstract String getPath(@NotNull CompilerMessageLocation location);
protected abstract String getPath(@NotNull CompilerMessageSourceLocation location);
@Override
public String renderUsage(@NotNull String usage) {

View File

@@ -42,7 +42,7 @@ public class PrintingMessageCollector implements MessageCollector {
public void report(
@NotNull CompilerMessageSeverity severity,
@NotNull String message,
@Nullable CompilerMessageLocation location
@Nullable CompilerMessageSourceLocation location
) {
if (!verbose && CompilerMessageSeverity.VERBOSE.contains(severity)) return;

View File

@@ -27,7 +27,7 @@ public class XmlMessageRenderer implements MessageRenderer {
}
@Override
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location) {
public String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageSourceLocation location) {
StringBuilder out = new StringBuilder();
String tagName = severity.getPresentableName();
out.append("<").append(tagName);

View File

@@ -66,6 +66,7 @@ import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitsExtensionsResolutionFilter
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
@@ -135,7 +136,8 @@ object TopDownAnalyzerFacadeForJVM {
declarationProviderFactory: (StorageManager, Collection<KtFile>) -> DeclarationProviderFactory,
targetEnvironment: TargetEnvironment = CompilerEnvironment,
sourceModuleSearchScope: GlobalSearchScope = newModuleSearchScope(project, files),
klibList: List<KotlinLibrary> = emptyList()
klibList: List<KotlinLibrary> = emptyList(),
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null
): ComponentProvider {
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET, JvmTarget.DEFAULT)
val languageVersionSettings = configuration.languageVersionSettings
@@ -186,7 +188,8 @@ object TopDownAnalyzerFacadeForJVM {
targetEnvironment, lookupTracker, expectActualTracker,
packagePartProvider(dependencyScope), languageVersionSettings,
useBuiltInsProvider = true,
configureJavaClassFinder = configureJavaClassFinder
configureJavaClassFinder = configureJavaClassFinder,
implicitsResolutionFilter = implicitsResolutionFilter
)
moduleClassResolver.compiledCodeResolver = dependenciesContainer.get()
@@ -220,7 +223,8 @@ object TopDownAnalyzerFacadeForJVM {
partProvider, languageVersionSettings,
useBuiltInsProvider = true,
configureJavaClassFinder = configureJavaClassFinder,
javaClassTracker = configuration[JVMConfigurationKeys.JAVA_CLASSES_TRACKER]
javaClassTracker = configuration[JVMConfigurationKeys.JAVA_CLASSES_TRACKER],
implicitsResolutionFilter = implicitsResolutionFilter
).apply {
initJvmBuiltInsForTopDownAnalysis()
(partProvider as? IncrementalPackagePartProvider)?.deserializationConfiguration = get()

View File

@@ -38,6 +38,17 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
}
}
val jvmTarget = get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
if (jvmTarget.bytecodeVersion < JvmTarget.JVM_1_8.bytecodeVersion) {
val jvmDefaultMode = languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode)
if (jvmDefaultMode.forAllMethodsWithBody) {
messageCollector.report(
ERROR,
"'-Xjvm-default=${jvmDefaultMode.description}' is only supported since JVM target 1.8. Recompile with '-jvm-target 1.8'"
)
}
}
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
}

View File

@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.compiler.plugin.*
import org.jetbrains.kotlin.config.CompilerConfiguration
import java.io.File
import java.net.URLClassLoader
import java.util.*
object PluginCliParser {
@JvmStatic
@@ -78,44 +77,52 @@ object PluginCliParser {
configuration: CompilerConfiguration,
classLoader: URLClassLoader
) {
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
it.pluginId
} ?: mapOf()
// TODO issue a warning on using deprecated command line processors when all official plugin migrate to the newer convention
val commandLineProcessors = ServiceLoaderLite.loadImplementations(CommandLineProcessor::class.java, classLoader)
for (processor in commandLineProcessors) {
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
processCompilerPluginsOptions(configuration, pluginOptions, commandLineProcessors)
}
}
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
val option = declaredOptions[optionValue!!.optionName]
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
optionsToValues.putValue(option, optionValue)
fun processCompilerPluginsOptions(
configuration: CompilerConfiguration,
pluginOptions: Iterable<String>?,
commandLineProcessors: List<CommandLineProcessor>
) {
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
it.pluginId
} ?: mapOf()
for (processor in commandLineProcessors) {
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
val option = declaredOptions[optionValue!!.optionName]
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
optionsToValues.putValue(option, optionValue)
}
for (option in processor.pluginOptions) {
val values = optionsToValues[option]
if (option.required && values.isEmpty()) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
)
}
if (!option.allowMultipleOccurrences && values.size > 1) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
)
}
for (option in processor.pluginOptions) {
val values = optionsToValues[option]
if (option.required && values.isEmpty()) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
)
}
if (!option.allowMultipleOccurrences && values.size > 1) {
throw PluginCliOptionProcessingException(
processor.pluginId,
processor.pluginOptions,
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
)
}
for (value in values) {
processor.processOption(option, value.value, configuration)
}
for (value in values) {
processor.processOption(option, value.value, configuration)
}
}
}

View File

@@ -27,7 +27,6 @@ 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
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration

View File

@@ -19,7 +19,7 @@ public class KotlinCompilerVersion {
// Binaries produced by this compiler with that language version (or any future language version) are going to be marked
// as "pre-release" and will not be loaded by release versions of the compiler.
// Change this value before and after every major release
private static final boolean IS_PRE_RELEASE = true;
private static final boolean IS_PRE_RELEASE = false;
public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release";

View File

@@ -47,6 +47,9 @@ object CommonConfigurationKeys {
@JvmField
val EXPECT_ACTUAL_LINKER = CompilerConfigurationKey.create<Boolean>("Experimental expext/actual linker")
@JvmField
val DESERIALIZE_FAKE_OVERRIDES = CompilerConfigurationKey.create<Boolean>("Deserialize fake overrides")
}
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings

View File

@@ -6,19 +6,21 @@
package org.jetbrains.kotlin.daemon.client.experimental
import io.ktor.network.sockets.Socket
import kotlinx.coroutines.*
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.daemon.client.CompileServiceSessionAsync
import org.jetbrains.kotlin.daemon.client.KotlinCompilerDaemonClient
import org.jetbrains.kotlin.daemon.client.DaemonReportMessage
import org.jetbrains.kotlin.daemon.client.DaemonReportingTargets
import org.jetbrains.kotlin.daemon.client.KotlinCompilerDaemonClient
import org.jetbrains.kotlin.daemon.client.launchProcessWithFallback
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.daemon.common.Profiler
import org.jetbrains.kotlin.daemon.common.experimental.*
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.Server
import org.jetbrains.kotlin.daemon.common.experimental.socketInfrastructure.ServerSocketWrapper
import org.jetbrains.kotlin.daemon.common.*
import java.io.File
import java.io.Serializable
import java.net.SocketException
@@ -30,7 +32,6 @@ import java.util.concurrent.Semaphore
import java.util.concurrent.TimeUnit
import java.util.logging.Logger
import kotlin.concurrent.thread
import org.jetbrains.kotlin.daemon.client.launchProcessWithFallback
class KotlinCompilerClient : KotlinCompilerDaemonClient {

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.daemon.client
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
@@ -66,7 +66,7 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
else -> throw IllegalStateException("Unexpected compiler message report severity $severity")
}
if (message != null) {
report(compilerSeverity, message, attachment as? CompilerMessageLocation)
report(compilerSeverity, message, attachment as? CompilerMessageSourceLocation)
}
else {
reportUnexpected(category, severity, message, attachment)

View File

@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.daemon
import com.intellij.openapi.application.ApplicationManager
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
@@ -181,7 +181,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
}
class TestMessageCollector : MessageCollector {
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageLocation?)
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageSourceLocation?)
val messages = arrayListOf<Message>()
@@ -189,7 +189,7 @@ class TestMessageCollector : MessageCollector {
messages.clear()
}
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
messages.add(Message(severity, message, location))
}

View File

@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.daemon.experimental.integration
import com.intellij.openapi.application.ApplicationManager
import kotlinx.coroutines.runBlocking
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
@@ -301,7 +301,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
}
class TestMessageCollector : MessageCollector {
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageLocation?)
data class Message(val severity: CompilerMessageSeverity, val message: String, val location: CompilerMessageSourceLocation?)
val messages = arrayListOf<Message>()
@@ -309,7 +309,7 @@ class TestMessageCollector : MessageCollector {
messages.clear()
}
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
messages.add(Message(severity, message, location))
}

View File

@@ -168,9 +168,9 @@ internal class KeepFirstErrorMessageCollector(compilerMessagesStream: PrintStrea
private val innerCollector = PrintingMessageCollector(compilerMessagesStream, MessageRenderer.WITHOUT_PATHS, false)
internal var firstErrorMessage: String? = null
internal var firstErrorLocation: CompilerMessageLocation? = null
internal var firstErrorLocation: CompilerMessageSourceLocation? = null
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
if (firstErrorMessage == null && severity.isError) {
firstErrorMessage = message
firstErrorLocation = location

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.daemon.report
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
@@ -34,7 +34,7 @@ internal class CompileServicesFacadeMessageCollector(
hasErrors = false
}
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
log.info("Message: " + MessageRenderer.WITHOUT_PATHS.render(severity, message, location))
when (severity) {
CompilerMessageSeverity.OUTPUT -> {

View File

@@ -5,17 +5,14 @@
package org.jetbrains.kotlin.daemon.report.experimental
import kotlinx.coroutines.*
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
import org.jetbrains.kotlin.daemon.KotlinCompileDaemon.log
import org.jetbrains.kotlin.daemon.common.CompilationOptions
import org.jetbrains.kotlin.daemon.common.ReportCategory
import org.jetbrains.kotlin.daemon.common.ReportSeverity
import org.jetbrains.kotlin.daemon.common.CompilerServicesFacadeBaseAsync
import org.jetbrains.kotlin.daemon.common.report
import org.jetbrains.kotlin.daemon.common.*
internal class CompileServicesFacadeMessageCollector(
private val servicesFacade: CompilerServicesFacadeBaseAsync,
@@ -28,7 +25,7 @@ internal class CompileServicesFacadeMessageCollector(
hasErrors = false
}
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
GlobalScope.async {
log.info("Message: " + MessageRenderer.WITHOUT_PATHS.render(severity, message, location))
when (severity) {

View File

@@ -358,6 +358,20 @@ public abstract interface Comparable<in T> : R|kotlin/Any| {
}
@R|kotlin/annotation/Target|() @R|kotlin/annotation/MustBeDocumented|() @R|kotlin/SinceKotlin|(version = String(1.4)) public final annotation class DeprecatedSinceKotlin : R|kotlin/Annotation| {
public final val errorSince: R|kotlin/String|
public get(): R|kotlin/String|
public final val hiddenSince: R|kotlin/String|
public get(): R|kotlin/String|
public final val warningSince: R|kotlin/String|
public get(): R|kotlin/String|
public constructor(warningSince: R|kotlin/String| = STUB, errorSince: R|kotlin/String| = STUB, hiddenSince: R|kotlin/String| = STUB): R|kotlin/DeprecatedSinceKotlin|
}
public final enum class DeprecationLevel : R|kotlin/Enum<kotlin/DeprecationLevel>| {
private constructor(): R|kotlin/DeprecationLevel|

View File

@@ -1,6 +1,5 @@
class C(val map: MutableMap<String, Any>) {
// NB: this does not work because of @LowPriorityInOverloadResolution not deserialized (KT-37228)
var foo by <!AMBIGUITY!>map<!>
var foo by map
}
var bar by <!AMBIGUITY!>hashMapOf<String, Any>()<!>
var bar by hashMapOf<String, Any>()

View File

@@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
^ this@R|/C|.D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
public final var foo: R|kotlin/Any|by R|<local>/map|
public get(): R|kotlin/Any| {
^ this@R|/C|.D|/C.foo|.R|kotlin/collections/getValue|<R|kotlin/Any|, R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|)
}
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
this@R|/C|.D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
public set(<set-?>: R|kotlin/Any|): R|kotlin/Unit| {
this@R|/C|.D|/C.foo|.R|kotlin/collections/setValue|<R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
}
}
public final var bar: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
public final var bar: R|ft<kotlin/Any, kotlin/Any?>!|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
public get(): R|ft<kotlin/Any, kotlin/Any?>!| {
^ D|/bar|.R|kotlin/collections/getValue|<R|ft<kotlin/Any, kotlin/Any?>!|, R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|)
}
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
public set(<set-?>: R|ft<kotlin/Any, kotlin/Any?>!|): R|kotlin/Unit| {
D|/bar|.R|kotlin/collections/setValue|<R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|, R|<local>/bar|)
}

View File

@@ -1794,6 +1794,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/classVsPackage.kt");
}
@TestMetadata("compatibilityResolveWithVarargAndOperatorCall.kt")
public void testCompatibilityResolveWithVarargAndOperatorCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/compatibilityResolveWithVarargAndOperatorCall.kt");
}
@TestMetadata("constraintFromLHSWithCorrectDirection.kt")
public void testConstraintFromLHSWithCorrectDirection() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirection.kt");
@@ -1804,6 +1809,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/constraintFromLHSWithCorrectDirectionError.kt");
}
@TestMetadata("correctCandidateWithCompatibilityForSeveralCandidates.kt")
public void testCorrectCandidateWithCompatibilityForSeveralCandidates() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/correctCandidateWithCompatibilityForSeveralCandidates.kt");
}
@TestMetadata("correctInfoAfterArrayLikeCall.kt")
public void testCorrectInfoAfterArrayLikeCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt");
@@ -1914,6 +1924,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/noAmbiguityWhenAllReferencesAreInapplicable.kt");
}
@TestMetadata("noCompatibilityResolveWithProressiveModeForNI.kt")
public void testNoCompatibilityResolveWithProressiveModeForNI() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/noCompatibilityResolveWithProressiveModeForNI.kt");
}
@TestMetadata("noExceptionOnRedCodeWithArrayLikeCall.kt")
public void testNoExceptionOnRedCodeWithArrayLikeCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/noExceptionOnRedCodeWithArrayLikeCall.kt");
@@ -1939,6 +1954,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/referenceAdaptationCompatibility.kt");
}
@TestMetadata("referenceAdaptationHasDependencyOnApi14.kt")
public void testReferenceAdaptationHasDependencyOnApi14() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/referenceAdaptationHasDependencyOnApi14.kt");
}
@TestMetadata("referenceToCompanionObjectMemberViaClassName.kt")
public void testReferenceToCompanionObjectMemberViaClassName() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/referenceToCompanionObjectMemberViaClassName.kt");
}
@TestMetadata("referenceToCompanionObjectMemberViaClassNameCompatibility.kt")
public void testReferenceToCompanionObjectMemberViaClassNameCompatibility() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/referenceToCompanionObjectMemberViaClassNameCompatibility.kt");
}
@TestMetadata("rewriteAtSliceOnGetOperator.kt")
public void testRewriteAtSliceOnGetOperator() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/rewriteAtSliceOnGetOperator.kt");
@@ -1964,6 +1994,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/typealiases.kt");
}
@TestMetadata("unitAdaptationForReferenceCompatibility.kt")
public void testUnitAdaptationForReferenceCompatibility() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/unitAdaptationForReferenceCompatibility.kt");
}
@TestMetadata("unused.kt")
public void testUnused() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/unused.kt");
@@ -1974,6 +2009,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/whitespacesInExpression.kt");
}
@TestMetadata("withQuestionMarks.kt")
public void testWithQuestionMarks() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/withQuestionMarks.kt");
}
@TestMetadata("compiler/testData/diagnostics/tests/callableReference/bound")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -2559,6 +2599,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
@TestMetadata("adaptedReferenceAgainstKCallable.kt")
public void testAdaptedReferenceAgainstKCallable() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstKCallable.kt");
}
@TestMetadata("adaptedReferenceAgainstReflectionType.kt")
public void testAdaptedReferenceAgainstReflectionType() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/adaptedReferenceAgainstReflectionType.kt");
}
public void testAllFilesPresentInResolve() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/callableReference/resolve"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@@ -2623,6 +2673,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/commonSupertypeFromReturnTypesOfCallableReference.kt");
}
@TestMetadata("compatibilityWarningOnReferenceAgainstReflectiveType.kt")
public void testCompatibilityWarningOnReferenceAgainstReflectiveType() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/compatibilityWarningOnReferenceAgainstReflectiveType.kt");
}
@TestMetadata("constructor.kt")
public void testConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/constructor.kt");
@@ -2708,6 +2763,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/multipleOutersAndMultipleCallableReferences.kt");
}
@TestMetadata("nestedReferenceCallAgainstExpectedType.kt")
public void testNestedReferenceCallAgainstExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/nestedReferenceCallAgainstExpectedType.kt");
}
@TestMetadata("noAmbiguityBetweenTopLevelAndMemberProperty.kt")
public void testNoAmbiguityBetweenTopLevelAndMemberProperty() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/noAmbiguityBetweenTopLevelAndMemberProperty.kt");
@@ -2718,6 +2778,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/noFakeDescriptorForObject.kt");
}
@TestMetadata("overloadAmbiguityForSimpleLastExpressionOfBlock.kt")
public void testOverloadAmbiguityForSimpleLastExpressionOfBlock() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/overloadAmbiguityForSimpleLastExpressionOfBlock.kt");
}
@TestMetadata("overloads.kt")
public void testOverloads() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/overloads.kt");
@@ -2748,6 +2813,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/resolveEqualsOperatorWithAnyExpectedType.kt");
}
@TestMetadata("resolveReferenceAgainstKFunctionAndKPrpoerty.kt")
public void testResolveReferenceAgainstKFunctionAndKPrpoerty() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/resolveReferenceAgainstKFunctionAndKPrpoerty.kt");
}
@TestMetadata("resolveTwoReferencesAgainstGenerics.kt")
public void testResolveTwoReferencesAgainstGenerics() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/resolveTwoReferencesAgainstGenerics.kt");
}
@TestMetadata("valVsFun.kt")
public void testValVsFun() throws Exception {
runTest("compiler/testData/diagnostics/tests/callableReference/resolve/valVsFun.kt");
@@ -3816,6 +3891,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldAsClassDelegate.kt");
}
@TestMetadata("fieldInitialization.kt")
public void testFieldInitialization() throws Exception {
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.kt");
}
@TestMetadata("infiniteLoops.kt")
public void testInfiniteLoops() throws Exception {
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/infiniteLoops.kt");
@@ -4626,6 +4706,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/coroutines"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("suspendInvokeInsideTry.kt")
public void testSuspendInvokeInsideTry() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendInvokeInsideTry.kt");
}
@TestMetadata("suspendInvokeInsideWhen.kt")
public void testSuspendInvokeInsideWhen() throws Exception {
runTest("compiler/testData/diagnostics/tests/coroutines/suspendInvokeInsideWhen.kt");
}
@TestMetadata("compiler/testData/diagnostics/tests/coroutines/callableReference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -6131,6 +6221,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/overloadResolutionForSeveralProvideDelegates.kt");
}
@TestMetadata("provideDelegateOnFunctionalTypeWithThis.kt")
public void testProvideDelegateOnFunctionalTypeWithThis() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOnFunctionalTypeWithThis.kt");
}
@TestMetadata("provideDelegateOperatorDeclaration.kt")
public void testProvideDelegateOperatorDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/provideDelegateOperatorDeclaration.kt");
@@ -6465,6 +6560,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedHidden.kt");
}
@TestMetadata("deprecatedHiddenOnCallableReferenceArgument.kt")
public void testDeprecatedHiddenOnCallableReferenceArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedHiddenOnCallableReferenceArgument.kt");
}
@TestMetadata("deprecatedInheritance.kt")
public void testDeprecatedInheritance() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedInheritance.kt");
@@ -6584,6 +6684,64 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
public void testWarningOnConstructorErrorOnClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/warningOnConstructorErrorOnClass.kt");
}
@TestMetadata("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DeprecatedSinceKotlin extends AbstractFirOldFrontendDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInDeprecatedSinceKotlin() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("checkValuesAreParseableAsVersion.kt")
public void testCheckValuesAreParseableAsVersion() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/checkValuesAreParseableAsVersion.kt");
}
@TestMetadata("deprecatedSinceKotlinDeclaration.kt")
public void testDeprecatedSinceKotlinDeclaration() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt");
}
@TestMetadata("deprecatedSinceKotlinHiddenOnReferenceArgument.kt")
public void testDeprecatedSinceKotlinHiddenOnReferenceArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.kt");
}
@TestMetadata("deprecatedSinceKotlinOutsideKotlinPackage.kt")
public void testDeprecatedSinceKotlinOutsideKotlinPackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinOutsideKotlinPackage.kt");
}
@TestMetadata("deprecatedSinceKotlinWithoutArguments.kt")
public void testDeprecatedSinceKotlinWithoutArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinWithoutArguments.kt");
}
@TestMetadata("error.kt")
public void testError() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt");
}
@TestMetadata("hidden.kt")
public void testHidden() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt");
}
@TestMetadata("messageFromDeprecatedAnnotation.kt")
public void testMessageFromDeprecatedAnnotation() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/messageFromDeprecatedAnnotation.kt");
}
@TestMetadata("warning.kt")
public void testWarning() throws Exception {
runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt");
}
}
}
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature")
@@ -7969,6 +8127,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/funInterface/noCompatibilityResolveForFunInterfaces.kt");
}
@TestMetadata("prohibitFunInterfaceConstructorReferences.kt")
public void testProhibitFunInterfaceConstructorReferences() throws Exception {
runTest("compiler/testData/diagnostics/tests/funInterface/prohibitFunInterfaceConstructorReferences.kt");
}
@TestMetadata("resolveFunInterfaceWithoutMainMethod.kt")
public void testResolveFunInterfaceWithoutMainMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/funInterface/resolveFunInterfaceWithoutMainMethod.kt");
@@ -9931,6 +10094,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/commonSuperTypeOfErrorTypes.kt");
}
@TestMetadata("compatibilityResolveWhenVariableHasComplexIntersectionType.kt")
public void testCompatibilityResolveWhenVariableHasComplexIntersectionType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/compatibilityResolveWhenVariableHasComplexIntersectionType.kt");
}
@TestMetadata("completeInferenceIfManyFailed.kt")
public void testCompleteInferenceIfManyFailed() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completeInferenceIfManyFailed.kt");
@@ -9966,6 +10134,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/dependantOnVarianceNullable.kt");
}
@TestMetadata("equalitySubstitutionInsideNonInvariantType.kt")
public void testEqualitySubstitutionInsideNonInvariantType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/equalitySubstitutionInsideNonInvariantType.kt");
}
@TestMetadata("expectedTypeAdditionalTest.kt")
public void testExpectedTypeAdditionalTest() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/expectedTypeAdditionalTest.kt");
@@ -10076,6 +10249,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/intersectionTypeMultipleBoundsAsReceiver.kt");
}
@TestMetadata("intersectionTypesWithContravariantTypes.kt")
public void testIntersectionTypesWithContravariantTypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/intersectionTypesWithContravariantTypes.kt");
}
@TestMetadata("intersectionWithEnum.kt")
public void testIntersectionWithEnum() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/intersectionWithEnum.kt");
@@ -10261,6 +10439,21 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
}
@TestMetadata("returningLambdaInSuspendContext.kt")
public void testReturningLambdaInSuspendContext() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
}
@TestMetadata("simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt")
public void testSimpleLambdaInCallWithAnotherLambdaWithBuilderInference() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/simpleLambdaInCallWithAnotherLambdaWithBuilderInference.kt");
}
@TestMetadata("skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt")
public void testSkipedUnresolvedInBuilderInferenceWithStubReceiverType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/skipedUnresolvedInBuilderInferenceWithStubReceiverType.kt");
}
@TestMetadata("starApproximation.kt")
public void testStarApproximation() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
@@ -10398,6 +10591,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturedTypeWithTypeVariableSubtyping.kt");
}
@TestMetadata("capturingFromArgumentOfFlexibleType.kt")
public void testCapturingFromArgumentOfFlexibleType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/capturingFromArgumentOfFlexibleType.kt");
}
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
public void testExpectedTypeMismatchWithInVariance() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/expectedTypeMismatchWithInVariance.kt");
@@ -10491,6 +10689,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitReference.kt");
}
@TestMetadata("coercionToUnitWithNothingType.kt")
public void testCoercionToUnitWithNothingType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionToUnitWithNothingType.kt");
}
@TestMetadata("coercionWithExpectedType.kt")
public void testCoercionWithExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithExpectedType.kt");
@@ -10511,6 +10714,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coercionWithoutExpectedType.kt");
}
@TestMetadata("coerctionToUnitForATypeWithUpperBound.kt")
public void testCoerctionToUnitForATypeWithUpperBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coerctionToUnitForATypeWithUpperBound.kt");
}
@TestMetadata("coersionWithAnonymousFunctionsAndUnresolved.kt")
public void testCoersionWithAnonymousFunctionsAndUnresolved() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/coercionToUnit/coersionWithAnonymousFunctionsAndUnresolved.kt");
@@ -10818,6 +11026,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
public void testTakingExtensibilityFromDeclarationOfAnonymousFunction() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/takingExtensibilityFromDeclarationOfAnonymousFunction.kt");
}
@TestMetadata("wrongVariableFixationOrder.kt")
public void testWrongVariableFixationOrder() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/wrongVariableFixationOrder.kt");
}
@TestMetadata("wrongVariableFixationOrder2.kt")
public void testWrongVariableFixationOrder2() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/wrongVariableFixationOrder2.kt");
}
}
}
@@ -11164,6 +11382,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nothingWithCallableReference.kt");
}
@TestMetadata("nullableExpectedTypeFromVariable.kt")
public void testNullableExpectedTypeFromVariable() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/nullableExpectedTypeFromVariable.kt");
}
@TestMetadata("platformNothingAsUsefulConstraint.kt")
public void testPlatformNothingAsUsefulConstraint() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/platformNothingAsUsefulConstraint.kt");
@@ -11173,6 +11396,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
public void testReifiedParameterWithRecursiveBound() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/reifiedParameterWithRecursiveBound.kt");
}
@TestMetadata("specialCallWithMaterializeAndExpectedType.kt")
public void testSpecialCallWithMaterializeAndExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/nothingType/specialCallWithMaterializeAndExpectedType.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/inference/publicApproximation")
@@ -13631,6 +13859,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/j+k/sam/compatibilityResolveToOuterScopeForKotlinFunctions.kt");
}
@TestMetadata("conversionForDerivedGenericClass.kt")
public void testConversionForDerivedGenericClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/conversionForDerivedGenericClass.kt");
}
@TestMetadata("conversionsWithNestedGenerics.kt")
public void testConversionsWithNestedGenerics() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/conversionsWithNestedGenerics.kt");
}
@TestMetadata("enhancedSamConstructor.kt")
public void testEnhancedSamConstructor() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
@@ -13651,6 +13889,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/j+k/sam/kt37920.kt");
}
@TestMetadata("kt39630.kt")
public void testKt39630() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/kt39630.kt");
}
@TestMetadata("privateCandidatesWithWrongArguments.kt")
public void testPrivateCandidatesWithWrongArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/privateCandidatesWithWrongArguments.kt");
@@ -13661,6 +13904,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/j+k/sam/recursiveSamsAndInvoke.kt");
}
@TestMetadata("referenceToSamFunctionAgainstExpectedType.kt")
public void testReferenceToSamFunctionAgainstExpectedType() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.kt");
}
@TestMetadata("samOnTypeParameter.kt")
public void testSamOnTypeParameter() throws Exception {
runTest("compiler/testData/diagnostics/tests/j+k/sam/samOnTypeParameter.kt");
@@ -15241,6 +15489,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/oldInference.kt");
}
@TestMetadata("secondNamed.kt")
public void testSecondNamed() throws Exception {
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/secondNamed.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/namedArguments/mixedNamedPosition/simple.kt");
@@ -19523,6 +19776,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/samConversions/checkSamConversionsAreDisabledByDefault.kt");
}
@TestMetadata("conversionOnLambdaAsLastExpression.kt")
public void testConversionOnLambdaAsLastExpression() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/conversionOnLambdaAsLastExpression.kt");
}
@TestMetadata("DisabledForKTSimple.kt")
public void testDisabledForKTSimple() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/DisabledForKTSimple.kt");
@@ -19538,6 +19796,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/samConversions/GenericSubstitutionKT.kt");
}
@TestMetadata("javaMemberAgainstExtension.kt")
public void testJavaMemberAgainstExtension() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/javaMemberAgainstExtension.kt");
}
@TestMetadata("OverloadPriority.kt")
public void testOverloadPriority() throws Exception {
runTest("compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt");
@@ -21362,6 +21625,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/smartCasts/smartcastOnSameFieldOfDifferentInstances.kt");
}
@TestMetadata("smartcastToNothingAfterCheckingForNull.kt")
public void testSmartcastToNothingAfterCheckingForNull() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/smartcastToNothingAfterCheckingForNull.kt");
}
@TestMetadata("thisWithLabel.kt")
public void testThisWithLabel() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/thisWithLabel.kt");
@@ -24429,6 +24697,64 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
}
}
@TestMetadata("compiler/testData/diagnostics/tests/unitConversion")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class UnitConversion extends AbstractFirOldFrontendDiagnosticsTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInUnitConversion() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/unitConversion"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("chainedFunSuspendUnitConversion.kt")
public void testChainedFunSuspendUnitConversion() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/chainedFunSuspendUnitConversion.kt");
}
@TestMetadata("chainedFunUnitConversion.kt")
public void testChainedFunUnitConversion() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/chainedFunUnitConversion.kt");
}
@TestMetadata("chainedUnitSuspendConversion.kt")
public void testChainedUnitSuspendConversion() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/chainedUnitSuspendConversion.kt");
}
@TestMetadata("noUnitConversionForGenericTypeFromArrow.kt")
public void testNoUnitConversionForGenericTypeFromArrow() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/noUnitConversionForGenericTypeFromArrow.kt");
}
@TestMetadata("noUnitConversionOnReturningGenericFunctionalType.kt")
public void testNoUnitConversionOnReturningGenericFunctionalType() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/noUnitConversionOnReturningGenericFunctionalType.kt");
}
@TestMetadata("unitConversionCompatibility.kt")
public void testUnitConversionCompatibility() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionCompatibility.kt");
}
@TestMetadata("unitConversionDisabledForSimpleArguments.kt")
public void testUnitConversionDisabledForSimpleArguments() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionDisabledForSimpleArguments.kt");
}
@TestMetadata("unitConversionForAllKinds.kt")
public void testUnitConversionForAllKinds() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionForAllKinds.kt");
}
@TestMetadata("unitConversionForSubtypes.kt")
public void testUnitConversionForSubtypes() throws Exception {
runTest("compiler/testData/diagnostics/tests/unitConversion/unitConversionForSubtypes.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/varargs")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -24491,6 +24817,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
runTest("compiler/testData/diagnostics/tests/varargs/assigningSingleElementsInNamedFormFunDeprecation_before.kt");
}
@TestMetadata("inferredNullableArrayAsVararg.kt")
public void testInferredNullableArrayAsVararg() throws Exception {
runTest("compiler/testData/diagnostics/tests/varargs/inferredNullableArrayAsVararg.kt");
}
@TestMetadata("kt1781.kt")
public void testKt1781() throws Exception {
runTest("compiler/testData/diagnostics/tests/varargs/kt1781.kt");

View File

@@ -561,6 +561,52 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
public void testTarget8() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/target8.kt");
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class AllCompatibility extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInAllCompatibility() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("specialization.kt")
public void testSpecialization() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility/specialization.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class JvmDefaultWithoutCompatibility extends AbstractFirOldFrontendDiagnosticsTestWithStdlib {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInJvmDefaultWithoutCompatibility() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@TestMetadata("target6.kt")
public void testTarget6() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target6.kt");
}
@TestMetadata("target8.kt")
public void testTarget8() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8.kt");
}
@TestMetadata("target8Disabled.kt")
public void testTarget8Disabled() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultWithoutCompatibility/target8Disabled.kt");
}
}
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField")
@@ -1835,6 +1881,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/testsWithStdLib/factoryPattern/overloadByLambdaReturnType_enabled_no_annotation.kt");
}
@TestMetadata("referenceWithTheSameNameAsContainingProperty.kt")
public void testReferenceWithTheSameNameAsContainingProperty() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/factoryPattern/referenceWithTheSameNameAsContainingProperty.kt");
}
@TestMetadata("resolutionInOldInference.kt")
public void testResolutionInOldInference() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/factoryPattern/resolutionInOldInference.kt");

View File

@@ -93,7 +93,13 @@ class FirJvmSerializerExtension @JvmOverloads constructor(
writeVersionRequirementForJvmDefaultIfNeeded(klass, proto, versionRequirementTable)
if (jvmDefaultMode.forAllMethodsWithBody && klass is FirRegularClass && klass.classKind == ClassKind.INTERFACE) {
proto.setExtension(JvmProtoBuf.jvmClassFlags, JvmFlags.getClassFlags(true))
proto.setExtension(
JvmProtoBuf.jvmClassFlags,
JvmFlags.getClassFlags(
jvmDefaultMode.forAllMethodsWithBody,
JvmDefaultMode.ALL_COMPATIBILITY == jvmDefaultMode
)
)
}
}

View File

@@ -1284,9 +1284,9 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/boxingOptimization/kt6842.kt");
}
@TestMetadata("maxMinBy.kt")
public void testMaxMinBy() throws Exception {
runTest("compiler/testData/codegen/box/boxingOptimization/maxMinBy.kt");
@TestMetadata("maxMinByOrNull.kt")
public void testMaxMinByOrNull() throws Exception {
runTest("compiler/testData/codegen/box/boxingOptimization/maxMinByOrNull.kt");
}
@TestMetadata("nullCheck.kt")
@@ -1707,6 +1707,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
public void testLackOfNullCheckOnNullableInsideBuild() throws Exception {
runTest("compiler/testData/codegen/box/builderInference/lackOfNullCheckOnNullableInsideBuild.kt");
}
@TestMetadata("substituteStubTypeIntoCR.kt")
public void testSubstituteStubTypeIntoCR() throws Exception {
runTest("compiler/testData/codegen/box/builderInference/substituteStubTypeIntoCR.kt");
}
@TestMetadata("substituteStubTypeIntolambdaParameterDescriptor.kt")
public void testSubstituteStubTypeIntolambdaParameterDescriptor() throws Exception {
runTest("compiler/testData/codegen/box/builderInference/substituteStubTypeIntolambdaParameterDescriptor.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/builtinStubMethods")
@@ -2090,6 +2100,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/noReflectionForAdaptedCallableReferencesWithSuspendConversion.kt");
}
@TestMetadata("referenceToVarargWithDefaults.kt")
public void testReferenceToVarargWithDefaults() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/referenceToVarargWithDefaults.kt");
}
@TestMetadata("reflectionForVarargAsArray.kt")
public void testReflectionForVarargAsArray() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/adaptedReferences/reflectionForVarargAsArray.kt");
@@ -2685,6 +2700,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/callableReference/function/privateClassMember.kt");
}
@TestMetadata("referenceToCompanionMember.kt")
public void testReferenceToCompanionMember() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/referenceToCompanionMember.kt");
}
@TestMetadata("sortListOfStrings.kt")
public void testSortListOfStrings() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/sortListOfStrings.kt");
@@ -5097,9 +5117,9 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/contracts/exception.kt");
}
@TestMetadata("field.kt")
public void testField() throws Exception {
runTest("compiler/testData/codegen/box/contracts/field.kt");
@TestMetadata("fieldReadInConstructor.kt")
public void testFieldReadInConstructor() throws Exception {
runTest("compiler/testData/codegen/box/contracts/fieldReadInConstructor.kt");
}
@TestMetadata("forLoop.kt")
@@ -5117,6 +5137,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");
}
@TestMetadata("listAppend.kt")
public void testListAppend() throws Exception {
runTest("compiler/testData/codegen/box/contracts/listAppend.kt");
}
@TestMetadata("valInWhen.kt")
public void testValInWhen() throws Exception {
runTest("compiler/testData/codegen/box/contracts/valInWhen.kt");
@@ -9567,6 +9592,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt");
}
@TestMetadata("genericProvideDelegateOnNumberLiteral.kt")
public void testGenericProvideDelegateOnNumberLiteral() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericProvideDelegateOnNumberLiteral.kt");
}
@TestMetadata("hostCheck.kt")
public void testHostCheck() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt");
@@ -10366,6 +10396,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/enum/kt2350.kt");
}
@TestMetadata("kt38996.kt")
public void testKt38996() throws Exception {
runTest("compiler/testData/codegen/box/enum/kt38996.kt");
}
@TestMetadata("kt7257.kt")
public void testKt7257() throws Exception {
runTest("compiler/testData/codegen/box/enum/kt7257.kt");
@@ -11200,6 +11235,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversion.kt");
}
@TestMetadata("basicFunInterfaceConversionClash.kt")
public void testBasicFunInterfaceConversionClash() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/basicFunInterfaceConversionClash.kt");
}
@TestMetadata("castFromAny.kt")
public void testCastFromAny() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/castFromAny.kt");
@@ -11235,6 +11275,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/funInterface/multimodule.kt");
}
@TestMetadata("nonAbstractMethod.kt")
public void testNonAbstractMethod() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/nonAbstractMethod.kt");
}
@TestMetadata("nullableSam.kt")
public void testNullableSam() throws Exception {
runTest("compiler/testData/codegen/box/funInterface/nullableSam.kt");
@@ -12325,6 +12370,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("approximateNonTopLevelCapturedTypes.kt")
public void testApproximateNonTopLevelCapturedTypes() throws Exception {
runTest("compiler/testData/codegen/box/inference/approximateNonTopLevelCapturedTypes.kt");
}
@TestMetadata("builderInference.kt")
public void testBuilderInference() throws Exception {
runTest("compiler/testData/codegen/box/inference/builderInference.kt");
@@ -12385,6 +12435,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inference/lastExpressionOfLambdaWithNothingConstraint.kt");
}
@TestMetadata("noNothingValueInsideSpecialCall.kt")
public void testNoNothingValueInsideSpecialCall() throws Exception {
runTest("compiler/testData/codegen/box/inference/noNothingValueInsideSpecialCall.kt");
}
@TestMetadata("plusAssignInsideLambda.kt")
public void testPlusAssignInsideLambda() throws Exception {
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
}
@TestMetadata("unsafeVarianceCodegen.kt")
public void testUnsafeVarianceCodegen() throws Exception {
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
@@ -13023,6 +13083,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/noReturnTypeMangling.kt");
}
@TestMetadata("noReturnTypeManglingJvmName.kt")
public void testNoReturnTypeManglingJvmName() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/noReturnTypeManglingJvmName.kt");
}
@TestMetadata("nullableEqeqNonNull.kt")
public void testNullableEqeqNonNull() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/nullableEqeqNonNull.kt");
@@ -14487,6 +14552,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
public void testTostring() throws Exception {
runTest("compiler/testData/codegen/box/intrinsics/tostring.kt");
}
@TestMetadata("trimMarginWithBlankString.kt")
public void testTrimMarginWithBlankString() throws Exception {
runTest("compiler/testData/codegen/box/intrinsics/trimMarginWithBlankString.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/ir")
@@ -14501,6 +14571,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/ir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("anonymousClassLeak.kt")
public void testAnonymousClassLeak() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousClassLeak.kt");
}
@TestMetadata("anonymousObjectInForLoopIteratorAndBody.kt")
public void testAnonymousObjectInForLoopIteratorAndBody() throws Exception {
runTest("compiler/testData/codegen/box/ir/anonymousObjectInForLoopIteratorAndBody.kt");
@@ -14551,6 +14626,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/ir/kt29833.kt");
}
@TestMetadata("kt40083.kt")
public void testKt40083() throws Exception {
runTest("compiler/testData/codegen/box/ir/kt40083.kt");
}
@TestMetadata("objectClass.kt")
public void testObjectClass() throws Exception {
runTest("compiler/testData/codegen/box/ir/objectClass.kt");
@@ -15268,6 +15348,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/jvm8/defaults/kt14243_prop.kt");
}
@TestMetadata("kt40920.kt")
public void testKt40920() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/kt40920.kt");
}
@TestMetadata("oneImplementation.kt")
public void testOneImplementation() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/oneImplementation.kt");
@@ -15400,6 +15485,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/defaultArgsViaAnonymousObject.kt");
}
@TestMetadata("funInterface.kt")
public void testFunInterface() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/funInterface.kt");
}
@TestMetadata("inheritedFunctionWithDefaultParameters.kt")
public void testInheritedFunctionWithDefaultParameters() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/allCompatibility/inheritedFunctionWithDefaultParameters.kt");
@@ -15657,6 +15747,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/defaultArgsViaAnonymousObject.kt");
}
@TestMetadata("funInterface.kt")
public void testFunInterface() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/funInterface.kt");
}
@TestMetadata("inheritedFunctionWithDefaultParameters.kt")
public void testInheritedFunctionWithDefaultParameters() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/inheritedFunctionWithDefaultParameters.kt");
@@ -15682,6 +15777,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt14243_2.kt");
}
@TestMetadata("kt40920.kt")
public void testKt40920() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/kt40920.kt");
}
@TestMetadata("privateFunInInterface.kt")
public void testPrivateFunInInterface() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/privateFunInInterface.kt");
@@ -15719,6 +15819,24 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/delegationBy/simpleProperty.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/specialization")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Specialization extends AbstractFirBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTestWithCustomIgnoreDirective(this::doTest, TargetBackend.JVM_IR, testDataFilePath, "// IGNORE_BACKEND_FIR: ");
}
public void testAllFilesPresentInSpecialization() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/specialization"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("basic.kt")
public void testBasic() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/defaults/noDefaultImpls/specialization/basic.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/jvm8/defaults/noDelegation")
@@ -15843,6 +15961,26 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/invokeDefaultViaSuper.kt");
}
@TestMetadata("kt40920.kt")
public void testKt40920() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920.kt");
}
@TestMetadata("kt40920_java.kt")
public void testKt40920_java() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java.kt");
}
@TestMetadata("kt40920_java2.kt")
public void testKt40920_java2() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_java2.kt");
}
@TestMetadata("kt40920_map.kt")
public void testKt40920_map() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt");
}
@TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault.kt")
public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/javaDefaults/longChainOfKotlinExtendsFromJavaWithDefault.kt");
@@ -26033,6 +26171,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/mapping/types"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("allSupertypes.kt")
public void testAllSupertypes() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/allSupertypes.kt");
}
@TestMetadata("annotationConstructorParameters.kt")
public void testAnnotationConstructorParameters() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt");
@@ -26048,6 +26191,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/reflection/mapping/types/constructors.kt");
}
@TestMetadata("createType.kt")
public void testCreateType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/createType.kt");
}
@TestMetadata("genericArrayElementType.kt")
public void testGenericArrayElementType() throws Exception {
runTest("compiler/testData/codegen/box/reflection/mapping/types/genericArrayElementType.kt");

View File

@@ -113,6 +113,10 @@ class FirJavaConstructor @FirImplementationDetail constructor(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirConstructor {
return this
}
override var containerSource: DeserializedContainerSource? = null
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {

View File

@@ -6,10 +6,8 @@
package org.jetbrains.kotlin.fir
import com.intellij.openapi.util.Disposer
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys.CONTENT_ROOTS
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY
import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
@@ -17,9 +15,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.TestJdkKind
import java.io.FileOutputStream
import java.io.PrintStream
import kotlin.system.measureNanoTime
@@ -87,7 +82,7 @@ class NonFirResolveModularizedTotalKotlinTest : AbstractModularizedTest() {
}
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
if (location != null)
print(location.toString())
print(":")

View File

@@ -84,7 +84,6 @@ private class FirCallArgumentsProcessor(private val function: FirFunction<*>) {
if (state == State.VARARG_POSITION) {
completeVarargPositionArguments()
}
state = State.NAMED_ONLY_ARGUMENTS
processNamedArgument(argument, argumentName)
}
@@ -125,6 +124,8 @@ private class FirCallArgumentsProcessor(private val function: FirFunction<*>) {
addDiagnostic(NamedArgumentNotAllowed(argument, function))
}
val stateAllowsMixedNamedAndPositionArguments = state != State.NAMED_ONLY_ARGUMENTS
state = State.NAMED_ONLY_ARGUMENTS
val parameter = findParameterByName(argument, name) ?: return
result[parameter]?.let {
@@ -134,7 +135,7 @@ private class FirCallArgumentsProcessor(private val function: FirFunction<*>) {
result[parameter] = ResolvedCallArgument.SimpleArgument(argument)
if (parameters.getOrNull(currentPositionedParameterIndex) == parameter) {
if (stateAllowsMixedNamedAndPositionArguments && parameters.getOrNull(currentPositionedParameterIndex) == parameter) {
state = State.POSITION_ARGUMENTS
currentPositionedParameterIndex++
}

View File

@@ -99,7 +99,13 @@ class FirCallCompletionResultsWriterTransformer(
data: ExpectedArgumentType?,
): CompositeTransformResult<FirStatement> {
val calleeReference = qualifiedAccessExpression.calleeReference as? FirNamedReferenceWithCandidate
?: return qualifiedAccessExpression.compose()
?: return run {
if (mode == Mode.DelegatedPropertyCompletion) {
val typeUpdater = TypeUpdaterForDelegateArguments()
qualifiedAccessExpression.transformSingle(typeUpdater, null)
}
qualifiedAccessExpression.compose()
}
val result = prepareQualifiedTransform(qualifiedAccessExpression, calleeReference)
.transformExplicitReceiver(integerApproximator, null)
val typeRef = result.typeRef as FirResolvedTypeRef

View File

@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.fir.resolve.ResolutionMode
import org.jetbrains.kotlin.fir.resolve.ScopeSession
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.transformers.*
import org.jetbrains.kotlin.fir.resolve.transformers.TransformImplicitType
import org.jetbrains.kotlin.fir.resolve.transformers.contracts.runContractResolveForLocalClass
import org.jetbrains.kotlin.fir.symbols.impl.FirAccessorSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
@@ -86,9 +85,9 @@ fun <F : FirClass<F>> F.runContractAndBodiesResolutionForLocalClass(
components.session, components.scopeSession,
implicitBodyResolveComputationSession,
FirResolvePhase.BODY_RESOLVE,
outerBodyResolveContext = newContext,
implicitTypeOnly = false,
returnTypeCalculator
returnTypeCalculator,
outerBodyResolveContext = newContext
)
val graphBuilder = components.context.dataFlowAnalyzerContext.graphBuilder

View File

@@ -108,7 +108,6 @@ class FirIntegerOperator @FirImplementationDetail constructor(
FirDeclarationOrigin.Synthetic,
returnTypeRef,
receiverTypeRef,
typeParameters = mutableListOf(),
valueParameters = mutableListOf(),
body = null,
status,
@@ -117,6 +116,7 @@ class FirIntegerOperator @FirImplementationDetail constructor(
kind.operatorName,
symbol,
annotations = mutableListOf(),
typeParameters = mutableListOf(),
) {
enum class Kind(val unary: Boolean, val operatorName: Name) {
PLUS(false, OperatorNameConventions.PLUS),

View File

@@ -64,4 +64,6 @@ abstract class FirAnonymousFunction : FirFunction<FirAnonymousFunction>, FirExpr
abstract override fun <D> transformControlFlowGraphReference(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirAnonymousFunction
}

View File

@@ -64,4 +64,6 @@ abstract class FirConstructor : FirPureAbstractElement(), FirFunction<FirConstru
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirConstructor
abstract fun <D> transformDelegatedConstructor(transformer: FirTransformer<D>, data: D): FirConstructor
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirConstructor
}

View File

@@ -57,4 +57,6 @@ abstract class FirErrorFunction : FirPureAbstractElement(), FirFunction<FirError
abstract override fun <D> transformControlFlowGraphReference(transformer: FirTransformer<D>, data: D): FirErrorFunction
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirErrorFunction
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirErrorFunction
}

View File

@@ -55,4 +55,6 @@ interface FirFunction<F : FirFunction<F>> : FirCallableDeclaration<F>, FirTarget
fun <D> transformControlFlowGraphReference(transformer: FirTransformer<D>, data: D): FirFunction<F>
fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirFunction<F>
fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirFunction<F>
}

View File

@@ -60,6 +60,8 @@ abstract class FirPropertyAccessor : FirPureAbstractElement(), FirFunction<FirPr
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
abstract override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirPropertyAccessor
abstract fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirPropertyAccessor

View File

@@ -62,6 +62,8 @@ abstract class FirSimpleFunction : FirPureAbstractElement(), FirFunction<FirSimp
abstract override fun <D> transformValueParameters(transformer: FirTransformer<D>, data: D): FirSimpleFunction
abstract override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirSimpleFunction
abstract override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirSimpleFunction
abstract override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirSimpleFunction

View File

@@ -69,7 +69,7 @@ internal class FirAnonymousFunctionImpl(
transformReceiverTypeRef(transformer, data)
transformControlFlowGraphReference(transformer, data)
transformValueParameters(transformer, data)
body = body?.transformSingle(transformer, data)
transformBody(transformer, data)
typeRef = typeRef.transformSingle(transformer, data)
label = label?.transformSingle(transformer, data)
typeParameters.transformInplace(transformer, data)
@@ -101,6 +101,11 @@ internal class FirAnonymousFunctionImpl(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirAnonymousFunctionImpl {
body = body?.transformSingle(transformer, data)
return this
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
resolvePhase = newResolvePhase
}

View File

@@ -74,7 +74,7 @@ internal class FirConstructorImpl(
transformStatus(transformer, data)
transformAnnotations(transformer, data)
transformDelegatedConstructor(transformer, data)
body = body?.transformSingle(transformer, data)
transformBody(transformer, data)
return this
}
@@ -113,6 +113,11 @@ internal class FirConstructorImpl(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirConstructorImpl {
body = body?.transformSingle(transformer, data)
return this
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
resolvePhase = newResolvePhase
}

View File

@@ -90,6 +90,10 @@ internal class FirErrorFunctionImpl(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirErrorFunctionImpl {
return this
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
resolvePhase = newResolvePhase
}

View File

@@ -74,7 +74,7 @@ internal class FirPrimaryConstructor(
transformStatus(transformer, data)
transformAnnotations(transformer, data)
transformDelegatedConstructor(transformer, data)
body = body?.transformSingle(transformer, data)
transformBody(transformer, data)
return this
}
@@ -113,6 +113,11 @@ internal class FirPrimaryConstructor(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPrimaryConstructor {
body = body?.transformSingle(transformer, data)
return this
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
resolvePhase = newResolvePhase
}

View File

@@ -69,7 +69,7 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor(
transformReturnTypeRef(transformer, data)
transformControlFlowGraphReference(transformer, data)
transformValueParameters(transformer, data)
body = body?.transformSingle(transformer, data)
transformBody(transformer, data)
transformContractDescription(transformer, data)
transformStatus(transformer, data)
transformAnnotations(transformer, data)
@@ -96,6 +96,11 @@ open class FirPropertyAccessorImpl @FirImplementationDetail constructor(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPropertyAccessorImpl {
body = body?.transformSingle(transformer, data)
return this
}
override fun <D> transformContractDescription(transformer: FirTransformer<D>, data: D): FirPropertyAccessorImpl {
contractDescription = contractDescription.transformSingle(transformer, data)
return this

View File

@@ -72,7 +72,7 @@ open class FirSimpleFunctionImpl @FirImplementationDetail constructor(
transformReceiverTypeRef(transformer, data)
transformControlFlowGraphReference(transformer, data)
transformValueParameters(transformer, data)
body = body?.transformSingle(transformer, data)
transformBody(transformer, data)
transformStatus(transformer, data)
transformContractDescription(transformer, data)
transformAnnotations(transformer, data)
@@ -100,6 +100,11 @@ open class FirSimpleFunctionImpl @FirImplementationDetail constructor(
return this
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirSimpleFunctionImpl {
body = body?.transformSingle(transformer, data)
return this
}
override fun <D> transformStatus(transformer: FirTransformer<D>, data: D): FirSimpleFunctionImpl {
status = status.transformSingle(transformer, data)
return this

View File

@@ -109,6 +109,10 @@ class FirSyntheticPropertyAccessor(
throw AssertionError("Transformation of synthetic property accessor isn't supported")
}
override fun <D> transformBody(transformer: FirTransformer<D>, data: D): FirPropertyAccessor {
throw AssertionError("Transformation of synthetic property accessor isn't supported")
}
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
throw AssertionError("Mutation of synthetic property accessor isn't supported")
}

View File

@@ -27,7 +27,7 @@ dependencies {
Platform[192].orHigher {
runtimeOnly(intellijCoreDep()) { includeJars("jdom") }
}
implementation(kotlin("reflect"))
implementation(project(":kotlin-reflect"))
}
val writeCopyright by task<WriteCopyrightToFile> {

View File

@@ -100,7 +100,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+controlFlowGraphReferenceField
+symbol("FirFunctionSymbol", "F")
+fieldList(valueParameter, withReplace = true).withTransform()
+body(nullable = true)
+body(nullable = true).withTransform()
}
errorFunction.configure {

View File

@@ -42,6 +42,7 @@ import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinderFactory
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.calls.tower.ImplicitsExtensionsResolutionFilter
import org.jetbrains.kotlin.resolve.jvm.JavaDescriptorResolver
import org.jetbrains.kotlin.resolve.jvm.JvmDiagnosticComponents
import org.jetbrains.kotlin.resolve.jvm.multiplatform.OptionalAnnotationPackageFragmentProvider
@@ -63,7 +64,8 @@ fun createContainerForLazyResolveWithJava(
languageVersionSettings: LanguageVersionSettings,
useBuiltInsProvider: Boolean,
configureJavaClassFinder: (StorageComponentContainer.() -> Unit)? = null,
javaClassTracker: JavaClassesTracker? = null
javaClassTracker: JavaClassesTracker? = null,
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null,
): StorageComponentContainer = createContainer("LazyResolveWithJava", JvmPlatformAnalyzerServices) {
configureModule(moduleContext, jvmPlatform, JvmPlatformAnalyzerServices, bindingTrace, languageVersionSettings)
@@ -73,6 +75,7 @@ fun createContainerForLazyResolveWithJava(
useInstance(moduleContentScope)
useInstance(packagePartProvider)
useInstance(declarationProviderFactory)
useInstanceIfNotNull(implicitsResolutionFilter)
useInstance(VirtualFileFinderFactory.getInstance(moduleContext.project).create(moduleContentScope))

View File

@@ -29,7 +29,6 @@ import org.jetbrains.kotlin.load.java.lazy.ModuleClassResolverImpl
import org.jetbrains.kotlin.load.java.structure.JavaClass
import org.jetbrains.kotlin.load.kotlin.PackagePartProvider
import org.jetbrains.kotlin.platform.jvm.isJvm
import org.jetbrains.kotlin.platform.jvm.isJvm
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.resolve.TargetEnvironment
@@ -39,7 +38,9 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
class JvmPlatformParameters(
val packagePartProviderFactory: (ModuleContent<*>) -> PackagePartProvider,
val moduleByJavaClass: (JavaClass) -> ModuleInfo?
val moduleByJavaClass: (JavaClass) -> ModuleInfo?,
// params: referenced module info of target class, context module info of current resolver
val resolverForReferencedModule: ((ModuleInfo, ModuleInfo) -> ResolverForModule?)? = null,
) : PlatformAnalysisParameters
@@ -64,13 +65,22 @@ class JvmResolverForModuleFactory(
)
val moduleClassResolver = ModuleClassResolverImpl { javaClass ->
val referencedClassModule = (platformParameters as JvmPlatformParameters).moduleByJavaClass(javaClass)
// We don't have full control over idea resolve api so we allow for a situation which should not happen in Kotlin.
// For example, type in a java library can reference a class declared in a source root (is valid but rare case)
// Providing a fallback strategy in this case can hide future problems, so we should at least log to be able to diagnose those
val referencedClassModule = platformParameters.moduleByJavaClass(javaClass)
// A type in a java library can reference a class declared in a source root (is valid but rare case).
// Resolving such a class with Kotlin resolver for libraries is guaranteed to fail, as libraries can't
// have dependencies on the source roots. The chain of resolvers (sources -> libraries -> sdk) exists to prevent
// potentially slow repetitive analysis of the same libraries after modifications in sources. The only way to mitigate
// this restriction currently is to manually configure resolution anchors for known source-dependent libraries in a project.
// See also KT-24309
@Suppress("UNCHECKED_CAST")
val resolverForReferencedModule = referencedClassModule?.let { resolverForProject.tryGetResolverForModule(it as M) }
val resolverForReferencedModule = referencedClassModule?.let { referencedModuleInfo ->
if (platformParameters.resolverForReferencedModule != null) {
platformParameters.resolverForReferencedModule.invoke(referencedModuleInfo, moduleInfo)
} else {
resolverForProject.tryGetResolverForModule(referencedModuleInfo as M)
}
}
val resolverForModule = resolverForReferencedModule?.takeIf {
referencedClassModule.platform.isJvm() || referencedClassModule.platform == null
@@ -110,12 +120,12 @@ class JvmResolverForModuleFactory(
)
providersForModule +=
PackageFragmentProviderExtension.getInstances(project)
.mapNotNull {
it.getPackageFragmentProvider(
project, moduleDescriptor, moduleContext.storageManager, trace, moduleInfo, lookupTracker
)
}
PackageFragmentProviderExtension.getInstances(project)
.mapNotNull {
it.getPackageFragmentProvider(
project, moduleDescriptor, moduleContext.storageManager, trace, moduleInfo, lookupTracker
)
}
return ResolverForModule(CompositePackageFragmentProvider(providersForModule), container)
}

View File

@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.resolve.jvm.annotations
import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.annotations.Annotated
@@ -19,6 +20,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
val JVM_DEFAULT_FQ_NAME = FqName("kotlin.jvm.JvmDefault")
val JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME = FqName("kotlin.jvm.JvmDefaultWithoutCompatibility")
val JVM_OVERLOADS_FQ_NAME = FqName("kotlin.jvm.JvmOverloads")
val JVM_SYNTHETIC_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmSynthetic")
@@ -64,6 +66,10 @@ fun CallableMemberDescriptor.isCompiledToJvmDefault(jvmDefault: JvmDefaultMode):
fun CallableMemberDescriptor.hasJvmDefaultAnnotation(): Boolean =
DescriptorUtils.getDirectMember(this).annotations.hasAnnotation(JVM_DEFAULT_FQ_NAME)
fun DeclarationDescriptor.hasJvmDefaultNoCompatibilityAnnotation(): Boolean =
this.annotations.hasAnnotation(JVM_DEFAULT_NO_COMPATIBILITY_FQ_NAME)
fun CallableMemberDescriptor.hasPlatformDependentAnnotation(): Boolean =
DescriptorUtils.getDirectMember(this).annotations.hasAnnotation(PLATFORM_DEPENDENT_ANNOTATION_FQ_NAME)

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