Compare commits

...

369 Commits

Author SHA1 Message Date
Mikhail Glukhikh
6381b3b151 Add Docs & Examples issues to Changelog 2019-04-11 10:33:18 +03:00
nikita.movshin
7c7da5498e Add changelog for eap4 2019-04-10 21:28:55 +03:00
Yan Zhulanow
384fe15a8e Debugger: Assume a class name from the coroutine metadata may be invalid (KT-30934) 2019-04-10 21:17:02 +03:00
Stanislav Erokhin
6319f56464 Revert "Fix wrong state-machine generation if inner object is retransformed"
This reverts commit 571c204499.
2019-04-10 21:05:47 +03:00
Stanislav Erokhin
e975f6f916 Revert "Regenerate anonymous object if call site of non-inlineable"
This reverts commit 321a197d81.
2019-04-10 21:05:25 +03:00
Juan Chen
857c0b5597 Fix SAM_WITH_RECEIVER_PLUGIN_NAME.
SAM_WITH_RECEIVER_PLUGIN_NAME in PathUtil was accidentally broken by
4c751cdd52 (diff-819dacd07c45ba85ba5459d8a09418daR34)

(cherry picked from commit f489a47025)
2019-04-10 14:59:04 +02:00
Ilya Matveev
02144498f1 Update Kotlin/Native: 1.2 2019-04-10 12:57:00 +07:00
Anton Bannykh
681e8dd968 JS: switch off inlined local declaration deduplication (KT-30877 fixed) 2019-04-08 14:31:56 +03:00
Alexander Podkhalyuzin
7025adeaea Fixed DSL Marker icon
#KT-30470 Fixed

(cherry picked from commit 1fbbd71085)
2019-04-04 19:27:33 +03:00
Ilya Matveev
0423d49ef2 Update Kotlin/Native: 1.2-eap-9319 2019-04-04 21:35:23 +07:00
Andrey Uskov
91699471b9 Optimize memory usage during import of MPP projects
#KT-30767 Fixed

(cherry picked from commit 792fae4afc)
2019-04-03 19:22:28 +03:00
Sergey Igushkin
8372e917ef Fix Java sources inspected too early in Android variants (KT-30735)
The Android Gradle plugin can set Java sources after a variant is
created, similar to AP options. We need to inspect the Java sources
only from at `afterEvaluate` time.

Issue #KT-30735 Fixed

(cherry picked from commit e23b74792d)
2019-04-03 18:03:46 +03:00
Yan Zhulanow
1ae93dea56 Async stack traces: fix compatibility with kotlin-stdlib 1.2.70 (KT-30611) 2019-04-03 16:36:07 +03:00
Yan Zhulanow
4ea3aa2a0a 191: Fix test running for common modules in MPP/Gradle (KT-29908) 2019-04-03 16:36:07 +03:00
Yan Zhulanow
5184f35165 191: Update target IntelliJ SDK version to 191.6183 2019-04-03 16:36:06 +03:00
Ilya Gorbunov
03a5c26060 Fix wording in Random.nextInt/Long/UInt/ULong docs
#KT-30704 Fixed

(cherry picked from commit d77f76bdb0)
2019-04-03 16:24:53 +03:00
Ilya Matveev
7fa7e61f0a Configure CocoaPods plugin to be published at the plugin portal 2019-04-03 19:48:33 +07:00
Vyacheslav Gerasimov
7cf5c28560 Build: Fix upload_plugins.gradle broken after migration to gradle 5.0
`<< {` syntax is removed since gradle 5.0

(cherry picked from commit 394031a183)
2019-04-03 11:06:04 +03:00
Ilya Matveev
6f90e9bb08 Update Kotlin/Native: 1.2-eap-9273 2019-04-03 13:10:28 +07:00
Ilya Matveev
54d75fb73b Gradle plugin: Enable missing mingw_x86 target for K/N 2019-04-03 13:05:26 +07:00
Alexander Gorshenev
897d51796f Grab constructor call type parameters from its class, not from the contructor
(cherry picked from commit 4332ce9884)
2019-04-02 20:02:50 +03:00
Ilya Chernikov
419a22c1d2 Avoid warning about scripting subplugin for MPP project
Temporary solution, the subplugin should be adapted to the new MPP
#KT-30742 fixed
2019-04-02 14:05:29 +02:00
Leonid Startsev
45d2662821 Insert correct dispatch receivers and type arguments for expression inside generated by plugin IR functions 2019-04-01 18:50:31 +03:00
Alexander Podkhalyuzin
2782813ef9 Use indexes instead of slow directory search for script dependencies
#KT-30018 Comment

(cherry picked from commit 742ffb98ad)
2019-04-01 18:37:18 +03:00
Ilmir Usmanov
396d748ef4 Generate inline site's file name in metadata
Otherwise, stacktraces will have invalid file name (declaration site).
 #KT-30508 Fixed
2019-04-01 18:14:33 +03:00
Ilya Chernikov
369fdebbfb Make createClassLikeInfo method deprecation level - error
so it could be fixed quicker on the use sites
2019-04-01 17:12:23 +02:00
Ilya Chernikov
bce9b9c203 Revert createClassLikeInfo method signature change, depreceate it ...
instead and make alternative method for refactored usages.
Should fix compatibility with the Spek framework plugin.
2019-04-01 17:00:38 +02:00
Ilmir Usmanov
321a197d81 Regenerate anonymous object if call site of non-inlineable
functional argument is suspend
Split LambdaInfo into inlineable and non-inlineable
 #KT-26925
2019-04-01 16:50:35 +03:00
Ilmir Usmanov
571c204499 Fix wrong state-machine generation if inner object is retransformed
during inlining.
 #KT-29492 Fixed
2019-04-01 16:50:33 +03:00
Natalia Selezneva
533f5012a5 Do not call FileEditorManager.getSelectedEditor outside UI thread (KT-30130)
^KT-30130 Fixed
2019-04-01 10:19:22 +03:00
Ilya Chernikov
505b219b5f Apply scripting subplugin in gradle mpp plugin, so scripts could be added to mpp sources
#KT-30679 fixed
2019-03-29 11:21:25 +01:00
Ilya Chernikov
eb7ef5a8b2 Fix scripts discovery in IDEA after adding optional marker extension 2019-03-28 13:54:01 +01:00
Ilya Matveev
ffc27b0bc6 Update Kotlin/Native: 1.2-eap-9117 2019-03-28 00:07:16 +07:00
nikita.movshin
bfe9d5d0bb Update Changelog.md for 1.3.30-eap3 2019-03-27 14:36:57 +03:00
Nikolay Krasko
28c95272e2 Hide concrete classes for Kotlin nodes to avoid more compatibility problems 2019-03-27 12:12:37 +03:00
Nikolay Krasko
c026097bb6 Minor: cleanup and remove outdated TODOs 2019-03-27 12:12:23 +03:00
Sergey Igushkin
39eee9c0af Fix Android AP in Kapt (KT-30632), run Android Kapt IT with AGP 3.3.2
Fixes a bug introduced by the commit 6fa610156e, which led to Kapt
options being imported from Android AP options too early (immediately at
creation time for each Android variant, while the Android plugin added
the options only afterwards).

Move Android subplugin options configuration to the time & scope where
it was prior to 6fa610156e.
2019-03-27 11:15:35 +03:00
Nikolay Krasko
a9c28ab4f1 Use xmlId for fetching release date (KT-30388) 2019-03-27 11:15:01 +03:00
Nikolay Krasko
2452558ba3 Additional checks for listed and approve in fetching release date (KT-30388) 2019-03-27 11:14:41 +03:00
Nikolay Krasko
75bf9ef0be Rename action for throwing exception from Kotlin plugin
Make the name similar to other internal actions for throwing exceptions.
2019-03-27 11:13:51 +03:00
Natalia Selezneva
36d2d6607c Fix compilation for 1.3.30 2019-03-27 09:40:01 +03:00
Natalia Selezneva
e0792394cc Run indexing for new script dependencies if they are updated from notification 2019-03-26 23:52:11 +03:00
Natalia Selezneva
2302967bfb Fix NoSuchElementException editing script file
^KT-30440 Fixed
2019-03-26 23:51:30 +03:00
Natalia Selezneva
b8d573b6f4 Fix warning in scripts that dependencies are not available
^KT-30441 Fixed
2019-03-26 23:50:14 +03:00
Alexander Podkhalyuzin
44d1e81c73 Do not call find editor outside UI thread
#KT-30117 Fixed

(cherry picked from commit 37de9a0a26)
2019-03-26 18:24:44 +03:00
Alexander Podkhalyuzin
86500b52e4 Fixed selection in case of empty class body
#KT-30597 Fixed

(cherry picked from commit 19f6290686)
2019-03-26 18:24:09 +03:00
Abduqodiri Qurbonzoda
e88814ff26 Replace "binary representation of" with "bits of"
(cherry picked from commit 636ed025da)
2019-03-26 16:43:40 +03:00
Abduqodiri Qurbonzoda
63b116b188 Replace mistaken "bit sign" with "sign bit"
(cherry picked from commit 960797b926)
2019-03-26 16:43:39 +03:00
Abduqodiri Qurbonzoda
a9bad98772 More detailed Primitive.toChar conversion documentation
(cherry picked from commit f36a8db8eb)
2019-03-26 16:43:38 +03:00
Andrey Uskov
d254c583c1 Fix creation of Android source roots
#KT-30464 Fixed

(cherry picked from commit a0b8140278)
2019-03-26 08:32:24 +03:00
nikita.movshin
8f1f4cbe96 Add changelog for 1.3.30-eap3 2019-03-25 17:56:40 +03:00
Mikhael Bogdanov
cc1dcf69b4 Revert "Don't generate annotations on $default methods"
This reverts commit 3b57ceea
2019-03-25 12:45:42 +01:00
Ilya Matveev
e2505325ad Update Kotlin/Native: 1.2-eap-8879 2019-03-22 20:08:42 +07:00
Yan Zhulanow
57642ff586 Revert "Kapt: Generate constant value initializers for mutable properties (KT-30164)"
This reverts commit cce2b472
2019-03-22 15:18:39 +03:00
Yan Zhulanow
8fc83b21a7 Revert "Kapt: Move out the 'final' fallback for initial field values"
This reverts commit 10e53a2e
2019-03-22 15:18:35 +03:00
Yan Zhulanow
dc9e112844 Revert "Kapt: Support default constant values for constructor parameters"
This reverts commit e4d758b6
2019-03-22 15:18:30 +03:00
Leonid Startsev
0e525987f6 Allow '@Serializable' on a type usage (for kotlinx.serialization/367) 2019-03-22 14:59:01 +03:00
Leonid Startsev
0c4ad4bb86 Instantiating of Polymorphic in Companion.serializer() for JS and Native 2019-03-22 14:57:45 +03:00
Leonid Startsev
52b5a868e7 Auto-applying @Polymorphic for interfaces and serializable abstract
classes
2019-03-22 14:57:44 +03:00
Leonid Startsev
13f6dbbfd4 Do not enable PolymorphicSerializer without special annotation 2019-03-22 14:57:43 +03:00
Leonid Startsev
04948907bb New instantiating type for polymorphic serializer 2019-03-22 14:57:42 +03:00
Ilya Matveev
c9de6e44fa Update Kotlin/Native: 1.2-eap-8865 2019-03-22 18:21:44 +07:00
Nicolay Mitropolsky
aca62090fe 191: Uast: making KotlinUObjectLiteralExpression provide a proper referenceNameElement (KT-30534)
(cherry picked from commit ce40bfb259)
2019-03-21 19:59:32 +03:00
Toshiaki Kameyama
00405b3f94 Use withIndex intention: fix false positive for destructuring declaration
#KT-30341 Fixed

(cherry picked from commit bd3d5a9dbb)
2019-03-21 19:50:40 +03:00
Toshiaki Kameyama
24f2b91356 Add when branches: remove unnecessary blank line
#KT-30426 Fixed

(cherry picked from commit cbdc79fcda)
2019-03-21 19:50:21 +03:00
Nicolay Mitropolsky
e5c5e90dc5 Uast: getMaybeLightElement returns class for annotation primary constructor
(cherry picked from commit 713f73e414)
2019-03-21 17:52:25 +03:00
Nicolay Mitropolsky
3b0b6b14fc Uast: resolveCallToDeclaration cleanup
(cherry picked from commit 7b590055f8)
2019-03-21 17:52:24 +03:00
Nicolay Mitropolsky
4fdbf987d7 Uast: stop resolve parts of fqn to the full-name target
(cherry picked from commit 90894176f9)
2019-03-21 17:52:23 +03:00
Yan Zhulanow
5541bcfac1 Don't use experimental features of Android Extensions in 'testAndroidDaggerIC()'
AndroidDaggerProject uses the @Parcelize functionality that was experimental until 1.3.30. Now it is not.
2019-03-21 17:46:29 +03:00
Yan Zhulanow
b5e4e07cca Always attach kotlin-android-extensions-runtime library
@Parcelize is now enabled by default, and it requires the runtime library.
Enabling it for all clients is a temporary solution.
In future, the runtime library will be split to two separate artifacts.
2019-03-21 17:46:29 +03:00
Yan Zhulanow
e8445b9b98 Minor: Fix error message, add missing article 2019-03-21 17:46:29 +03:00
Yan Zhulanow
8f49f44cef Kapt: Fix star indentation in stub Javadoc (KT-30163) 2019-03-21 17:46:28 +03:00
Yan Zhulanow
cf699796fc Kapt: Support default constant values for constructor parameters 2019-03-21 17:46:28 +03:00
Yan Zhulanow
f6a1e13bc7 Kapt: Move out the 'final' fallback for initial field values 2019-03-21 17:46:28 +03:00
Yan Zhulanow
348fc18376 Kapt: Generate constant value initializers for mutable properties (KT-30164) 2019-03-21 17:46:28 +03:00
Yan Zhulanow
c34f00e268 Kapt: Use constant value references where possible in property initializers 2019-03-21 17:46:28 +03:00
Yan Zhulanow
195cbda7a7 Kapt: Always use raw types for annotation parameter types (KT-30346) 2019-03-21 17:46:27 +03:00
Yan Zhulanow
0bf335cf1a Remove isAtBreakpoint checks as it's not valid in all cases
For example, when we stopped at a breakpoint and then did a 'step over' action, we aren't at that breakpoint any more.
However, we still can evaluate things.
2019-03-21 17:46:27 +03:00
Yan Zhulanow
22b1c29ce8 Avoid using 'loadClass()' as it doesn't cache the results 2019-03-21 17:46:27 +03:00
Yan Zhulanow
8c184481e7 Use caching 'findClass()' instead of raw 'Class.forName()' call in async stack trace provider (KT-30268) 2019-03-21 17:46:27 +03:00
Yan Zhulanow
91fa42baba Move eval4j to idea 2019-03-21 17:46:27 +03:00
Yan Zhulanow
d239f02afe Add the whole content of the Apache 2.0 license to the Kotlin repo 2019-03-21 17:46:26 +03:00
Yan Zhulanow
4f97b4672c Refactoring: Incapsulate method calls into ExecutionContext 2019-03-21 17:46:26 +03:00
Yan Zhulanow
fc8b012aa2 Debugger: Fix indentation in code fragments 2019-03-21 17:46:26 +03:00
Yan Zhulanow
a2182d593f Don't activate Kotlin async stack trace provider in Java sources (KT-30318) 2019-03-21 17:46:26 +03:00
Yan Zhulanow
26256f4112 Code fragment analysis: analyze parents if there's no sensible scope for the default element (KT-29179) 2019-03-21 17:46:26 +03:00
Yan Zhulanow
534c9fb05a Don't file an exception if we failed to calculate the anonymous class name 2019-03-21 17:46:26 +03:00
Yan Zhulanow
335f979533 Minor: Fix formatting in DebuggerClassNameProvider 2019-03-21 17:46:25 +03:00
Yan Zhulanow
1f8756227e Fix breakpoint handling in Kotlin scripts (KT-29234) 2019-03-21 17:46:25 +03:00
Yan Zhulanow
57a55f4929 Fix asmTypeForAnonymousClassOrNull(): it should not throw an exception if a class name isn't found 2019-03-21 17:46:25 +03:00
Yan Zhulanow
6e09494f20 Explicitly check for the callable class availability
'@NotNull' annotation generates a not-null assertion that caused exceptions to throw from 'asmTypeForAnonymousClassOrNull()'.
2019-03-21 17:46:25 +03:00
Yan Zhulanow
f017b47e0a Debugger: Fix missing NOP in empty 'when' header (KT-29189) 2019-03-21 17:46:25 +03:00
Yan Zhulanow
ee293c0ec4 Debugger: Show captured outer this in lambdas (Variables view) (KT-30220) 2019-03-21 17:46:25 +03:00
Yan Zhulanow
2a47e75b8e Hide '$delegate' variables in Kotlin variables mode 2019-03-21 17:46:24 +03:00
Yan Zhulanow
7b3b189d07 Fix lambda evaluation on JDK 9-11 (KT-29423) 2019-03-21 17:46:24 +03:00
Yan Zhulanow
c4c90d920d Debugger: Call invokeMethod() safely, through the execution context (KT-30268, EA-131589) 2019-03-21 17:46:24 +03:00
Yan Zhulanow
2c39d1cadc Fix EA-138393: Calculate async stack traces only on breakpoints 2019-03-21 17:46:24 +03:00
Yan Zhulanow
43fd33c0aa Minor: Fix a few compilation warnings in compiler and compiler tests, fix formatting 2019-03-21 17:46:24 +03:00
Yan Zhulanow
c0d0cd8f5e Pill: Recognize non-default test source roots 2019-03-21 17:46:23 +03:00
Yan Zhulanow
1ceef03bb8 Fix EA-135863: Access allLineLocations() safely 2019-03-21 17:46:23 +03:00
Yan Zhulanow
b65f777a19 Fix EA-105847, use 'location()' safely 2019-03-21 17:46:23 +03:00
Ilya Chernikov
8f4a705d09 Move common idea and compiler parts of the scripting plugin to the new jar 2019-03-21 15:42:34 +01:00
Nikolay Krasko
ab07560c1a Remove special KotlinReportSubmitter bunch for AS 3.5 2019-03-21 17:38:52 +03:00
Ilya Matveev
8b8a3f6819 CocoaPods: Use FQ name for the sync task during an Xcode build 2019-03-21 21:12:19 +07:00
Ilya Matveev
a621a22a43 CocoaPods: Generate wrapper if the corresponding property enabled 2019-03-21 21:12:19 +07:00
Ilya Matveev
64b3519252 Fat frameworks: Use absolute path to lipo 2019-03-21 21:12:19 +07:00
Ilya Matveev
2c50f37fae Fat frameworks: Don't fail if plist has no device capabilities
The PlistBuddy fails when deleting an entry from a file which
has no such entry. This patch workarounds this by ignoring
PlistBuddy's exit code.
2019-03-21 21:12:19 +07:00
Ilya Matveev
6d6a320bb9 CocoaPods: Don't generate a fat framework for a single device target 2019-03-21 21:12:19 +07:00
Ilya Matveev
574229dfcc Fat frameworks: Improve header merging
1. If header contents are identical, don't write all of them
   in the resulting header. Just write content of one of the
   headers without #ifdef-s.
2. Use #elif to separate declarations for different platforms.
2019-03-21 21:12:19 +07:00
Ilya Matveev
e381138e61 Fat frameworks: Run PlistBuddy only once for all commands
Previously we executed the PlistBuddy utility for each command
separately. This patch gathers all commands and run PlistBuddy
for all of them at once.
2019-03-21 21:12:19 +07:00
Ilya Matveev
2a9125b267 Fat frameworks: Improve error messaging 2019-03-21 21:12:19 +07:00
Ilya Matveev
c9a252729b CocoaPods: Require Gradle wrapper for Xcode build 2019-03-21 21:12:19 +07:00
Ilya Matveev
590b81184d CocoaPods: Rename: simple framework -> regular framework 2019-03-21 21:12:19 +07:00
Ilya Matveev
b463df5a1d CocoaPods: Detect the real path to Gradle wrapper.
Previously the CocoaPods plugin assumed that Gradle wrapper
is located in the project directory. But the project may be
a part of multiproject build and wrapper may be located in
the root directory of such a build. Also the build may not
have the wrapper at all.

This patch looks for the wrapper in the root directory of the
build and runs the local Gradle if there is no wrapper.
2019-03-21 21:12:19 +07:00
Ilya Matveev
7b1373053d CocoaPods: Don't use realpath utility in script phase
The realpath utility may not be found on the user's machine
so we get rid of using it.
2019-03-21 21:12:19 +07:00
Ilya Matveev
f8f5f8d4d4 CocoaPods: Build fat arm32/arm64 frameworks
Building for old iOS devices requires us to provide fat
arm32/arm64 frameworks. This patch uses the fat framework
task to build such a framework and provides it to Xcode
if a build for a device is executed. In other cases
(building for iOS simulator or macOS) simple frameworks
are still used.
2019-03-21 21:12:19 +07:00
Ilya Matveev
e2c61e7231 Provide a task for building a fat framework
This patch adds a task taking several iOS frameworks and
building one fat framework on their basis.

Issue #KT-24184 Fixed
2019-03-21 21:12:19 +07:00
Nikolay Krasko
669b39d874 Add bunch file for ITNReporterCompat to fix compilation in AS 3.5 2019-03-21 13:40:11 +03:00
Dmitry Gridin
137a2794bc Fix exception when add import
#KT-30524 Fixed

(cherry picked from commit 403801b0b3)
2019-03-21 16:39:30 +07:00
Dmitry Gridin
41d8e84593 Improve: optimize ConvertMemberToExtension
(cherry picked from commit 3ce002dd6e)
2019-03-21 16:39:16 +07:00
Dmitry Gridin
42b7db6507 Minor: refactoring ConvertMemberToExtensionIntention
(cherry picked from commit e8eb9c3d58)
2019-03-21 16:39:04 +07:00
Dmitry Gridin
ace0dcaf06 Improve: add more cases for MoveVariableDeclarationIntoWhen
#KT-30499 Fixed

(cherry picked from commit e11072b8c2)
2019-03-21 16:38:52 +07:00
Dmitry Gridin
da846d27f6 Inspection "MoveVariableDeclarationIntoWhen" should inline variable declaration
(cherry picked from commit c84ff1d8b1)
2019-03-21 16:38:38 +07:00
Ilya Chernikov
922a55b069 Fix tests after unblocking exceptions on loading script definitions
should be temporary, proper solution needed in the future
2019-03-20 21:23:25 +01:00
Ilya Chernikov
ec1f57660d Write tests for dynamic versions with ivy and maven resolvers
and refactor tests
#KT-27051 fixed
this commit is just a confirmation of the fix: either it worked
from the beginning, or was fixed by some unrelated change
2019-03-20 21:23:25 +01:00
Ilya Chernikov
6b7adfea03 Refactor script definition loading error handling
reenable logging of failures
suppress loading from failed contributors
2019-03-20 21:23:24 +01:00
Ilya Chernikov
a164d8d9d5 Refactor ivy resolver
add support for artifacts with type an classifier
use ibiblio resolver by default - it is designed for working with maven central
add test, but disable it - see comments for the reason and todos
2019-03-20 21:23:24 +01:00
Ilya Chernikov
624fb69d88 Add optional suffix to the script template markers
add suffix to the markers in the repo
#KT-28593 fixed
2019-03-20 21:23:23 +01:00
Ilya Gorbunov
fd1fe8d68c Clarify toSortedMap and sortedMapOf docs (KT-30100)
Remove the note about iteration order so that toSortedMap is not misused
for sorting map entires with the comparator inconsistent with key equality.

(cherry picked from commit 8021f9c4af)
2019-03-20 22:25:07 +03:00
Sergey Igushkin
6894d1feeb Revert profile_settings.xml accidentally deleted in ffdd43b8
(cherry picked from commit af7c35b5c7)
2019-03-20 20:00:26 +03:00
Sergey Igushkin
b5f9be5763 Don't publish or expose the 'org.jetbrains.kotlin.js' plugin in 1.3.30 2019-03-20 18:24:13 +03:00
Sergey Igushkin
5f148dad80 KT-27675: Following the Gradle Java plugin, enable Kapt cache by default
As the Gradle Java plugin considers Java annotation processing cacheable
with any annotation processors, we can enable build cache by default
for Kapt tasks, leaving the opt-out flag just in case.

Issue #KT-27675 Fixed

(cherry picked from commit 914f7c8719)
2019-03-20 18:24:12 +03:00
Sergey Igushkin
47423ec5d5 Automatically detect Android Java 1.8 source+target (KT-21030)
When Android Java 8 desugaring is set as follows (or above):

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

set the Kotlin JVM target to 1.8

Issue #KT-21030 Fixed

(cherry picked from commit ffbd0e8af1)
2019-03-20 18:24:12 +03:00
Sergey Igushkin
a21766f0b0 Fix wrong commits picked for master: restore changes from KOTLIN-CR-2817
(cherry picked from commit 70db646576)
2019-03-20 18:24:12 +03:00
Sergey Igushkin
fd8c164fda Revert "Use KotlinTarget.disambiguationClassifier for task & configuration names"
(cherry picked from commit ec3e5c6959)
2019-03-20 18:24:11 +03:00
Sergey Igushkin
ecdec20d1d Introduce new Gradle plugin org.jetbrains.kotlin.js
This is the Gradle plugin that does not rely on the
Java model and uses the same Kotlin model
(target – compilation – source set) as MPP does.

Also add JS DCE support for this plugin.

Issue #KT-5756 Fixed
Issue #KT-13256 Fixed
Issue #KT-16355 Fixed
Issue #KT-20156 Fixed
Issue #KT-29284 Fixed

(cherry picked from commit 91ce7ef5ca)
2019-03-20 18:24:11 +03:00
Sergey Igushkin
fa10395235 Refactor & minor fix in software component logic of AbstractKotlinTarget
* Create the sources JAR for both Gradle 4.7+ and versions below 4.7
* Set `componentName` in all branches of `createKotlinVariant`

(cherry picked from commit 03b74343c8)
2019-03-20 18:24:11 +03:00
Sergey Igushkin
1f1e8ca1b6 Apply user-defined attributes in single-platform plugins
The attributes applied by the user to the target and its compilations
were ignored in single-platform plugins while the target was not a part
of the API.

Since the user will be able to access and configure the target, we need
to apply the attributes to the relevant configurations in the same way
as in MPP.

(cherry picked from commit 5b5316214f)
2019-03-20 18:24:10 +03:00
Sergey Igushkin
9c413572af Add the single-platform target's 'components' to 'project.components'
(cherry picked from commit 8fa1630695)
2019-03-20 18:24:10 +03:00
Sergey Igushkin
b298a3ed1a Use KotlinTarget.disambiguationClassifier for task & configuration names
In MPP, the disambiguation classifier is always the same as the target
name. In single-platform projects, the task name suffix should be empty
for the JVM targets. Using the `disambiguationClassifier` for this
purpose is more consistent with other usages of
`disambiguationClassifier`.

The target name for all existing single-platform plugins will be just
'kotlin'.

(cherry picked from commit a19e8fe03e)
2019-03-20 18:24:10 +03:00
Sergey Igushkin
fa87574e90 Introduce single-project extensions with static types for Kotlin target
(cherry picked from commit 4e711f9a0c)
2019-03-20 18:24:09 +03:00
Sergey Igushkin
56e67bd7c9 Fix user-specified attributes in Android targets (KT-27714)
Ensure that custom target and compilation attributes are copied to
relevant configurations of Android targets as well, which did not happen
because of Android variants (and missing simple apiElements,
runtimeElements) and Android compilations being created late in the
project configuration.

Issue #KT-27714 Fixed

