mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-26 08:31:31 +00:00
Compare commits
369 Commits
get-script
...
v1.3.30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6381b3b151 | ||
|
|
7c7da5498e | ||
|
|
384fe15a8e | ||
|
|
6319f56464 | ||
|
|
e975f6f916 | ||
|
|
857c0b5597 | ||
|
|
02144498f1 | ||
|
|
681e8dd968 | ||
|
|
7025adeaea | ||
|
|
0423d49ef2 | ||
|
|
91699471b9 | ||
|
|
8372e917ef | ||
|
|
1ae93dea56 | ||
|
|
4ea3aa2a0a | ||
|
|
5184f35165 | ||
|
|
03a5c26060 | ||
|
|
7fa7e61f0a | ||
|
|
7cf5c28560 | ||
|
|
6f90e9bb08 | ||
|
|
54d75fb73b | ||
|
|
897d51796f | ||
|
|
419a22c1d2 | ||
|
|
45d2662821 | ||
|
|
2782813ef9 | ||
|
|
396d748ef4 | ||
|
|
369fdebbfb | ||
|
|
bce9b9c203 | ||
|
|
321a197d81 | ||
|
|
571c204499 | ||
|
|
533f5012a5 | ||
|
|
505b219b5f | ||
|
|
eb7ef5a8b2 | ||
|
|
ffc27b0bc6 | ||
|
|
bfe9d5d0bb | ||
|
|
28c95272e2 | ||
|
|
c026097bb6 | ||
|
|
39eee9c0af | ||
|
|
a9c28ab4f1 | ||
|
|
2452558ba3 | ||
|
|
75bf9ef0be | ||
|
|
36d2d6607c | ||
|
|
e0792394cc | ||
|
|
2302967bfb | ||
|
|
b8d573b6f4 | ||
|
|
44d1e81c73 | ||
|
|
86500b52e4 | ||
|
|
e88814ff26 | ||
|
|
63b116b188 | ||
|
|
a9bad98772 | ||
|
|
d254c583c1 | ||
|
|
8f1f4cbe96 | ||
|
|
cc1dcf69b4 | ||
|
|
e2505325ad | ||
|
|
57642ff586 | ||
|
|
8fc83b21a7 | ||
|
|
dc9e112844 | ||
|
|
0e525987f6 | ||
|
|
0c4ad4bb86 | ||
|
|
52b5a868e7 | ||
|
|
13f6dbbfd4 | ||
|
|
04948907bb | ||
|
|
c9de6e44fa | ||
|
|
aca62090fe | ||
|
|
00405b3f94 | ||
|
|
24f2b91356 | ||
|
|
e5c5e90dc5 | ||
|
|
3b0b6b14fc | ||
|
|
4fdbf987d7 | ||
|
|
5541bcfac1 | ||
|
|
b5e4e07cca | ||
|
|
e8445b9b98 | ||
|
|
8f49f44cef | ||
|
|
cf699796fc | ||
|
|
f6a1e13bc7 | ||
|
|
348fc18376 | ||
|
|
c34f00e268 | ||
|
|
195cbda7a7 | ||
|
|
0bf335cf1a | ||
|
|
22b1c29ce8 | ||
|
|
8c184481e7 | ||
|
|
91fa42baba | ||
|
|
d239f02afe | ||
|
|
4f97b4672c | ||
|
|
fc8b012aa2 | ||
|
|
a2182d593f | ||
|
|
26256f4112 | ||
|
|
534c9fb05a | ||
|
|
335f979533 | ||
|
|
1f8756227e | ||
|
|
57a55f4929 | ||
|
|
6e09494f20 | ||
|
|
f017b47e0a | ||
|
|
ee293c0ec4 | ||
|
|
2a47e75b8e | ||
|
|
7b3b189d07 | ||
|
|
c4c90d920d | ||
|
|
2c39d1cadc | ||
|
|
43fd33c0aa | ||
|
|
c0d0cd8f5e | ||
|
|
1ceef03bb8 | ||
|
|
b65f777a19 | ||
|
|
8f4a705d09 | ||
|
|
ab07560c1a | ||
|
|
8b8a3f6819 | ||
|
|
a621a22a43 | ||
|
|
64b3519252 | ||
|
|
2c50f37fae | ||
|
|
6d6a320bb9 | ||
|
|
574229dfcc | ||
|
|
e381138e61 | ||
|
|
2a9125b267 | ||
|
|
c9a252729b | ||
|
|
590b81184d | ||
|
|
b463df5a1d | ||
|
|
7b1373053d | ||
|
|
f8f5f8d4d4 | ||
|
|
e2c61e7231 | ||
|
|
669b39d874 | ||
|
|
137a2794bc | ||
|
|
41d8e84593 | ||
|
|
42b7db6507 | ||
|
|
ace0dcaf06 | ||
|
|
da846d27f6 | ||
|
|
922a55b069 | ||
|
|
ec1f57660d | ||
|
|
6b7adfea03 | ||
|
|
a164d8d9d5 | ||
|
|
624fb69d88 | ||
|
|
fd1fe8d68c | ||
|
|
6894d1feeb | ||
|
|
b5f9be5763 | ||
|
|
5f148dad80 | ||
|
|
47423ec5d5 | ||
|
|
a21766f0b0 | ||
|
|
fd8c164fda | ||
|
|
ecdec20d1d | ||
|
|
fa10395235 | ||
|
|
1f1e8ca1b6 | ||
|
|
9c413572af | ||
|
|
b298a3ed1a | ||
|
|
fa87574e90 | ||
|
|
56e67bd7c9 | ||
|
|
6aa1709ae4 | ||
|
|
9a994ab364 | ||
|
|
fb57ec1076 | ||
|
|
f64b76561a | ||
|
|
9d12760b81 | ||
|
|
2baeb67f72 | ||
|
|
abe2db4d84 | ||
|
|
6a1ff34f6f | ||
|
|
2938e2f8cf | ||
|
|
a0d9f8144c | ||
|
|
fa1224ae63 | ||
|
|
b9636aad73 | ||
|
|
7aa65671fc | ||
|
|
2a8d9e6e9e | ||
|
|
37ed69347d | ||
|
|
49e0ad054c | ||
|
|
cda7a2d22d | ||
|
|
633cdf90b7 | ||
|
|
21a25db4f2 | ||
|
|
9625081f13 | ||
|
|
a31b08468b | ||
|
|
22aa4b575e | ||
|
|
191578bafa | ||
|
|
77d41040a0 | ||
|
|
ad2d63426c | ||
|
|
6060df876a | ||
|
|
4910994c2a | ||
|
|
5289218403 | ||
|
|
f3a1f0fa5d | ||
|
|
fce0a1d29d | ||
|
|
dd8209b20d | ||
|
|
fc6f20b6e5 | ||
|
|
be9e3d81e2 | ||
|
|
afc9dcd869 | ||
|
|
831f10b62c | ||
|
|
ab805c5f52 | ||
|
|
1c0562be2a | ||
|
|
f90ff23884 | ||
|
|
990c9de07c | ||
|
|
ec9a780dec | ||
|
|
a205144aa9 | ||
|
|
b3f4327ce8 | ||
|
|
ea7bdf5a6b | ||
|
|
85cfa28d47 | ||
|
|
5654166596 | ||
|
|
0d8057c7c5 | ||
|
|
58395e84b5 | ||
|
|
aa586e7eb0 | ||
|
|
557ec4cc89 | ||
|
|
7c1066f317 | ||
|
|
70c6d34d81 | ||
|
|
070324a67b | ||
|
|
ad043c8378 | ||
|
|
4554cdd54e | ||
|
|
f94311a4a3 | ||
|
|
624332bd6c | ||
|
|
a47fb6e40a | ||
|
|
39ab591679 | ||
|
|
93e5849b8b | ||
|
|
338c11f6d1 | ||
|
|
e5436802b6 | ||
|
|
f8173c07c2 | ||
|
|
017821a01d | ||
|
|
bfb240ee11 | ||
|
|
b84d0e406b | ||
|
|
7066d2cb5d | ||
|
|
d164f0b58c | ||
|
|
b827ddf22f | ||
|
|
60100a337c | ||
|
|
e52f481fcd | ||
|
|
e31104bbde | ||
|
|
cd03c543de | ||
|
|
20361e462d | ||
|
|
62b76fe25d | ||
|
|
8ba3141c1a | ||
|
|
462b25c3a9 | ||
|
|
44518097c5 | ||
|
|
9a485d8bbb | ||
|
|
485f6c62ee | ||
|
|
14b98ab49a | ||
|
|
ceaacc7890 | ||
|
|
29bb3de2a4 | ||
|
|
41824a0b39 | ||
|
|
b7f23aeda5 | ||
|
|
1c2549dce6 | ||
|
|
ced8dee0e9 | ||
|
|
3e17f8d27d | ||
|
|
238a4fbc88 | ||
|
|
5da7ed6dd5 | ||
|
|
425346e8c0 | ||
|
|
36fdd5107a | ||
|
|
29cbf6d42a | ||
|
|
c04e476a7b | ||
|
|
e3c4cded7b | ||
|
|
ff84936aaf | ||
|
|
49f291cb02 | ||
|
|
8153f22236 | ||
|
|
3a0d6097dc | ||
|
|
ee0d9051e2 | ||
|
|
686eb92557 | ||
|
|
5a0dd2206e | ||
|
|
cad8f1826f | ||
|
|
1a73d10f2b | ||
|
|
b7672a5155 | ||
|
|
cdf3d031d8 | ||
|
|
f51feceb01 | ||
|
|
153ce51475 | ||
|
|
8c81b1760f | ||
|
|
dc4e06c6af | ||
|
|
38f6303702 | ||
|
|
b6353524a0 | ||
|
|
2e8d524b19 | ||
|
|
75afa63a79 | ||
|
|
3cd89c71cd | ||
|
|
7e376ff3c6 | ||
|
|
8cc11279d7 | ||
|
|
9a01d323aa | ||
|
|
a84470c124 | ||
|
|
87944cd866 | ||
|
|
ff97e1cea9 | ||
|
|
ff38226b01 | ||
|
|
e934478581 | ||
|
|
39616479ba | ||
|
|
38c5f58be7 | ||
|
|
0fe065ba77 | ||
|
|
4d601d34d0 | ||
|
|
39e22851cd | ||
|
|
d2cf140965 | ||
|
|
b1e2afccb5 | ||
|
|
a1d586cfc5 | ||
|
|
056f99228f | ||
|
|
88bdb7a8b9 | ||
|
|
9e61c7db7d | ||
|
|
572ac40df0 | ||
|
|
276aa903db | ||
|
|
8df4c48be2 | ||
|
|
a62d3812f6 | ||
|
|
2bd835f008 | ||
|
|
e7cf4fd3f2 | ||
|
|
320b0f907b | ||
|
|
7650f63921 | ||
|
|
419195e608 | ||
|
|
a616b79cba | ||
|
|
183eca867e | ||
|
|
7dbd79304d | ||
|
|
6e20d4deec | ||
|
|
068afcacae | ||
|
|
d2d73b5043 | ||
|
|
3391530809 | ||
|
|
4d96bfe089 | ||
|
|
9d37feab72 | ||
|
|
feb8b91075 | ||
|
|
fbe6c72c46 | ||
|
|
04a898dd44 | ||
|
|
8a05e00960 | ||
|
|
a690dbefe5 | ||
|
|
c366433034 | ||
|
|
8be1487429 | ||
|
|
7c62ffa9cd | ||
|
|
10c71ea2f2 | ||
|
|
bb98d95186 | ||
|
|
5098171326 | ||
|
|
e9c071aabc | ||
|
|
ed7b530513 | ||
|
|
65feaf9a4a | ||
|
|
558d1edd39 | ||
|
|
492dd24897 | ||
|
|
710134b4a6 | ||
|
|
c253404622 | ||
|
|
94a88c5c19 | ||
|
|
8ac926d3e2 | ||
|
|
1dcad35f21 | ||
|
|
6df81c5fc7 | ||
|
|
6c0cec151e | ||
|
|
22b2fc0c9f | ||
|
|
48596fe2c7 | ||
|
|
7fcc915fc4 | ||
|
|
7c4e5dbb09 | ||
|
|
4b12826e99 | ||
|
|
fab11884cc | ||
|
|
800ccdcc1d | ||
|
|
0d16f0de42 | ||
|
|
d191510b42 | ||
|
|
536ab732cd | ||
|
|
e100e3ec58 | ||
|
|
e6a560c49c | ||
|
|
f1636cab67 | ||
|
|
15a60b8640 | ||
|
|
86395bc6dc | ||
|
|
a8345c25f0 | ||
|
|
017d99de4c | ||
|
|
bb020202aa | ||
|
|
e111863ee2 | ||
|
|
d940851bdf | ||
|
|
868c22b4cf | ||
|
|
a8755cef36 | ||
|
|
1629c46177 | ||
|
|
3dfd560470 | ||
|
|
f745c84574 | ||
|
|
502a6086d6 | ||
|
|
1050b9d19b | ||
|
|
7954c1fced | ||
|
|
5454bed997 | ||
|
|
c361b184d9 | ||
|
|
4b1c847863 | ||
|
|
1162c1be5f | ||
|
|
b55d69c36b | ||
|
|
0af1dc35a4 | ||
|
|
ef27fe4e0e | ||
|
|
614c68280f | ||
|
|
bfbdd3f2fb | ||
|
|
157ad173ec | ||
|
|
dfbe43fe16 | ||
|
|
3dc42d2525 | ||
|
|
919d527aa7 | ||
|
|
45991a69ff | ||
|
|
a134e568f2 | ||
|
|
3af23f2d3f | ||
|
|
7572ee4122 | ||
|
|
41f3415b4a | ||
|
|
9dbd7269cb | ||
|
|
dd3d2311a8 | ||
|
|
b28e71730b | ||
|
|
5e91bc5697 | ||
|
|
ef209999f7 | ||
|
|
d364505652 | ||
|
|
30d2a1ae2a |
2
.idea/artifacts/kotlin_plugin_jar.xml
generated
2
.idea/artifacts/kotlin_plugin_jar.xml
generated
@@ -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
7
.idea/dictionaries/NK.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="NK">
|
||||
<words>
|
||||
<w>typealias</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
2
.idea/inspectionProfiles/idea_default.xml
generated
2
.idea/inspectionProfiles/idea_default.xml
generated
@@ -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>
|
||||
|
||||
19
.idea/runConfigurations/IDEA__Not_Internal_.xml
generated
Normal file
19
.idea/runConfigurations/IDEA__Not_Internal_.xml
generated
Normal 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>
|
||||
7814
ChangeLog.md
7814
ChangeLog.md
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,8 @@ sourceSets {
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
@@ -39,5 +41,3 @@ javadocJar()
|
||||
testsJar()
|
||||
|
||||
projectTest()
|
||||
|
||||
publish()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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") {
|
||||
|
||||
8
buildSrc/gradle.properties.as35
Normal file
8
buildSrc/gradle.properties.as35
Normal 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
|
||||
286
buildSrc/prepare-deps/intellij-sdk/build.gradle.kts.as35
Normal file
286
buildSrc/prepare-deps/intellij-sdk/build.gradle.kts.as35
Normal 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)
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -133,7 +133,6 @@ class AnonymousObjectTransformer(
|
||||
val coroutineTransformer = CoroutineTransformer(
|
||||
inliningContext,
|
||||
classBuilder,
|
||||
sourceInfo,
|
||||
methodsToTransform,
|
||||
superClassName
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
val jar: Jar by tasks
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(jar))
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
publish()
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,8 @@ sourceSets {
|
||||
"test" {}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
noDefaultJar()
|
||||
|
||||
runtimeJar(task<ShadowJar>("shadowJar")) {
|
||||
@@ -55,5 +57,3 @@ javadocJar()
|
||||
dist()
|
||||
|
||||
ideaPlugin()
|
||||
|
||||
publish()
|
||||
|
||||
@@ -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" +
|
||||
")"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 -> {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.";
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -169,7 +169,7 @@ class LocalClassDescriptorHolder(
|
||||
},
|
||||
containingDeclaration,
|
||||
classOrObject.nameAsSafeName,
|
||||
KtClassInfoUtil.createClassLikeInfo(classOrObject),
|
||||
KtClassInfoUtil.createClassOrObjectInfo(classOrObject),
|
||||
classOrObject.hasModifier(KtTokens.EXTERNAL_KEYWORD)
|
||||
)
|
||||
writableScope?.addClassifierDescriptor(classDescriptor!!)
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
2
compiler/testData/cli/jvm/help.out
vendored
2
compiler/testData/cli/jvm/help.out
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
62
compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt
vendored
Normal file
62
compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.kt
vendored
Normal 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"
|
||||
}
|
||||
179
compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.txt
vendored
Normal file
179
compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation.txt
vendored
Normal 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
|
||||
}
|
||||
189
compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation_1_2.txt
vendored
Normal file
189
compiler/testData/codegen/box/coroutines/tailCallOptimizations/innerObjectRetransformation_1_2.txt
vendored
Normal 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
|
||||
}
|
||||
41
compiler/testData/codegen/box/jvmPackageName/multifileClass.kt
vendored
Normal file
41
compiler/testData/codegen/box/jvmPackageName/multifileClass.kt
vendored
Normal 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 }
|
||||
18
compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt
vendored
Normal file
18
compiler/testData/codegen/box/multiplatform/defaultArguments/dispatchReceiverValue.kt
vendored
Normal 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")
|
||||
16
compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt
vendored
Normal file
16
compiler/testData/codegen/box/multiplatform/defaultArguments/extensionReceiverValue.kt
vendored
Normal 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")
|
||||
17
compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt
vendored
Normal file
17
compiler/testData/codegen/box/multiplatform/defaultArguments/parametersInArgumentValues.kt
vendored
Normal 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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
49
compiler/testData/codegen/boxInline/suspend/fileNameInMetadata.kt
vendored
Normal file
49
compiler/testData/codegen/boxInline/suspend/fileNameInMetadata.kt
vendored
Normal 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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
2
compiler/testData/codegen/kapt/dataClass.txt
vendored
2
compiler/testData/codegen/kapt/dataClass.txt
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
25
compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt
vendored
Normal file
25
compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt
vendored
Normal 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 }
|
||||
@@ -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
Reference in New Issue
Block a user