(cherry picked from commit b3eef05e6e)
2019-03-20 18:24:09 +03:00
Sergey Igushkin
6aa1709ae4 Create and configure Android compilations earlier (KT-29964)
As Android variants are created after the project is evaluated,
the build script and plugins might have added some item handlers to the
domain object containers which are yet to be filled.

To ensure that those handlers see properly configured compilations and
their tasks, we need to add a compilations to the container only after
it has been properly configured.

Also, the `forEachVariant` handler is already executed in
`afterEvaluate`, and there seems to be no need to wrap our
code working with variants in `afterEvaluate`.

Issue #KT-29964 Fixed

(cherry picked from commit 6fa610156e)
2019-03-20 18:24:08 +03:00
Sergey Igushkin
9a994ab364 Ignore deprecated configurations in a test with Gradle 5.3+ (KT-30378)
(cherry picked from commit 49ee197578)
2019-03-20 18:24:08 +03:00
Sergey Igushkin
fb57ec1076 Exclude the configurations of source sets from dependency resolution
The `*Api`, `*Implementation`, `*CompileOnly`, and `*RuntimeOnly`
configurations of a `KotlinSourceSet` must not be resolved directly, as
they lack attributes needed to choose a Kotlin MPP variant, and they
must not be candidates in variant-aware resolution of a project
dependency either.

With Gradle 5.3, these configurations failed to resolve anyway, as they
had no proper `org.gradle.usage` attribute, and the disambiguation
rules of the 'java-base' plugin conflicted with the Kotlin rules.

(cherry picked from commit 0830977d16)
2019-03-20 18:24:08 +03:00
Sergey Igushkin
f64b76561a Fix publishing with Gradle 5.3 (KT-30379)
In Gradle 5.3, there was a change to the internal logic of publishing
`SoftwareComponent`s with the 'maven-publish' plugin, and,
simultaneously, a new public API was introduced for user-defined
software components, see https://github.com/gradle/gradle/pull/8399

Earlier, the 'maven-publish' plugin used the Gradle `Usage` attribute
values to arrange the dependencies of a software component's
`UsageContext`s into the Maven scopes. Now that mechanism doesn't work
and a `SoftwareComponent` must provide an explicit mapping of the
variants to POMs by using the `SoftwareComponentFactory.adhoc` API.

However, the new API lacks some features we need to properly publish an
MPP, such as adding a component to another one as a variant, so we still
create old-style software components under the hood and
then wrap them into the new API (and then wrap the adhoc components once
again).

We also continue to use the old-style components for Kotlin-specific
logic like finding a target in another project that a dependency
resolved to, as the components produced by the new API lack crucial
information that is used in the logic, like references to
`KotlinCompilation`s.

Issue #KT-30379 Fixed

(cherry picked from commit 7c139e059a)
2019-03-20 18:24:07 +03:00
Sergey Igushkin
9d12760b81 Run tests against Gradle 5.3 RC2
(cherry picked from commit eedb8b0ae1)
2019-03-20 18:24:07 +03:00
Sergey Igushkin
2baeb67f72 Support a Gradle Usage value 'java-api-jars'
The support on our side involves:

* using the new value for Maven publishing, as the 'maven-publish'
plugin now expects 'java-api-jars' for dependency scopes ordering where
it used to expect 'java-api'

* accepting the new value in KotlinUsages compatibility and
disambiguation rules

(cherry picked from commit 17df1ce096)
2019-03-20 18:24:07 +03:00
Sergey Igushkin
abe2db4d84 Warning for Kotlin plugins loaded multiple times (KT-30276)
Print a warning with an instruction on how to fix this. Don't warn about
different versions and duplicate plugins in composite build.

Issue #KT-30276 Fixed

(cherry picked from commit 7d9405a9cb)
2019-03-20 18:24:07 +03:00
Sergey Igushkin
6a1ff34f6f Setup conf2ScopeMappings for 'api' configuration with 'maven' plugin
The 'java' plugin doesn't expect the 'api' configuration to exist (it
is only introduced by the 'java-library' plugin) and doesn't map it
to the compile scope when publishing with the legacy 'maven' plugin.

This commit adds the missing conf2ScopeMapping for 'api' -> 'compile'

(cherry picked from commit 42a7c87e2e)
2019-03-20 18:24:06 +03:00
Sergey Igushkin
2938e2f8cf Fix ConcurrentModificationException iterating over tasks (KT-29971)
Issue #KT-29971 Fixed

(cherry picked from commit 803af3e040)
2019-03-20 18:24:06 +03:00
Sergey Igushkin
a0d9f8144c Rewrite MPP dependencies in POMs of single-platform projects (KT-27059)
This is needed to ensure that POMs of single-platform Kotlin projects
depending on MPP libraries contain dependencies (Maven coordinates)
of the platform-specific modules of the libraries.

The mechanism and rationale are the same as in KT-28482

Issue #KT-27059 Fixed

(cherry picked from commit 4aaa1a8067)
2019-03-20 18:24:06 +03:00
Sergey Igushkin
fa1224ae63 Add a switch that disables dependencies rewriting in POMs
This covers the cases when a user knows what they do and doesn't want
anything to do any changes to the POMs, e.g. they want to manually
replace all of the dependencies, so they need the original dependencies.

(cherry picked from commit 51279a8195)
2019-03-20 18:24:05 +03:00
Sergey Igushkin
b9636aad73 Refactor: move all tools for MPP dependencies rewriting to a utils file
(cherry picked from commit 2f8baf6715)
2019-03-20 18:24:05 +03:00
Sergey Rostov
7aa65671fc Gradle: Supress PackageDirectoryMismatch in targets for gradle.plugin.mpp package
(cherry picked from commit f467d892ca)
2019-03-20 18:24:05 +03:00
Sergey Rostov
2a8d9e6e9e Gradle: Move files from org.jetbrains.kotlin.gradle.plugin.mpp to org.jetbrains.kotlin.gradle.targets
(cherry picked from commit 88c04f75f1)
2019-03-20 18:24:04 +03:00
Pavel Nikitin
37ed69347d KT-30322 Memory leak in CompilationSourceSetUtil (#2158)
Issue #KT-30322 Fixed

(cherry picked from commit a6b7aa3257)
2019-03-20 18:24:04 +03:00
Sergey Igushkin
49e0ad054c Actual change for splitting files preserving Git history
Remove resulting redeclarations and finish the split in files below:

  - from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

(cherry picked from commit 51234d10b9)
2019-03-20 18:24:03 +03:00
Sergey Igushkin
cda7a2d22d (step 8/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves the temporary files back to their original paths.
2019-03-20 18:24:03 +03:00
Sergey Igushkin
633cdf90b7 Merge commit 'ffdd43b8083c4fd7795799e351f23d997534a43e'; commit 'af3bf257ba1584fd2f3d690fe76c48778699e29b'; commit '83d22a3744df1b79545070fbb9ea13ee1182a614'; commit 'b7cf915e884caea8cabc2db5f611fa5d5a7536e8'; commit '522a5b8c3ffd84c11cb70efead9c152e8d62cd37'; commit '37a117574f314263360350964e80ce182c093e31' into move-packages-on-master 2019-03-20 18:23:56 +03:00
Sergey Igushkin
21a25db4f2 (step 7/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves the original files to
temporary files suffixed with '.git_split_tmp'
2019-03-20 18:23:56 +03:00
Sergey Igushkin
9625081f13 (step 4/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves:

  mpp\kotlinTargetPresets.kt -> mpp\KotlinJvmTargetPreset.kt
  mpp\kotlinCompilations.kt -> mpp\KotlinJsCompilation.kt
  mpp\KotlinCompilationFactory.kt -> mpp\KotlinNativeCompilationFactory.kt
2019-03-20 18:23:55 +03:00
Sergey Igushkin
a31b08468b (step 5/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves:

  mpp\kotlinTargetPresets.kt -> mpp\KotlinJvmWithJavaTargetPreset.kt
  mpp\kotlinCompilations.kt -> mpp\KotlinNativeCompilation.kt
  mpp\KotlinCompilationFactory.kt -> mpp\KotlinWithJavaCompilationFactory.kt
2019-03-20 18:23:55 +03:00
Sergey Igushkin
22aa4b575e (step 6/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves:

  mpp\kotlinTargetPresets.kt -> mpp\KotlinMetadataTargetPreset.kt
  mpp\kotlinCompilations.kt -> mpp\KotlinWithJavaCompilation.kt
2019-03-20 18:23:55 +03:00
Sergey Igushkin
191578bafa (step 3/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves:

  mpp\kotlinTargets.kt -> mpp\KotlinWithJavaTarget.kt
  mpp\kotlinTargetPresets.kt -> mpp\KotlinJsTargetPreset.kt
  mpp\kotlinCompilations.kt -> mpp\KotlinJvmAndroidCompilation.kt
  mpp\KotlinCompilationFactory.kt -> mpp\KotlinJvmAndroidCompilationFactory.kt
2019-03-20 18:23:54 +03:00
Sergey Igushkin
77d41040a0 (step 1/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves:

  KotlinTargetConfigurator.kt -> KotlinNativeTaretConfigurator.kt
  mpp\kotlinTargets.kt -> mpp\KotlinAndroidTarget.kt
  mpp\kotlinTargetPresets.kt -> mpp\KotlinAndroidTargetPreset.kt
  mpp\kotlinCompilations.kt -> mpp\KotlinCommonCompilation.kt
  mpp\KotlinCompilationFactory.kt -> mpp\KotlinJsCompilationFactory.kt
  mpp\kotlinCompilationOutputs.kt -> mpp\KotlinWithJavaCompilationOutput.kt
2019-03-20 18:23:53 +03:00
Sergey Igushkin
ad2d63426c (step 2/8) Copy files with Git history (automatic commit)
- from KotlinTargetConfigurator.kt
    - to KotlinNativeTaretConfigurator.kt
  - from mpp\kotlinTargets.kt
    - to mpp\KotlinAndroidTarget.kt
    - to mpp\KotlinNativeTarget.kt
    - to mpp\KotlinWithJavaTarget.kt
  - from mpp\kotlinTargetPresets.kt
    - to mpp\KotlinAndroidTargetPreset.kt
    - to mpp\KotlinNativeTargetPreset.kt
    - to mpp\KotlinJsTargetPreset.kt
    - to mpp\KotlinJvmTargetPreset.kt
    - to mpp\KotlinJvmWithJavaTargetPreset.kt
    - to mpp\KotlinMetadataTargetPreset.kt
  - from mpp\kotlinCompilations.kt
    - to mpp\KotlinCommonCompilation.kt
    - to mpp\KotlinJvmCompilation.kt
    - to mpp\KotlinJvmAndroidCompilation.kt
    - to mpp\KotlinJsCompilation.kt
    - to mpp\KotlinNativeCompilation.kt
    - to mpp\KotlinWithJavaCompilation.kt
  - from mpp\KotlinCompilationFactory.kt
    - to mpp\KotlinJsCompilationFactory.kt
    - to mpp\KotlinJvmCompilationFactory.kt
    - to mpp\KotlinJvmAndroidCompilationFactory.kt
    - to mpp\KotlinNativeCompilationFactory.kt
    - to mpp\KotlinWithJavaCompilationFactory.kt
  - from mpp\kotlinCompilationOutputs.kt
    - to mpp\KotlinWithJavaCompilationOutput.kt

This commit moves:

  mpp\kotlinTargets.kt -> mpp\KotlinNativeTarget.kt
  mpp\kotlinTargetPresets.kt -> mpp\KotlinNativeTargetPreset.kt
  mpp\kotlinCompilations.kt -> mpp\KotlinJvmCompilation.kt
  mpp\KotlinCompilationFactory.kt -> mpp\KotlinJvmCompilationFactory.kt
2019-03-20 18:23:53 +03:00
Nikolay Krasko
6060df876a Merge branch '1.3.30' of ssh://git.jetbrains.team/kotlin into 1.3.30 2019-03-20 17:39:38 +03:00
Ilmir Usmanov
4910994c2a Fix test data 2019-03-20 17:15:36 +03:00
Ilmir Usmanov
5289218403 Do not generate StateMachineChecker if CHECK_STATE_MACHINE directive is
not present.
Otherwise, since it uses suspend functions, it breaks IR tests.
2019-03-20 17:15:35 +03:00
Ilmir Usmanov
f3a1f0fa5d Generate RETURN instead of ARETURN if (cross)inline suspend lambda returns Unit
#KT-30073 Fixed
2019-03-20 17:15:34 +03:00
Ilmir Usmanov
fce0a1d29d Check number of suspensions in crossinline tests 2019-03-20 17:15:33 +03:00
Ilmir Usmanov
dd8209b20d Add facility to check number of suspensions in coroutine tests 2019-03-20 17:15:32 +03:00
Alexey Tsvetkov
fc6f20b6e5 Clear outputs before compiling with in-process/out-of-process execution mode
Issue #KT-30492 Fixed
2019-03-20 17:12:27 +03:00
Ivan Gavrilovic
be9e3d81e2 Incremental KAPT - invalidate obsolete types
Once set of dirty symbols is computed, filter these types
when they are requested from the JavaFileManager. This is accomplished
by tracking all declared types in the sources and generated sources.
It is not necessary track types in generated class files, as these will
be removed before the APs are incrementally run.

Motivation: APs (e.g. Dagger) may use Elements.getTypeElement(String)
to determine if type is already present, and if it is, they will not
generate it. Therefore, whenever generated sources is invalidated, types
it defines need to be filtered in the JavaFileManager.

Issue is https://youtrack.jetbrains.com/issue/KT-23880
2019-03-20 16:44:21 +03:00
Ivan Gavrilovic
afc9dcd869 Incremental KAPT - handle inherited annotations
Handle annotations with @Inherited. This is important for
the aggregating APs, as the current implementation passes all sources
annotated with claimed aggregating annotations.

Issue is https://youtrack.jetbrains.com/issue/KT-23880
2019-03-20 16:44:17 +03:00
Ivan Gavrilovic
831f10b62c Incremental annotation processing with KAPT
Add support for incremental annotation processors in KAPT. These
processors conform to https://docs.gradle.org/current/userguide/java_plugin.html#sec:incremental_annotation_processing
specification.

Support is provided by using javac compiler APIs and
recording the source file structure. At runtime, processors
are instrumented with custom Filer that is used to keep track of generated
files. In order to support classpath changes, stub generation task is
used to generated a list of changed FQCNs, and this is simply used by KAPT.
Both worker and non-worker mode are supported.

 #KT-23880
2019-03-20 16:44:13 +03:00
Nikolay Krasko
ab805c5f52 Make internal mode controlled from execution arguments 2019-03-20 16:37:27 +03:00
Nikolay Krasko
1c0562be2a Allow to pass addition system properties to runIde task 2019-03-20 16:37:09 +03:00
Nikolay Krasko
f90ff23884 Allow to throw plugin exception when plugin version is patched 2019-03-20 16:36:45 +03:00
Nikolay Krasko
990c9de07c Add internal action for reporting exceptions from Kotlin plugin 2019-03-20 16:36:36 +03:00
Nikolay Krasko
ec9a780dec Log connection problems during fetching release date 2019-03-20 16:35:36 +03:00
Nikolay Krasko
a205144aa9 Use special request for fetching plugin release date in exception reporter 2019-03-20 16:35:28 +03:00
Nikolay Krasko
b3f4327ce8 Prevent constant reporting from released plugin versions in EA (KT-30388)
Apply a compromise strategy between "no report" and "always report".
Report only for several days after release and don't bother users afterwards.

 #KT-30388 Fixed

All exceptions still can be found in Idea Log.
2019-03-20 16:35:17 +03:00
Nikolay Krasko
ea7bdf5a6b Allow to override plugin version with system property
Need this during testing and development.
2019-03-20 16:35:08 +03:00
Nikolay Krasko
85cfa28d47 Extract ITNReporter.submit() compatibility problem to separate file 2019-03-20 16:34:59 +03:00
Dmitry Gridin
5654166596 Fix false positive "Unused import" for type alias
#KT-29977 Fixed

(cherry picked from commit 600a955a51)
2019-03-20 20:30:24 +07:00
Dmitry Gridin
0d8057c7c5 Minor: refactoring KotlinUnusedImportInspection
(cherry picked from commit 7e4b3ceede)
2019-03-20 20:30:08 +07:00
Toshiaki Kameyama
58395e84b5 Change to star projection: do not suggest in arguments or receiver
#KT-23259 Fixed

(cherry picked from commit 4e3d13fcee)
2019-03-20 20:17:21 +07:00
Nicolay Mitropolsky
aa586e7eb0 191: Uast: isJvmElement check added to the newly added conversion methods (EA-125791)
(cherry picked from commit 0d2426b081)
2019-03-20 12:28:28 +03:00
Anton Yalyshev
557ec4cc89 updated TipsOfTheDay pics, as New Project Wizards got new names
(cherry picked from commit 1bc35b1b0c)
2019-03-20 12:21:32 +03:00
Anton Yalyshev
7c1066f317 improved english in wizard's descriptions. also now user knows about project's build system from its name #KT-27183 fixed
(cherry picked from commit 71eb540eaf)
2019-03-20 12:21:10 +03:00
Dmitriy Dolovov
70c6d34d81 Don't publish CLion/AppCode plugins to IDEA channel at plugins.jetbrains.com
(cherry picked from commit 1a9ed88be4)
2019-03-20 12:20:46 +07:00
Ilya Gorbunov
070324a67b Clarify floor and ceil docs (KT-30418)
(cherry picked from commit b74fe7c1c3)
2019-03-19 21:18:03 +03:00
Ilya Gorbunov
ad043c8378 Minor: collection docs formatting
(cherry picked from commit b0a234ec74)
2019-03-19 21:18:03 +03:00
Ilya Gorbunov
4554cdd54e Clarify behavior of MutableSet.add (KT-29373)
(cherry picked from commit bc444df20c)
2019-03-19 21:18:03 +03:00
Ilya Gorbunov
f94311a4a3 Clarify yield/yieldAll function suspending the caller behavior
(cherry picked from commit 25b3f62767)
2019-03-19 21:18:03 +03:00
Vyacheslav Gerasimov
624332bd6c as35: Apply Android Studio patches 2019-03-19 21:06:15 +03:00
Vyacheslav Gerasimov
a47fb6e40a as35: Fork as35 bunch from 191 2019-03-19 21:06:15 +03:00
Vyacheslav Gerasimov
39ab591679 as35: Update versions to AS 3.5 C8 2019-03-19 21:06:14 +03:00
Vyacheslav Gerasimov
93e5849b8b as35: Add bintray repo for AS 2019-03-19 21:06:14 +03:00
Ilya Chernikov
338c11f6d1 Fix deserialization of the compiled script
#KT-29741 fixed
2019-03-19 17:19:19 +01:00
Ilya Chernikov
e5436802b6 Implement import test witch caching
reproduced KT-29741
plus some tests refactoring
2019-03-19 17:19:18 +01:00
Ilya Chernikov
f8173c07c2 Fix equality and serializability of scripting data, fix relevant caching behaviour 2019-03-19 17:19:18 +01:00
Ilya Chernikov
017821a01d Extend script cache tests, revealing that cache doesn't work in fact 2019-03-19 17:19:17 +01:00
Ilya Chernikov
bfb240ee11 Relocate packages that could be possibly used in the scripts themselves
#KT-30210 fixed
2019-03-19 17:19:17 +01:00
Dmitry Gridin
b84d0e406b Fix false positive 'Introduce import alias' on this/super
(cherry picked from commit 43be01bbc8)
2019-03-19 16:50:12 +07:00
Dmitry Gridin
7066d2cb5d Optimize "Introduce import alias"
Relates to #KT-30462

(cherry picked from commit 1626bc4751)
2019-03-19 16:49:19 +07:00
Dmitry Gridin
d164f0b58c Fix local conflicts in 'Introduce import alias'
(cherry picked from commit ccb1ae13ea)
2019-03-19 16:49:04 +07:00
Dmitry Gridin
b827ddf22f Improve: intention "Introduce Import Alias" should suggest new names for the new alias
#KT-30456 Fixed

(cherry picked from commit 9659453351)
2019-03-19 16:48:51 +07:00
Dmitry Gridin
60100a337c Minor: refactoring KotlinNameSuggester
(cherry picked from commit ff34788eb3)
2019-03-19 16:48:33 +07:00
Ilya Matveev
e52f481fcd Improve deprecation warning about usage of old binary DSL
Previously we showed list of all deprecated APIs even if a user uses
only one of them. This patch changes the behaviour and shows only
APIs really used by the user. An approach similar to the one used by
SingleWarningPerBuild in applied here.

Issue #KT-29998 Fixed
2019-03-19 11:24:22 +07:00
Ilya Matveev
e31104bbde Disable C2 compiler for HotSpot VM when running K/N tools 2019-03-19 11:24:22 +07:00
Alexey Tsvetkov
cd03c543de Fix inter-project IC for kaptGenerateStubs task with AGP
In Android projects we need to detect modules by inspecting jar files
in order to find build history files.
However `useModuleDetection` property was not set up correctly for
KaptGenerateStubsTask.

    #KT-29761 Fixed
2019-03-18 21:11:41 +03:00
Anton Yalyshev
20361e462d update names for Kotlin Gradle DSL wizards as well
(cherry picked from commit b3cbd7d5bd)
2019-03-18 16:18:20 +03:00
Anton Yalyshev
62b76fe25d renewed pictures of our wizards in TipOfTheDay #KT-28941 Fixed
(cherry picked from commit 52f297c644)
2019-03-18 16:18:06 +03:00
Anton Yalyshev
8ba3141c1a unified naming of Kotlin projects #KT-17829 Fixed
(cherry picked from commit 8a3659008e)
2019-03-18 16:17:43 +03:00
Anton Yalyshev
462b25c3a9 better look for wizards names and descriptions: removed word dups and specified build system #KT-27183 Fixed
(cherry picked from commit 415793be1c)
2019-03-18 16:17:32 +03:00
Dmitry Gridin
44518097c5 Allow "Create class" action in return statement
#KT-22137 Fixed

(cherry picked from commit d333a0ad4e)
2019-03-18 16:42:23 +07:00
Dmitry Gridin
9a485d8bbb Minor: refactoring createClassUtils.kt
(cherry picked from commit 41cfb4e2ed)
2019-03-18 16:42:04 +07:00
Dmitry Gridin
485f6c62ee Move caret to class name after creating it from "CreateFromUsage" action
Relates to #KT-24631

(cherry picked from commit 220cb95b85)
2019-03-18 16:41:44 +07:00
Dmitry Gridin
14b98ab49a Intention “Introduce import alias” shouldn't modify other files
#KT-30412 Fixed

(cherry picked from commit 3bf0fb8957)
2019-03-18 16:40:46 +07:00
Dmitry Gridin
ceaacc7890 Fix false positive for type error in intentions AddReturnTo...
Relates to #KT-25272

(cherry picked from commit 179dfce3a8)
2019-03-18 16:40:29 +07:00
Dmitry Gridin
29bb3de2a4 Fix false positive "Redundant lambda arrow" inspection
#KT-29590 Fixed
 #KT-19462 Fixed
 #KT-29124 Fixed

(cherry picked from commit 479e812bbc)
2019-03-18 16:39:38 +07:00
Dereck Bridie
41824a0b39 KT-25272: Unused expression as last expression of normal function should have quickfix to add "return" Fixed
(cherry picked from commit a02ad76b16)
2019-03-18 16:36:08 +07:00
Dmitry Gridin
b7f23aeda5 Change priority of the quick fixes
#KT-30233 Fixed

(cherry picked from commit 8f9c536a82)
2019-03-18 16:23:00 +07:00
Dmitry Gridin
1c2549dce6 Minor: fix warnings & refactoring
(cherry picked from commit 3d66147685)
2019-03-18 16:21:45 +07:00
Dmitry Gridin
ced8dee0e9 Fix "Specify type explicitly" intention with generic type
#KT-27641 Fixed
 #KT-30252 Fixed

(cherry picked from commit 6b8547f57b)
2019-03-18 16:20:07 +07:00
Dmitry Gridin
3e17f8d27d Fix false positive "Insert explicit type arguments" intention
#KT-16139 Fixed

(cherry picked from commit 6ba0a182bb)
2019-03-18 16:01:38 +07:00
Dmitry Gridin
238a4fbc88 Minor: refactoring InsertExplicitTypeArgumentIntention
(cherry picked from commit 212e573c26)
2019-03-18 16:01:29 +07:00
Dmitry Gridin
5da7ed6dd5 Improve Create property from Usage
Place generated property next to other properties
 #KT-14886 Fixed

(cherry picked from commit c89d1af9fa)
2019-03-18 15:59:49 +07:00
Dmitry Gridin
425346e8c0 Refactoring
(cherry picked from commit 5d599ee2ff)
2019-03-18 15:58:44 +07:00
Toshiaki Kameyama
36fdd5107a Replace return with 'if'/'when': don't drop return label
#KT-30414 Fixed

(cherry picked from commit 39016594b1)
2019-03-18 09:49:34 +03:00
Dmitriy Dolovov
29cbf6d42a Native: Support 2- and 3-digit Kotlin/Native versions
(cherry picked from commit dbc66bd0ae)
2019-03-18 11:17:49 +07:00
Dmitriy Dolovov
c04e476a7b Add a hint to the message about not found Kotlin Gradle plugin version
Issue #KT-19788

(cherry picked from commit 77ab15ec65)
2019-03-18 11:17:07 +07:00
Ilya Chernikov
e3c4cded7b Restore jvmTarget 1.6 for scripting libraries that could be used externally
#KT-29319 fixed
2019-03-15 18:00:40 +01:00
Abduqodiri Qurbonzoda
ff84936aaf Implement coerce extension functions for unsigned types
(cherry picked from commit 35c6f09886)
2019-03-15 18:52:51 +03:00
Abduqodiri Qurbonzoda
49f291cb02 Throw IOOB on invalid index in JS StringBuilder.get to adhere contract
(cherry picked from commit a369496aca)
2019-03-15 18:52:50 +03:00
Abduqodiri Qurbonzoda
8153f22236 Document Array and String get() function behavior (KT-30141)
(cherry picked from commit 814d6cf39c)
2019-03-15 18:52:49 +03:00
Abduqodiri Qurbonzoda
3a0d6097dc Write docs for primitive types conversions
(cherry picked from commit a0e2ca669b)
2019-03-15 18:52:29 +03:00
Ilya Gorbunov
ee0d9051e2 Document exception thrown for negative n in take/takeLast/drop/dropLast
#KT-29151

(cherry picked from commit edc766af56)
2019-03-15 18:09:19 +03:00
Ilya Gorbunov
686eb92557 Add samples for is(|Not|NullOr)Empty and is(|Not|NullOr)Blank functions
(cherry picked from commit 6bc7c06038)
2019-03-15 18:09:17 +03:00
Ilya Gorbunov
5a0dd2206e Docs: use consistent kotlinlang.org url in references
(cherry picked from commit ffe8b4419c)
2019-03-15 18:07:34 +03:00
Abduqodiri Qurbonzoda
cad8f1826f Check for index-out-of-bound in elementAt function (KT-30051)
(cherry picked from commit ba61695a45)
2019-03-15 18:06:40 +03:00
Abduqodiri Qurbonzoda
1a73d10f2b Remove implementations of conversions from UByte/UShort to Float/Double
(cherry picked from commit 82002e5e73)
2019-03-15 18:06:28 +03:00
Ilya Gorbunov
b7672a5155 KT-29151 Provide specialized string samples for all drop/take functions
These include:
- take, takeLast, takeWhile, takeLastWhile,
- drop, dropLast, dropWhile, dropLastWhile

(cherry picked from commit 42120b93b8)
2019-03-15 18:04:43 +03:00
Burak Eregar
cdf3d031d8 KT-29151 Fix the problematic pages - CharSequence.take() & String.take()
(cherry picked from commit 991e739693)
2019-03-15 18:04:42 +03:00
Dmitriy Dolovov
f51feceb01 Fix MPP wizard tests
Issue #KT-30003 fixed
2019-03-15 15:29:53 +03:00
Dmitriy Dolovov
153ce51475 Update Kotlin/Native project templates
Use modern "binaries" DSL
2019-03-15 15:29:30 +03:00
Igor Chevdar
8c81b1760f Bump native compiler version to 1.2-eap-8554 2019-03-14 20:05:51 +03:00
Ilya Matveev
dc4e06c6af Update Kotlin/Native: 1.2-eap-8472 2019-03-13 20:03:47 +07:00
Igor Chevdar
38f6303702 Wrapped descriptors: supported complex annotations 2019-03-13 17:22:48 +07:00
Igor Chevdar
b6353524a0 [IR] Copied functions from IrGenerator to IrBuilder
With that the number of UNDEFINED_OFFSET should be greater reduced
2019-03-13 09:09:29 +03:00
nikita.movshin
2e8d524b19 Add changelog for 1.3.30-eap2 2019-03-12 11:18:27 +03:00
nikita.movshin
75afa63a79 Added changelog for 1.3.30-eap2 2019-03-12 11:04:23 +03:00
Ilya Gorbunov
3cd89c71cd Move UArraysKt into kotlin.collections.unsigned package
Provide UArraysKt class in kotlin.collections for binary compatibility
instead of removed multipart facade class. It contains only non-inline
functions of the latter.

(cherry picked from commit 6ae5e91930)
2019-03-09 00:10:50 +03:00
Ilya Gorbunov
7e376ff3c6 Make JvmPackageName a common internal annotation
(cherry picked from commit db4c4132f6)
2019-03-09 00:10:49 +03:00
Abduqodiri Qurbonzoda
8cc11279d7 Implement min max minOf maxOf functions for unsigned types (KT-30035)
(cherry picked from commit be6c2d8c7d)
2019-03-09 00:10:47 +03:00
Abduqodiri Qurbonzoda
9a01d323aa Implement contains extension functions for URanges (KT-26378)
(cherry picked from commit bf83f0e070)
2019-03-09 00:10:46 +03:00
Abduqodiri Qurbonzoda
a84470c124 Implement sorting extension functions for UArrays
(cherry picked from commit cb587893c0)
2019-03-09 00:10:44 +03:00
Abduqodiri Qurbonzoda
87944cd866 Implement drop, take & filter extension functions for UArrays
(cherry picked from commit c42dbb34ca)
2019-03-09 00:10:43 +03:00
Abduqodiri Qurbonzoda
ff97e1cea9 Implement map, flatMap, zip & groupBy extension functions for UArrays
(cherry picked from commit abb275775e)
2019-03-09 00:10:41 +03:00
Abduqodiri Qurbonzoda
ff38226b01 Implement folding extension functions for UArrays
(cherry picked from commit 503264b996)
2019-03-09 00:10:40 +03:00
Abduqodiri Qurbonzoda
e934478581 Implement sum extension function for UArrays (KT-28779)
(cherry picked from commit 7695b5e575)
2019-03-09 00:10:39 +03:00
Abduqodiri Qurbonzoda
39616479ba Implement reduce, forEach, min & max extension functions for UArrays
(cherry picked from commit 690e35f11a)
2019-03-09 00:10:37 +03:00
Abduqodiri Qurbonzoda
38c5f58be7 Implement asList, slice & sliceArray extension functions for UArrays
(cherry picked from commit fc85781bfc)
2019-03-09 00:10:36 +03:00
Abduqodiri Qurbonzoda
0fe065ba77 Implement reversing extension functions for UArrays
(cherry picked from commit 114736c09b)
2019-03-09 00:10:34 +03:00
Abduqodiri Qurbonzoda
4d601d34d0 Implement first, last & single extension functions for UArrays
(cherry picked from commit 92cd84682c)
2019-03-09 00:10:33 +03:00
Abduqodiri Qurbonzoda
39e22851cd Implement conversion from typed array and collection to UArrays
(cherry picked from commit 299fac8e2d)
2019-03-09 00:10:31 +03:00
Abduqodiri Qurbonzoda
d2cf140965 Implement any, all, none, count & sumBy functions for UArrays
(cherry picked from commit bbaabb90e4)
2019-03-09 00:10:30 +03:00
Abduqodiri Qurbonzoda
b1e2afccb5 Implement index-requesting extension functions for UArrays
Contains implementations of `indexOf`, `lastIndexOf`, `indexOfFirst`,
`indexOfLast`, `lastIndex` and `indices` extension functions.

(cherry picked from commit 512d986006)
2019-03-09 00:10:28 +03:00
Abduqodiri Qurbonzoda
a1d586cfc5 Implement fill extension function for UArrays (KT-28339)
(cherry picked from commit 876dff6d22)
2019-03-09 00:10:27 +03:00
Abduqodiri Qurbonzoda
056f99228f Implement component(N) functions for destructuring UArrays
(cherry picked from commit 6b92190726)
2019-03-09 00:10:25 +03:00
Abduqodiri Qurbonzoda
88bdb7a8b9 Implement binarySearch method for UArrays (KT-27262)
(cherry picked from commit 550c74bb6b)
2019-03-09 00:10:24 +03:00
Abduqodiri Qurbonzoda
9e61c7db7d Specialize plus operator for UArrays (KT-28397)
(cherry picked from commit 6cd9858147)
2019-03-09 00:10:22 +03:00
Abduqodiri Qurbonzoda
572ac40df0 Write docs for unsigned types conversions
(cherry picked from commit 3af6b36401)
2019-03-09 00:10:01 +03:00
Ilya Gorbunov
276aa903db Advance bootstrap to 1.3.30-eap-28 2019-03-07 20:21:55 +03:00
Kirill Shmakov
8df4c48be2 Add key 'module' into interop definitions file 2019-03-07 19:51:46 +03:00
Ilya Matveev
a62d3812f6 Update Kotlin/Native: 1.2-eap-8365 2019-03-07 18:59:26 +03:00
Ilya Matveev
2bd835f008 CocoaPods: Replace '-' with '_' in podspec name 2019-03-07 18:59:26 +03:00
Ilya Matveev
e7cf4fd3f2 CocoaPods: Refactor framework name mangling 2019-03-07 18:59:26 +03:00
Ilya Matveev
320b0f907b CocoaPods: Rename user-visible: Cocoapods -> CocoaPods 2019-03-07 18:59:25 +03:00
Ilya Matveev
7650f63921 CocoaPods: Rename podspec task: generatePodspec -> podspec 2019-03-07 18:59:25 +03:00
Ilya Matveev
419195e608 CocoaPods: Replace dynamic dummy framework with a static one 2019-03-07 18:59:25 +03:00
Ilya Matveev
a616b79cba Refactor kotlin multiplatform extension access 2019-03-07 18:59:25 +03:00
Ilya Matveev
183eca867e CocoaPods: Use regex to split quoted compiler args 2019-03-07 18:59:25 +03:00
Ilya Matveev
7dbd79304d CocoaPods: Add 'native' in the plugin ID
kotlin-cocoapods -> kotlin-native-cocoapods
org.jetbrains.kotlin.cocoapods ->
org.jetbrains.kotlin.native.cocoapods
2019-03-07 18:59:25 +03:00
Ilya Matveev
6e20d4deec Support -Xstatic-framework in DSL
In Kotlin/Native 1.3.30 EAP1 an ability to build
a static ObjC framework has been added. This patch
adds support for this feature in the kotlin-multiplatform
plugin.
2019-03-07 18:59:24 +03:00
Ilya Matveev
068afcacae CocoaPods: Basic support
This patch adds a separate Gradle plugin allowing
a user to import Kotlin/Native modules in Cocoapods
projects and use Cocoapods dependencies in Kotlin
code via cinterop.

The plugin when applied does the following things:

1. Add a framework binary for each supported (iOS
   or macOS) platform in the project.

2. Add a Cocoapods extension allowing one to configure
   Cocoapods dependencies of the project.

3. Create cinterop tasks for each dependency from the
   previous point. The tasks are added for main
   compilations of each supported platform.

4. Add a task to generate a podspec-file which includes
   the framework from the point 1, script to
   build it and dependencies from the point 2.

So the Cocoapods import procedure is the following:

1. A user runs `./gradlew generatePodspec`. The plugin
   creates a podspec-file with all dependencies.

2. The user adds a dependency on this podspec in his Podfile
   and runs `pod install`. Cocoapods downloads dependencies
   and configures user's XCode project.

3. The user runs XCode build. XCode builds dependencies and then
   runs Gradle build. Gradle performs interop processing and
   builds the Kotlin framework. Compiler options and header
   search paths are passed in the Gradle from XCode environment
   variables. After that the final application is built by XCode.

Issue #KT-30269 Fixed
2019-03-07 18:59:24 +03:00
Ilya Matveev
d2d73b5043 Avoid resolution ambiguity for cinterop DSL
Earlier we used to have two methods: cinterops(Container.() -> Unit) and
cinterops(Action<Container>). It's OK for Groovy DSL but causes resolution
ambiguity in Kotlin DSL. This patch removes the first overload to avoid
this situation. The second overload still can be called in Kotlin DSL
as `cinterops { ... }`.
2019-03-07 18:59:24 +03:00
Ilya Matveev
3391530809 Deprecate old DSL method for binary configuration
In 1.3.20 a new binaries DSL was introduced. This
patch deprecates old DSL methods used for binary
configuration in 1.3.0 and 1.3.1x.

Issue #KT-29998 Fixed
2019-03-07 18:59:24 +03:00
Ilya Matveev
4d96bfe089 Add main interop libraries in test interop dependencies
Earlier we added interop libraries built for a main compilation
in dependencies of a corresponding test compilation. But we didn't
add them in dependencies of interop libraries built for the test
compilation. It caused cinterop failures when the test compilation
has interop libraries. This patch fixes it by adding main interop
libraries in dependencies of test ones.

Also earlier interop libraries of test compilations were
unintentionally added in apiElements and publication. This patch
fixes this issue too.

Issue #KT-30290 Fixed
2019-03-07 18:59:24 +03:00
Natalia Selezneva
9d37feab72 Preprocess script dependencies before running UnusedSymbolInspection
^KT-29474

(cherry picked from commit f98429c509)
2019-03-07 18:41:03 +03:00
Natalia Selezneva
feb8b91075 Show notification that script dependencies are not ready yet
(cherry picked from commit 47a4500eaa)
2019-03-07 18:41:03 +03:00
Natalia Selezneva
fbe6c72c46 Show progress for loading script dependencies even show notification is true when there are more than 3 scripts in queue
We are trying to update script dependencies silently when 'Reload script dependencies on file change' is off,
but in case when the queue for update is too long we need to make process visible to user and make it cancelable.

(cherry picked from commit 1d56f44093)
2019-03-07 18:41:02 +03:00
Natalia Selezneva
04a898dd44 Fire one 'roots changed' event after all scripts dependencies loaded
^KT-29474

(cherry picked from commit 8331d9789e)
2019-03-07 18:41:02 +03:00
Natalia Selezneva
8a05e00960 Check project.isDisposed before attaching script reports
(cherry picked from commit 6bc6dea916)
2019-03-07 18:41:02 +03:00
Natalia Selezneva
a690dbefe5 Do not search for text occurrences if this option is switched off
(cherry picked from commit c2dd365158)
2019-03-07 18:41:02 +03:00
Natalia Selezneva
c366433034 Scratch can be modified during execution (KT-30200)
^KT-30200 Fixed

(cherry picked from commit 4a0574dc5f)
2019-03-07 18:41:02 +03:00
Natalia Selezneva
8be1487429 Introduce ScratchPanelListener to set module in the created panel (KT-30049)
^KT-30049 Fixed

(cherry picked from commit 0dbbd8e08c)
2019-03-07 18:41:01 +03:00
Roman Elizarov
7c62ffa9cd Invoke probeCoroutineResumed on each unroll of the frame from heap
Fixes KT-29997
2019-03-07 17:38:38 +03:00
Alexander Udalov
10c71ea2f2 Support JVM target versions up to 12
#KT-26240 Fixed

(cherry picked from commit 518b03125c)
2019-03-07 12:09:11 +01:00
Alexander Udalov
bb98d95186 Minor, remove confusing logic from GenericReplChecker
(cherry picked from commit 9f75fd0d62)
2019-03-07 12:09:10 +01:00
Alexander Udalov
5098171326 Use JvmTarget.DEFAULT instead of JVM_1_6 where applicable
(cherry picked from commit c7c377e1b1)
2019-03-07 12:09:08 +01:00
Alexander Udalov
e9c071aabc Support JvmPackageName with JvmMultifileClass
This is an internal feature of our standard library needed to compile
new API for unsigned types

(cherry picked from commit 59fda8d7ce)
2019-03-06 15:38:31 +01:00
Alexander Udalov
ed7b530513 Reformat MultifileClassCodegen, fix inspections
(cherry picked from commit ea21cda4df)
2019-03-06 15:38:28 +01:00
Yan Zhulanow
65feaf9a4a 191: 191: Fix test compilation, remove deleted test
(cherry picked from commit 7c0233dfeb)
2019-03-06 13:41:52 +03:00
Nicolay Mitropolsky
558d1edd39 Uast: getMaybeLightElement cleanup
(cherry picked from commit f664499708)
2019-03-06 13:41:51 +03:00
Nicolay Mitropolsky
492dd24897 Uast: testing resolve for method called on variables of parametrized types
(cherry picked from commit ec1badf60d)
2019-03-06 13:41:51 +03:00
Nicolay Mitropolsky
710134b4a6 Uast: type-parameter references resolves to type-parameters
(cherry picked from commit 5268cd4663)
2019-03-06 13:41:51 +03:00
Nicolay Mitropolsky
c253404622 Uast: TypeReferences log test added
(cherry picked from commit ec26ea4e36)
2019-03-06 13:41:51 +03:00
Nicolay Mitropolsky
94a88c5c19 Uast: ResolveEverythingTest tests for generics added
(cherry picked from commit adb13b2f9e)
2019-03-06 13:41:51 +03:00
Nicolay Mitropolsky
8ac926d3e2 Uast: resolving references to local function declarations
(cherry picked from commit 337f16194a)
2019-03-06 13:41:51 +03:00
Nicolay Mitropolsky
1dcad35f21 Uast: making KotlinUSimpleReferenceExpression able to resolve to types
(cherry picked from commit 72860fb695)
2019-03-06 13:41:50 +03:00
Nicolay Mitropolsky
6df81c5fc7 Uast: setup for KotlinUastResolveEverythingTest
(cherry picked from commit e1e1e53e4a)
2019-03-06 13:41:50 +03:00
Nicolay Mitropolsky
6c0cec151e Uast: support for KtDelegatedSuperTypeEntry (KT-30033)
(cherry picked from commit 9c674cb7c3)
2019-03-06 13:41:50 +03:00
Nicolay Mitropolsky
22b2fc0c9f Uast multiresolve key description fix
(cherry picked from commit c151be5547)
2019-03-06 13:41:50 +03:00
Natalia Selezneva
48596fe2c7 Add scripting resolver extension to plugin-kotlin-extensions.xml
(cherry picked from commit ae22bdee15)
2019-03-06 13:16:19 +03:00
Natalia Selezneva
7fcc915fc4 Fix saving Kotlin Scripting Setting to xml
^KT-30146 Fixed

(cherry picked from commit bc1e836f01)
2019-03-06 13:14:38 +03:00
Natalia Selezneva
7c4e5dbb09 Do not threat modifications inside lambdas in KtScriptInitializer block as out of code block
(cherry picked from commit 48433110a4)
2019-03-06 13:14:10 +03:00
Natalia Selezneva
4b12826e99 Optimize MemberVisibilityCanBePrivateInspection: check that descriptor is in class before resolving it
(cherry picked from commit 49277bb5e4)
2019-03-06 13:13:51 +03:00
Natalia Selezneva
fab11884cc KtScriptInitializer doesn't has a descriptor
(cherry picked from commit 560acd631c)
2019-03-06 13:13:33 +03:00
Natalia Selezneva
800ccdcc1d Optimize ChangeVisibilityModifierIntention: do not analyze element if declaration isn't local
(cherry picked from commit 3b4d1dd7bf)
2019-03-06 13:13:12 +03:00
Natalia Selezneva
0d16f0de42 Optimize KotlinUFunctionCallExpression.isAnnotationArgumentArrayExpression
(cherry picked from commit 869fb46c0b)
2019-03-06 13:12:52 +03:00
Toshiaki Kameyama
d191510b42 Add intention to replace '!isNotEmpty()' to 'isEmpty()'
#KT-30123 Fixed

(cherry picked from commit 6b35c06d50)
2019-03-06 11:19:18 +03:00
Toshiaki Kameyama
536ab732cd Import members from: suggest on type reference
#KT-29927 Fixed

(cherry picked from commit 6b5ba272a0)
2019-03-06 11:18:25 +03:00
Dmitry Gridin
e100e3ec58 Fix KT-26965
(cherry picked from commit 2a940f5b0a)
2019-03-06 11:15:14 +03:00
Dereck Bridie
e6a560c49c #KT-26965 Add inspection + quickfix for replacing Collection<T>.count() with .size
(cherry picked from commit 4156a76129)
2019-03-06 11:13:48 +03:00
Mikhail Zarechenskiy
f1636cab67 Swap arguments for diagnostic message about incompatible enums
This commit is restoring previous behavior changed in c4b69b65 and
 fixing `DiagnosticMessageTestGenerated.testIncompatibleEnums` test
2019-03-06 10:49:53 +03:00
Mikhail Zarechenskiy
15a60b8640 Gradually prohibit comparison of incompatible enums
#KT-22043 Fixed
2019-03-05 14:23:50 +03:00
Mikhail Zarechenskiy
86395bc6dc Refactoring: move getRepresentativeUpperBound method to core
Plus prettify it a bit
2019-03-05 14:23:32 +03:00
Mikhail Zarechenskiy
a8345c25f0 Increment metadata version and improve message for error type
Follow-up of 617bed1b
2019-03-05 14:23:13 +03:00
Shagen Ogandzhanian
017d99de4c Fix for npm publishing configuration
This reverts commit 0188cd5330.
Turns out it's not a url after all
2019-03-05 11:32:15 +03:00
Toshiaki Kameyama
bb020202aa map.get() with not-null assertion: add quick-fixes
#KT-30010 Fixed

(cherry picked from commit d67c793a9b)
2019-03-05 09:57:14 +03:00
Toshiaki Kameyama
e111863ee2 Add inspection to replace Java Map.forEach with Kotlin's forEach
#KT-17278 Fixed

(cherry picked from commit 1a818970c3)
2019-03-05 09:56:32 +03:00
Mikhail Glukhikh
d940851bdf Fix "make constructor parameter a property" for vararg case
Same should work for annotated parameters
#KT-29312 Fixed

(cherry picked from commit 9e2ee6183c)
2019-03-05 09:55:50 +03:00
Mikhail Glukhikh
868c22b4cf Don't report "Unsafe call with ? extension receiver" with smart-cast
#KT-29499 Fixed

(cherry picked from commit c714e599ea)
2019-03-05 09:55:19 +03:00
Mikhail Glukhikh
a8755cef36 Don't report "main parameter not necessary" in objects #KT-29414 Fixed
(cherry picked from commit 4d19120d84)
2019-03-05 09:55:01 +03:00
Mikhail Glukhikh
1629c46177 MPP web builder: upgrade Ktor version to 1.1.3 #KT-29918 Fixed
(cherry picked from commit 022c625d2d)
2019-03-05 09:54:16 +03:00
Wil
3dfd560470 Minor: typo fix in Writer.buffered docs
(cherry picked from commit d3ac50f694)
2019-03-04 21:03:15 +03:00
Ilya Gorbunov
f745c84574 Do not expose internal copyOfUninitializedElements and copyOfNulls
(cherry picked from commit 640699e076)
2019-03-04 21:03:06 +03:00
Ilya Gorbunov
502a6086d6 Rewrite copyOfUninitializedElements with templates without using copyRangeTo
(cherry picked from commit 2e9497f8f8)
2019-03-04 21:03:05 +03:00
Ilya Gorbunov
1050b9d19b Rewrite copyInto without using copyRangeTo
Rename array copying implementation to arrayCopy

(cherry picked from commit c1a51d44a4)
2019-03-04 21:03:04 +03:00
Ilya Gorbunov
7954c1fced Move sorting implementations for Native to kotlin.collections
- Move Array.sortWith to generated code

(cherry picked from commit b8d9e896c2)
2019-03-04 21:03:02 +03:00
Ilya Gorbunov
5454bed997 Swap mismatched docs for Result.onSuccess/onFailure KT-30109
(cherry picked from commit 19bd326810)
2019-03-04 20:59:51 +03:00
Ilya Gorbunov
c361b184d9 Improve double-to-ulong conversion tests
#KT-27108

(cherry picked from commit 908009bf42)
2019-03-04 20:59:50 +03:00
Mikhail Glukhikh
4b1c847863 Remove FIR provider from IDE to prevent exceptions like KT-30243
This commit is a work-around for 1.3.30
2019-03-04 14:44:47 +03:00
Dmitry Gridin
1162c1be5f Fix KNPE from "Create" quick fix
#KT-27289 Fixed

(cherry picked from commit dce2139eb0)
2019-03-04 13:57:40 +03:00
Dmitry Gridin
b55d69c36b Refactoring
(cherry picked from commit 78bee70946)
2019-03-04 13:56:27 +03:00
Dmitry Gridin
0af1dc35a4 Fix "Introduce import alias" on extensions
#KT-30214 Fixed

(cherry picked from commit 5927032143)
2019-03-04 13:55:04 +03:00
Dmitry Gridin
ef27fe4e0e Fix caret position in "Convert function to property" intention
#KT-19944 Fixed

(cherry picked from commit 41f3316981)
2019-03-04 13:53:13 +03:00
Dmitry Gridin
614c68280f Refactoring & fix warnings
(cherry picked from commit 29a63ae58c)
2019-03-04 13:52:20 +03:00
Dmitry Gridin
bfbdd3f2fb Fix false positive "Redundant companion reference"
#KT-30166 Fixed

(cherry picked from commit 304007f602)
2019-03-04 13:51:24 +03:00
Dmitry Gridin
157ad173ec Add inspection to remove redundant qualifier name
#KT-12134 Fixed

(cherry picked from commit 3756b6f54d)
2019-03-04 13:50:54 +03:00
Dmitry Gridin
dfbe43fe16 Move canBePossibleToDropReceiver to Companion object & fix warnings
(cherry picked from commit d0c3a28996)
2019-03-04 13:50:28 +03:00
Andrey Uskov
3dc42d2525 Fix memory leak in gradle import
#KT-30076 Fixed

(cherry picked from commit 25dc81c2bd)
2019-03-04 01:46:59 +03:00
Andrey Uskov
919d527aa7 Minor. Reformat code in multiplatform project importer
(cherry picked from commit 3919898d19)
2019-03-04 01:46:10 +03:00
Andrey Uskov
45991a69ff Fix creation of KotlinSDK. GradleFacetImportTest fixed
(cherry picked from commit 735f86a50e)
2019-03-04 01:45:38 +03:00
Andrey Uskov
a134e568f2 Change class hierarchy of KotlinSourceRootType. Deadlock during concurrent classloading fixed
#KT-30137 Fixed

(cherry picked from commit 325ed8eb32)
2019-03-04 01:45:03 +03:00
Vyacheslav Gerasimov
3af23f2d3f Build: Add diagnostic for publish() helper
(cherry picked from commit f7428e7161)
2019-03-02 18:50:58 +03:00
Vyacheslav Gerasimov
7572ee4122 Build: Fix artifacts signing for maven central
With gradle > 5.0 `publish()` helper call should be done before
`noDefaultJar()` or any other artifact hacks, otherwise singing plugin doesn't sign any jars

(cherry picked from commit a42f607ecf)
2019-03-02 18:50:44 +03:00
Vyacheslav Gerasimov
41f3415b4a Build: Apply java plugin in kotlin-annotation-processing-embeddable
Otherwise artifact signature works incorrectly for this project

(cherry picked from commit df3aa48c9b)
2019-03-02 18:50:28 +03:00
Vyacheslav Gerasimov
9dbd7269cb Build: properly remove artifact from archives in runtimeJar helper
(cherry picked from commit f4c157a9bc)
2019-03-02 18:50:16 +03:00
Alexander Udalov
dd3d2311a8 Prohibit type parameters in class literals in annotation arguments
#KT-27799 Fixed

(cherry picked from commit 736ac12374)
2019-03-01 11:37:05 +01:00
Alexander Udalov
b28e71730b Support non-trivial default argument values in expected functions on JVM
#KT-22818 Fixed

(cherry picked from commit b8bc79e17c)
2019-03-01 11:35:22 +01:00
nikita.movshin
5e91bc5697 Added changelog for 1.3.30 2019-02-28 12:23:00 +03:00
Stanislav Erokhin
ef209999f7 Update Kotlin/Native: 1.2-eap-8089 2019-02-28 11:32:58 +03:00
Igor Chevdar
d364505652 Fixes of wrapped descriptors
Supported complex annotations
Supported type parameters in classes
2019-02-27 17:53:38 +03:00
Alexander Podkhalyuzin
30d2a1ae2a Do not go to the same type twice during contains search
This fixes exponent in algorithm for scala.FunctionN.curried, where N can be up to 22.

#KT-29435 Fixed

(cherry picked from commit 6098e97ae5)
2019-02-27 14:19:36 +03:00
1254 changed files with 36503 additions and 14811 deletions

2
.bunch
View File

@@ -4,5 +4,5 @@
as32_181_182
as33_182
as34
as35_as34
as35_191
191

View File

@@ -17,7 +17,7 @@
<element id="module-output" name="kotlin.core.descriptors.jvm.main" />
<element id="module-output" name="kotlin.core.descriptors.main" />
<element id="module-output" name="kotlin.core.deserialization.main" />
<element id="module-output" name="kotlin.eval4j.main" />
<element id="module-output" name="kotlin.idea.eval4j.main" />
<element id="module-output" name="kotlin.idea.fir-view.main" />
<element id="module-output" name="kotlin.compiler.frontend.java.main" />
<element id="module-output" name="kotlin.compiler.frontend.script.main" />

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

@@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="NK">
<words>
<w>typealias</w>
</words>
</dictionary>
</component>

View File

@@ -121,6 +121,8 @@
<Problem reference="com.intellij.openapi.diagnostic.LoggerKt#debugOrInfoIfTestMode" reason="Absent in 182." />
<Problem reference="com.intellij.psi.search.PsiSearchHelper#getInstance" reason="Absent in 181. Use psiSearchHelperInstance() instead." />
<Problem reference="com.intellij.psi.search.PsiSearchHelper.SERVICE" reason="Deprecated since 182. Use psiSearchHelperInstance() instead." />
<Problem reference="org.jetbrains.kotlin.idea.reporter.ITNReporterCompat#submit" reason="parentComponent is nullable in AS" />
<Problem reference="com.intellij.diagnostic.ITNReporter#submit" reason="parentComponent is nullable in AS" />
</list>
</option>
</inspection_tool>

View File

@@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-Pidea.is.internal=false" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
</configuration>
</component>

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,8 @@ sourceSets {
"test" { projectDefault() }
}
publish()
runtimeJar()
sourcesJar()
javadocJar()
@@ -39,5 +41,3 @@ javadocJar()
testsJar()
projectTest()
publish()

View File

@@ -10,7 +10,7 @@ import org.gradle.kotlin.dsl.*
buildscript {
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.30-dev-1945", onlySuccessBootstrap = false))
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.30-eap-28", projectExtId = "Kotlin_1330_Compiler", onlySuccessBootstrap = false))
repositories.withRedirector(project) {
bootstrapKotlinRepo?.let(::maven)
@@ -531,7 +531,7 @@ tasks {
":idea:idea-gradle-native:test",
":idea:idea-maven:test",
":j2k:test",
":eval4j:test")
":idea:eval4j:test")
}
create("idea-plugin-tests") {

View File

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

View File

@@ -0,0 +1,286 @@
@file:Suppress("PropertyName")
import org.gradle.api.publish.ivy.internal.artifact.FileBasedIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
import java.io.File
import org.gradle.internal.os.OperatingSystem
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijReleaseType: String by rootProject.extra
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
val asmVersion = rootProject.findProperty("versions.jar.asm-all") as String?
val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
val intellijSeparateSdks: Boolean by rootProject.extra
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
val installIntellijUltimate = intellijUltimateEnabled
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
if (intellijVersionDelimiterIndex == -1) {
error("Invalid IDEA version $intellijVersion")
}
val platformBaseVersion = intellijVersion.substring(0, intellijVersionDelimiterIndex)
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
logger.info("intellijVersion: $intellijVersion")
logger.info("androidStudioRelease: $androidStudioRelease")
logger.info("androidStudioBuild: $androidStudioBuild")
logger.info("intellijSeparateSdks: $intellijSeparateSdks")
logger.info("installIntellijCommunity: $installIntellijCommunity")
logger.info("installIntellijUltimate: $installIntellijUltimate")
val studioOs = "linux"
repositories {
if (androidStudioRelease != null) {
ivy {
if (cacheRedirectorEnabled) {
artifactPattern("https://cache-redirector.jetbrains.com/dl.google.com/dl/android/studio/ide-zips/$androidStudioRelease/[artifact]-[revision]-$studioOs.zip")
}
artifactPattern("https://dl.google.com/dl/android/studio/ide-zips/$androidStudioRelease/[artifact]-[revision]-$studioOs.zip")
metadataSources {
artifact()
}
}
ivy {
artifactPattern("https://dl.bintray.com/kotlin/as/[artifact]-[revision].zip")
credentials {
username = System.getenv("AS_BINTRAY_USER_NAME")
password = System.getenv("AS_BINTRAY_API_KEY")
}
metadataSources {
artifact()
}
}
}
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/$intellijReleaseType")
maven("https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven")
maven("https://cache-redirector.jetbrains.com/jetbrains.bintray.com/intellij-third-party-dependencies/")
}
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
maven("https://plugins.jetbrains.com/maven")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
}
val intellij by configurations.creating
val intellijUltimate by configurations.creating
val sources by configurations.creating
val `jps-standalone` by configurations.creating
val `jps-build-test` by configurations.creating
val `intellij-core` by configurations.creating
val `plugins-NodeJS` by configurations.creating
val customDepsRepoDir = File(buildDir, "repo")
val customDepsOrg: String by rootProject.extra
val customDepsRevision = intellijVersion
val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDepsRevision")
val repoDir = customDepsRepoModulesDir
dependencies {
if (androidStudioRelease != null) {
intellij("google:android-studio-ide:$androidStudioBuild")
} else {
if (installIntellijCommunity) {
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
}
if (installIntellijUltimate) {
intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion")
}
}
if (asmVersion != null) {
sources("org.jetbrains.intellij.deps:asm-all:$asmVersion:sources@jar")
}
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
`jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
`jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
`intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
if (intellijUltimateEnabled) {
`plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
}
}
fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration,
pathRemap: (String) -> String = { it },
extractor: (Configuration) -> Any) {
dependsOn(sourceConfig)
inputs.files(sourceConfig)
val targetDir = File(repoDir, sourceConfig.name)
outputs.dirs(targetDir)
doFirst {
project.copy {
from(extractor(sourceConfig))
into(targetDir)
eachFile {
path = pathRemap(path)
}
}
}
}
fun removePathPrefix(path: String): String {
if (androidStudioRelease == null) return path
val slashes = if (studioOs == "mac") 2 else 1
var result = path
repeat(slashes) {
result = result.substringAfter('/')
}
return result
}
val unzipIntellijSdk by tasks.creating {
configureExtractFromConfigurationTask(intellij, pathRemap = { removePathPrefix(it) }) {
zipTree(it.singleFile).matching {
exclude("**/plugins/Kotlin/**")
}
}
}
val unzipIntellijUltimateSdk by tasks.creating {
configureExtractFromConfigurationTask(intellijUltimate) {
zipTree(it.singleFile).matching {
exclude("plugins/Kotlin/**")
}
}
}
val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(`intellij-core`) { zipTree(it.singleFile) } }
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } }
val mergeSources by tasks.creating(Jar::class.java) {
dependsOn(sources)
from(provider { sources.map(::zipTree) })
destinationDir = File(repoDir, sources.name)
baseName = "intellij"
classifier = "sources"
version = intellijVersion
}
val copyJpsBuildTest by tasks.creating { configureExtractFromConfigurationTask(`jps-build-test`) { it.singleFile } }
val unzipNodeJSPlugin by tasks.creating { configureExtractFromConfigurationTask(`plugins-NodeJS`) { zipTree(it.singleFile) } }
fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection, baseDir: File, vararg sourcesJar: File) {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, moduleName, intellijVersion))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
jarFiles.asFileTree.files.forEach { jarFile ->
if (jarFile.isFile && jarFile.extension == "jar") {
val relativeName = jarFile.toRelativeString(baseDir).removeSuffix(".jar")
addArtifact(
FileBasedIvyArtifact(jarFile, DefaultIvyPublicationIdentity(customDepsOrg, relativeName, intellijVersion)).also {
it.conf = "default"
}
)
}
}
sourcesJar.forEach {
val sourcesArtifactName = it.name.substringBeforeLast("-").substringBeforeLast("-")
addArtifact(
FileBasedIvyArtifact(it, DefaultIvyPublicationIdentity(customDepsOrg, sourcesArtifactName, intellijVersion)).also { artifact ->
artifact.conf = "sources"
artifact.classifier = "sources"
}
)
}
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
}
}
val prepareIvyXmls by tasks.creating {
dependsOn(unzipIntellijCore, unzipJpsStandalone, mergeSources, copyJpsBuildTest)
val intellijSdkDir = File(repoDir, intellij.name)
val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name)
if (installIntellijCommunity) {
dependsOn(unzipIntellijSdk)
inputs.dir(intellijSdkDir)
outputs.file(File(repoDir, "${intellij.name}.ivy.xml"))
}
if (installIntellijUltimate) {
dependsOn(unzipIntellijUltimateSdk)
inputs.dir(intellijUltimateSdkDir)
outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml"))
}
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`)
flatDeps.forEach {
inputs.dir(File(repoDir, it.name))
outputs.file(File(repoDir, "${it.name}.ivy.xml"))
}
inputs.dir(File(repoDir, sources.name))
if (intellijUltimateEnabled) {
dependsOn(unzipNodeJSPlugin)
inputs.dir(File(repoDir, `plugins-NodeJS`.name))
outputs.file(File(repoDir, "${`plugins-NodeJS`.name}.ivy.xml"))
}
doFirst {
val sources = File(repoDir, sources.name).listFiles()
if (installIntellijCommunity) {
val libDir = File(intellijSdkDir, "lib")
writeIvyXml(intellij.name,
intellij.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
*sources)
File(intellijSdkDir, "plugins").listFiles { file: File -> file.isDirectory }.forEach {
writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), *sources)
}
}
if (installIntellijUltimate) {
val libDir = File(intellijUltimateSdkDir, "lib")
writeIvyXml(intellij.name, // important! the module name should be "intellij"
intellijUltimate.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
*sources)
File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), *sources)
}
}
flatDeps.forEach {
writeIvyXml(it.name, it.name, files("$repoDir/${it.name}"), File(repoDir, it.name), *sources)
}
if (intellijUltimateEnabled) {
val nodeJsBaseDir = "${`plugins-NodeJS`.name}/NodeJS/lib"
writeIvyXml("NodeJS", `plugins-NodeJS`.name, files("$repoDir/$nodeJsBaseDir"), File(repoDir, nodeJsBaseDir), *sources)
}
}
}
val build by tasks.creating {
dependsOn(prepareIvyXmls)
}
val clean by tasks.creating(Delete::class) {
delete(customDepsRepoModulesDir)
delete(buildDir)
}

View File

@@ -35,14 +35,26 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
}
}
var Project.artifactsRemovedDiagnosticFlag: Boolean
get() = extra.has("artifactsRemovedDiagnosticFlag") && extra["artifactsRemovedDiagnosticFlag"] == true
set(value) {
extra["artifactsRemovedDiagnosticFlag"] = value
}
fun Project.removeArtifacts(configuration: Configuration, task: Task) {
configuration.artifacts.removeAll { artifact ->
artifact.file in task.outputs.files
}
artifactsRemovedDiagnosticFlag = true
}
fun Project.noDefaultJar() {
tasks.findByName("jar")?.let { defaultJarTask ->
defaultJarTask.enabled = false
defaultJarTask.actions = emptyList()
configurations.forEach { cfg ->
cfg.artifacts.removeAll { artifact ->
artifact.file in defaultJarTask.outputs.files
}
removeArtifacts(cfg, defaultJarTask)
}
}
}
@@ -58,8 +70,7 @@ fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: Configurabl
fun <T : Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
extra["runtimeJarTask"] = task
tasks.findByName("jar")?.let { defaultJarTask ->
configurations.getOrCreate("archives")
.artifacts.removeAll { (it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false }
removeArtifacts(configurations.getOrCreate("archives"), defaultJarTask)
}
return task.apply {
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
@@ -109,6 +120,10 @@ fun Project.standardPublicJars() {
fun Project.publish(body: Upload.() -> Unit = {}): Upload {
apply<plugins.PublishedKotlinModule>()
if (artifactsRemovedDiagnosticFlag) {
error("`publish()` should be called before removing artifacts typically done in `noDefaultJar()` of `runtimeJar()` calls")
}
afterEvaluate {
if (configurations.findByName("classes-dirs") != null)
throw GradleException("classesDirsArtifact() is incompatible with publish(), see sources comments for details")

View File

@@ -137,7 +137,6 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
"-XX:ReservedCodeCacheSize=240m",
"-XX:+HeapDumpOnOutOfMemoryError",
"-ea",
"-Didea.is.internal=true",
"-Didea.debug.mode=true",
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
@@ -155,6 +154,12 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
jvmArgs("-Didea.ProcessCanceledException=disabled")
}
jvmArgs("-Didea.is.internal=${project.findProperty("idea.is.internal") ?: true}")
project.findProperty("idea.args")?.let { arguments ->
jvmArgs(arguments.toString().split(" "))
}
args()
doFirst {

View File

@@ -244,7 +244,7 @@ private fun parseSourceRoots(project: Project): List<PSourceRoot> {
for (sourceSet in project.sourceSets) {
val kotlinCompileTask = kotlinTasksBySourceSet[sourceSet.name]
val kind = if (sourceSet.name == SourceSet.TEST_SOURCE_SET_NAME) Kind.TEST else Kind.PRODUCTION
val kind = if (sourceSet.isTestSourceSet) Kind.TEST else Kind.PRODUCTION
fun Any.getKotlin(): SourceDirectorySet {
val kotlinMethod = javaClass.getMethod("getKotlin")
@@ -298,9 +298,8 @@ private fun parseSourceRoots(project: Project): List<PSourceRoot> {
private fun parseResourceRootsProcessedByProcessResourcesTask(project: Project, sourceSet: SourceSet): List<PSourceRoot> {
val isMainSourceSet = sourceSet.name == SourceSet.MAIN_SOURCE_SET_NAME
val isTestSourceSet = sourceSet.name == SourceSet.TEST_SOURCE_SET_NAME
val resourceRootKind = if (isTestSourceSet) PSourceRoot.Kind.TEST_RESOURCES else PSourceRoot.Kind.RESOURCES
val resourceRootKind = if (sourceSet.isTestSourceSet) PSourceRoot.Kind.TEST_RESOURCES else PSourceRoot.Kind.RESOURCES
val taskNameBase = "processResources"
val taskName = if (isMainSourceSet) taskNameBase else sourceSet.name + taskNameBase.capitalize()
val task = project.tasks.findByName(taskName) as? ProcessResources ?: return emptyList()
@@ -319,6 +318,11 @@ private fun parseResourceRootsProcessedByProcessResourcesTask(project: Project,
return roots.map { PSourceRoot(it, resourceRootKind, null) }
}
private val SourceSet.isTestSourceSet: Boolean
get() = name == SourceSet.TEST_SOURCE_SET_NAME
|| name.endsWith("Test")
|| name.endsWith("Tests")
private fun getKotlinOptions(kotlinCompileTask: Any): PSourceRootKotlinOptions? {
val compileArguments = kotlinCompileTask.invokeInternal("getSerializedCompilerArguments") as List<String>
fun parseBoolean(name: String) = compileArguments.contains("-$name")

View File

@@ -244,6 +244,10 @@ public abstract class AnnotationCodegen {
annotationTargetMaps.put(JvmTarget.JVM_1_6, jvm6);
annotationTargetMaps.put(JvmTarget.JVM_1_8, jvm8);
annotationTargetMaps.put(JvmTarget.JVM_9, jvm8);
annotationTargetMaps.put(JvmTarget.JVM_10, jvm8);
annotationTargetMaps.put(JvmTarget.JVM_11, jvm8);
annotationTargetMaps.put(JvmTarget.JVM_12, jvm8);
}
private void generateTargetAnnotation(

View File

@@ -100,7 +100,8 @@ import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.*;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.*;
import static org.jetbrains.kotlin.resolve.BindingContext.*;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.*;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.getDelegationConstructorCall;
import static org.jetbrains.kotlin.resolve.BindingContextUtils.isBoxedLocalCapturedInClosure;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.isFunctionExpression;
@@ -2900,7 +2901,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
while (cur != null) {
ClassDescriptor thisDescriptor = cur.getThisDescriptor();
if (!isSuper && thisDescriptor == thisOrOuterClass) {
// We use equals on type constructors (instead of reference equality on classes) to support the case where default parameter
// values of actual functions loaded from the expected function refer to the expected class.
if (!isSuper && thisDescriptor.getTypeConstructor().equals(thisOrOuterClass.getTypeConstructor())) {
return result;
}
@@ -3142,7 +3145,12 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
@NotNull VariableDescriptor target,
@Nullable StackValue receiverValue
) {
ClassDescriptor classDescriptor = CodegenBinding.anonymousClassForCallable(bindingContext, variableDescriptor);
ClassDescriptor classDescriptor = bindingContext.get(CLASS_FOR_CALLABLE, variableDescriptor);
if (classDescriptor == null) {
throw new IllegalStateException(
"Property reference class was not found: " + variableDescriptor +
"\nTried to generate: " + element.getText());
}
ClassBuilder classBuilder = state.getFactory().newVisitor(
JvmDeclarationOriginKt.OtherOrigin(element),
@@ -4858,6 +4866,10 @@ The "returned" value of try expression with no finally is either the last expres
KtProperty subjectVariable = expression.getSubjectVariable();
KtExpression subjectExpression = expression.getSubjectExpression();
if (subjectVariable == null && subjectExpression == null) {
v.nop();
}
SwitchCodegen switchCodegen = switchCodegenProvider.buildAppropriateSwitchCodegenIfPossible(
expression, isStatement, CodegenUtil.isExhaustive(bindingContext, expression, isStatement)
);

View File

@@ -21,10 +21,9 @@ import com.intellij.openapi.util.Trinity
import gnu.trove.TObjectIntHashMap
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.org.objectweb.asm.Type
import java.util.*
import java.util.ArrayList
class FrameMap : FrameMapBase<DeclarationDescriptor>()
open class FrameMap : FrameMapBase<DeclarationDescriptor>()
open class FrameMapBase<T : Any> {
private val myVarIndex = TObjectIntHashMap<T>()
@@ -61,7 +60,7 @@ open class FrameMapBase<T : Any> {
currentSize -= type.size
}
fun getIndex(descriptor: T): Int {
open fun getIndex(descriptor: T): Int {
return if (myVarIndex.contains(descriptor)) myVarIndex.get(descriptor) else -1
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver
/**
* This [FrameMap] subclass substitutes values declared in the expected declaration with the corresponding value in the actual declaration,
* which is needed for the case when expected function declares parameters with default values, which refer to other parameters.
*/
class FrameMapWithExpectActualSupport(private val module: ModuleDescriptor) : FrameMap() {
override fun getIndex(descriptor: DeclarationDescriptor): Int {
val tmp = if (descriptor is ParameterDescriptor) findActualParameter(descriptor) ?: descriptor else descriptor
return super.getIndex(tmp)
}
private fun findActualParameter(parameter: ParameterDescriptor): ParameterDescriptor? {
val container = parameter.containingDeclaration
if (container !is CallableMemberDescriptor || !container.isExpect) return null
// Generation of value parameters is supported by the fact that FunctionCodegen.generateDefaultImplBody substitutes value parameters
// of the generated actual function with the parameters of the expected declaration in the first place.
// Generation of dispatch receiver parameters (this and outer receiver values) is supported
// in ExpressionCodegen.generateThisOrOuterFromContext by comparing classes by type constructor equality.
if (parameter !is ReceiverParameterDescriptor || parameter.value !is ExtensionReceiver) return null
val actual = with(ExpectedActualResolver) {
container.findCompatibleActualForExpected(module).firstOrNull()
}
return (actual as? CallableDescriptor)?.extensionReceiverParameter
}
}

View File

@@ -1215,6 +1215,10 @@ public class FunctionCodegen {
getThrownExceptions(functionDescriptor, typeMapper)
);
// Only method annotations are copied to the $default method. Parameter annotations are not copied until there are valid use cases;
// enum constructors have two additional synthetic parameters which somewhat complicate this task
AnnotationCodegen.forMethod(mv, memberCodegen, state).genAnnotations(functionDescriptor, defaultMethod.getReturnType());
if (!state.getClassBuilderMode().generateBodies) {
if (this.owner instanceof MultifileClassFacadeContext)
endVisit(mv, "default method delegation", getSourceFromDescriptor(functionDescriptor));
@@ -1360,7 +1364,7 @@ public class FunctionCodegen {
@NotNull List<ValueParameterDescriptor> valueParameters,
boolean isStatic
) {
FrameMap frameMap = new FrameMap();
FrameMap frameMap = new FrameMapWithExpectActualSupport(state.getModule());
if (!isStatic) {
frameMap.enterTemp(OBJECT_TYPE);
}

View File

@@ -18,8 +18,6 @@ package org.jetbrains.kotlin.codegen
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.util.ArrayUtil
import com.intellij.util.SmartList
import org.jetbrains.kotlin.backend.common.CodegenUtil
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext
import org.jetbrains.kotlin.codegen.context.MethodContext
@@ -41,6 +39,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
@@ -67,20 +66,20 @@ class MultifileClassCodegenImpl(
) : MultifileClassCodegen {
private val facadeClassType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(facadeFqName)
private val packageFragment = getOnlyPackageFragment(facadeFqName.parent(), files, state.module)
private val packageFragment = getOnlyPackageFragment(files, state.module)
private val compiledPackageFragment = getCompiledPackageFragment(facadeFqName, state)
private val previouslyCompiledCallables =
if (compiledPackageFragment == null)
emptyList<DeserializedCallableMemberDescriptor>()
else
getDeserializedCallables(compiledPackageFragment)
if (compiledPackageFragment == null)
emptyList()
else
getDeserializedCallables(compiledPackageFragment)
private fun getDeserializedCallables(compiledPackageFragment: PackageFragmentDescriptor) =
compiledPackageFragment.getMemberScope()
.getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER)
.filterIsInstance<DeserializedCallableMemberDescriptor>()
compiledPackageFragment.getMemberScope()
.getContributedDescriptors(DescriptorKindFilter.CALLABLES, MemberScope.ALL_NAME_FILTER)
.filterIsInstance<DeserializedCallableMemberDescriptor>()
private val shouldGeneratePartHierarchy =
state.languageVersionSettings.getFlag(JvmAnalysisFlags.inheritMultifileParts)
@@ -100,7 +99,7 @@ class MultifileClassCodegenImpl(
private val superClassForInheritedPart = run {
val result = hashMapOf<String, String>()
for (i in 1 ..partInternalNamesSorted.size - 1) {
for (i in 1 until partInternalNamesSorted.size) {
result[partInternalNamesSorted[i]] = partInternalNamesSorted[i - 1]
}
result
@@ -115,29 +114,23 @@ class MultifileClassCodegenImpl(
J_L_OBJECT
private val classBuilder = ClassBuilderOnDemand {
val originFile = files.firstOrNull()
val actualPackageFragment = packageFragment
?: compiledPackageFragment
?: throw AssertionError("No package fragment for multifile facade $facadeFqName; files: $files")
val declarationOrigin = MultifileClass(originFile, actualPackageFragment)
?: compiledPackageFragment
?: throw AssertionError("No package fragment for multifile facade $facadeFqName; files: $files")
val singleSourceFile =
if (previouslyCompiledCallables.isEmpty())
files.singleOrNull { it.hasDeclarationsForPartClass() }
else
null
if (previouslyCompiledCallables.isEmpty())
files.singleOrNull { it.hasDeclarationsForPartClass() }
else
null
val superClassForFacade =
if (shouldGeneratePartHierarchy)
partInternalNamesSorted.last()
else
J_L_OBJECT
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
state.factory.newVisitor(declarationOrigin, facadeClassType, files).apply {
defineClass(singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
facadeClassType.internalName, null, superClassForFacade, ArrayUtil.EMPTY_STRING_ARRAY)
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
defineClass(
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
facadeClassType.internalName, null, superClassForFacade, emptyArray()
)
if (singleSourceFile != null) {
visitSource(singleSourceFile.name, null)
}
@@ -162,7 +155,7 @@ class MultifileClassCodegenImpl(
generateDelegatesToPreviouslyCompiledParts()
if (!partInternalNamesSorted.isEmpty()) {
if (partInternalNamesSorted.isNotEmpty()) {
generateMultifileFacadeClass()
}
@@ -175,16 +168,12 @@ class MultifileClassCodegenImpl(
try {
generatePart(file)
state.afterIndependentPart()
}
catch (e: ProcessCanceledException) {
} catch (e: ProcessCanceledException) {
throw e
}
catch (e: Throwable) {
val vFile = file.virtualFile
errorHandler.reportException(e, if (vFile == null) "no file" else vFile.url)
} catch (e: Throwable) {
errorHandler.reportException(e, file.virtualFile?.url ?: "no file")
DiagnosticUtils.throwIfRunningOnServer(e)
if (ApplicationManager.getApplication().isInternal) {
//noinspection CallToPrintStackTrace
e.printStackTrace()
}
}
@@ -205,7 +194,7 @@ class MultifileClassCodegenImpl(
private fun generatePart(file: KtFile) {
val packageFragment = this.packageFragment
?: throw AssertionError("File part $file of $facadeFqName: no package fragment")
?: throw AssertionError("File part $file of $facadeFqName: no package fragment")
val partType = Type.getObjectType(JvmFileClassUtil.getFileClassInternalName(file))
val partContext = state.rootContext.intoMultifileClassPart(packageFragment, facadeClassType, partType, file)
@@ -219,10 +208,7 @@ class MultifileClassCodegenImpl(
val builder = state.factory.newVisitor(MultifileClassPart(file, packageFragment), partType, file)
MultifileClassPartCodegen(
builder, file, packageFragment,
getSuperClassForPart(partType.internalName),
shouldGeneratePartHierarchy,
partContext, state
builder, file, packageFragment, getSuperClassForPart(partType.internalName), shouldGeneratePartHierarchy, partContext, state
).generate()
addDelegateGenerationTasksForDeclarationsInFile(file, packageFragment, partType)
@@ -284,14 +270,14 @@ class MultifileClassCodegenImpl(
val partFqName = JvmFileClassUtil.getPartFqNameForDeserialized(callable)
val partType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(partFqName)
addDelegateGenerationTaskIfNeeded(callable, { generateDelegateToCompiledMember(callable, compiledPackageFragment, partType) })
addDelegateGenerationTaskIfNeeded(callable) { generateDelegateToCompiledMember(callable, compiledPackageFragment, partType) }
}
}
private fun generateDelegateToCompiledMember(
member: CallableMemberDescriptor,
compiledPackageFragment: PackageFragmentDescriptor,
partType: Type
member: CallableMemberDescriptor,
compiledPackageFragment: PackageFragmentDescriptor,
partType: Type
) {
val context = state.rootContext.intoMultifileClass(compiledPackageFragment, facadeClassType, partType)
@@ -302,7 +288,8 @@ class MultifileClassCodegenImpl(
memberCodegen.functionCodegen.generateMethod(OtherOrigin(member), member, DelegateToCompiledMemberGenerationStrategy)
memberCodegen.functionCodegen.generateDefaultIfNeeded(
context.intoFunction(member), member, OwnerKind.PACKAGE, DefaultParameterValueLoader.DEFAULT, null)
context.intoFunction(member), member, OwnerKind.PACKAGE, DefaultParameterValueLoader.DEFAULT, null
)
memberCodegen.functionCodegen.generateOverloadsWithDefaultValues(null, member, member)
}
@@ -310,7 +297,7 @@ class MultifileClassCodegenImpl(
memberCodegen.propertyCodegen.generateInPackageFacade(member)
}
else -> {
throw IllegalStateException("Unexpected member: " + member)
throw IllegalStateException("Unexpected member: $member")
}
}
}
@@ -320,7 +307,9 @@ class MultifileClassCodegenImpl(
throw IllegalStateException("shouldn't be called")
}
override fun generateBody(mv: MethodVisitor, frameMap: FrameMap, signature: JvmMethodSignature, context: MethodContext, parentCodegen: MemberCodegen<*>) {
override fun generateBody(
mv: MethodVisitor, frameMap: FrameMap, signature: JvmMethodSignature, context: MethodContext, parentCodegen: MemberCodegen<*>
) {
throw IllegalStateException("shouldn't be called")
}
}
@@ -340,15 +329,29 @@ class MultifileClassCodegenImpl(
arv.visit(null, internalName)
}
arv.visitEnd()
val kotlinPackageFqName =
packageFragment?.fqName ?: compiledPackageFragment?.fqName
?: error("Either source package or compiled package should not be null: $facadeClassType ($files)")
if (files.any { it.packageFqName != kotlinPackageFqName })
throw UnsupportedOperationException(
"Multi-file parts of a facade with JvmPackageName should all lie in the same Kotlin package:\n " +
files.joinToString("\n ") { file -> "$file: package ${file.packageFqName}" }
)
if (kotlinPackageFqName != JvmClassName.byInternalName(facadeClassType.internalName).packageFqName) {
av.visit(JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME, kotlinPackageFqName.asString())
}
}
}
private fun createCodegenForDelegatesInMultifileFacade(facadeContext: FieldOwnerContext<*>): MemberCodegen<KtFile> =
object : MemberCodegen<KtFile>(state, null, facadeContext, null, classBuilder) {
override fun generateDeclaration() = throw UnsupportedOperationException()
override fun generateBody() = throw UnsupportedOperationException()
override fun generateKotlinMetadataAnnotation() = throw UnsupportedOperationException()
}
object : MemberCodegen<KtFile>(state, null, facadeContext, null, classBuilder) {
override fun generateDeclaration() = throw UnsupportedOperationException()
override fun generateBody() = throw UnsupportedOperationException()
override fun generateKotlinMetadataAnnotation() = throw UnsupportedOperationException()
}
private fun done() {
classBuilder.done()
@@ -359,19 +362,12 @@ class MultifileClassCodegenImpl(
companion object {
private val J_L_OBJECT = AsmTypes.OBJECT_TYPE.internalName
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
private const val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<KtFile>, moduleDescriptor: ModuleDescriptor): PackageFragmentDescriptor? {
val fragments = SmartList<PackageFragmentDescriptor>()
for (file in files) {
val fragment = moduleDescriptor.findPackageFragmentForFile(file)
?: throw AssertionError("package fragment is null for " + file + "\n" + file.text)
assert(packageFqName == fragment.fqName) { "expected package fq name: " + packageFqName + ", actual: " + fragment.fqName }
if (!fragments.contains(fragment)) {
fragments.add(fragment)
}
private fun getOnlyPackageFragment(files: Collection<KtFile>, moduleDescriptor: ModuleDescriptor): PackageFragmentDescriptor? {
val fragments = files.mapTo(linkedSetOf()) { file ->
moduleDescriptor.findPackageFragmentForFile(file)
?: throw AssertionError("package fragment is null for " + file + "\n" + file.text)
}
if (fragments.size > 1) {
throw IllegalStateException("More than one package fragment, files: $files | fragments: $fragments")
@@ -383,16 +379,15 @@ class MultifileClassCodegenImpl(
CodegenUtil.getMemberDeclarationsToGenerate(this).isNotEmpty()
private fun getCompiledPackageFragment(
facadeFqName: FqName, state: GenerationState
facadeFqName: FqName, state: GenerationState
): IncrementalPackageFragmentProvider.IncrementalMultifileClassPackageFragment? {
if (!IncrementalCompilation.isEnabledForJvm()) return null
val packageFqName = facadeFqName.parent()
val incrementalPackageFragment = state.module.getPackage(packageFqName).fragments.firstOrNull { fragment ->
fragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment &&
fragment.target == state.targetId
} as IncrementalPackageFragmentProvider.IncrementalPackageFragment?
fragment is IncrementalPackageFragmentProvider.IncrementalPackageFragment && fragment.target == state.targetId
} as IncrementalPackageFragmentProvider.IncrementalPackageFragment?
return incrementalPackageFragment?.getPackageFragmentForMultifileClass(facadeFqName)
}

View File

@@ -22,20 +22,22 @@ import org.jetbrains.kotlin.codegen.context.MultifileClassPartContext
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.java.JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtProperty
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
import org.jetbrains.org.objectweb.asm.Opcodes
class MultifileClassPartCodegen(
v: ClassBuilder,
file: KtFile,
private val packageFragment: PackageFragmentDescriptor,
private val superClassInternalName: String,
private val shouldGeneratePartHierarchy: Boolean,
partContext: MultifileClassPartContext,
state: GenerationState
v: ClassBuilder,
file: KtFile,
private val packageFragment: PackageFragmentDescriptor,
private val superClassInternalName: String,
private val shouldGeneratePartHierarchy: Boolean,
partContext: MultifileClassPartContext,
state: GenerationState
) : MemberCodegen<KtFile>(state, null, partContext, file, v) {
private val partType = partContext.filePartType
private val facadeClassType = partContext.multifileClassType
@@ -97,6 +99,11 @@ class MultifileClassPartCodegen(
writeKotlinMetadata(v, state, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART, extraFlags) { av ->
AsmUtil.writeAnnotationData(av, serializer, packageProto)
av.visit(JvmAnnotationNames.METADATA_MULTIFILE_CLASS_NAME_FIELD_NAME, facadeClassType.internalName)
val kotlinPackageFqName = element.packageFqName
if (kotlinPackageFqName != JvmClassName.byInternalName(partType.internalName).packageFqName) {
av.visit(METADATA_PACKAGE_NAME_FIELD_NAME, kotlinPackageFqName.asString())
}
}
}

View File

@@ -112,20 +112,12 @@ public class CodegenBinding {
return Boolean.TRUE.equals(bindingContext.get(ENUM_ENTRY_CLASS_NEED_SUBCLASS, classDescriptor));
}
@NotNull
public static ClassDescriptor anonymousClassForCallable(
@NotNull BindingContext bindingContext,
@NotNull CallableDescriptor descriptor
) {
//noinspection ConstantConditions
return bindingContext.get(CLASS_FOR_CALLABLE, descriptor);
}
@NotNull
public static Type asmTypeForAnonymousClass(@NotNull BindingContext bindingContext, @NotNull KtElement expression) {
Type result = asmTypeForAnonymousClassOrNull(bindingContext, expression);
if (result == null) {
throw new IllegalStateException("Type must not be null: " + expression.getText());
throw new KotlinExceptionWithAttachments("Couldn't compute ASM type for expression")
.withAttachment("expression.kt", PsiUtilsKt.getElementTextWithContext(expression));
}
return result;
@@ -152,8 +144,7 @@ public class CodegenBinding {
return asmTypeForAnonymousClassOrNull(bindingContext, variableDescriptor);
}
throw new KotlinExceptionWithAttachments("Couldn't compute ASM type for expression")
.withAttachment("expression.kt", PsiUtilsKt.getElementTextWithContext(expression));
return null;
}
@NotNull
@@ -168,7 +159,11 @@ public class CodegenBinding {
@Nullable
public static Type asmTypeForAnonymousClassOrNull(@NotNull BindingContext bindingContext, @NotNull CallableDescriptor descriptor) {
return bindingContext.get(ASM_TYPE, anonymousClassForCallable(bindingContext, descriptor));
ClassDescriptor classForCallable = bindingContext.get(CLASS_FOR_CALLABLE, descriptor);
if (classForCallable == null) {
return null;
}
return bindingContext.get(ASM_TYPE, classForCallable);
}
public static boolean canHaveOuter(@NotNull BindingContext bindingContext, @NotNull ClassDescriptor classDescriptor) {

View File

@@ -19,11 +19,11 @@ package org.jetbrains.kotlin.codegen.context;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.OwnerKind;
import org.jetbrains.kotlin.codegen.binding.CodegenBinding;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.anonymousClassForCallable;
public class ClosureContext extends ClassContext {
private final FunctionDescriptor functionDescriptor;
private final FunctionDescriptor originalSuspendLambdaDescriptor;
@@ -37,14 +37,27 @@ public class ClosureContext extends ClassContext {
@Nullable FunctionDescriptor originalSuspendLambdaDescriptor
) {
super(typeMapper,
anonymousClassForCallable(
typeMapper.getBindingContext(), originalSuspendLambdaDescriptor != null ? originalSuspendLambdaDescriptor : functionDescriptor),
getClassForCallable(typeMapper, functionDescriptor, originalSuspendLambdaDescriptor),
OwnerKind.IMPLEMENTATION, parentContext, localLookup);
this.functionDescriptor = functionDescriptor;
this.originalSuspendLambdaDescriptor = originalSuspendLambdaDescriptor;
}
@NotNull
private static ClassDescriptor getClassForCallable(
@NotNull KotlinTypeMapper typeMapper,
@NotNull FunctionDescriptor functionDescriptor,
@Nullable FunctionDescriptor originalSuspendLambdaDescriptor
) {
FunctionDescriptor callable = originalSuspendLambdaDescriptor != null ? originalSuspendLambdaDescriptor : functionDescriptor;
ClassDescriptor classDescriptor = typeMapper.getBindingContext().get(CodegenBinding.CLASS_FOR_CALLABLE, callable);
if (classDescriptor == null) {
throw new IllegalStateException("Class for callable is not found: " + functionDescriptor);
}
return classDescriptor;
}
public ClosureContext(
@NotNull KotlinTypeMapper typeMapper,
@NotNull FunctionDescriptor functionDescriptor,

View File

@@ -133,7 +133,6 @@ class AnonymousObjectTransformer(
val coroutineTransformer = CoroutineTransformer(
inliningContext,
classBuilder,
sourceInfo,
methodsToTransform,
superClassName
)

View File

@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.codegen.inline
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.binding.CodegenBinding.*
import org.jetbrains.kotlin.codegen.binding.MutableClosure
import org.jetbrains.kotlin.codegen.context.EnclosedValueDescriptor
@@ -225,7 +224,7 @@ class PsiExpressionLambda(
private val labels: Set<String>
private lateinit var closure: CalculatedClosure
private var closure: CalculatedClosure
init {
val bindingContext = typeMapper.bindingContext
@@ -234,8 +233,9 @@ class PsiExpressionLambda(
if (function == null && expression is KtCallableReferenceExpression) {
val variableDescriptor =
bindingContext.get(BindingContext.VARIABLE, functionWithBodyOrCallableReference) as? VariableDescriptorWithAccessors
?: throw AssertionError("""Reference expression not resolved to variable descriptor with accessors: ${expression.getText()}""")
classDescriptor = CodegenBinding.anonymousClassForCallable(bindingContext, variableDescriptor)
?: throw AssertionError("Reference expression not resolved to variable descriptor with accessors: ${expression.getText()}")
classDescriptor = bindingContext.get(CLASS_FOR_CALLABLE, variableDescriptor)
?: throw IllegalStateException("Class for callable not found: $variableDescriptor\n${expression.text}")
lambdaClassType = typeMapper.mapClass(classDescriptor)
val getFunction = PropertyReferenceCodegen.findGetFunction(variableDescriptor)
invokeMethodDescriptor = PropertyReferenceCodegen.createFakeOpenDescriptor(getFunction, classDescriptor)
@@ -246,7 +246,8 @@ class PsiExpressionLambda(
} else {
propertyReferenceInfo = null
invokeMethodDescriptor = function ?: throw AssertionError("Function is not resolved to descriptor: " + expression.text)
classDescriptor = anonymousClassForCallable(bindingContext, invokeMethodDescriptor)
classDescriptor = bindingContext.get(CLASS_FOR_CALLABLE, invokeMethodDescriptor)
?: throw IllegalStateException("Class for invoke method not found: $invokeMethodDescriptor\n${expression.text}")
lambdaClassType = asmTypeForAnonymousClass(bindingContext, invokeMethodDescriptor)
}

View File

@@ -9,6 +9,7 @@ import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.backend.common.CodegenUtil
import org.jetbrains.kotlin.codegen.*
import org.jetbrains.kotlin.codegen.context.*
import org.jetbrains.kotlin.codegen.coroutines.getOrCreateJvmSuspendFunctionView
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.isReleaseCoroutines
import org.jetbrains.kotlin.descriptors.*
@@ -134,11 +135,15 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
): SMAP {
lambdaInfo as? PsiExpressionLambda ?: error("TODO")
val invokeMethodDescriptor = lambdaInfo.invokeMethodDescriptor
val closureContext =
if (lambdaInfo.isPropertyReference)
val closureContext = when {
lambdaInfo.isPropertyReference ->
codegen.getContext().intoAnonymousClass(lambdaInfo.classDescriptor, codegen, OwnerKind.IMPLEMENTATION)
else
codegen.getContext().intoClosure(invokeMethodDescriptor, codegen, state.typeMapper)
invokeMethodDescriptor.isSuspend ->
codegen.getContext().intoCoroutineClosure(
getOrCreateJvmSuspendFunctionView(invokeMethodDescriptor, state), invokeMethodDescriptor, codegen, state.typeMapper
)
else -> codegen.getContext().intoClosure(invokeMethodDescriptor, codegen, state.typeMapper)
}
val context = closureContext.intoInlinedLambda(invokeMethodDescriptor, lambdaInfo.isCrossInline, lambdaInfo.isPropertyReference)
return generateMethodBody(

View File

@@ -27,7 +27,6 @@ import org.jetbrains.org.objectweb.asm.tree.TypeInsnNode
class CoroutineTransformer(
private val inliningContext: InliningContext,
private val classBuilder: ClassBuilder,
private val sourceFile: String?,
private val methods: List<MethodNode>,
private val superClassName: String
) {
@@ -107,7 +106,7 @@ class CoroutineTransformer(
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
containingClassInternalName = classBuilder.thisName,
isForNamedFunction = false,
sourceFile = sourceFile ?: "",
sourceFile = element.containingKtFile.name,
isCrossinlineLambda = inliningContext.isContinuation
)
}
@@ -136,7 +135,7 @@ class CoroutineTransformer(
isForNamedFunction = true,
needDispatchReceiver = true,
internalNameForDispatchReceiver = classBuilder.thisName,
sourceFile = sourceFile ?: ""
sourceFile = element.containingKtFile.name
)
}
}

View File

@@ -6,11 +6,11 @@
package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.kotlin.getRepresentativeUpperBound
import org.jetbrains.kotlin.resolve.InlineClassDescriptorResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.jvm.*
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
import java.security.MessageDigest
import java.util.*
@@ -44,7 +44,7 @@ private fun getSignatureElementForMangling(type: KotlinType): String = buildStri
}
is TypeParameterDescriptor -> {
append(getSignatureElementForMangling(getRepresentativeUpperBound(descriptor)))
append(getSignatureElementForMangling(descriptor.representativeUpperBound))
}
}
}

View File

@@ -62,7 +62,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-jvm-target",
valueDescription = "<version>",
description = "Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6"
description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11 or 12), default is 1.6"
)
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)

View File

@@ -215,10 +215,10 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
val libPath = PathUtil.kotlinPathsForCompiler.libPath.takeIf { it.exists() && it.isDirectory } ?: File(".")
with(PathUtil) {
val jars = arrayOf(
KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_COMMON_JAR,
KOTLIN_SCRIPTING_JVM_JAR
KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_IMPL_JAR,
KOTLIN_SCRIPTING_COMMON_JAR, KOTLIN_SCRIPTING_JVM_JAR
).mapNotNull { File(libPath, it).takeIf { it.exists() }?.canonicalPath }
if (jars.size == 3) {
if (jars.size == 4) {
pluginClasspaths = jars + pluginClasspaths
}
}

View File

@@ -140,7 +140,7 @@ object TopDownAnalyzerFacadeForJVM {
val sourceScope = if (separateModules) sourceModuleSearchScope else GlobalSearchScope.allScope(project)
val moduleClassResolver = SourceOrBinaryModuleClassResolver(sourceScope)
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.JVM_1_6
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET, JvmTarget.DEFAULT)
val languageVersionSettings = configuration.languageVersionSettings
val optionalBuiltInsModule =

View File

@@ -56,7 +56,8 @@ open class GenericReplChecker(
if (get(JVMConfigurationKeys.JVM_TARGET) == null) {
put(JVMConfigurationKeys.JVM_TARGET,
System.getProperty(KOTLIN_REPL_JVM_TARGET_PROPERTY)?.let { JvmTarget.fromString(it) }
?: if (getJavaVersion() >= 0x10008) JvmTarget.JVM_1_8 else JvmTarget.JVM_1_6)
?: System.getProperty("java.specification.version")?.let { JvmTarget.fromString(it) }
?: JvmTarget.DEFAULT)
}
}
KotlinCoreEnvironment.createForProduction(disposable, compilerConfiguration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
@@ -97,21 +98,3 @@ open class GenericReplChecker(
}
}
}
// initially taken from libraries/stdlib/src/kotlin/internal/PlatformImplementations.kt
// fixed according to JEP 223 - http://openjdk.java.net/jeps/223
// TODO: consider to place it to some common place
private fun getJavaVersion(): Int {
val default = 0x10006
val version = System.getProperty("java.specification.version") ?: return default
val components = version.split('.')
return try {
when (components.size) {
0 -> default
1 -> components[0].toInt() * 0x10000
else -> components[0].toInt() * 0x10000 + components[1].toInt()
}
} catch (e: NumberFormatException) {
default
}
}

View File

@@ -25,10 +25,10 @@ sourceSets {
"test" {}
}
publish()
val jar: Jar by tasks
runtimeJar(rewriteDepsToShadedCompiler(jar))
sourcesJar()
javadocJar()
publish()

View File

@@ -38,7 +38,10 @@ object DynamicComponentDescriptor : ValueDescriptor {
override fun toString(): String = "Dynamic"
}
class StorageComponentContainer(private val id: String, parent: StorageComponentContainer? = null) : ComponentContainer, ComponentProvider, Closeable {
class StorageComponentContainer(
private val id: String,
parent: StorageComponentContainer? = null
) : ComponentContainer, ComponentProvider, Closeable {
val unknownContext: ComponentResolveContext by lazy {
val parentContext = parent?.let { ComponentResolveContext(it, DynamicComponentDescriptor) }
ComponentResolveContext(this, DynamicComponentDescriptor, parentContext)
@@ -102,7 +105,10 @@ class StorageComponentContainer(private val id: String, parent: StorageComponent
override fun <T> create(request: Class<T>): T {
val constructorBinding = request.bindToConstructor(unknownContext)
val args = constructorBinding.argumentDescriptors.map { it.getValue() }.toTypedArray()
return runWithUnwrappingInvocationException { constructorBinding.constructor.newInstance(*args) as T }
return runWithUnwrappingInvocationException {
@Suppress("UNCHECKED_CAST")
constructorBinding.constructor.newInstance(*args) as T
}
}
override fun toString() = "Container $id"

View File

@@ -42,7 +42,7 @@ class ComponentContainerTest {
val descriptor = container.resolve<TestComponentInterface>()
assertNotNull(descriptor)
val instance = descriptor!!.getValue() as TestComponentInterface
val instance = descriptor.getValue() as TestComponentInterface
assertNotNull(instance)
assertFails {
instance.foo()
@@ -58,14 +58,14 @@ class ComponentContainerTest {
val descriptor = container.resolve<TestClientComponent>()
assertNotNull(descriptor)
val instance = descriptor!!.getValue() as TestClientComponent
val instance = descriptor.getValue() as TestClientComponent
assertNotNull(instance)
assertNotNull(instance.dep)
assertFails {
instance.dep.foo()
}
assertTrue(instance.dep is ManualTestComponent)
assertEquals("name", (instance.dep as ManualTestComponent).name)
assertEquals("name", instance.dep.name)
container.close()
assertTrue(instance.disposed)
assertFalse(instance.dep.disposed) // should not dispose manually passed instances
@@ -80,7 +80,7 @@ class ComponentContainerTest {
val descriptor = container.resolve<TestClientComponent>()
assertNotNull(descriptor)
val instance = descriptor!!.getValue() as TestClientComponent
val instance = descriptor.getValue() as TestClientComponent
assertNotNull(instance)
assertNotNull(instance.dep)
assertFails {
@@ -114,8 +114,8 @@ class ComponentContainerTest {
assertNotNull(descriptor1)
val descriptor2 = it.resolve<TestClientComponentInterface>()
assertNotNull(descriptor2)
assertTrue(descriptor1 == descriptor2)
assertTrue(descriptor1!!.getValue() == descriptor2!!.getValue())
assertEquals(descriptor1, descriptor2)
assertEquals(descriptor1.getValue(), descriptor2.getValue())
}
}
@@ -129,9 +129,9 @@ class ComponentContainerTest {
assertNotNull(descriptor1)
val descriptor2 = it.resolve<TestAdhocComponent2>()
assertNotNull(descriptor2)
val component1 = descriptor1!!.getValue() as TestAdhocComponent1
val component2 = descriptor2!!.getValue() as TestAdhocComponent2
assertTrue(component1.service === component2.service)
val component1 = descriptor1.getValue() as TestAdhocComponent1
val component2 = descriptor2.getValue() as TestAdhocComponent2
assertSame(component1.service, component2.service)
}
}
@@ -142,10 +142,10 @@ class ComponentContainerTest {
useImpl<TestClientComponent>()
useImpl<TestClientComponent2>()
useImpl<TestIterableComponent>()
}.use {
val descriptor = it.resolve<TestIterableComponent>()
}.use { container ->
val descriptor = container.resolve<TestIterableComponent>()
assertNotNull(descriptor)
val iterableComponent = descriptor!!.getValue() as TestIterableComponent
val iterableComponent = descriptor.getValue() as TestIterableComponent
assertEquals(2, iterableComponent.components.count())
assertTrue(iterableComponent.components.any { it is TestClientComponent })
assertTrue(iterableComponent.components.any { it is TestClientComponent2 })
@@ -160,10 +160,10 @@ class ComponentContainerTest {
useImpl<TestClientComponent2>()
useImpl<TestStringComponent>()
useImpl<JavaTestComponents>()
}.use {
val descriptor = it.resolve<JavaTestComponents>()
}.use { container ->
val descriptor = container.resolve<JavaTestComponents>()
assertNotNull(descriptor)
val iterableComponent = descriptor!!.getValue() as JavaTestComponents
val iterableComponent = descriptor.getValue() as JavaTestComponents
assertEquals(2, iterableComponent.components.count())
assertTrue(iterableComponent.components.any { it is TestClientComponent })
assertTrue(iterableComponent.components.any { it is TestClientComponent2 })
@@ -181,7 +181,7 @@ class ComponentContainerTest {
}.use {
val descriptor = it.resolve<TestGenericClient>()
assertNotNull(descriptor)
val genericClient = descriptor!!.getValue() as TestGenericClient
val genericClient = descriptor.getValue() as TestGenericClient
assertTrue(genericClient.component1 is TestStringComponent)
assertTrue(genericClient.component2 is TestIntComponent)
}
@@ -219,9 +219,11 @@ class ComponentContainerTest {
class WithSetters {
var isSetterCalled = false
@Suppress("unused")
var tc: TestComponent? = null
@Inject set(v) {
isSetterCalled = true
field = v
}
}
@@ -265,7 +267,7 @@ class ComponentContainerTest {
val b = a.b
assertTrue(b is B)
val c = b!!.c
val c = b.c
assertTrue(c is C)
}
@@ -284,10 +286,13 @@ class ComponentContainerTest {
val b = bc.get<B>()
val a = ac.get<A>()
@Suppress("USELESS_IS_CHECK")
assertTrue(b is B)
@Suppress("USELESS_IS_CHECK")
assertTrue(b.a is A)
@Suppress("USELESS_IS_CHECK")
assertTrue(a is A)
assertTrue(b.a === a)
assertSame(b.a, a)
}
@Test
@@ -306,10 +311,11 @@ class ComponentContainerTest {
useImpl<B>()
}
val a = ac.get<A>()
@Suppress("USELESS_IS_CHECK")
assertTrue(a is A)
assertTrue(a === bc2.get<B>().a)
assertTrue(a === bc1.get<B>().a)
assertTrue(a === bc1.get<A>())
assertSame(a, bc2.get<B>().a)
assertSame(a, bc1.get<B>().a)
assertSame(a, bc1.get())
}
@DefaultImplementation(impl = Impl::class)
@@ -317,7 +323,7 @@ class ComponentContainerTest {
class Impl : I()
class Impl2: I()
class Impl2 : I()
class Use(val i: I)
@@ -346,7 +352,7 @@ class ComponentContainerTest {
@DefaultImplementation(impl = A::class)
interface S
object A: S
object A : S
class UseS(val s: S)
@@ -356,6 +362,6 @@ class ComponentContainerTest {
useImpl<UseS>()
}.get<UseS>()
assertTrue(useS.s === A)
assertSame(useS.s, A)
}
}

View File

@@ -41,6 +41,8 @@ sourceSets {
"test" {}
}
publish()
noDefaultJar()
runtimeJar(task<ShadowJar>("shadowJar")) {
@@ -55,5 +57,3 @@ javadocJar()
dist()
ideaPlugin()
publish()

View File

@@ -64,7 +64,8 @@ class IncrementalCompilationOptions(
*/
val outputFiles: List<File>,
val multiModuleICSettings: MultiModuleICSettings,
val modulesInfo: IncrementalModuleInfo
val modulesInfo: IncrementalModuleInfo,
val classpathFqNamesHistory: File? = null
) : CompilationOptions(compilerMode, targetPlatform, reportCategories, reportSeverity, requestedCompilationResults) {
companion object {
const val serialVersionUID: Long = 0
@@ -80,6 +81,7 @@ class IncrementalCompilationOptions(
"multiModuleICSettings=$multiModuleICSettings, " +
"usePreciseJavaTracking=$usePreciseJavaTracking" +
"outputFiles=$outputFiles" +
"classpathFqNamesHistory=$classpathFqNamesHistory" +
")"
}
}

View File

@@ -41,7 +41,10 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.daemon.report.*
import org.jetbrains.kotlin.daemon.report.CompileServicesFacadeMessageCollector
import org.jetbrains.kotlin.daemon.report.DaemonMessageReporter
import org.jetbrains.kotlin.daemon.report.DaemonMessageReporterPrintStreamAdapter
import org.jetbrains.kotlin.daemon.report.getICReporter
import org.jetbrains.kotlin.incremental.*
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import org.jetbrains.kotlin.incremental.components.LookupTracker
@@ -580,15 +583,19 @@ class CompileServiceImpl(
}
}
val outputFiles = incrementalCompilationOptions.outputFiles.toMutableList()
incrementalCompilationOptions.classpathFqNamesHistory?.let { outputFiles.add(it) }
val compiler = IncrementalJvmCompilerRunner(
workingDir,
javaSourceRoots,
reporter,
buildHistoryFile = incrementalCompilationOptions.multiModuleICSettings.buildHistoryFile,
outputFiles = incrementalCompilationOptions.outputFiles,
outputFiles = outputFiles,
usePreciseJavaTracking = incrementalCompilationOptions.usePreciseJavaTracking,
modulesApiHistory = modulesApiHistory,
kotlinSourceFilesExtensions = allKotlinExtensions
kotlinSourceFilesExtensions = allKotlinExtensions,
classpathFqNamesHistory = incrementalCompilationOptions.classpathFqNamesHistory
)
return try {
compiler.compile(allKotlinFiles, k2jvmArgs, compilerMessageCollector, changedFiles)

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.config
import org.jetbrains.org.objectweb.asm.Opcodes
@@ -21,10 +22,13 @@ import org.jetbrains.org.objectweb.asm.Opcodes
enum class JvmTarget(override val description: String) : TargetPlatformVersion {
JVM_1_6("1.6"),
JVM_1_8("1.8"),
JVM_9("9"),
JVM_10("10"),
JVM_11("11"),
JVM_12("12"),
;
val bytecodeVersion: Int by lazy {
@Suppress("DEPRECATION")
when (this) {
JVM_1_6 -> Opcodes.V1_6
JVM_1_8 ->
@@ -33,6 +37,10 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.1.9")) -> Opcodes.V9
else -> Opcodes.V1_8
}
JVM_9 -> Opcodes.V9
JVM_10 -> Opcodes.V9 + 1
JVM_11 -> Opcodes.V9 + 2
JVM_12 -> Opcodes.V9 + 3
}
}
@@ -44,16 +52,13 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
fun fromString(string: String) = values().find { it.description == string }
fun getDescription(bytecodeVersion: Int): String {
@Suppress("DEPRECATION")
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?:
when (bytecodeVersion) {
Opcodes.V1_7 -> "1.7"
Opcodes.V9 -> "1.9"
else -> null
}
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?: when (bytecodeVersion) {
Opcodes.V1_7 -> "1.7"
else -> null
}
return if (platformDescription != null) "JVM target $platformDescription"
else "JVM bytecode version $bytecodeVersion"
else "JVM bytecode version $bytecodeVersion"
}
}
}

View File

@@ -82,7 +82,7 @@ object JvmAnalyzerFacade : ResolverForModuleFactory() {
resolverForModule.componentProvider.get<JavaDescriptorResolver>()
}
val jvmTarget = targetPlatformVersion as? JvmTarget ?: JvmTarget.JVM_1_6
val jvmTarget = targetPlatformVersion as? JvmTarget ?: JvmTarget.DEFAULT
val trace = CodeAnalyzerInitializer.getInstance(project).createTrace()
val lookupTracker = LookupTracker.DO_NOTHING

View File

@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.*
class InterfaceDefaultMethodCallChecker(val jvmTarget: JvmTarget) : CallChecker {
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
val supportDefaults = jvmTarget == JvmTarget.JVM_1_8
val supportDefaults = jvmTarget >= JvmTarget.JVM_1_8
val descriptor = resolvedCall.resultingDescriptor as? CallableMemberDescriptor ?: return
if (descriptor is JavaPropertyDescriptor) return

View File

@@ -28,7 +28,10 @@ import org.jetbrains.kotlin.resolve.AdditionalAnnotationChecker
import org.jetbrains.kotlin.resolve.AnnotationChecker
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.descriptorUtil.*
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.getAnnotationRetention
import org.jetbrains.kotlin.resolve.descriptorUtil.isRepeatableAnnotation
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
object RepeatableAnnotationChecker: AdditionalAnnotationChecker {
@@ -81,12 +84,8 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker {
if (classDescriptor.getAnnotationRetention() != KotlinRetention.SOURCE) {
trace.report(ErrorsJvm.ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES.on(entry, classFqName))
}
if (classFqName == JvmFileClassUtil.JVM_PACKAGE_NAME) {
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES.on(entry))
}
}
}
else {
} else {
for ((entry, classDescriptor) in fileAnnotationsToCheck) {
if (classDescriptor.fqNameSafe != JvmFileClassUtil.JVM_PACKAGE_NAME) continue
@@ -97,13 +96,11 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker {
val value = (stringTemplateEntries.singleOrNull() as? KtLiteralStringTemplateEntry)?.text
if (value == null) {
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_CANNOT_BE_EMPTY.on(entry))
}
else if (!isValidJavaFqName(value)) {
} else if (!isValidJavaFqName(value)) {
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_MUST_BE_VALID_NAME.on(entry))
}
else if (entry.containingKtFile.declarations.any {
it !is KtFunction && it !is KtProperty && it !is KtTypeAlias
}) {
} else if (entry.containingKtFile.declarations.any {
it !is KtFunction && it !is KtProperty && it !is KtTypeAlias
}) {
trace.report(ErrorsJvm.JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES.on(entry))
}
}

View File

@@ -67,7 +67,6 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
MAP.put(NON_SOURCE_REPEATED_ANNOTATION, "Repeatable annotations with non-SOURCE retention are not yet supported");
MAP.put(ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES, "Annotation ''@{0}'' is not applicable to the multi-file classes", TO_STRING);
MAP.put(JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES, "''@JvmPackageName'' annotation is not supported in multi-file classes");
MAP.put(JVM_PACKAGE_NAME_CANNOT_BE_EMPTY, "''@JvmPackageName'' annotation value cannot be empty");
MAP.put(JVM_PACKAGE_NAME_MUST_BE_VALID_NAME, "''@JvmPackageName'' annotation value must be a valid dot-qualified name of a package");
MAP.put(JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES, "''@JvmPackageName'' annotation is not supported for files with class declarations");

View File

@@ -68,7 +68,6 @@ public interface ErrorsJvm {
DiagnosticFactory0<KtAnnotationEntry> NON_SOURCE_REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR);
DiagnosticFactory1<KtAnnotationEntry, FqName> ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES = DiagnosticFactory1.create(ERROR);
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_CANNOT_BE_EMPTY = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_MUST_BE_VALID_NAME = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtAnnotationEntry> JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES = DiagnosticFactory0.create(ERROR);

View File

@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
import org.jetbrains.kotlin.idea.MainFunctionDetector
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.BindingContext.*
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
@@ -736,7 +737,9 @@ class ControlFlowInformationProvider private constructor(
return
}
!languageVersionSettings.supportsFeature(LanguageFeature.WarningOnMainUnusedParameter) -> {
trace.record(UNUSED_MAIN_PARAMETER, element)
if (owner.containingClassOrObject == null) {
trace.record(UNUSED_MAIN_PARAMETER, element)
}
return
}
}

View File

@@ -231,6 +231,8 @@ public interface Errors {
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_MUST_BE_CONST = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER = DiagnosticFactory0.create(WARNING);
DiagnosticFactory0<KtExpression> ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtAnnotatedExpression> ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE = DiagnosticFactory0.create(WARNING);
DiagnosticFactory0<KtAnnotationEntry> ANNOTATION_USED_AS_ANNOTATION_ARGUMENT = DiagnosticFactory0.create(ERROR);
@@ -798,6 +800,8 @@ public interface Errors {
DiagnosticFactory2<KtElement, KotlinType, KotlinType> INCOMPATIBLE_ENUM_COMPARISON =
DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtElement, KotlinType, KotlinType> INCOMPATIBLE_ENUM_COMPARISON_ERROR =
DiagnosticFactory2.create(ERROR);
DiagnosticFactory1<KtExpression, KotlinType> HAS_NEXT_MISSING = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<KtExpression, KotlinType> HAS_NEXT_FUNCTION_AMBIGUITY = DiagnosticFactory1.create(ERROR);

View File

@@ -741,6 +741,7 @@ public class DefaultErrorMessages {
}, RENDER_TYPE, RENDER_TYPE);
MAP.put(INCOMPATIBLE_ENUM_COMPARISON, "Comparison of incompatible enums ''{0}'' and ''{1}'' is always unsuccessful", RENDER_TYPE, RENDER_TYPE);
MAP.put(INCOMPATIBLE_ENUM_COMPARISON_ERROR, "Comparison of incompatible enums ''{0}'' and ''{1}'' is always unsuccessful", RENDER_TYPE, RENDER_TYPE);
MAP.put(SENSELESS_COMPARISON, "Condition ''{0}'' is always ''{1}''", ELEMENT_TEXT, TO_STRING);
MAP.put(SENSELESS_NULL_IN_WHEN, "Expression under 'when' is never equal to null");
@@ -866,6 +867,8 @@ public class DefaultErrorMessages {
MAP.put(ANNOTATION_ARGUMENT_MUST_BE_CONST, "An annotation argument must be a compile-time constant");
MAP.put(ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST, "An enum annotation argument must be a enum constant");
MAP.put(ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL, "An annotation argument must be a class literal (T::class)");
MAP.put(ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER, "Type parameter in a class literal is not allowed in an annotation argument");
MAP.put(ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR, "Type parameter in a class literal is deprecated in an annotation argument");
MAP.put(ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT, "Default value of annotation parameter must be a compile-time constant");
MAP.put(ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE,

View File

@@ -127,7 +127,13 @@ class ConstantExpressionEvaluator(
val descriptor = expressionType.constructor.declarationDescriptor
val diagnosticFactory = when {
DescriptorUtils.isEnumClass(descriptor) -> Errors.ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST
descriptor is ClassDescriptor && KotlinBuiltIns.isKClass(descriptor) -> Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL
descriptor is ClassDescriptor && KotlinBuiltIns.isKClass(descriptor) -> {
if (isTypeParameterOrArrayOfTypeParameter(expressionType.arguments.singleOrNull()?.type)) {
Errors.ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR
} else {
Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL
}
}
else -> Errors.ANNOTATION_ARGUMENT_MUST_BE_CONST
}
@@ -177,6 +183,8 @@ class ConstantExpressionEvaluator(
} else {
trace.report(Errors.ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL.on(argumentExpression))
}
} else if (doubleColonLhs is DoubleColonLHS.Type && isTypeParameterOrArrayOfTypeParameter(doubleColonLhs.type)) {
trace.report(Errors.ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER.on(argumentExpression))
}
}
}
@@ -324,6 +332,13 @@ class ConstantExpressionEvaluator(
fun getPossiblyErrorConstant(expression: KtExpression, bindingContext: BindingContext): CompileTimeConstant<*>? {
return bindingContext.get(BindingContext.COMPILE_TIME_VALUE, expression)
}
internal fun isTypeParameterOrArrayOfTypeParameter(type: KotlinType?): Boolean =
when {
type == null -> false
KotlinBuiltIns.isArray(type) -> isTypeParameterOrArrayOfTypeParameter(type.arguments.singleOrNull()?.type)
else -> type.constructor.declarationDescriptor is TypeParameterDescriptor
}
}
}
@@ -336,6 +351,7 @@ private class ConstantExpressionEvaluatorVisitor(
private val constantExpressionEvaluator: ConstantExpressionEvaluator,
private val trace: BindingTrace
) : KtVisitor<CompileTimeConstant<*>?, KotlinType>() {
private val languageVersionSettings = constantExpressionEvaluator.languageVersionSettings
private val builtIns = constantExpressionEvaluator.module.builtIns
fun evaluate(expression: KtExpression, expectedType: KotlinType?): CompileTimeConstant<*>? {
@@ -613,7 +629,8 @@ private class ConstantExpressionEvaluatorVisitor(
trace.report(Errors.DIVISION_BY_ZERO.on(parentExpression))
if ((isIntegerType(argumentForReceiver.value) && isIntegerType(argumentForParameter.value)) ||
!constantExpressionEvaluator.languageVersionSettings.supportsFeature(LanguageFeature.DivisionByZeroInConstantExpressions)) {
!languageVersionSettings.supportsFeature(LanguageFeature.DivisionByZeroInConstantExpressions)
) {
return ErrorValue.create("Division by zero").wrap()
}
}
@@ -883,11 +900,19 @@ private class ConstantExpressionEvaluatorVisitor(
}
override fun visitClassLiteralExpression(expression: KtClassLiteralExpression, expectedType: KotlinType?): CompileTimeConstant<*>? {
val type = trace.getType(expression)!!
if (type.isError) return null
val descriptor = type.constructor.declarationDescriptor
val kClassType = trace.getType(expression)!!
if (kClassType.isError) return null
val descriptor = kClassType.constructor.declarationDescriptor
if (descriptor !is ClassDescriptor || !KotlinBuiltIns.isKClass(descriptor)) return null
return KClassValue.create(type.arguments.first().type)?.wrap()
val type = kClassType.arguments.singleOrNull()?.type ?: return null
if (languageVersionSettings.supportsFeature(LanguageFeature.ProhibitTypeParametersInClassLiteralsInAnnotationArguments) &&
ConstantExpressionEvaluator.isTypeParameterOrArrayOfTypeParameter(type)
) {
return null
}
return KClassValue.create(type)?.wrap()
}
private fun resolveArguments(valueArguments: List<ValueArgument>, expectedType: KotlinType): List<CompileTimeConstant<*>?> {
@@ -983,12 +1008,7 @@ private class ConstantExpressionEvaluatorVisitor(
parameters: CompileTimeConstant.Parameters,
expectedType: KotlinType
): CompileTimeConstant<*>? {
if (parameters.isUnsignedNumberLiteral &&
!checkAccessibilityOfUnsignedTypes(
constantExpressionEvaluator.module,
constantExpressionEvaluator.languageVersionSettings
)
) {
if (parameters.isUnsignedNumberLiteral && !checkAccessibilityOfUnsignedTypes()) {
return UnsignedErrorValueTypeConstant(value, parameters)
}
@@ -1019,8 +1039,8 @@ private class ConstantExpressionEvaluatorVisitor(
}.wrap(parameters)
}
private fun checkAccessibilityOfUnsignedTypes(module: ModuleDescriptor, languageVersionSettings: LanguageVersionSettings): Boolean {
val uInt = module.findClassAcrossModuleDependencies(KotlinBuiltIns.FQ_NAMES.uInt) ?: return false
private fun checkAccessibilityOfUnsignedTypes(): Boolean {
val uInt = constantExpressionEvaluator.module.findClassAcrossModuleDependencies(KotlinBuiltIns.FQ_NAMES.uInt) ?: return false
val accessibility = uInt.checkSinceKotlinVersionAccessibility(languageVersionSettings)
// Case `NotAccessibleButWasExperimental` will be checked later in `checkExperimentalityOfConstantLiteral`
return accessibility is SinceKotlinAccessibility.Accessible

View File

@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.resolve.lazy.data;
import kotlin.DeprecationLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.psi.KtClass;
import org.jetbrains.kotlin.psi.KtClassOrObject;
@@ -23,8 +24,18 @@ import org.jetbrains.kotlin.psi.KtObjectDeclaration;
public class KtClassInfoUtil {
/**
* @deprecated use {@link #createClassOrObjectInfo(KtClassOrObject)} instead.
*/
@Deprecated
@kotlin.Deprecated(message = "Use createClassOrObjectInfo(KtClassOrObject) instead", level = DeprecationLevel.ERROR)
@NotNull
public static KtClassOrObjectInfo<? extends KtClassOrObject> createClassLikeInfo(@NotNull KtClassOrObject classOrObject) {
public static KtClassLikeInfo createClassLikeInfo(@NotNull KtClassOrObject classOrObject) {
return createClassOrObjectInfo(classOrObject);
}
@NotNull
public static KtClassOrObjectInfo<? extends KtClassOrObject> createClassOrObjectInfo(@NotNull KtClassOrObject classOrObject) {
if (classOrObject instanceof KtClass) {
return new KtClassInfo((KtClass) classOrObject);
}

View File

@@ -52,7 +52,7 @@ abstract class AbstractPsiBasedDeclarationProvider(storageManager: StorageManage
is KtTypeAlias ->
typeAliases.put(declaration.nameAsName.safeNameForLazyResolve(), declaration)
is KtClassOrObject ->
classesAndObjects.put(declaration.nameAsName.safeNameForLazyResolve(), KtClassInfoUtil.createClassLikeInfo(declaration))
classesAndObjects.put(declaration.nameAsName.safeNameForLazyResolve(), KtClassInfoUtil.createClassOrObjectInfo(declaration))
is KtScript ->
scripts.put(KtScriptInfo(declaration).script.nameAsName, KtScriptInfo(declaration))
is KtDestructuringDeclaration -> {

View File

@@ -18,9 +18,7 @@ import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorBase;
import org.jetbrains.kotlin.descriptors.impl.FunctionDescriptorImpl;
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory;
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory0;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.name.Name;
@@ -454,7 +452,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@Nullable
private static KtClassLikeInfo getCompanionObjectInfo(@Nullable KtObjectDeclaration companionObject) {
if (companionObject != null) {
return KtClassInfoUtil.createClassLikeInfo(companionObject);
return KtClassInfoUtil.createClassOrObjectInfo(companionObject);
}
return null;

View File

@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.CallHandle;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystem;
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
import java.util.*;
@@ -41,11 +40,6 @@ public class TypeIntersector {
return intersectTypes(new LinkedHashSet<>(Arrays.asList(typeA, typeB))) == null;
}
public static boolean isIncompatibleEnums(@NotNull KotlinType typeA, @NotNull KotlinType typeB) {
if (!TypeUtilsKt.isEnum(typeA) || !TypeUtilsKt.isEnum(typeB)) return false;
return !typeA.getConstructor().equals(typeB.getConstructor());
}
@Nullable
public static KotlinType intersectTypes(@NotNull Collection<KotlinType> types) {
assert !types.isEmpty() : "Attempting to intersect empty collection of types, this case should be dealt with on the call site.";

View File

@@ -0,0 +1,49 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.types
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
import org.jetbrains.kotlin.types.typeUtil.*
fun checkEnumsForCompatibility(context: ExpressionTypingContext, reportOn: KtElement, typeA: KotlinType, typeB: KotlinType) {
if (isIncompatibleEnums(typeA, typeB)) {
val diagnostic = if (context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitComparisonOfIncompatibleEnums)) {
Errors.INCOMPATIBLE_ENUM_COMPARISON_ERROR
} else {
Errors.INCOMPATIBLE_ENUM_COMPARISON
}
context.trace.report(diagnostic.on(reportOn, typeA, typeB))
}
}
private fun isIncompatibleEnums(typeA: KotlinType, typeB: KotlinType): Boolean {
if (!typeA.isEnum() && !typeB.isEnum()) return false
if (TypeUtils.isNullableType(typeA) && TypeUtils.isNullableType(typeB)) return false
// TODO: remove this line once KT-30266 will be fixed
// For now, this check is needed as isSubClass contains bug wrt Nothing
if (typeA.isNothingOrNullableNothing() || typeB.isNothingOrNullableNothing()) return false
val representativeTypeA = typeA.representativeTypeForTypeParameter()
val representativeTypeB = typeB.representativeTypeForTypeParameter()
val classA = representativeTypeA.constructor.declarationDescriptor as? ClassDescriptor ?: return false
val classB = representativeTypeB.constructor.declarationDescriptor as? ClassDescriptor ?: return false
return !DescriptorUtils.isSubclass(classA, classB) && !DescriptorUtils.isSubclass(classB, classA)
}
private fun KotlinType.representativeTypeForTypeParameter(): KotlinType {
val descriptor = constructor.declarationDescriptor
return if (descriptor is TypeParameterDescriptor) descriptor.representativeUpperBound else this
}

View File

@@ -1430,10 +1430,10 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (rightType != null) {
if (TypeIntersector.isIntersectionEmpty(leftType, rightType)) {
context.trace.report(EQUALITY_NOT_APPLICABLE.on(expression, expression.getOperationReference(), leftType, rightType));
} else {
EnumCompatibilityCheckerKt.checkEnumsForCompatibility(context, expression, leftType, rightType);
}
else if (TypeIntersector.isIncompatibleEnums(leftType, rightType)) {
context.trace.report(INCOMPATIBLE_ENUM_COMPARISON.on(expression, leftType, rightType));
}
SenselessComparisonChecker.checkSenselessComparisonWithNull(
expression, left, right, context,

View File

@@ -169,7 +169,7 @@ class LocalClassDescriptorHolder(
},
containingDeclaration,
classOrObject.nameAsSafeName,
KtClassInfoUtil.createClassLikeInfo(classOrObject),
KtClassInfoUtil.createClassOrObjectInfo(classOrObject),
classOrObject.hasModifier(KtTokens.EXTERNAL_KEYWORD)
)
writableScope?.addClassifierDescriptor(classDescriptor!!)

View File

@@ -684,9 +684,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
return
}
if (TypeIntersector.isIncompatibleEnums(type, subjectType)) {
context.trace.report(INCOMPATIBLE_ENUM_COMPARISON.on(reportErrorOn, subjectType, type))
}
checkEnumsForCompatibility(context, reportErrorOn, subjectType, type)
// check if the pattern is essentially a 'null' expression
if (KotlinBuiltIns.isNullableNothing(type) && !TypeUtils.isNullableType(subjectType)) {

View File

@@ -313,7 +313,7 @@ abstract class IncrementalCompilerRunner<
open fun runWithNoDirtyKotlinSources(caches: CacheManager): Boolean = false
private fun processChangesAfterBuild(
protected open fun processChangesAfterBuild(
compilationMode: CompilationMode,
currentBuildInfo: BuildInfo,
dirtyData: DirtyData

View File

@@ -47,6 +47,7 @@ import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import java.io.File
import java.io.ObjectOutputStream
fun makeIncrementally(
cachesDir: File,
@@ -109,7 +110,8 @@ class IncrementalJvmCompilerRunner(
buildHistoryFile: File,
outputFiles: Collection<File>,
private val modulesApiHistory: ModulesApiHistory,
override val kotlinSourceFilesExtensions: List<String> = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
override val kotlinSourceFilesExtensions: List<String> = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS,
private val classpathFqNamesHistory: File? = null
) : IncrementalCompilerRunner<K2JVMCompilerArguments, IncrementalJvmCachesManager>(
workingDir,
"caches-jvm",
@@ -126,6 +128,8 @@ class IncrementalJvmCompilerRunner(
override fun destinationDir(args: K2JVMCompilerArguments): File =
args.destinationAsFile
private var dirtyClasspathChanges: Collection<FqName> = emptySet<FqName>()
private val psiFileFactory: PsiFileFactory by lazy {
val rootDisposable = Disposer.newDisposable()
val configuration = CompilerConfiguration()
@@ -163,6 +167,7 @@ class IncrementalJvmCompilerRunner(
}
is ChangesEither.Known -> {
dirtyFiles.addByDirtySymbols(classpathChanges.lookupSymbols)
dirtyClasspathChanges = classpathChanges.fqNames
dirtyFiles.addByDirtyClasses(classpathChanges.fqNames)
}
}
@@ -253,6 +258,28 @@ class IncrementalJvmCompilerRunner(
}
}
override fun processChangesAfterBuild(compilationMode: CompilationMode, currentBuildInfo: BuildInfo, dirtyData: DirtyData) {
super.processChangesAfterBuild(compilationMode, currentBuildInfo, dirtyData)
classpathFqNamesHistory ?: return
classpathFqNamesHistory.mkdirs()
val historyFiles = classpathFqNamesHistory.listFiles()
if (dirtyClasspathChanges.isEmpty() && historyFiles.isNotEmpty()) {
// Don't write an empty file. We check there is at least one file so that downstream task can mark what it has processed.
return
}
if (historyFiles.size > 10) {
historyFiles.minBy { it.lastModified() }!!.delete()
}
val newHistoryFile = classpathFqNamesHistory.resolve(System.currentTimeMillis().toString())
ObjectOutputStream(newHistoryFile.outputStream().buffered()).use {
val listOfNames = dirtyClasspathChanges.map { it.toString() }.toList()
it.writeObject(listOfNames)
}
}
override fun postCompilationHook(exitCode: ExitCode) {}
override fun updateCaches(

View File

@@ -6,18 +6,18 @@
package org.jetbrains.kotlin.backend.common.descriptors
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.ReceiverParameterDescriptorImpl
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
import org.jetbrains.kotlin.ir.types.classifierOrFail
import org.jetbrains.kotlin.ir.types.toKotlinType
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.isAnnotationClass
import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.constants.*
@@ -41,13 +41,20 @@ abstract class WrappedDeclarationDescriptor<T : IrDeclaration>(annotations: Anno
private val annotationsFromOwner by lazy {
val ownerAnnotations = (owner as? IrAnnotationContainer)?.annotations ?: return@lazy Annotations.EMPTY
Annotations.create(ownerAnnotations.map { call ->
AnnotationDescriptorImpl(
call.symbol.owner.parentAsClass.defaultType.toKotlinType(),
call.symbol.owner.valueParameters.associate { it.name to call.getValueArgument(it.index)!!.toConstantValue() },
/*TODO*/ SourceElement.NO_SOURCE
)
})
Annotations.create(ownerAnnotations.map { it.toAnnotationDescriptor() })
}
private fun IrCall.toAnnotationDescriptor(): AnnotationDescriptor {
assert(symbol.owner is IrConstructor && symbol.owner.parentAsClass.isAnnotationClass) {
"Expected call to constructor of annotation class but was: ${this.dump()}"
}
return AnnotationDescriptorImpl(
symbol.owner.parentAsClass.defaultType.toKotlinType(),
symbol.owner.valueParameters.map { it.name to getValueArgument(it.index) }
.filter { it.second != null }
.associate { it.first to it.second!!.toConstantValue() },
/*TODO*/ SourceElement.NO_SOURCE
)
}
private fun IrElement.toConstantValue(): ConstantValue<*> {
@@ -77,7 +84,9 @@ abstract class WrappedDeclarationDescriptor<T : IrDeclaration>(annotations: Anno
this is IrClassReference -> KClassValue(classType.classifierOrFail.descriptor.classId!!, /*TODO*/0)
else -> error("$this is not expected")
this is IrCall -> AnnotationValue(this.toAnnotationDescriptor())
else -> error("$this is not expected: ${this.dump()}")
}
}
@@ -583,7 +592,7 @@ open class WrappedClassDescriptor(
private val _typeConstructor: TypeConstructor by lazy {
LazyTypeConstructor(
this,
{ emptyList() },
{ owner.typeParameters.map { it.descriptor } },
{ owner.superTypes.map { it.toKotlinType() } },
LockBasedStorageManager.NO_LOCKS
)

View File

@@ -234,7 +234,7 @@ open class DefaultParameterInjector(
type = context.irBuiltIns.unitType,
symbol = symbolForCall as IrConstructorSymbol,
descriptor = symbolForCall.descriptor,
typeArgumentsCount = symbolForCall.owner.typeParameters.size
typeArgumentsCount = expression.typeArgumentsCount
)
.apply {
copyTypeArgumentsFrom(expression)

View File

@@ -271,3 +271,42 @@ fun IrBuilderWithScope.irSetField(receiver: IrExpression, irField: IrField, valu
value = value,
type = context.irBuiltIns.unitType
)
inline fun IrBuilderWithScope.irBlock(
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
): IrExpression =
IrBlockBuilder(
context, scope,
startOffset,
endOffset,
origin, resultType
).block(body)
inline fun IrBuilderWithScope.irComposite(
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
): IrExpression =
IrBlockBuilder(
context, scope,
startOffset,
endOffset,
origin, resultType, true
).block(body)
inline fun IrBuilderWithScope.irBlockBody(
startOffset: Int = this.startOffset,
endOffset: Int = this.endOffset,
body: IrBlockBodyBuilder.() -> Unit
): IrBlockBody =
IrBlockBodyBuilder(
context, scope,
startOffset,
endOffset
).blockBody(body)

View File

@@ -143,8 +143,7 @@ fun <T : IrBuilder> T.at(startOffset: Int, endOffset: Int) = apply {
}
inline fun IrGeneratorWithScope.irBlock(
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET,
startOffset: Int, endOffset: Int,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
@@ -157,8 +156,7 @@ inline fun IrGeneratorWithScope.irBlock(
).block(body)
inline fun IrGeneratorWithScope.irComposite(
startOffset: Int = UNDEFINED_OFFSET,
endOffset: Int = UNDEFINED_OFFSET,
startOffset: Int, endOffset: Int,
origin: IrStatementOrigin? = null,
resultType: IrType? = null,
body: IrBlockBuilder.() -> Unit
@@ -171,7 +169,7 @@ inline fun IrGeneratorWithScope.irComposite(
).block(body)
inline fun IrGeneratorWithScope.irBlockBody(
startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET,
startOffset: Int, endOffset: Int,
body: IrBlockBodyBuilder.() -> Unit
): IrBlockBody =
IrBlockBodyBuilder(

View File

@@ -34,20 +34,20 @@ public interface KtNodeTypes {
IElementType OBJECT_DECLARATION = KtStubElementTypes.OBJECT_DECLARATION;
IElementType TYPEALIAS = KtStubElementTypes.TYPEALIAS;
IElementType ENUM_ENTRY = KtStubElementTypes.ENUM_ENTRY;
IElementType CLASS_INITIALIZER = KtStubElementTypes.CLASS_INITIALIZER;
IElementType SCRIPT_INITIALIZER = new KtNodeType("SCRIPT_INITIALIZER", KtScriptInitializer.class);
IElementType ENUM_ENTRY = KtStubElementTypes.ENUM_ENTRY;
IElementType CLASS_INITIALIZER = KtStubElementTypes.CLASS_INITIALIZER;
IElementType SCRIPT_INITIALIZER = new KtNodeType("SCRIPT_INITIALIZER", KtScriptInitializer.class);
IElementType SECONDARY_CONSTRUCTOR = KtStubElementTypes.SECONDARY_CONSTRUCTOR;
IElementType PRIMARY_CONSTRUCTOR = KtStubElementTypes.PRIMARY_CONSTRUCTOR;
IElementType TYPE_PARAMETER_LIST = KtStubElementTypes.TYPE_PARAMETER_LIST;
IElementType TYPE_PARAMETER = KtStubElementTypes.TYPE_PARAMETER;
IElementType SUPER_TYPE_LIST = KtStubElementTypes.SUPER_TYPE_LIST;
IElementType DELEGATED_SUPER_TYPE_ENTRY = KtStubElementTypes.DELEGATED_SUPER_TYPE_ENTRY;
IElementType SUPER_TYPE_CALL_ENTRY = KtStubElementTypes.SUPER_TYPE_CALL_ENTRY;
IElementType SUPER_TYPE_ENTRY = KtStubElementTypes.SUPER_TYPE_ENTRY;
KtNodeType PROPERTY_DELEGATE = new KtNodeType("PROPERTY_DELEGATE", KtPropertyDelegate.class);
IElementType CONSTRUCTOR_CALLEE = KtStubElementTypes.CONSTRUCTOR_CALLEE;
IElementType TYPE_PARAMETER_LIST = KtStubElementTypes.TYPE_PARAMETER_LIST;
IElementType TYPE_PARAMETER = KtStubElementTypes.TYPE_PARAMETER;
IElementType SUPER_TYPE_LIST = KtStubElementTypes.SUPER_TYPE_LIST;
IElementType DELEGATED_SUPER_TYPE_ENTRY = KtStubElementTypes.DELEGATED_SUPER_TYPE_ENTRY;
IElementType SUPER_TYPE_CALL_ENTRY = KtStubElementTypes.SUPER_TYPE_CALL_ENTRY;
IElementType SUPER_TYPE_ENTRY = KtStubElementTypes.SUPER_TYPE_ENTRY;
IElementType PROPERTY_DELEGATE = new KtNodeType("PROPERTY_DELEGATE", KtPropertyDelegate.class);
IElementType CONSTRUCTOR_CALLEE = KtStubElementTypes.CONSTRUCTOR_CALLEE;
IElementType VALUE_PARAMETER_LIST = KtStubElementTypes.VALUE_PARAMETER_LIST;
IElementType VALUE_PARAMETER = KtStubElementTypes.VALUE_PARAMETER;
@@ -72,20 +72,17 @@ public interface KtNodeTypes {
IElementType DYNAMIC_TYPE = KtStubElementTypes.DYNAMIC_TYPE;
IElementType FUNCTION_TYPE = KtStubElementTypes.FUNCTION_TYPE;
IElementType FUNCTION_TYPE_RECEIVER = KtStubElementTypes.FUNCTION_TYPE_RECEIVER;
KtNodeType SELF_TYPE = new KtNodeType("SELF_TYPE", KtSelfType.class);
IElementType NULLABLE_TYPE = KtStubElementTypes.NULLABLE_TYPE;
IElementType TYPE_PROJECTION = KtStubElementTypes.TYPE_PROJECTION;
// TODO: review
IElementType PROPERTY_ACCESSOR = KtStubElementTypes.PROPERTY_ACCESSOR;
IElementType INITIALIZER_LIST = KtStubElementTypes.INITIALIZER_LIST;
IElementType TYPE_CONSTRAINT_LIST = KtStubElementTypes.TYPE_CONSTRAINT_LIST;
IElementType TYPE_CONSTRAINT = KtStubElementTypes.TYPE_CONSTRAINT;
IElementType CONSTRUCTOR_DELEGATION_CALL = new KtNodeType.KtLeftBoundNodeType("CONSTRUCTOR_DELEGATION_CALL", KtConstructorDelegationCall.class);
KtNodeType CONSTRUCTOR_DELEGATION_REFERENCE = new KtNodeType.KtLeftBoundNodeType("CONSTRUCTOR_DELEGATION_REFERENCE", KtConstructorDelegationReferenceExpression.class);
IElementType CONSTRUCTOR_DELEGATION_REFERENCE = new KtNodeType.KtLeftBoundNodeType("CONSTRUCTOR_DELEGATION_REFERENCE", KtConstructorDelegationReferenceExpression.class);
// TODO: Not sure if we need separate NT for each kind of constants
IElementType NULL = KtStubElementTypes.NULL;
IElementType BOOLEAN_CONSTANT = KtStubElementTypes.BOOLEAN_CONSTANT;
IElementType FLOAT_CONSTANT = KtStubElementTypes.FLOAT_CONSTANT;
@@ -98,63 +95,63 @@ public interface KtNodeTypes {
IElementType LITERAL_STRING_TEMPLATE_ENTRY = KtStubElementTypes.LITERAL_STRING_TEMPLATE_ENTRY;
IElementType ESCAPE_STRING_TEMPLATE_ENTRY = KtStubElementTypes.ESCAPE_STRING_TEMPLATE_ENTRY;
KtNodeType PARENTHESIZED = new KtNodeType("PARENTHESIZED", KtParenthesizedExpression.class);
KtNodeType RETURN = new KtNodeType("RETURN", KtReturnExpression.class);
KtNodeType THROW = new KtNodeType("THROW", KtThrowExpression.class);
KtNodeType CONTINUE = new KtNodeType("CONTINUE", KtContinueExpression.class);
KtNodeType BREAK = new KtNodeType("BREAK", KtBreakExpression.class);
KtNodeType IF = new KtNodeType("IF", KtIfExpression.class);
KtNodeType CONDITION = new KtNodeType("CONDITION", KtContainerNode.class);
KtNodeType THEN = new KtNodeType("THEN", KtContainerNodeForControlStructureBody.class);
KtNodeType ELSE = new KtNodeType("ELSE", KtContainerNodeForControlStructureBody.class);
KtNodeType TRY = new KtNodeType("TRY", KtTryExpression.class);
KtNodeType CATCH = new KtNodeType("CATCH", KtCatchClause.class);
KtNodeType FINALLY = new KtNodeType("FINALLY", KtFinallySection.class);
KtNodeType FOR = new KtNodeType("FOR", KtForExpression.class);
KtNodeType WHILE = new KtNodeType("WHILE", KtWhileExpression.class);
KtNodeType DO_WHILE = new KtNodeType("DO_WHILE", KtDoWhileExpression.class);
KtNodeType LOOP_RANGE = new KtNodeType("LOOP_RANGE", KtContainerNode.class);
KtNodeType BODY = new KtNodeType("BODY", KtContainerNodeForControlStructureBody.class);
KtNodeType BLOCK = new KtNodeType("BLOCK", KtBlockExpression.class);
IElementType PARENTHESIZED = new KtNodeType("PARENTHESIZED", KtParenthesizedExpression.class);
IElementType RETURN = new KtNodeType("RETURN", KtReturnExpression.class);
IElementType THROW = new KtNodeType("THROW", KtThrowExpression.class);
IElementType CONTINUE = new KtNodeType("CONTINUE", KtContinueExpression.class);
IElementType BREAK = new KtNodeType("BREAK", KtBreakExpression.class);
IElementType IF = new KtNodeType("IF", KtIfExpression.class);
IElementType CONDITION = new KtNodeType("CONDITION", KtContainerNode.class);
IElementType THEN = new KtNodeType("THEN", KtContainerNodeForControlStructureBody.class);
IElementType ELSE = new KtNodeType("ELSE", KtContainerNodeForControlStructureBody.class);
IElementType TRY = new KtNodeType("TRY", KtTryExpression.class);
IElementType CATCH = new KtNodeType("CATCH", KtCatchClause.class);
IElementType FINALLY = new KtNodeType("FINALLY", KtFinallySection.class);
IElementType FOR = new KtNodeType("FOR", KtForExpression.class);
IElementType WHILE = new KtNodeType("WHILE", KtWhileExpression.class);
IElementType DO_WHILE = new KtNodeType("DO_WHILE", KtDoWhileExpression.class);
IElementType LOOP_RANGE = new KtNodeType("LOOP_RANGE", KtContainerNode.class);
IElementType BODY = new KtNodeType("BODY", KtContainerNodeForControlStructureBody.class);
IElementType BLOCK = new KtNodeType("BLOCK", KtBlockExpression.class);
IElementType LAMBDA_EXPRESSION = new LambdaExpressionElementType();
KtNodeType FUNCTION_LITERAL = new KtNodeType("FUNCTION_LITERAL", KtFunctionLiteral.class);
KtNodeType ANNOTATED_EXPRESSION = new KtNodeType("ANNOTATED_EXPRESSION", KtAnnotatedExpression.class);
IElementType FUNCTION_LITERAL = new KtNodeType("FUNCTION_LITERAL", KtFunctionLiteral.class);
IElementType ANNOTATED_EXPRESSION = new KtNodeType("ANNOTATED_EXPRESSION", KtAnnotatedExpression.class);
IElementType REFERENCE_EXPRESSION = KtStubElementTypes.REFERENCE_EXPRESSION;
IElementType ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION = KtStubElementTypes.ENUM_ENTRY_SUPERCLASS_REFERENCE_EXPRESSION;
KtNodeType OPERATION_REFERENCE = new KtNodeType("OPERATION_REFERENCE", KtOperationReferenceExpression.class);
KtNodeType LABEL = new KtNodeType("LABEL", KtLabelReferenceExpression.class);
IElementType OPERATION_REFERENCE = new KtNodeType("OPERATION_REFERENCE", KtOperationReferenceExpression.class);
IElementType LABEL = new KtNodeType("LABEL", KtLabelReferenceExpression.class);
KtNodeType LABEL_QUALIFIER = new KtNodeType("LABEL_QUALIFIER", KtContainerNode.class);
IElementType LABEL_QUALIFIER = new KtNodeType("LABEL_QUALIFIER", KtContainerNode.class);
KtNodeType THIS_EXPRESSION = new KtNodeType("THIS_EXPRESSION", KtThisExpression.class);
KtNodeType SUPER_EXPRESSION = new KtNodeType("SUPER_EXPRESSION", KtSuperExpression.class);
KtNodeType BINARY_EXPRESSION = new KtNodeType("BINARY_EXPRESSION", KtBinaryExpression.class);
KtNodeType BINARY_WITH_TYPE = new KtNodeType("BINARY_WITH_TYPE", KtBinaryExpressionWithTypeRHS.class);
KtNodeType IS_EXPRESSION = new KtNodeType("IS_EXPRESSION", KtIsExpression.class); // TODO:
KtNodeType PREFIX_EXPRESSION = new KtNodeType("PREFIX_EXPRESSION", KtPrefixExpression.class);
KtNodeType POSTFIX_EXPRESSION = new KtNodeType("POSTFIX_EXPRESSION", KtPostfixExpression.class);
KtNodeType LABELED_EXPRESSION = new KtNodeType("LABELED_EXPRESSION", KtLabeledExpression.class);
KtNodeType CALL_EXPRESSION = new KtNodeType("CALL_EXPRESSION", KtCallExpression.class);
KtNodeType ARRAY_ACCESS_EXPRESSION = new KtNodeType("ARRAY_ACCESS_EXPRESSION", KtArrayAccessExpression.class);
KtNodeType INDICES = new KtNodeType("INDICES", KtContainerNode.class);
IElementType DOT_QUALIFIED_EXPRESSION = KtStubElementTypes.DOT_QUALIFIED_EXPRESSION;
KtNodeType CALLABLE_REFERENCE_EXPRESSION = new KtNodeType("CALLABLE_REFERENCE_EXPRESSION", KtCallableReferenceExpression.class);
KtNodeType CLASS_LITERAL_EXPRESSION = new KtNodeType("CLASS_LITERAL_EXPRESSION", KtClassLiteralExpression.class);
KtNodeType SAFE_ACCESS_EXPRESSION = new KtNodeType("SAFE_ACCESS_EXPRESSION", KtSafeQualifiedExpression.class);
IElementType THIS_EXPRESSION = new KtNodeType("THIS_EXPRESSION", KtThisExpression.class);
IElementType SUPER_EXPRESSION = new KtNodeType("SUPER_EXPRESSION", KtSuperExpression.class);
IElementType BINARY_EXPRESSION = new KtNodeType("BINARY_EXPRESSION", KtBinaryExpression.class);
IElementType BINARY_WITH_TYPE = new KtNodeType("BINARY_WITH_TYPE", KtBinaryExpressionWithTypeRHS.class);
IElementType IS_EXPRESSION = new KtNodeType("IS_EXPRESSION", KtIsExpression.class);
IElementType PREFIX_EXPRESSION = new KtNodeType("PREFIX_EXPRESSION", KtPrefixExpression.class);
IElementType POSTFIX_EXPRESSION = new KtNodeType("POSTFIX_EXPRESSION", KtPostfixExpression.class);
IElementType LABELED_EXPRESSION = new KtNodeType("LABELED_EXPRESSION", KtLabeledExpression.class);
IElementType CALL_EXPRESSION = new KtNodeType("CALL_EXPRESSION", KtCallExpression.class);
IElementType ARRAY_ACCESS_EXPRESSION = new KtNodeType("ARRAY_ACCESS_EXPRESSION", KtArrayAccessExpression.class);
IElementType INDICES = new KtNodeType("INDICES", KtContainerNode.class);
IElementType DOT_QUALIFIED_EXPRESSION = KtStubElementTypes.DOT_QUALIFIED_EXPRESSION;
IElementType CALLABLE_REFERENCE_EXPRESSION = new KtNodeType("CALLABLE_REFERENCE_EXPRESSION", KtCallableReferenceExpression.class);
IElementType CLASS_LITERAL_EXPRESSION = new KtNodeType("CLASS_LITERAL_EXPRESSION", KtClassLiteralExpression.class);
IElementType SAFE_ACCESS_EXPRESSION = new KtNodeType("SAFE_ACCESS_EXPRESSION", KtSafeQualifiedExpression.class);
KtNodeType OBJECT_LITERAL = new KtNodeType("OBJECT_LITERAL", KtObjectLiteralExpression.class);
IElementType OBJECT_LITERAL = new KtNodeType("OBJECT_LITERAL", KtObjectLiteralExpression.class);
KtNodeType WHEN = new KtNodeType("WHEN", KtWhenExpression.class);
KtNodeType WHEN_ENTRY = new KtNodeType("WHEN_ENTRY", KtWhenEntry.class);
IElementType WHEN = new KtNodeType("WHEN", KtWhenExpression.class);
IElementType WHEN_ENTRY = new KtNodeType("WHEN_ENTRY", KtWhenEntry.class);
KtNodeType WHEN_CONDITION_IN_RANGE = new KtNodeType("WHEN_CONDITION_IN_RANGE", KtWhenConditionInRange.class);
KtNodeType WHEN_CONDITION_IS_PATTERN = new KtNodeType("WHEN_CONDITION_IS_PATTERN", KtWhenConditionIsPattern.class);
KtNodeType WHEN_CONDITION_EXPRESSION = new KtNodeType("WHEN_CONDITION_WITH_EXPRESSION", KtWhenConditionWithExpression.class);
IElementType WHEN_CONDITION_IN_RANGE = new KtNodeType("WHEN_CONDITION_IN_RANGE", KtWhenConditionInRange.class);
IElementType WHEN_CONDITION_IS_PATTERN = new KtNodeType("WHEN_CONDITION_IS_PATTERN", KtWhenConditionIsPattern.class);
IElementType WHEN_CONDITION_EXPRESSION = new KtNodeType("WHEN_CONDITION_WITH_EXPRESSION", KtWhenConditionWithExpression.class);
KtNodeType COLLECTION_LITERAL_EXPRESSION = new KtNodeType("COLLECTION_LITERAL_EXPRESSION", KtCollectionLiteralExpression.class);
IElementType COLLECTION_LITERAL_EXPRESSION = new KtNodeType("COLLECTION_LITERAL_EXPRESSION", KtCollectionLiteralExpression.class);
IElementType PACKAGE_DIRECTIVE = KtStubElementTypes.PACKAGE_DIRECTIVE;

View File

@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.kdoc.parser
import com.intellij.openapi.util.text.StringUtil
enum class KDocKnownTag private constructor(val isReferenceRequired: Boolean, val isSectionStart: Boolean) {
enum class KDocKnownTag(val isReferenceRequired: Boolean, val isSectionStart: Boolean) {
AUTHOR(false, false),
THROWS(true, false),
EXCEPTION(true, false),

View File

@@ -22,7 +22,6 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.KtNodeType;
import org.jetbrains.kotlin.KtNodeTypes;
import org.jetbrains.kotlin.lexer.KtToken;
import org.jetbrains.kotlin.lexer.KtTokens;
@@ -155,7 +154,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
AS(AS_KEYWORD, AS_SAFE) {
@Override
public KtNodeType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
parser.myKotlinParsing.parseTypeRef();
return BINARY_WITH_TYPE;
}
@@ -173,7 +172,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
ELVIS(KtTokens.ELVIS),
IN_OR_IS(IN_KEYWORD, NOT_IN, IS_KEYWORD, NOT_IS) {
@Override
public KtNodeType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
if (operation == IS_KEYWORD || operation == NOT_IS) {
parser.myKotlinParsing.parseTypeRef();
return IS_EXPRESSION;
@@ -216,7 +215,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
* @param parser the parser object
* @return node type of the result
*/
public KtNodeType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
public IElementType parseRightHandSide(IElementType operation, KotlinExpressionParsing parser) {
parseHigherPrecedence(parser);
return BINARY_EXPRESSION;
}
@@ -316,7 +315,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
parseOperationReference();
KtNodeType resultType = precedence.parseRightHandSide(operation, this);
IElementType resultType = precedence.parseRightHandSide(operation, this);
expression.done(resultType);
expression = expression.precede();
}
@@ -1008,7 +1007,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
parseAsCollectionLiteralExpression(COLLECTION_LITERAL_EXPRESSION, true, "Expecting an element");
}
private void parseAsCollectionLiteralExpression(KtNodeType nodeType, boolean canBeEmpty, String missingElementErrorMessage) {
private void parseAsCollectionLiteralExpression(IElementType nodeType, boolean canBeEmpty, String missingElementErrorMessage) {
assert _at(LBRACKET);
PsiBuilder.Marker innerExpressions = mark();
@@ -1627,7 +1626,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
* : "continue" getEntryPoint?
* : "break" getEntryPoint?
*/
private void parseJump(KtNodeType type) {
private void parseJump(IElementType type) {
assert _at(BREAK_KEYWORD) || _at(CONTINUE_KEYWORD);
PsiBuilder.Marker marker = mark();

View File

@@ -7,13 +7,13 @@ package org.jetbrains.kotlin.psi
import com.intellij.lang.ASTNode
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.KtNodeType
import com.intellij.psi.tree.IElementType
abstract class KtExpressionImpl(node: ASTNode) : KtElementImpl(node), KtExpression {
override fun <R, D> accept(visitor: KtVisitor<R, D>, data: D) = visitor.visitExpression(this, data)
protected fun findExpressionUnder(type: KtNodeType): KtExpression? {
protected fun findExpressionUnder(type: IElementType): KtExpression? {
val containerNode = findChildByType<KtContainerNode>(type) ?: return null
return containerNode.findChildByClass<KtExpression>(KtExpression::class.java)
}

View File

@@ -431,6 +431,9 @@ fun PsiElement.before(element: PsiElement) = textRange.endOffset <= element.text
inline fun <reified T : PsiElement> PsiElement.getLastParentOfTypeInRow() = parents.takeWhile { it is T }.lastOrNull() as? T
inline fun <reified T : PsiElement> PsiElement.getLastParentOfTypeInRowWithSelf() = parentsWithSelf
.takeWhile { it is T }.lastOrNull() as? T
fun KtModifierListOwner.hasExpectModifier() = hasModifier(KtTokens.HEADER_KEYWORD) || hasModifier(KtTokens.EXPECT_KEYWORD)
fun KtModifierList.hasExpectModifier() = hasModifier(KtTokens.HEADER_KEYWORD) || hasModifier(KtTokens.EXPECT_KEYWORD)

View File

@@ -5,7 +5,7 @@ where possible options include:
-include-runtime Include Kotlin runtime in to resulting .jar
-java-parameters Generate metadata for Java 1.8 reflection on method parameters
-jdk-home <path> Path to JDK home directory to include into classpath, if differs from default JAVA_HOME
-jvm-target <version> Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6
-jvm-target <version> Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11 or 12), default is 1.6
-module-name <name> Name of the generated .kotlin_module file
-no-jdk Don't include Java runtime into classpath
-no-reflect Don't include kotlin-reflect.jar into classpath

View File

@@ -1,3 +1,3 @@
error: unknown JVM target version: 1.5
Supported versions: 1.6, 1.8
Supported versions: 1.6, 1.8, 9, 10, 11, 12
COMPILATION_ERROR

View File

@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
import kotlin.test.assertEquals
@@ -17,26 +18,22 @@ fun test(name: String, annotations: Array<out Annotation>) {
assertEquals(1, annotations.filterIsInstance<Ann>().single().x, "$name[0]")
}
fun testAbsence(name: String, annotations: Array<out Annotation>) {
assertEquals(0, annotations.filterIsInstance<Ann>().size, "$name")
}
fun box(): String {
val foo = A::class.java.getDeclaredMethods().first { it.getName() == "foo" }
test("foo", foo.getDeclaredAnnotations())
val fooDefault = A::class.java.getDeclaredMethods().first { it.getName() == "foo\$default" }
testAbsence("foo\$default", fooDefault.getDeclaredAnnotations())
test("foo", foo.getDeclaredAnnotations())
val (secondary, secondaryDefault) = A::class.java.getDeclaredConstructors().partition { it.getParameterTypes().size == 3 }
test("secondary", secondary[0].getDeclaredAnnotations())
testAbsence("secondary\$default", secondaryDefault[0].getDeclaredAnnotations())
test("secondary\$default", secondaryDefault[0].getDeclaredAnnotations())
val (primary, primaryDefault) = B::class.java.getConstructors().partition { it.getParameterTypes().size == 3 }
test("primary", primary[0].getDeclaredAnnotations())
testAbsence("primary\$default", primaryDefault[0].getDeclaredAnnotations())
test("primary\$default", primaryDefault[0].getDeclaredAnnotations())
return "OK"
}

View File

@@ -0,0 +1,62 @@
// IGNORE_BACKEND: JVM_IR
// COMMON_COROUTINES_TEST
// WITH_RUNTIME
// WITH_COROUTINES
// CHECK_BYTECODE_LISTING
// In this test the following transformation are occuring:
// flow$1 -> flowWith$$inlined$flow$1
// flow$1 -> check$$inlined$flow$1
// flow$1 -> flowWith$$inlined$flow$2
// flowWith$$inlined$flow$2 -> check$$inlined$flowWith$1
// All thansformations, except the third, shall generate state-machine.
// The third shall not generate state-machine, since it is retransformed.
package flow
import COROUTINES_PACKAGE.*
import helpers.*
interface FlowCollector<T> {
suspend fun emit(value: T)
}
interface Flow<T : Any> {
suspend fun collect(collector: FlowCollector<T>)
}
public inline fun <T : Any> flow(crossinline block: suspend FlowCollector<T>.() -> Unit) = object : Flow<T> {
override suspend fun collect(collector: FlowCollector<T>) = collector.block()
}
suspend inline fun <T : Any> Flow<T>.collect(crossinline action: suspend (T) -> Unit): Unit =
collect(object : FlowCollector<T> {
override suspend fun emit(value: T) = action(value)
})
inline fun <T : Any, R : Any> Flow<T>.flowWith(crossinline builderBlock: suspend Flow<T>.() -> Flow<R>): Flow<T> =
flow {
builderBlock()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
suspend fun check() {
val f: Unit = flow<Int> {
emit(1)
}.flowWith {
this
}.collect {
// In this test collect is just terminating operation, which just runs the lazy computations
}
}
fun box(): String {
builder {
check()
}
return "OK"
}

View File

@@ -0,0 +1,179 @@
@kotlin.Metadata
public interface flow/Flow {
public abstract @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public interface flow/FlowCollector {
public abstract @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.coroutines.jvm.internal.DebugMetadata
@kotlin.Metadata
final class flow/InnerObjectRetransformationKt$box$1 {
field label: int
inner class flow/InnerObjectRetransformationKt$box$1
method <init>(p0: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): kotlin.coroutines.Continuation
public final method invoke(p0: java.lang.Object): java.lang.Object
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$check$$inlined$collect$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1
public method <init>(p0: flow.InnerObjectRetransformationKt$check$$inlined$collect$1, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1 {
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1
public method <init>(): void
public @org.jetbrains.annotations.Nullable method emit(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field L$3: java.lang.Object
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$check$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1
public method <init>(p0: flow.InnerObjectRetransformationKt$check$$inlined$flow$1, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1 {
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1
public method <init>(): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1 {
synthetic final field $this_flowWith$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.Flow): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
@kotlin.coroutines.jvm.internal.DebugMetadata
final class flow/InnerObjectRetransformationKt$check$1 {
field L$0: java.lang.Object
field label: int
synthetic field result: java.lang.Object
inner class flow/InnerObjectRetransformationKt$check$1
method <init>(p0: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$collect$2$emit$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$collect$2$emit$1
public method <init>(p0: flow.InnerObjectRetransformationKt$collect$2, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$collect$2 {
synthetic final field $action: kotlin.jvm.functions.Function2
inner class flow/InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$collect$2$emit$1
public method <init>(p0: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method emit(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flow$1$collect$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$flow$1
inner class flow/InnerObjectRetransformationKt$flow$1
inner class flow/InnerObjectRetransformationKt$flow$1$collect$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flow$1, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flow$1 {
synthetic final field $block: kotlin.jvm.functions.Function2
inner class flow/InnerObjectRetransformationKt$flow$1
inner class flow/InnerObjectRetransformationKt$flow$1$collect$1
public method <init>(p0: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$1, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1 {
synthetic final field $builderBlock$inlined: kotlin.jvm.functions.Function2
synthetic final field $this_flowWith$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1$1
public method <init>(p0: flow.Flow, p1: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1 {
field label: int
synthetic field result: java.lang.Object
synthetic final field this$0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$2, p1: kotlin.coroutines.Continuation): void
public final @org.jetbrains.annotations.Nullable method invokeSuspend(@org.jetbrains.annotations.NotNull p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2 {
synthetic final field $builderBlock$inlined: kotlin.jvm.functions.Function2
synthetic final field $this_flowWith$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.Flow, p1: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt {
inner class flow/InnerObjectRetransformationKt$box$1
inner class flow/InnerObjectRetransformationKt$check$1
inner class flow/InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$flow$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void
public final static @org.jetbrains.annotations.Nullable method check(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
private final static method collect(@org.jetbrains.annotations.NotNull p0: flow.Flow, p1: kotlin.jvm.functions.Function2, p2: kotlin.coroutines.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method flow(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): flow.Flow
public final static @org.jetbrains.annotations.NotNull method flowWith(@org.jetbrains.annotations.NotNull p0: flow.Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2): flow.Flow
}

View File

@@ -0,0 +1,189 @@
@kotlin.Metadata
public interface flow/Flow {
public abstract @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public interface flow/FlowCollector {
public abstract @org.jetbrains.annotations.Nullable method emit(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
final class flow/InnerObjectRetransformationKt$box$1 {
inner class flow/InnerObjectRetransformationKt$box$1
method <init>(p0: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.NotNull method create(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): kotlin.coroutines.experimental.Continuation
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
public final method invoke(p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
synthetic final field this$0: flow.InnerObjectRetransformationKt$check$$inlined$collect$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1
public method <init>(p0: flow.InnerObjectRetransformationKt$check$$inlined$collect$1, p1: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$collect$1 {
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$collect$1$1
public method <init>(): void
public @org.jetbrains.annotations.Nullable method emit(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1 {
field L$0: java.lang.Object
field L$1: java.lang.Object
field L$2: java.lang.Object
field L$3: java.lang.Object
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
synthetic final field this$0: flow.InnerObjectRetransformationKt$check$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1
public method <init>(p0: flow.InnerObjectRetransformationKt$check$$inlined$flow$1, p1: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$flow$1 {
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$check$$inlined$flow$1$1
public method <init>(): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1 {
synthetic final field $this_flowWith$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$check$$inlined$flowWith$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.Flow): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
final class flow/InnerObjectRetransformationKt$check$1 {
field L$0: java.lang.Object
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
inner class flow/InnerObjectRetransformationKt$check$1
method <init>(p0: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$collect$2$emit$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
synthetic final field this$0: flow.InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$collect$2$emit$1
public method <init>(p0: flow.InnerObjectRetransformationKt$collect$2, p1: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$collect$2 {
synthetic final field $action: kotlin.jvm.functions.Function2
inner class flow/InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$collect$2$emit$1
public method <init>(p0: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method emit(@org.jetbrains.annotations.NotNull p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flow$1$collect$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
synthetic final field this$0: flow.InnerObjectRetransformationKt$flow$1
inner class flow/InnerObjectRetransformationKt$flow$1
inner class flow/InnerObjectRetransformationKt$flow$1$collect$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flow$1, p1: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flow$1 {
synthetic final field $block: kotlin.jvm.functions.Function2
inner class flow/InnerObjectRetransformationKt$flow$1
inner class flow/InnerObjectRetransformationKt$flow$1$collect$1
public method <init>(p0: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
synthetic final field this$0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$1, p1: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1 {
synthetic final field $builderBlock$inlined: kotlin.jvm.functions.Function2
synthetic final field $this_flowWith$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$1$1
public method <init>(p0: flow.Flow, p1: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
synthetic final field this$0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.InnerObjectRetransformationKt$flowWith$$inlined$flow$2, p1: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2 {
synthetic final field $builderBlock$inlined: kotlin.jvm.functions.Function2
synthetic final field $this_flowWith$inlined: flow.Flow
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2
inner class flow/InnerObjectRetransformationKt$flowWith$$inlined$flow$2$1
public method <init>(p0: flow.Flow, p1: kotlin.jvm.functions.Function2): void
public @org.jetbrains.annotations.Nullable method collect(@org.jetbrains.annotations.NotNull p0: flow.FlowCollector, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public final class flow/InnerObjectRetransformationKt {
inner class flow/InnerObjectRetransformationKt$box$1
inner class flow/InnerObjectRetransformationKt$check$1
inner class flow/InnerObjectRetransformationKt$collect$2
inner class flow/InnerObjectRetransformationKt$flow$1
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void
public final static @org.jetbrains.annotations.Nullable method check(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
private final static method collect(@org.jetbrains.annotations.NotNull p0: flow.Flow, p1: kotlin.jvm.functions.Function2, p2: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method flow(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): flow.Flow
public final static @org.jetbrains.annotations.NotNull method flowWith(@org.jetbrains.annotations.NotNull p0: flow.Flow, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function2): flow.Flow
}

View File

@@ -0,0 +1,41 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: A1.kt
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@file:JvmPackageName("baz.foo.quux.bar")
@file:JvmName("Facade")
@file:JvmMultifileClass
package foo.bar
val g: S? get() = f().substring(0, 0) + "K"
// FILE: A2.kt
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@file:JvmPackageName("baz.foo.quux.bar")
@file:JvmName("Facade")
@file:JvmMultifileClass
package foo.bar
inline fun <T> i(block: () -> T): T = block()
// FILE: A3.kt
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@file:JvmPackageName("baz.foo.quux.bar")
@file:JvmName("Facade")
@file:JvmMultifileClass
package foo.bar
typealias S = String
fun f(): String = "O"
// FILE: B.kt
import foo.bar.*
fun box(): S = i { f() + g }

View File

@@ -0,0 +1,18 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND: JVM_IR
// FILE: common.kt
expect class C {
val value: String
fun test(result: String = value): String
}
// FILE: platform.kt
actual class C(actual val value: String) {
actual fun test(result: String): String = result
}
fun box() = C("Fail").test("OK")

View File

@@ -0,0 +1,16 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND: JVM_IR
// FILE: common.kt
class Receiver(val value: String)
expect fun Receiver.test(result: String = value): String
// FILE: platform.kt
actual fun Receiver.test(result: String): String {
return result
}
fun box() = Receiver("Fail").test("OK")

View File

@@ -0,0 +1,17 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND: JVM_IR
// FILE: common.kt
class B(val value: Int)
expect fun test(a: Int = 2, b: Int = B(a * 2).value, c: String = "${b}$a"): String
// FILE: platform.kt
actual fun test(a: Int, b: Int, c: String): String = c
fun box(): String {
val result = test()
return if (result == "42") "OK" else "Fail: $result"
}

View File

@@ -0,0 +1,31 @@
// !LANGUAGE: +MultiPlatformProjects
// NO_CHECK_LAMBDA_INLINING
// IGNORE_BACKEND: JVM_IR
// FILE: 1.kt
class C(val s1: String, val s2: String)
expect fun C.test(r1: () -> String = { s1 }, r2: () -> String = this::s2): String
actual inline fun C.test(r1: () -> String, r2: () -> String): String = r1() + r2()
expect class D {
val s1: String
val s2: String
fun test(r1: () -> String = { s1 }, r2: () -> String = this::s2): String
}
actual class D(actual val s1: String, actual val s2: String) {
actual inline fun test(r1: () -> String, r2: () -> String): String = r1() + r2()
}
// FILE: 2.kt
fun box(): String {
if (C("O", "K").test() != "OK") return "Fail extension receiver"
if (D("O", "K").test() != "OK") return "Fail dispatch receiver"
return "OK"
}

View File

@@ -0,0 +1,49 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// WITH_COROUTINES
// FILE: flow.kt
package flow
interface FlowCollector<T> {
suspend fun emit(value: T)
}
interface Flow<T : Any> {
suspend fun collect(collector: FlowCollector<T>)
}
public inline fun <T : Any> flow(crossinline block: suspend FlowCollector<T>.() -> Unit): Flow<T> = object : Flow<T> {
override suspend fun collect(collector: FlowCollector<T>) = collector.block()
}
inline suspend fun <T : Any> Flow<T>.collect(crossinline action: suspend (T) -> Unit): Unit =
collect(object : FlowCollector<T> {
override suspend fun emit(value: T) = action(value)
})
// FILE: Test.kt
import flow.*
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var str = "FAIL"
builder {
flow<Unit> {
var continuation: Continuation<Unit>? = null
suspendCoroutineUninterceptedOrReturn<Unit> { continuation = it; Unit }
str = "$continuation"
}.collect {
}
}
if ("(Test.kt:" !in str) return str
return "OK"
}

View File

@@ -4,9 +4,14 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val l: suspend () -> Unit = { c() }
val l: suspend () -> Unit = {
c()
c()
}
l()
l()
}
@@ -18,26 +23,16 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
if (i != 1) return "FAIL"
StateMachineChecker.check(numberOfSuspensions = 8)
return "OK"
}

View File

@@ -4,15 +4,19 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val l: suspend () -> Unit = {
val l1 : suspend () -> Unit = {
c()
c()
}
l1()
l1()
}
l()
l()
}
// FILE: inlineSite.kt
@@ -23,26 +27,16 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
if (i != 1) return "FAIL $i"
StateMachineChecker.check(numberOfSuspensions = 16)
return "OK"
}

View File

@@ -4,26 +4,21 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
}
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val l: suspend () -> Unit = {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
l()
l()
}
// FILE: inlineSite.kt
@@ -33,7 +28,7 @@ import COROUTINES_PACKAGE.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
@@ -43,6 +38,6 @@ fun box(): String {
res = "FAIL 1"
}
}
if (i != 1) return "FAIL 2"
StateMachineChecker.check(numberOfSuspensions = 10)
return res
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
interface SuspendRunnable {
suspend fun run()
@@ -20,21 +21,28 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val sr = object: SuspendRunnable {
override suspend fun run() {
c()
c()
}
}
sr.run()
sr.run()
}
l()
l()
}
}
sr.run()
sr.run()
}
l()
l()
}
}
sr.run()
sr.run()
}
l()
l()
}
// FILE: inlineSite.kt
@@ -45,26 +53,16 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
if (i != 1) return "FAIL $i"
StateMachineChecker.check(numberOfSuspensions = 256)
return "OK"
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
interface SuspendRunnable {
suspend fun run()
@@ -12,8 +13,10 @@ interface SuspendRunnable {
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val l: suspend () -> Unit = {
c()
c()
}
l()
l()
}
// FILE: inlineSite.kt
@@ -24,14 +27,7 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
@@ -45,26 +41,28 @@ fun box(): String {
val l : suspend () -> Unit = {
val sr = object: SuspendRunnable {
override suspend fun run() {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
sr.run()
sr.run()
}
l()
l()
}
}
sr.run()
sr.run()
}
l()
l()
}
}
sr.run()
sr.run()
}
}
if (i != 1) return "FAIL $i"
StateMachineChecker.check(numberOfSuspensions = 256)
return "OK"
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
interface SuspendRunnable {
suspend fun run()
@@ -13,9 +14,11 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val o = object : SuspendRunnable {
override suspend fun run() {
c()
c()
}
}
o.run()
o.run()
}
// FILE: inlineSite.kt
@@ -26,26 +29,16 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
if (i != 1) return "FAIL $i"
StateMachineChecker.check(numberOfSuspensions = 8)
return "OK"
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
interface SuspendRunnable {
suspend fun run()
@@ -15,12 +16,15 @@ suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val o1 = object: SuspendRunnable {
override suspend fun run() {
c()
c()
}
}
o1.run()
o1.run()
}
}
o.run()
o.run()
}
// FILE: inlineSite.kt
@@ -31,26 +35,16 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
if (i != 1) return "FAIL $i"
StateMachineChecker.check(numberOfSuspensions = 16)
return "OK"
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
interface SuspendRunnable {
suspend fun run1()
@@ -14,9 +15,11 @@ suspend inline fun crossinlineMe(crossinline c1: suspend () -> Unit, crossinline
val o = object : SuspendRunnable {
override suspend fun run1() {
c1()
c1()
}
override suspend fun run2() {
c2()
c2()
}
}
o.run1()
@@ -27,19 +30,13 @@ suspend inline fun crossinlineMe(crossinline c1: suspend () -> Unit, crossinline
// COMMON_COROUTINES_TEST
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
c.startCoroutine(CheckStateMachineContinuation)
}
var i = 0;
var j = 0;
suspend fun incrementI() {
i++
}
var j = 0
suspend fun incrementJ() {
j++
@@ -47,9 +44,10 @@ suspend fun incrementJ() {
fun box(): String {
builder {
crossinlineMe({ incrementI() }) { incrementJ() }
crossinlineMe({ StateMachineChecker.suspendHere() }) { incrementJ() }
}
if (i != 1) return "FAIL i $i"
if (j != 1) return "FAIL i $i"
if (j != 0) return "FAIL j != 0 $j"
StateMachineChecker.check(numberOfSuspensions = 2)
if (j != 2) return "FAIL j != 2 $j"
return "OK"
}

View File

@@ -4,17 +4,11 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
}
interface SuspendRunnable {
suspend fun run()
}
@@ -22,11 +16,11 @@ interface SuspendRunnable {
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val o = object : SuspendRunnable {
override suspend fun run() {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
o.run()
@@ -39,7 +33,7 @@ import COROUTINES_PACKAGE.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
@@ -49,6 +43,6 @@ fun box(): String {
res = "FAIL 1"
}
}
if (i != 1) return "FAIL 2"
StateMachineChecker.check(numberOfSuspensions = 5)
return res
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
c()
@@ -18,26 +19,19 @@ import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
var i = 0;
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn<Unit> {
i++
COROUTINE_SUSPENDED
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
if (i != 1) return "FAIL"
StateMachineChecker.check(numberOfSuspensions = 10)
return "OK"
}

View File

@@ -4,6 +4,7 @@
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
// CHECK_STATE_MACHINE
suspend inline fun crossinlineMe(crossinline c: suspend () -> Unit) {
val l: suspend () -> Unit = { c() }
@@ -21,53 +22,20 @@ import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
import helpers.*
var result = "FAIL"
var i = 0
var finished = false
var proceed: () -> Unit = {}
suspend fun suspendHere() = suspendCoroutine<Unit> { c ->
i++
proceed = { c.resume(Unit) }
}
fun builder(c: suspend () -> Unit) {
val continuation = object: ContinuationAdapter<Unit>() {
override val context: CoroutineContext
get() = EmptyCoroutineContext
override fun resume(value: Unit) {
proceed = {
result = "OK"
finished = true
}
}
override fun resumeWithException(exception: Throwable) {
throw exception
}
}
c.startCoroutine(continuation)
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
crossinlineMe2 {
suspendHere()
suspendHere()
suspendHere()
suspendHere()
suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
}
for (counter in 0 until 10) {
if (i != counter + 1) return "Expected ${counter + 1}, got $i"
proceed()
}
if (i != 10) return "FAIL $i"
if (finished) return "resume on root continuation is called"
proceed()
if (!finished) return "resume on root continuation is not called"
return result
StateMachineChecker.check(numberOfSuspensions = 10)
return "OK"
}

View File

@@ -1,7 +1,7 @@
@kotlin.Metadata
public final class Foo {
public method <init>(): void
public synthetic deprecated static method bar$default(p0: Foo, p1: java.lang.String, p2: int, p3: java.lang.Object): void
public synthetic deprecated static @kotlin.Deprecated @kotlin.jvm.JvmOverloads method bar$default(p0: Foo, p1: java.lang.String, p2: int, p3: java.lang.Object): void
public deprecated final @kotlin.Deprecated @kotlin.jvm.JvmOverloads method bar(): void
public deprecated final @kotlin.Deprecated @kotlin.jvm.JvmOverloads method bar(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}

View File

@@ -10,7 +10,7 @@ public final class C {
private final field x: int
public method <init>(p0: int): void
public final method component1(): int
public synthetic static method copy$default(p0: C, p1: int, p2: int, p3: java.lang.Object): C
public synthetic static @org.jetbrains.annotations.NotNull method copy$default(p0: C, p1: int, p2: int, p3: java.lang.Object): C
public final @org.jetbrains.annotations.NotNull method copy(): C
public final @org.jetbrains.annotations.NotNull method copy(p0: int): C
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean

View File

@@ -1,18 +1,18 @@
@kotlin.Metadata
public final class ASimpleClass {
public method <init>(): void
public synthetic static method showSnackbar$default(p0: ASimpleClass, p1: java.lang.String, p2: int, p3: int, p4: int, p5: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbar$default(p0: ASimpleClass, p1: java.lang.String, p2: int, p3: int, p4: int, p5: java.lang.Object): void
public final @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int): void
public final @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, p2: int): void
public synthetic static method showSnackbarLong$default(p0: ASimpleClass, p1: java.lang.String, p2: int, p3: int, p4: long, p5: java.lang.String, p6: int, p7: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbarLong$default(p0: ASimpleClass, p1: java.lang.String, p2: int, p3: int, p4: long, p5: java.lang.String, p6: int, p7: java.lang.Object): void
public final @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long): void
public final @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long, @org.jetbrains.annotations.NotNull p4: java.lang.String): void
public final @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @LongRes p2: long): void
public synthetic static method showSnackbarLongNoExtension$default(p0: ASimpleClass, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension$default(p0: ASimpleClass, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public final @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long): void
public final @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
public final @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @LongRes p1: long): void
public synthetic static method showSnackbarNoExtension$default(p0: ASimpleClass, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbarNoExtension$default(p0: ASimpleClass, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public final @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int): void
public final @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int, p1: int): void
}
@@ -22,18 +22,18 @@ public final class BSimpleObject {
public final static field INSTANCE: BSimpleObject
static method <clinit>(): void
private method <init>(): void
public synthetic static method showSnackbar$default(p0: java.lang.String, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbar$default(p0: java.lang.String, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, p2: int): void
public synthetic static method showSnackbarLong$default(p0: java.lang.String, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong$default(p0: java.lang.String, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long, @org.jetbrains.annotations.NotNull p4: java.lang.String): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @LongRes p2: long): void
public synthetic static method showSnackbarLongNoExtension$default(p0: int, p1: int, p2: long, p3: java.lang.String, p4: int, p5: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension$default(p0: int, p1: int, p2: long, p3: java.lang.String, p4: int, p5: java.lang.Object): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @LongRes p1: long): void
public synthetic static method showSnackbarNoExtension$default(p0: int, p1: int, p2: int, p3: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarNoExtension$default(p0: int, p1: int, p2: int, p3: java.lang.Object): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int): void
public final static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int, p1: int): void
}
@@ -43,18 +43,18 @@ public final class CClassWithCompanion$Companion {
inner class CClassWithCompanion$Companion
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic static method showSnackbar$default(p0: CClassWithCompanion$Companion, p1: java.lang.String, p2: int, p3: int, p4: int, p5: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbar$default(p0: CClassWithCompanion$Companion, p1: java.lang.String, p2: int, p3: int, p4: int, p5: java.lang.Object): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, p2: int): void
public synthetic static method showSnackbarLong$default(p0: CClassWithCompanion$Companion, p1: java.lang.String, p2: int, p3: int, p4: long, p5: java.lang.String, p6: int, p7: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong$default(p0: CClassWithCompanion$Companion, p1: java.lang.String, p2: int, p3: int, p4: long, p5: java.lang.String, p6: int, p7: java.lang.Object): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long, @org.jetbrains.annotations.NotNull p4: java.lang.String): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @LongRes p2: long): void
public synthetic static method showSnackbarLongNoExtension$default(p0: CClassWithCompanion$Companion, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension$default(p0: CClassWithCompanion$Companion, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @LongRes p1: long): void
public synthetic static method showSnackbarNoExtension$default(p0: CClassWithCompanion$Companion, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarNoExtension$default(p0: CClassWithCompanion$Companion, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int): void
public final @kotlin.jvm.JvmStatic @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int, p1: int): void
}
@@ -86,8 +86,8 @@ public final class DClassConstuctors$InnerClass {
public @kotlin.jvm.JvmOverloads method <init>(p0: DClassConstuctors, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long, @org.jetbrains.annotations.NotNull p4: java.lang.String): void
public @kotlin.jvm.JvmOverloads method <init>(p0: DClassConstuctors, @StringRes p1: int, @LongRes p2: long): void
public @kotlin.jvm.JvmOverloads method <init>(p0: DClassConstuctors, @StringRes p1: int, p2: int): void
public synthetic method <init>(p0: DClassConstuctors, p1: int, p2: int, p3: int, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic method <init>(p0: DClassConstuctors, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic @kotlin.jvm.JvmOverloads method <init>(p0: DClassConstuctors, p1: int, p2: int, p3: int, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic @kotlin.jvm.JvmOverloads method <init>(p0: DClassConstuctors, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
@@ -98,8 +98,8 @@ public final class DClassConstuctors {
public @kotlin.jvm.JvmOverloads method <init>(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
public @kotlin.jvm.JvmOverloads method <init>(@StringRes p0: int, @LongRes p1: long): void
public @kotlin.jvm.JvmOverloads method <init>(@StringRes p0: int, p1: int): void
public synthetic method <init>(p0: int, p1: int, p2: int, p3: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic method <init>(p0: int, p1: int, p2: long, p3: java.lang.String, p4: int, p5: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic @kotlin.jvm.JvmOverloads method <init>(p0: int, p1: int, p2: int, p3: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic @kotlin.jvm.JvmOverloads method <init>(p0: int, p1: int, p2: long, p3: java.lang.String, p4: int, p5: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@java.lang.annotation.Retention
@@ -108,18 +108,18 @@ public annotation class DefRes
@kotlin.Metadata
public final class JvmOverloadsAndParametersAnnotationsKt {
public synthetic static method showSnackbar$default(p0: java.lang.String, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbar$default(p0: java.lang.String, p1: int, p2: int, p3: int, p4: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int): void
public final static @kotlin.jvm.JvmOverloads method showSnackbar(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, p2: int): void
public synthetic static method showSnackbarLong$default(p0: java.lang.String, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbarLong$default(p0: java.lang.String, p1: int, p2: int, p3: long, p4: java.lang.String, p5: int, p6: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @DefRes p2: int, @LongRes p3: long, @org.jetbrains.annotations.NotNull p4: java.lang.String): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarLong(@org.jetbrains.annotations.NotNull p0: java.lang.String, @StringRes p1: int, @LongRes p2: long): void
public synthetic static method showSnackbarLongNoExtension$default(p0: int, p1: int, p2: long, p3: java.lang.String, p4: int, p5: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension$default(p0: int, p1: int, p2: long, p3: java.lang.String, p4: int, p5: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @DefRes p1: int, @LongRes p2: long, @org.jetbrains.annotations.NotNull p3: java.lang.String): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarLongNoExtension(@StringRes p0: int, @LongRes p1: long): void
public synthetic static method showSnackbarNoExtension$default(p0: int, p1: int, p2: int, p3: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method showSnackbarNoExtension$default(p0: int, p1: int, p2: int, p3: java.lang.Object): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int): void
public final static @kotlin.jvm.JvmOverloads method showSnackbarNoExtension(@StringRes p0: int, p1: int): void
}

View File

@@ -4,7 +4,7 @@ final class OomInReturnUnitKt$test$1 {
synthetic field data: java.lang.Object
synthetic field exception: java.lang.Throwable
inner class OomInReturnUnitKt$test$1
method <init>(p0: COROUTINES_PACKAGE.Continuation): void
method <init>(p0: kotlin.coroutines.experimental.Continuation): void
public final @org.jetbrains.annotations.Nullable method doResume(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Throwable): java.lang.Object
synthetic final method getLabel(): int
synthetic final method setLabel(p0: int): void
@@ -13,25 +13,25 @@ final class OomInReturnUnitKt$test$1 {
@kotlin.Metadata
public final class OomInReturnUnitKt {
inner class OomInReturnUnitKt$test$1
public final static @org.jetbrains.annotations.Nullable method some(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method test(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method some(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
public final static @org.jetbrains.annotations.Nullable method test(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.Continuation): java.lang.Object
}
@kotlin.Metadata
public abstract class helpers/ContinuationAdapter {
private final @org.jetbrains.annotations.NotNull field context: COROUTINES_PACKAGE.CoroutineContext
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.experimental.CoroutineContext
public method <init>(): void
public @org.jetbrains.annotations.NotNull method getContext(): COROUTINES_PACKAGE.CoroutineContext
public @org.jetbrains.annotations.NotNull method getContext(): kotlin.coroutines.experimental.CoroutineContext
}
@kotlin.Metadata
public final class helpers/CoroutineUtilKt$handleExceptionContinuation$1 {
synthetic final field $x: kotlin.jvm.functions.Function1
private final @org.jetbrains.annotations.NotNull field context: COROUTINES_PACKAGE.EmptyCoroutineContext
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.experimental.EmptyCoroutineContext
inner class helpers/CoroutineUtilKt$handleExceptionContinuation$1
method <init>(p0: kotlin.jvm.functions.Function1): void
public synthetic method getContext(): COROUTINES_PACKAGE.CoroutineContext
public @org.jetbrains.annotations.NotNull method getContext(): COROUTINES_PACKAGE.EmptyCoroutineContext
public synthetic method getContext(): kotlin.coroutines.experimental.CoroutineContext
public @org.jetbrains.annotations.NotNull method getContext(): kotlin.coroutines.experimental.EmptyCoroutineContext
public method resume(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void
public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void
}
@@ -39,11 +39,11 @@ public final class helpers/CoroutineUtilKt$handleExceptionContinuation$1 {
@kotlin.Metadata
public final class helpers/CoroutineUtilKt$handleResultContinuation$1 {
synthetic final field $x: kotlin.jvm.functions.Function1
private final @org.jetbrains.annotations.NotNull field context: COROUTINES_PACKAGE.EmptyCoroutineContext
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.experimental.EmptyCoroutineContext
inner class helpers/CoroutineUtilKt$handleResultContinuation$1
method <init>(p0: kotlin.jvm.functions.Function1): void
public synthetic method getContext(): COROUTINES_PACKAGE.CoroutineContext
public @org.jetbrains.annotations.NotNull method getContext(): COROUTINES_PACKAGE.EmptyCoroutineContext
public synthetic method getContext(): kotlin.coroutines.experimental.CoroutineContext
public @org.jetbrains.annotations.NotNull method getContext(): kotlin.coroutines.experimental.EmptyCoroutineContext
public method resume(p0: java.lang.Object): void
public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void
}
@@ -52,8 +52,8 @@ public final class helpers/CoroutineUtilKt$handleResultContinuation$1 {
public final class helpers/CoroutineUtilKt {
inner class helpers/CoroutineUtilKt$handleExceptionContinuation$1
inner class helpers/CoroutineUtilKt$handleResultContinuation$1
public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): COROUTINES_PACKAGE.Continuation
public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): COROUTINES_PACKAGE.Continuation
public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.experimental.Continuation
public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.experimental.Continuation
}
@kotlin.Metadata
@@ -66,13 +66,13 @@ public final class helpers/EmptyContinuation$Companion {
@kotlin.Metadata
public class helpers/EmptyContinuation {
public final static field Companion: helpers.EmptyContinuation$Companion
private final @org.jetbrains.annotations.NotNull field context: COROUTINES_PACKAGE.CoroutineContext
private final @org.jetbrains.annotations.NotNull field context: kotlin.coroutines.experimental.CoroutineContext
inner class helpers/EmptyContinuation$Companion
static method <clinit>(): void
public method <init>(): void
public method <init>(@org.jetbrains.annotations.NotNull p0: COROUTINES_PACKAGE.CoroutineContext): void
public synthetic method <init>(p0: COROUTINES_PACKAGE.CoroutineContext, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
public @org.jetbrains.annotations.NotNull method getContext(): COROUTINES_PACKAGE.CoroutineContext
public method <init>(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.experimental.CoroutineContext): void
public synthetic method <init>(p0: kotlin.coroutines.experimental.CoroutineContext, p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
public @org.jetbrains.annotations.NotNull method getContext(): kotlin.coroutines.experimental.CoroutineContext
public method resume(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void
public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void
}

View File

@@ -5,7 +5,7 @@ public final class User {
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: int): void
public final @org.jetbrains.annotations.NotNull method component1(): java.lang.String
public final method component2(): int
public synthetic static method copy$default(p0: User, p1: java.lang.String, p2: int, p3: int, p4: java.lang.Object): User
public synthetic static @org.jetbrains.annotations.NotNull method copy$default(p0: User, p1: java.lang.String, p2: int, p3: int, p4: java.lang.Object): User
public final @org.jetbrains.annotations.NotNull method copy(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: int): User
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final method getAge(): int

View File

@@ -1,7 +1,7 @@
@kotlin.Metadata
public final class Test {
public method <init>(): void
public synthetic static method b$default(p0: Test, p1: java.lang.String, p2: int, p3: char, p4: int, p5: java.lang.Object): void
public synthetic static @kotlin.jvm.JvmOverloads method b$default(p0: Test, p1: java.lang.String, p2: int, p3: char, p4: int, p5: java.lang.Object): void
public final @kotlin.jvm.JvmOverloads @synthetic.kotlin.jvm.GeneratedByJvmOverloads method b(): void
public final @kotlin.jvm.JvmOverloads @synthetic.kotlin.jvm.GeneratedByJvmOverloads method b(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final @kotlin.jvm.JvmOverloads @synthetic.kotlin.jvm.GeneratedByJvmOverloads method b(@org.jetbrains.annotations.NotNull p0: java.lang.String, p1: int): void

View File

@@ -0,0 +1,25 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: A.kt
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
@file:JvmPackageName("baz.foo.quux.bar")
@file:JvmName("Facade")
@file:JvmMultifileClass
package foo.bar
typealias S = String
fun f(): String = "O"
val g: S? get() = f().substring(0, 0) + "K"
inline fun <T> i(block: () -> T): T = block()
// FILE: B.kt
import foo.bar.*
fun box(): S = i { f() + g }

View File

@@ -1,4 +1,4 @@
// WITH_REFLECT
// !LANGUAGE: +ProhibitTypeParametersInClassLiteralsInAnnotationArguments
import kotlin.reflect.KClass
@@ -35,4 +35,11 @@ fun test7() {}
fun test8() {}
inline val <reified T> T.test9
get() = @Ann(T::class) object {}
get() = @AnnArray(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>arrayOf(
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>T::class<!>,
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>Array<T>::class<!>,
<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>Array<Array<Array<T>>>::class<!>
)<!>) object {}
inline val <reified T> T.test10
get() = @AnnArray(<!NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION!>[<!ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR!>T::class<!>]<!>) object {}

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