Compare commits

...

82 Commits

Author SHA1 Message Date
Alexey Sedunov
c6a58c7bbf Configuration: Do not auto-advance "Latest Stable" to pre-release version
#KT-25611 Fixed
2018-07-26 20:35:22 +03:00
Ilmir Usmanov
a79f45aed2 Refactoring. Move transformRuntimeFunctionTypeToSuspendFunction to TypeDeserializer
(cherry picked from commit a10bd9f)
2018-07-26 13:31:17 +03:00
Ilmir Usmanov
2f3080e260 Refactoring. Make DeserializedMemberDescriptor somewhat immutable
(cherry picked from commit 533dd44)
2018-07-26 13:31:01 +03:00
Vyacheslav Gerasimov
2920c782b0 as33c4: Update build range for AS 3.3 plugin to match C4 and further releases 2018-07-25 17:39:53 +03:00
Vyacheslav Gerasimov
40ed1e6230 as32: Update build range for AS 3.2 plugin to match RC1 and further releases 2018-07-25 17:39:43 +03:00
Alexander Udalov
822dc4e997 Fix generic signature of FunctionN type visible from Java 2018-07-24 16:29:47 +02:00
Nikolay Krasko
90f4532b82 Don't delete unresolved imports in cleanup inspection (KT-25678)
It looks like they were deleted because of the bug in search for deprecated
imports search.

(cherry picked from commit 7b6df0a)

 #KT-25678 Fixed
2018-07-24 17:14:24 +03:00
Mikhail Glukhikh
c7f004ced4 1.3 migration: make inspections working for non-experimental coroutines
(cherry picked from commit cc1d9e88d5)
2018-07-24 17:11:32 +03:00
Ilya Gorbunov
e2a78ef4a5 Add changelog for 1.3-M1 2018-07-24 16:14:32 +03:00
Alexey Tsvetkov
499c850777 Minor: fix 173 patchset 2018-07-24 16:09:39 +03:00
Alexey Tsvetkov
f0ad81a447 Minor: fix 172 patchset 2018-07-24 16:09:16 +03:00
Alexey Tsvetkov
dc810530d8 Report info message when JS IC is enabled in JPS 2018-07-24 16:09:12 +03:00
Alexey Tsvetkov
372961f92e Add setting to enable JS IC for JPS
#KT-25565 fixed
2018-07-24 16:09:06 +03:00
Alexey Tsvetkov
2e80ae8fb7 Use separate system properties to control IC for JVM and JS
Also this commit effectively disables JS IC by default

     #KT-25563 fixed
2018-07-24 16:09:00 +03:00
Vyacheslav Gerasimov
e484775194 Update build range for AS 3.3 plugin to match only AS 3.3 C3 2018-07-24 15:57:26 +03:00
Vyacheslav Gerasimov
b3ad204aba Update build range for AS 3.2 plugin to match next AS 3.2 releases 2018-07-24 15:57:15 +03:00
Ilya Gorbunov
a7a48c2c04 Fixup: Include new coroutines and unsigned classes into stdlib
Add new coroutines sources into sources.jar
2018-07-24 15:05:28 +03:00
Vyacheslav Gerasimov
c681883207 as33c4: Remove registration of AndroidGradleOrderEnumerationHandler from gradle-java.xml 2018-07-24 14:07:13 +03:00
Vyacheslav Gerasimov
14b611def0 as33c4: Fix compatibility with AS 3.3 C4 2018-07-24 11:43:19 +03:00
Vyacheslav Gerasimov
6c7a3dfa64 as33c4: Remove KotlinExplicitMovementProvider.kt
compilation fails against git4idea bundled in AS, wrong version probably
2018-07-24 11:43:19 +03:00
Vyacheslav Gerasimov
f22b74364e as33c4: Update versions for AS 3.3 C4 2018-07-24 11:43:18 +03:00
Vyacheslav Gerasimov
f1dca37cda as33c4: *TEMP* Build against AS 3.3 C4 2018-07-24 11:43:18 +03:00
Vyacheslav Gerasimov
8c515c2de4 Add as33c4 bunch derived from 182 2018-07-24 11:43:18 +03:00
Denis Zharkov
e9a33ee2e9 Partially revert 79e776e9d7
It's necessary for preserving external plugin compatibility
2018-07-24 11:28:01 +03:00
Dmitry Petrov
6a38d67e00 Fix ConstantValue-related testData for lightClasses tests
TODO support custom language version settings for lightClasses tests
2018-07-24 10:57:48 +03:00
Dmitry Petrov
76d3a3eb83 Fix ConstantValue-related testData for loadJava tests 2018-07-24 10:57:48 +03:00
Ilmir Usmanov
0c6db935b0 Add warning on -Xcoroutines flag use
The only case when warning is not reported is -Xcoroutines=default.
But this is OK until the flag is removed completely.
2018-07-23 21:55:15 +03:00
Ilmir Usmanov
85e2d4e445 Deserialize experimental coroutines as suspend functions/types
but deprecate them for now.
Promote stub version.
 #KT-25623: Fixed
2018-07-23 21:53:52 +03:00
Nikolay Krasko
50270f639b Add intention for replacing experimental coroutines usages to cleanup (KT-25251)
#KT-25251 In Progress

(cherry picked from commit 6687081)
2018-07-23 18:58:23 +03:00
Dmitry Petrov
670e847cd1 Fix ProjectImpl leak in PatternMatchingTypingVisitor 2018-07-23 16:07:24 +03:00
Denis Zharkov
1e3985d660 Restore method broken in f72aa78eec
Otherwise plugin compatibility tests are failing
2018-07-23 13:39:50 +03:00
Ilya Gorbunov
aea980de20 Add stdlib test for Boolean companion 2018-07-21 02:23:45 +03:00
Ilya Gorbunov
8d1de33efb Use Char.MIN_VALUE and MAX_VALUE in tests 2018-07-21 02:23:42 +03:00
Ilya Gorbunov
55421b035a Add tests for SIZE_BYTES and SIZE_BITS constants
#KT-8247 Fixed
2018-07-21 02:23:39 +03:00
Ilya Gorbunov
f6948847b2 Add tests for UInt, ULong
Opt-in to use unsigned types in tests
2018-07-21 02:23:36 +03:00
Ilya Gorbunov
a145c26071 Switch bootstrap to 1.3 branch, build 1.3-M1-eap-77 2018-07-21 02:23:33 +03:00
Ilya Gorbunov
2f196a3a81 Unignore passing tests with unsigned literals in JS 2018-07-21 02:23:14 +03:00
Mikhail Zarechenskiy
6e64c5fca7 Support other kinds of translation for unsigned literals 2018-07-20 20:38:12 +03:00
Roman Artemev
b496bd3a3a Fix unsigned constants translation (Int to UInt) 2018-07-20 20:38:09 +03:00
Mikhail Zarechenskiy
1d18821aaf Initial support of unsigned literals translation in JS 2018-07-20 20:38:06 +03:00
Ilya Gorbunov
62ed64bc00 Generate hashCode and equals for unsigned types 2018-07-20 20:38:02 +03:00
Ilya Gorbunov
2f3b9ecc96 Opt-in to use unsigned types in various internal utils 2018-07-20 20:37:59 +03:00
Ilya Gorbunov
1bd54a9edf Deprecate js Math.random and provide replacement with Random.nextDouble
#KT-23564 Fixed
2018-07-20 20:37:56 +03:00
Dmitry Savvinov
216fd04b29 Disable contracts in 1.3-M1
^KT-25538 Fixed
2018-07-20 20:37:53 +03:00
Ilya Gorbunov
f7c9438fa8 Allow to skip JS IR tests with gradle property kotlin.compiler.js.ir.tests.skip 2018-07-20 20:37:49 +03:00
Ilya Gorbunov
835971a619 Update expected reachable node count in JS tests
Caused by new coroutine API an its js support
2018-07-20 20:37:46 +03:00
Ilya Gorbunov
69d0c08b26 Update expected reachable node count in JS tests
Caused by introduction of new random API
2018-07-20 20:37:43 +03:00
Alexander Udalov
c189721d69 Revert "Ignore tests on big function types until master is 1.3"
This reverts commit f03dc62173.
2018-07-20 20:37:39 +03:00
Alexander Udalov
7581e0f8b8 Introduce kotlin.jvm.functions.FunctionN
#KT-13764
2018-07-20 20:37:32 +03:00
Alexander Udalov
9bc4c1320a Convert FunctionBase to Kotlin, add type parameter to Lambda
This will make it possible to avoid raw types when inheriting from both
FunctionBase and Function<R>. This change adds a generic type parameter
to FunctionBase and Lambda which is not source-breaking under our policy
because both FunctionBase and Lambda are internal classes (located in
package kotlin.jvm.internal)
2018-07-20 20:37:29 +03:00
Alexander Udalov
f0724f4a3b Move superinterface to the only subclass of FunctionBase 2018-07-20 20:37:26 +03:00
Ilya Gorbunov
93b8d464ca Introduce Char.MIN_VALUE and MAX_VALUE constants (KT-21763)
Add Char.MIN_VALUE and Char.MAX_VALUE implementations in primitive companion objects.
Update builtins test data and public API.

Co-authored-by: Oskar Drozda <themppsplx@gmail.com>
2018-07-20 20:37:23 +03:00
Ilya Gorbunov
afd95d7942 Split summary from description in Char docs 2018-07-20 20:37:20 +03:00
Ilya Gorbunov
f9a3c058c7 Introduce SIZE_BYTES and SIZE_BITS constants for all integral types
#KT-8247 Fixed
2018-07-20 20:37:16 +03:00
Ilya Gorbunov
19705c7ad6 Annotate companion object declaration with SinceKotlin
Move it to the end of the class declaration.
Update builtins testdata
2018-07-20 20:37:13 +03:00
Kerooker
3d9c10b6ee Removed Boolean from ClassMapperLite to avoid compiler confusion 2018-07-20 20:37:09 +03:00
Kerooker
f45f172d4d KT-7922 Added Boolean Companion Object 2018-07-20 20:37:06 +03:00
Ilya Gorbunov
5264ea9fd3 Improve isNullOrEmpty() extensions
- Annotate with SinceKotlin("1.3") and InlineOnly
- Add contract linking the receiver and the returned value
- Unify wording in docs
- Add sample for Map.isNullOrEmpty

#KT-23279
2018-07-20 20:37:03 +03:00
Mon_chi
6b98569bd0 Add isNullOrEmpty() to Array, Collection, and Map. Fixes KT-23279 2018-07-20 20:37:00 +03:00
Jeff Wright
54212c7023 Add Collections.isNullOrEmpty #KT-23279 2018-07-20 20:36:57 +03:00
Toshiaki Kameyama
63d5186a66 "Useless call on collection type" inspection: Apply to 'kotlin.sequences.orEmpty' 2018-07-20 20:36:53 +03:00
Toshiaki Kameyama
31c2dfee3c Add Sequence.orEmpty #KT-16552 Fixed 2018-07-20 20:36:50 +03:00
Ilya Gorbunov
f7337cc9fc Make bound check helpers top-level so they are compiled as static on JVM
Improve empty range exception text in nextInt/nextLong(range)
2018-07-20 20:36:47 +03:00
Ilya Gorbunov
22402b70f8 More efficient double generation in JS 2018-07-20 20:36:44 +03:00
Ilya Gorbunov
d50c4ad862 Write random contract tests and fix implementations to pass them 2018-07-20 20:36:41 +03:00
Ilya Gorbunov
96762a1854 Add xorwow random implementation test and fix implementation 2018-07-20 20:36:37 +03:00
Ilya Gorbunov
fd05ef21fd Provide ThreadLocalRandom wrapper only on JDK8 as it is buggy in JDK7 2018-07-20 20:36:34 +03:00
Ilya Gorbunov
5d09fe5ae5 Remove lazy initialization of default platform random 2018-07-20 20:36:31 +03:00
Ilya Gorbunov
1c22f25342 Random docs and API refinement
KT-17261
2018-07-20 20:36:28 +03:00
Ilya Gorbunov
2d516446cd Common shuffle/shuffled with the specified random source
KT-17261, KT-9010
2018-07-20 20:36:25 +03:00
Ilya Gorbunov
4d51d1343d Provide common Random API
#KT-17261
2018-07-20 20:36:22 +03:00
Ilmir Usmanov
5f886fa5d4 Do not coerce function literals to suspend.
The design is to use `suspend fun` instead of coercion, just as suspend
lambdas.
However, this syntax is not supported in the parser. But this is not a
problem, since the coercion lead to internal compiler error.
As a workaround everybody uses suspend lambdas.
 #KT-24860: Fixed
2018-07-20 20:36:19 +03:00
Ilya Gorbunov
e07c8d142a Migrate stepping and evaluation tests to the new coroutine API 2018-07-20 20:36:16 +03:00
Ilya Gorbunov
c013aa8211 Introduce StringBuilder.clear() extension
#KT-18910 Fixed
2018-07-20 20:22:10 +03:00
Ilya Gorbunov
755ea9aae4 Allow pre-release compiler reading pre-release binaries in tests
Pre-release compiler should be able to read pre-release binaries in tests
even if a stable language version is used, otherwise no stdlib API can be read.
2018-07-20 20:22:06 +03:00
Alexander Udalov
4e4cd252b8 Make kotlin.Metadata public
Prohibit explicit usage of `@Metadata` to prevent possible
AnnotationFormatError at runtime

 #KT-23602 Fixed
2018-07-20 20:22:03 +03:00
Ilya Gorbunov
8018be7cb4 For bootstrapping on 1.3-M1: compile parts that can be used in .gradle.kts scripts with 1.2 language version 2018-07-20 20:22:00 +03:00
Ilya Gorbunov
2de412fbb3 Include new coroutines and unsigned classes into stdlib
Fix clashing module name in common coroutines sourceset
2018-07-20 20:21:57 +03:00
Ilya Gorbunov
77c2e34201 Update public API test due to ProperVisibilityForCompanionObjectInstanceField 2018-07-20 19:29:57 +03:00
Ilya Gorbunov
d2fba5dfe5 Temporarily turn off ReleaseCoroutines feature 2018-07-20 19:29:55 +03:00
Ilya Gorbunov
27aceee4ea Advance maven project versions to 1.3-SNAPSHOT 2018-07-20 19:29:52 +03:00
Ilya Gorbunov
c033468783 Advance project version to 1.3-SNAPSHOT
Set LATEST_STABLE language version and current version of stdlib to 1.3, set IS_PRE_RELEASE
Remove "EXPERIMENTAL" from 1.3 version description in tests and gradle options
2018-07-20 19:29:50 +03:00
405 changed files with 10393 additions and 6407 deletions

1
.bunch
View File

@@ -5,3 +5,4 @@ as31_173
as32
182
as33_as32
as33c4_182

File diff suppressed because it is too large Load Diff

View File

@@ -35,9 +35,8 @@ class CacheVersion(
private val whenVersionChanged: CacheVersion.Action,
private val whenTurnedOn: CacheVersion.Action,
private val whenTurnedOff: CacheVersion.Action,
isEnabled: ()->Boolean
private val isEnabled: Boolean
) {
private val isEnabled by lazy(isEnabled)
private val actualVersion: Int?
get() = try {
@@ -95,18 +94,18 @@ class CacheVersion(
}
}
fun normalCacheVersion(dataRoot: File, enabled: Boolean? = null): CacheVersion =
fun normalCacheVersion(dataRoot: File, enabled: Boolean): CacheVersion =
CacheVersion(ownVersion = NORMAL_VERSION,
versionFile = File(dataRoot, NORMAL_VERSION_FILE_NAME),
whenVersionChanged = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOn = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOff = CacheVersion.Action.CLEAN_NORMAL_CACHES,
isEnabled = { enabled ?: IncrementalCompilation.isEnabled() })
isEnabled = enabled)
fun dataContainerCacheVersion(dataRoot: File, enabled: Boolean? = null): CacheVersion =
fun dataContainerCacheVersion(dataRoot: File, enabled: Boolean): CacheVersion =
CacheVersion(ownVersion = DATA_CONTAINER_VERSION,
versionFile = File(dataRoot, DATA_CONTAINER_VERSION_FILE_NAME),
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOff = CacheVersion.Action.CLEAN_DATA_CONTAINER,
isEnabled = { enabled ?: IncrementalCompilation.isEnabled() })
isEnabled = enabled)

View File

@@ -23,6 +23,7 @@ import com.intellij.util.io.EnumeratorStringDescriptor
import gnu.trove.THashSet
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
@@ -264,7 +265,7 @@ open class IncrementalJvmCache(
override fun clean() {
super.clean()
normalCacheVersion(targetDataRoot).clean()
normalCacheVersion(targetDataRoot, IncrementalCompilation.isEnabledForJvm()).clean()
}
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {

View File

@@ -78,7 +78,7 @@ class KotlinModuleXmlBuilder {
directoriesToFilterOut: Set<File>) {
p.println("<!-- Classpath -->")
for (file in files) {
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabled()
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabledForJvm()
if (isOutput) {
// For IDEA's make (incremental compilation) purposes, output directories of the current module and its dependencies
// appear on the class path, so we are at risk of seeing the results of the previous build, i.e. if some class was

View File

@@ -11,9 +11,9 @@ import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
import proguard.gradle.ProGuardTask
buildscript {
extra["defaultSnapshotVersion"] = "1.2-SNAPSHOT"
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.70-dev-491", onlySuccessBootstrap = false))
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3-M1-eap-77", projectExtId = "Kotlin_13M1_Compiler", onlySuccessBootstrap = false))
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
@@ -81,7 +81,7 @@ val defaultSnapshotVersion: String by extra
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
val kotlinVersion by extra(findProperty("deployVersion")?.toString() ?: buildNumber)
val kotlinLanguageVersion by extra("1.2")
val kotlinLanguageVersion by extra("1.3")
allprojects {
group = "org.jetbrains.kotlin"
@@ -307,7 +307,7 @@ allprojects {
configureJvmProject(javaHome!!, jvmTarget!!)
val commonCompilerArgs = listOfNotNull("-Xallow-kotlin-package", "-Xread-deserialized-contracts", "-Xprogressive".takeIf { hasProperty("test.progressive.mode") })
val commonCompilerArgs = listOfNotNull("-Xallow-kotlin-package", "-Xread-deserialized-contracts", "-Xprogressive".takeIf { hasProperty("test.progressive.mode") }, "-XXLanguage:-ReleaseCoroutines")
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {

View File

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

View File

@@ -0,0 +1,298 @@
@file:Suppress("PropertyName")
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
}
}
val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijRepo: String by rootProject.extra
val intellijReleaseType: String by rootProject.extra
val intellijVersion = rootProject.extra["versions.intellijSdk"] 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 by lazy {
when {
OperatingSystem.current().isWindows -> "windows"
OperatingSystem.current().isMacOsX -> "mac"
OperatingSystem.current().isLinux -> "linux"
else -> {
logger.error("Unknown operating system for android tools: ${OperatingSystem.current().name}")
""
}
}
}
repositories {
if (androidStudioRelease != null) {
ivy {
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()
}
}
}
maven { setUrl("$intellijRepo/$intellijReleaseType") }
maven { setUrl("https://plugins.jetbrains.com/maven") }
// github returns broken pipe =(
// ivy {
// artifactPattern("https://raw.github.com/JetBrains/intellij-community/[revision]/lib/src/[artifact].zip")
// metadataSources {
// artifact()
// }
// }
}
val intellij by configurations.creating
val intellijUltimate by configurations.creating
val sources by configurations.creating
val `asm-shaded-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")
}
}
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
// if (platformBaseVersion == "182") {
// // There is no asm sources for 182 yet
// `asm-shaded-sources`("asmsources:asm-src:181@zip")
// } else {
// `asm-shaded-sources`("asmsources:asm-src:$platformBaseVersion@zip")
// }
`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 = 2 // 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 copyAsmShadedSources by tasks.creating(Copy::class.java) {
// from(`asm-shaded-sources`)
// rename(".zip", ".jar")
// destinationDir = File(repoDir, `asm-shaded-sources`.name)
//}
val copyIntellijSdkSources by tasks.creating(ShadowJar::class.java) {
// from(copyAsmShadedSources)
from(sources)
baseName = "ideaIC"
version = intellijVersion
classifier = "sources"
destinationDir = File(repoDir, sources.name)
}
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, sourcesJar: File?) {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, moduleName, intellijVersion))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
jarFiles.asFileTree.files.forEach {
if (it.isFile && it.extension == "jar") {
val relativeName = it.toRelativeString(baseDir).removeSuffix(".jar")
addArtifact(DefaultIvyArtifact(it, relativeName, "jar", "jar", null).also { it.conf = "default" })
}
}
if (sourcesJar != null) {
val sourcesArtifactName = sourcesJar.name.removeSuffix(".jar").substringBefore("-")
addArtifact(DefaultIvyArtifact(sourcesJar, sourcesArtifactName, "jar", "sources", "sources").also { it.conf = "sources" })
}
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
}
}
val prepareIvyXmls by tasks.creating {
dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest/*, copyAsmShadedSources */)
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`, `asm-shaded-sources`)
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 sourcesFile = if (sources.isEmpty) null else File(repoDir, "${sources.name}/${sources.singleFile.name}")
if (installIntellijCommunity) {
val libDir = File(intellijSdkDir, "lib")
writeIvyXml(intellij.name,
intellij.name,
fileTree(libDir).filter {
it.parentFile == libDir && !it.name.startsWith("kotlin-")
},
libDir,
sourcesFile)
File(intellijSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
}
}
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,
sourcesFile)
File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
}
}
flatDeps.forEach {
writeIvyXml(it.name, it.name, files("$repoDir/${it.name}"), File(repoDir, it.name), sourcesFile)
}
if (intellijUltimateEnabled) {
val nodeJsBaseDir = "${`plugins-NodeJS`.name}/NodeJS/lib"
writeIvyXml("NodeJS", `plugins-NodeJS`.name, files("$repoDir/$nodeJsBaseDir"), File(repoDir, nodeJsBaseDir), sourcesFile)
}
}
}
val build by tasks.creating {
dependsOn(prepareIvyXmls)
}
val clean by tasks.creating(Delete::class) {
delete(customDepsRepoModulesDir)
delete(buildDir)
}

View File

@@ -383,7 +383,7 @@ class MultifileClassCodegenImpl(
private fun getCompiledPackageFragment(
facadeFqName: FqName, state: GenerationState
): IncrementalPackageFragmentProvider.IncrementalMultifileClassPackageFragment? {
if (!IncrementalCompilation.isEnabled()) return null
if (!IncrementalCompilation.isEnabledForJvm()) return null
val packageFqName = facadeFqName.parent()

View File

@@ -646,17 +646,21 @@ public class KotlinTypeMapper {
List<TypeParameterDescriptor> parameters = classDescriptor.getDeclaredTypeParameters();
List<TypeProjection> arguments = type.getArguments();
if (classDescriptor instanceof FunctionClassDescriptor &&
((FunctionClassDescriptor) classDescriptor).getFunctionKind() == FunctionClassDescriptor.Kind.KFunction) {
// kotlin.reflect.KFunction{n}<P1, ... Pn, R> is mapped to kotlin.reflect.KFunction<R> on JVM (see JavaToKotlinClassMap).
// So for these classes, we need to skip all type arguments except the very last one
writeGenericArguments(
signatureVisitor,
Collections.singletonList(CollectionsKt.last(arguments)),
Collections.singletonList(CollectionsKt.last(parameters)),
mode
);
return;
if (classDescriptor instanceof FunctionClassDescriptor) {
FunctionClassDescriptor functionClass = (FunctionClassDescriptor) classDescriptor;
if (functionClass.hasBigArity() ||
functionClass.getFunctionKind() == FunctionClassDescriptor.Kind.KFunction) {
// kotlin.reflect.KFunction{n}<P1, ..., Pn, R> is mapped to kotlin.reflect.KFunction<R> (for all n), and
// kotlin.Function{n}<P1, ..., Pn, R> is mapped to kotlin.jvm.functions.FunctionN<R> (for n > 22).
// So for these classes, we need to skip all type arguments except the very last one
writeGenericArguments(
signatureVisitor,
Collections.singletonList(CollectionsKt.last(arguments)),
Collections.singletonList(CollectionsKt.last(parameters)),
mode
);
return;
}
}
writeGenericArguments(signatureVisitor, arguments, parameters, mode);

View File

@@ -42,6 +42,14 @@ sourceSets {
"test" { }
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
freeCompilerArgs += "-Xskip-metadata-version-check"
}
}
testsJar {}
projectTest {

View File

@@ -33,6 +33,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
const val WARN = "warn"
const val ERROR = "error"
const val ENABLE = "enable"
const val DEFAULT = "default"
}
@get:Transient
@@ -108,7 +109,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
valueDescription = "{enable|warn|error}",
description = "Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier"
)
var coroutinesState: String? by FreezableVar(WARN)
var coroutinesState: String? by FreezableVar(DEFAULT)
@Argument(
value = "-Xnew-inference",
@@ -200,7 +201,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
when (coroutinesState) {
CommonCompilerArguments.ERROR -> put(LanguageFeature.Coroutines, LanguageFeature.State.ENABLED_WITH_ERROR)
CommonCompilerArguments.ENABLE -> put(LanguageFeature.Coroutines, LanguageFeature.State.ENABLED)
CommonCompilerArguments.WARN -> {
CommonCompilerArguments.WARN, CommonCompilerArguments.DEFAULT -> {
}
else -> {
val message = "Invalid value of -Xcoroutines (should be: enable, warn or error): " + coroutinesState
@@ -293,12 +294,23 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
}
return LanguageVersionSettingsImpl(
val languageVersionSettings = LanguageVersionSettingsImpl(
languageVersion,
ApiVersion.createByLanguageVersion(apiVersion),
configureAnalysisFlags(collector),
configureLanguageFeatures(collector)
)
if (languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines)) {
if (coroutinesState != DEFAULT) {
collector.report(
CompilerMessageSeverity.STRONG_WARNING,
"-Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond"
)
}
}
return languageVersionSettings
}
private fun parseVersion(collector: MessageCollector, value: String?, versionOf: String): LanguageVersion? =

View File

@@ -307,7 +307,7 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
override fun setupPlatformSpecificArgumentsAndServices(
configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments, services: Services
) {
if (IncrementalCompilation.isEnabled()) {
if (IncrementalCompilation.isEnabledForJvm()) {
services.get(LookupTracker::class.java)?.let {
configuration.put(CommonConfigurationKeys.LOOKUP_TRACKER, it)
}

View File

@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.cli.js.K2JSCompiler
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.daemon.report.CompileServicesFacadeMessageCollector
@@ -469,7 +470,7 @@ class CompileServiceImpl(
}
val workingDir = incrementalCompilationOptions.workingDir
val versions = commonCacheVersions(workingDir) +
val versions = commonCacheVersions(workingDir, enabled = true) +
customCacheVersion(incrementalCompilationOptions.customCacheVersion,
incrementalCompilationOptions.customCacheVersionFileName,
workingDir,
@@ -519,7 +520,7 @@ class CompileServiceImpl(
}
val workingDir = incrementalCompilationOptions.workingDir
val versions = commonCacheVersions(workingDir) +
val versions = commonCacheVersions(workingDir, enabled = true) +
customCacheVersion(incrementalCompilationOptions.customCacheVersion,
incrementalCompilationOptions.customCacheVersionFileName,
workingDir,

View File

@@ -417,6 +417,12 @@ interface LanguageSettingsProvider {
isReleaseCoroutines: Boolean? = null
): LanguageVersionSettings
@Deprecated("Use `getLanguageVersionSettings` method with default parameter instead")
fun getLanguageVersionSettings(
moduleInfo: ModuleInfo,
project: Project
) = getLanguageVersionSettings(moduleInfo, project, null)
fun getTargetPlatform(moduleInfo: ModuleInfo): TargetPlatformVersion
object Default : LanguageSettingsProvider {

View File

@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2018 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.resolve.calls;
@@ -197,7 +186,8 @@ public class ArgumentTypeResolver {
public KotlinTypeInfo getArgumentTypeInfo(
@Nullable KtExpression expression,
@NotNull CallResolutionContext<?> context,
@NotNull ResolveArgumentsMode resolveArgumentsMode
@NotNull ResolveArgumentsMode resolveArgumentsMode,
boolean suspendFunctionTypeExpected
) {
if (expression == null) {
return TypeInfoFactoryKt.noTypeInfo(context);
@@ -205,7 +195,7 @@ public class ArgumentTypeResolver {
KtFunction functionLiteralArgument = getFunctionLiteralArgumentIfAny(expression, context);
if (functionLiteralArgument != null) {
return getFunctionLiteralTypeInfo(expression, functionLiteralArgument, context, resolveArgumentsMode);
return getFunctionLiteralTypeInfo(expression, functionLiteralArgument, context, resolveArgumentsMode, suspendFunctionTypeExpected);
}
KtCallableReferenceExpression callableReferenceExpression = getCallableReferenceExpressionIfAny(expression, context);
@@ -291,10 +281,11 @@ public class ArgumentTypeResolver {
@NotNull KtExpression expression,
@NotNull KtFunction functionLiteral,
@NotNull CallResolutionContext<?> context,
@NotNull ResolveArgumentsMode resolveArgumentsMode
@NotNull ResolveArgumentsMode resolveArgumentsMode,
boolean suspendFunctionTypeExpected
) {
if (resolveArgumentsMode == SHAPE_FUNCTION_ARGUMENTS) {
KotlinType type = getShapeTypeOfFunctionLiteral(functionLiteral, context.scope, context.trace, true);
KotlinType type = getShapeTypeOfFunctionLiteral(functionLiteral, context.scope, context.trace, true, suspendFunctionTypeExpected);
return TypeInfoFactoryKt.createTypeInfo(type, context);
}
return expressionTypingServices.getTypeInfo(expression, context.replaceContextDependency(INDEPENDENT));
@@ -305,7 +296,8 @@ public class ArgumentTypeResolver {
@NotNull KtFunction function,
@NotNull LexicalScope scope,
@NotNull BindingTrace trace,
boolean expectedTypeIsUnknown
boolean expectedTypeIsUnknown,
boolean suspendFunctionTypeExpected
) {
boolean isFunctionLiteral = function instanceof KtFunctionLiteral;
if (function.getValueParameterList() == null && isFunctionLiteral) {
@@ -335,7 +327,7 @@ public class ArgumentTypeResolver {
return expectedTypeIsUnknown && isFunctionLiteral
? functionPlaceholders.createFunctionPlaceholderType(parameterTypes, /* hasDeclaredArguments = */ true)
: FunctionTypesKt.createFunctionType(
builtIns, Annotations.Companion.getEMPTY(), receiverType, parameterTypes, parameterNames, returnType
builtIns, Annotations.Companion.getEMPTY(), receiverType, parameterTypes, parameterNames, returnType, suspendFunctionTypeExpected
);
}
@@ -371,7 +363,7 @@ public class ArgumentTypeResolver {
CallResolutionContext<?> newContext = context.replaceDataFlowInfo(infoForArguments.getInfo(argument));
// Here we go inside arguments and determine additional data flow information for them
KotlinTypeInfo typeInfoForCall = getArgumentTypeInfo(expression, newContext, resolveArgumentsMode);
KotlinTypeInfo typeInfoForCall = getArgumentTypeInfo(expression, newContext, resolveArgumentsMode, false);
infoForArguments.updateInfo(argument, typeInfoForCall.getDataFlowInfo());
}
}

View File

@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2018 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.resolve.calls
@@ -325,7 +314,7 @@ class CallCompleter(
// While the expected type is not known, the function literal arguments are not analyzed (to analyze function literal bodies once),
// but they should be analyzed when the expected type is known (during the call completion).
ArgumentTypeResolver.getFunctionLiteralArgumentIfAny(expression, context)?.let { functionLiteralArgument ->
argumentTypeResolver.getFunctionLiteralTypeInfo(expression, functionLiteralArgument, context, RESOLVE_FUNCTION_ARGUMENTS)
argumentTypeResolver.getFunctionLiteralTypeInfo(expression, functionLiteralArgument, context, RESOLVE_FUNCTION_ARGUMENTS, false)
}
// While the expected type is not known, (possibly overloaded) callable references can have placeholder types

View File

@@ -1,23 +1,13 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2018 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.resolve.calls
import com.google.common.collect.Lists
import org.jetbrains.kotlin.builtins.ReflectionTypes
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
@@ -362,7 +352,7 @@ class CandidateResolver(
val expectedType = getEffectiveExpectedType(parameterDescriptor, argument, context)
val newContext = context.replaceDataFlowInfo(infoForArguments.getInfo(argument)).replaceExpectedType(expectedType)
val typeInfoForCall = argumentTypeResolver.getArgumentTypeInfo(expression, newContext, resolveFunctionArgumentBodies)
val typeInfoForCall = argumentTypeResolver.getArgumentTypeInfo(expression, newContext, resolveFunctionArgumentBodies, expectedType.isSuspendFunctionType)
val type = typeInfoForCall.type
infoForArguments.updateInfo(argument, typeInfoForCall.dataFlowInfo)

View File

@@ -1,25 +1,11 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2018 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.resolve.calls
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.ReflectionTypes
import org.jetbrains.kotlin.builtins.isBuiltinFunctionalTypeOrSubtype
import org.jetbrains.kotlin.builtins.isFunctionTypeOrSubtype
import org.jetbrains.kotlin.builtins.*
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.CallableDescriptor
@@ -261,7 +247,12 @@ class GenericCandidateResolver(
val dataFlowInfoForArgument = context.candidateCall.dataFlowInfoForArguments.getInfo(valueArgument)
val newContext = context.replaceExpectedType(expectedType).replaceDataFlowInfo(dataFlowInfoForArgument)
val typeInfoForCall = argumentTypeResolver.getArgumentTypeInfo(argumentExpression, newContext, resolveFunctionArgumentBodies)
val typeInfoForCall = argumentTypeResolver.getArgumentTypeInfo(
argumentExpression,
newContext,
resolveFunctionArgumentBodies,
expectedType?.isSuspendFunctionType == true
)
context.candidateCall.dataFlowInfoForArguments.updateInfo(valueArgument, typeInfoForCall.dataFlowInfo)
val constraintPosition = VALUE_PARAMETER_POSITION.position(valueParameterDescriptor.index)
@@ -435,7 +426,13 @@ class GenericCandidateResolver(
var expectedType = newSubstitution.buildSubstitutor().substitute(effectiveExpectedType, Variance.IN_VARIANCE)
if (expectedType == null || TypeUtils.isDontCarePlaceholder(expectedType)) {
expectedType = argumentTypeResolver.getShapeTypeOfFunctionLiteral(functionLiteral, context.scope, context.trace, false)
expectedType = argumentTypeResolver.getShapeTypeOfFunctionLiteral(
functionLiteral,
context.scope,
context.trace,
false,
expectedType?.isSuspendFunctionType == true
)
}
if (expectedType == null || !expectedType.isBuiltinFunctionalTypeOrSubtype || hasUnknownFunctionParameter(expectedType)) {
return
@@ -463,7 +460,8 @@ class GenericCandidateResolver(
.replaceDataFlowInfo(dataFlowInfoForArgument).replaceResolutionResultsCache(temporaryToResolveFunctionLiteral.cache)
.replaceContextDependency(INDEPENDENT)
val type = argumentTypeResolver.getFunctionLiteralTypeInfo(
argumentExpression, functionLiteral, newContext, RESOLVE_FUNCTION_ARGUMENTS
argumentExpression, functionLiteral, newContext, RESOLVE_FUNCTION_ARGUMENTS,
expectedType.isSuspendFunctionType
).type
if (!mismatch[0]) {
constraintSystem.addSubtypeConstraint(type, effectiveExpectedTypeInSystem, position)
@@ -476,8 +474,10 @@ class GenericCandidateResolver(
val newContext = context.replaceExpectedType(expectedTypeWithEstimatedReturnType).replaceDataFlowInfo(dataFlowInfoForArgument)
.replaceContextDependency(INDEPENDENT)
val type =
argumentTypeResolver.getFunctionLiteralTypeInfo(argumentExpression, functionLiteral, newContext, RESOLVE_FUNCTION_ARGUMENTS)
.type
argumentTypeResolver.getFunctionLiteralTypeInfo(
argumentExpression, functionLiteral, newContext, RESOLVE_FUNCTION_ARGUMENTS,
expectedType.isSuspendFunctionType
).type
constraintSystem.addSubtypeConstraint(type, effectiveExpectedTypeInSystem, position)
}

View File

@@ -1,17 +1,6 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2018 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.resolve.calls.inference
@@ -178,7 +167,7 @@ class CoroutineInferenceSupport(
val newContext = context.replaceExpectedType(newExpectedType)
.replaceDataFlowInfo(context.candidateCall.dataFlowInfoForArguments.getInfo(valueArgument))
.replaceContextDependency(ContextDependency.INDEPENDENT).replaceTraceAndCache(temporaryForCoroutine)
argumentTypeResolver.getFunctionLiteralTypeInfo(argumentExpression, functionLiteral, newContext, RESOLVE_FUNCTION_ARGUMENTS)
argumentTypeResolver.getFunctionLiteralTypeInfo(argumentExpression, functionLiteral, newContext, RESOLVE_FUNCTION_ARGUMENTS, true)
inferenceData.reportInferenceResult(csBuilder)
}
@@ -260,7 +249,7 @@ class CoroutineInferenceSupport(
context: CallResolutionContext<*>
): KotlinTypeInfo {
getFunctionLiteralArgumentIfAny(expression, context)?.let {
return argumentTypeResolver.getFunctionLiteralTypeInfo(expression, it, context, RESOLVE_FUNCTION_ARGUMENTS)
return argumentTypeResolver.getFunctionLiteralTypeInfo(expression, it, context, RESOLVE_FUNCTION_ARGUMENTS, false)
}
getCallableReferenceExpressionIfAny(expression, context)?.let {

View File

@@ -103,6 +103,13 @@ private data class DeprecatedByOverridden(private val deprecations: Collection<D
"Overrides deprecated member in '${DescriptorUtils.getContainingClass(target)!!.fqNameSafe.asString()}'"
}
private data class DeprecatedExperimentalCoroutine(
override val target: DeclarationDescriptor
) : Deprecation {
override val deprecationLevel: DeprecationLevelValue = DeprecationLevelValue.ERROR
override val message: String? = "Experimental coroutine cannot be used with API version 1.3"
}
private data class DeprecatedByVersionRequirement(
val versionRequirement: VersionRequirement,
override val target: DeclarationDescriptor
@@ -304,6 +311,7 @@ class DeprecationResolver(
}
getDeprecationByVersionRequirement(target)?.let(result::add)
getDeprecationByCoroutinesVersion(target)?.let(result::add)
}
fun addUseSiteTargetedDeprecationIfPresent(annotatedDescriptor: DeclarationDescriptor, useSiteTarget: AnnotationUseSiteTarget?) {
@@ -343,6 +351,11 @@ class DeprecationResolver(
return result.distinct()
}
private fun getDeprecationByCoroutinesVersion(target: DeclarationDescriptor): DeprecatedExperimentalCoroutine? =
if (target is DeserializedMemberDescriptor && target.isExperimentalCoroutineInReleaseEnvironment)
DeprecatedExperimentalCoroutine(target)
else null
private fun getDeprecationByVersionRequirement(target: DeclarationDescriptor): DeprecatedByVersionRequirement? {
fun createVersion(version: String): MavenComparableVersion? = try {
MavenComparableVersion(version)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* Copyright 2010-2018 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.
*/
@@ -118,11 +118,11 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
val expectedType = context.expectedType
val functionalTypeExpected = expectedType.isBuiltinFunctionalType()
val suspendFunctionTypeExpected = expectedType.isSuspendFunctionType()
val resultType = functionDescriptor.createFunctionType(suspendFunctionTypeExpected)
// We forbid anonymous function expressions to suspend type coercion for now, until `suspend fun` syntax is supported
val resultType = functionDescriptor.createFunctionType(suspendFunction = false)
if (components.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) && functionalTypeExpected)
if (components.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) && functionalTypeExpected && !expectedType.isSuspendFunctionType)
createTypeInfo(resultType, context)
else
components.dataFlowAnalyzer.createCheckedTypeInfo(resultType, context, function)

View File

@@ -154,7 +154,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
}
object None : Subject(null, null, null) {
class None : Subject(null, null, null) {
override fun createDataFlowValue(contextAfterSubject: ExpressionTypingContext, builtIns: KotlinBuiltIns) =
DataFlowValue.nullValue(builtIns)
@@ -195,7 +195,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
)
else ->
Subject.None
Subject.None()
}
val contextAfterSubject = run {

View File

@@ -37,7 +37,8 @@ fun makeJsIncrementally(
messageCollector: MessageCollector = MessageCollector.NONE,
reporter: ICReporter = EmptyICReporter
) {
val versions = commonCacheVersions(cachesDir) + standaloneCacheVersion(cachesDir)
val isIncremental = IncrementalCompilation.isEnabledForJs()
val versions = commonCacheVersions(cachesDir, isIncremental) + standaloneCacheVersion(cachesDir, isIncremental)
val allKotlinFiles = sourceRoots.asSequence().flatMap { it.walk() }
.filter { it.isFile && it.extension.equals("kt", ignoreCase = true) }.toList()
@@ -47,14 +48,13 @@ fun makeJsIncrementally(
}
}
inline fun <R> withJsIC(fn: ()->R): R {
inline fun <R> withJsIC(fn: () -> R): R {
val isJsEnabledBackup = IncrementalCompilation.isEnabledForJs()
IncrementalCompilation.setIsEnabledForJs(true)
try {
return withIC { fn() }
}
finally {
return fn()
} finally {
IncrementalCompilation.setIsEnabledForJs(isJsEnabledBackup)
}
}
@@ -70,7 +70,7 @@ class IncrementalJsCompilerRunner(
reporter
) {
override fun isICEnabled(): Boolean =
IncrementalCompilation.isEnabled() && IncrementalCompilation.isEnabledForJs()
IncrementalCompilation.isEnabledForJs()
override fun createCacheManager(args: K2JSCompilerArguments): IncrementalJsCachesManager =
IncrementalJsCachesManager(cacheDirectory, reporter)

View File

@@ -56,7 +56,8 @@ fun makeIncrementally(
messageCollector: MessageCollector = MessageCollector.NONE,
reporter: ICReporter = EmptyICReporter
) {
val versions = commonCacheVersions(cachesDir) + standaloneCacheVersion(cachesDir)
val isIncremental = IncrementalCompilation.isEnabledForJvm()
val versions = commonCacheVersions(cachesDir, isIncremental) + standaloneCacheVersion(cachesDir, isIncremental)
val kotlinExtensions = listOf("kt", "kts")
val allExtensions = kotlinExtensions + listOf("java")
@@ -86,7 +87,7 @@ object EmptyICReporter : ICReporter {
}
inline fun <R> withIC(enabled: Boolean = true, fn: ()->R): R {
val isEnabledBackup = IncrementalCompilation.isEnabled()
val isEnabledBackup = IncrementalCompilation.isEnabledForJvm()
IncrementalCompilation.setIsEnabled(enabled)
try {
@@ -114,7 +115,7 @@ class IncrementalJvmCompilerRunner(
localStateDirs = localStateDirs
) {
override fun isICEnabled(): Boolean =
IncrementalCompilation.isEnabled()
IncrementalCompilation.isEnabledForJvm()
override fun createCacheManager(args: K2JVMCompilerArguments): IncrementalJvmCachesManager =
IncrementalJvmCachesManager(cacheDirectory, File(args.destination), reporter)

View File

@@ -21,8 +21,8 @@ import java.io.File
internal const val STANDALONE_CACHE_VERSION = 2
internal const val STANDALONE_VERSION_FILE_NAME = "standalone-ic-format-version.txt"
fun standaloneCacheVersion(dataRoot: File): CacheVersion =
customCacheVersion(STANDALONE_CACHE_VERSION, STANDALONE_VERSION_FILE_NAME, dataRoot, enabled = true)
fun standaloneCacheVersion(dataRoot: File, enabled: Boolean): CacheVersion =
customCacheVersion(STANDALONE_CACHE_VERSION, STANDALONE_VERSION_FILE_NAME, dataRoot, enabled)
fun customCacheVersion(version: Int, fileName: String, dataRoot: File, enabled: Boolean): CacheVersion =
CacheVersion(ownVersion = version,
@@ -30,8 +30,7 @@ fun customCacheVersion(version: Int, fileName: String, dataRoot: File, enabled:
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOff = CacheVersion.Action.REBUILD_ALL_KOTLIN,
isEnabled = { enabled })
isEnabled = enabled)
fun commonCacheVersions(cachesDir: File): List<CacheVersion> =
listOf(normalCacheVersion(cachesDir),
dataContainerCacheVersion(cachesDir))
fun commonCacheVersions(cachesDir: File, enabled: Boolean): List<CacheVersion> =
listOf(normalCacheVersion(cachesDir, enabled), dataContainerCacheVersion(cachesDir, enabled))

View File

@@ -0,0 +1,63 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.psi;
import com.intellij.openapi.project.Project;
import kotlin.collections.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.resolve.ImportPath;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* @deprecated This class is not used in the kotlin plugin/compiler and will be removed soon
*/
@Deprecated
public class KtImportsFactory {
@NotNull private final Project project;
private final Map<ImportPath, KtImportDirective> importsCache = new HashMap<>();
public KtImportsFactory(@NotNull Project project) {
this.project = project;
}
@NotNull
private KtImportDirective createImportDirective(@NotNull ImportPath importPath) {
KtImportDirective directive = importsCache.get(importPath);
if (directive != null) {
return directive;
}
KtImportDirective createdDirective = KtPsiFactoryKt.KtPsiFactory(project, false).createImportDirective(importPath);
importsCache.put(importPath, createdDirective);
return createdDirective;
}
@NotNull
public Collection<KtImportDirective> createImportDirectives(@NotNull Collection<ImportPath> importPaths) {
return CollectionsKt.map(importPaths, this::createImportDirective);
}
@NotNull
public Collection<KtImportDirective> createImportDirectivesNotCached(@NotNull Collection<ImportPath> importPaths) {
return KtPsiFactoryKt.KtPsiFactory(project, false).createImportDirectives(importPaths);
}
}

View File

@@ -437,6 +437,19 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
}
}
@Deprecated("function is not used in the kotlin plugin/compiler and will be removed soon")
fun createImportDirectives(paths: Collection<ImportPath>): List<KtImportDirective> {
val fileContent = buildString {
for (path in paths) {
appendImport(path)
append('\n')
}
}
val file = createFile(fileContent)
return file.importDirectives
}
fun createPrimaryConstructor(text: String = ""): KtPrimaryConstructor {
return createClass(if (text.isNotEmpty()) "class A $text" else "class A()").primaryConstructor!!
}

View File

@@ -28,7 +28,7 @@ object KotlinStubVersions {
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
// Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files).
private const val BINARY_STUB_VERSION = 66
private const val BINARY_STUB_VERSION = 67
// Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile)
// Increasing this version will lead to reindexing of all classfiles.

View File

@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.serialization
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
import org.jetbrains.kotlin.builtins.transformSuspendFunctionToRuntimeFunctionType
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
@@ -355,8 +356,9 @@ class DescriptorSerializer private constructor(
return listOfNotNull(
extensionReceiverParameter?.type,
returnType,
*typeParameters.flatMap { it.upperBounds }.toTypedArray(),
*valueParameters.map(ValueParameterDescriptor::getType).toTypedArray()
).any { type -> type.contains(UnwrappedType::isSuspendFunctionType) }
).any { type -> type.contains(UnwrappedType::isSuspendFunctionTypeOrSubtype) }
}
fun typeAliasProto(descriptor: TypeAliasDescriptor): ProtoBuf.TypeAlias.Builder {

View File

@@ -1,8 +1,8 @@
public final class A {
private final int i = 0;
private final java.lang.String i$1 = "";
private final java.lang.String j = "a";
private final java.lang.String j$1 = "b";
private final int i;
private final java.lang.String i$1;
private final java.lang.String j;
private final java.lang.String j$1;
public final void f(int i, double s) { /* compiled code */ }

View File

@@ -7,9 +7,9 @@ class A {
fun g(i: Int, s: Double): Int {}
fun g(s: Int, i: Double): String {}
private val i: Int = 0
private val i: String = ""
private val i: Int = { 0 }()
private val i: String = { "" }()
private val j: String = "a"
private val j: String = "b"
private val j: String = { "a" }()
private val j: String = { "b" }()
}

View File

@@ -1,5 +1,5 @@
public final class TopLevelDestructuringKt {
private static final int z = 3;
private static final int z;
public static final int getZ() { /* compiled code */ }
}

View File

@@ -4,4 +4,4 @@ data class Pair(val x: Int, val y: Int)
val (x, y) = Pair(1, 2)
val z = 3
val z = { 3 }()

View File

@@ -6,7 +6,7 @@ public interface TraitClassObjectField {
static final class Companion {
@org.jetbrains.annotations.Nullable
public static final java.lang.String x = "";
private static final java.lang.String y = "";
private static final java.lang.String y;
private Companion() { /* compiled code */ }
}

View File

@@ -3,6 +3,6 @@
interface TraitClassObjectField {
companion object {
const val x: String? = ""
private val y: String? = ""
private val y: String? = { "" }()
}
}

View File

@@ -1,14 +1,14 @@
public final class Class {
@org.jetbrains.annotations.Nullable
private final java.lang.String nullableVal = "";
private final java.lang.String nullableVal;
@org.jetbrains.annotations.Nullable
private java.lang.String nullableVar;
@org.jetbrains.annotations.NotNull
private final java.lang.String notNullVal = "";
private final java.lang.String notNullVal;
@org.jetbrains.annotations.NotNull
private java.lang.String notNullVar;
private final java.lang.String privateNN = "";
private final java.lang.String privateN = "";
private final java.lang.String privateNN;
private final java.lang.String privateN;
@org.jetbrains.annotations.NotNull
public final java.lang.String notNull(@org.jetbrains.annotations.NotNull java.lang.String a) { /* compiled code */ }

View File

@@ -13,10 +13,10 @@ class Class {
@Nullable fun nullableWithN(): String? = ""
@NotNull fun nullableWithNN(): String? = ""
val nullableVal: String? = ""
var nullableVar: String? = ""
val notNullVal: String = ""
var notNullVar: String = ""
val nullableVal: String? = { "" }()
var nullableVar: String? = { "" }()
val notNullVal: String = { "" }()
var notNullVar: String = { "" }()
val notNullValWithGet: String
@[Nullable] get() = ""
@@ -32,6 +32,6 @@ class Class {
@[NotNull] get() = ""
@[NotNull] set(v) {}
private val privateNN: String = ""
private val privateN: String? = ""
private val privateNN: String = { "" }()
private val privateN: String? = { "" }()
}

View File

@@ -1,7 +1,7 @@
public final class ClassObjectField {
@org.jetbrains.annotations.Nullable
private static final java.lang.String x = "";
private static final java.lang.String y = "";
private static final java.lang.String x;
private static final java.lang.String y;
public static final ClassObjectField.Companion Companion;
public ClassObjectField() { /* compiled code */ }

View File

@@ -2,7 +2,7 @@
class ClassObjectField {
companion object {
val x: String? = ""
private val y: String? = ""
val x: String? = { "" }()
private val y: String? = { "" }()
}
}

View File

@@ -1,14 +1,14 @@
public final class FileFacadeKt {
@org.jetbrains.annotations.Nullable
private static final java.lang.String nullableVal = "";
private static final java.lang.String nullableVal;
@org.jetbrains.annotations.Nullable
private static java.lang.String nullableVar;
@org.jetbrains.annotations.NotNull
private static final java.lang.String notNullVal = "";
private static final java.lang.String notNullVal;
@org.jetbrains.annotations.NotNull
private static java.lang.String notNullVar;
private static final java.lang.String privateNn = "";
private static final java.lang.String privateN = "";
private static final java.lang.String privateNn;
private static final java.lang.String privateN;
@org.jetbrains.annotations.NotNull
public static final java.lang.String notNull(@org.jetbrains.annotations.NotNull java.lang.String a) { /* compiled code */ }

View File

@@ -12,10 +12,10 @@ fun nullable(a: String?): String? = ""
@Nullable fun nullableWithN(): String? = ""
@NotNull fun nullableWithNN(): String? = ""
val nullableVal: String? = ""
var nullableVar: String? = ""
val notNullVal: String = ""
var notNullVar: String = ""
val nullableVal: String? = { "" }()
var nullableVar: String? = { "" }()
val notNullVal: String = { "" }()
var notNullVar: String = { "" }()
val notNullValWithGet: String
@[Nullable] get() = ""
@@ -31,6 +31,6 @@ var nullableVarWithGetSet: String?
@NotNull get() = ""
@NotNull set(v) {}
private val privateNn: String = ""
private val privateN: String? = ""
private val privateNn: String = { "" }()
private val privateN: String? = { "" }()
private fun privateFun(a: String, b: String?): String? = null

View File

@@ -1,5 +1,5 @@
public final class C implements Tr {
private final int v = 1;
private final int v;
@org.jetbrains.annotations.NotNull
public java.lang.Integer foo() { /* compiled code */ }

View File

@@ -7,5 +7,5 @@ interface Tr {
class C: Tr {
override fun foo() = 1
override val v = 1
override val v = { 1 }()
}

View File

@@ -1,7 +1,10 @@
public final class A {
private static final int c = 1;
private static final int c;
@org.jetbrains.annotations.NotNull
private static java.lang.String v;
public static final int cc = 1;
@org.jetbrains.annotations.NotNull
public static final java.lang.String cv = "A";
public static final pack.A INSTANCE;
public final int getC() { /* compiled code */ }

View File

@@ -3,7 +3,10 @@
package pack
object A {
val c = 1
var v = "A"
val c = { 1 }()
var v = { "A" }()
fun f() = 3
const val cc = 1
const val cv = "A"
}

View File

@@ -1,7 +1,7 @@
public final class C {
@kotlin.jvm.JvmField
@org.jetbrains.annotations.NotNull
public static final java.lang.String foo = "A";
public static final java.lang.String foo;
public static final C.Companion Companion;
public C() { /* compiled code */ }

View File

@@ -2,6 +2,6 @@
class C {
companion object {
@[kotlin.jvm.JvmField] public val foo: String = "A"
@[kotlin.jvm.JvmField] public val foo: String = { "A" }()
}
}

View File

@@ -1,7 +1,7 @@
public final class C {
@kotlin.jvm.JvmField
@org.jetbrains.annotations.NotNull
public final java.lang.String foo = "A";
public final java.lang.String foo;
public C() { /* compiled code */ }
}

View File

@@ -1,5 +1,5 @@
// C
class C {
@[kotlin.jvm.JvmField] public val foo: String = "A"
@[kotlin.jvm.JvmField] public val foo: String = { "A" }()
}

View File

@@ -2,7 +2,7 @@ public class InnerClasses extends kotlin.script.templates.standard.ScriptTemplat
public InnerClasses(java.lang.String[] p) { /* compiled code */ }
public static final class Bar {
private final int b = 0;
private final int b;
private final int a;
public final int getB() { /* compiled code */ }

View File

@@ -1,7 +1,7 @@
// InnerClasses
class Bar(val a: Int) {
val b: Int = 0
val b: Int = { 0 }()
fun getAPlusB() = a + b

View File

@@ -39,6 +39,10 @@ public final class Boolean : kotlin.Comparable<kotlin.Boolean> {
public final operator fun not(): kotlin.Boolean
public final infix fun or(/*0*/ other: kotlin.Boolean): kotlin.Boolean
public final infix fun xor(/*0*/ other: kotlin.Boolean): kotlin.Boolean
@kotlin.SinceKotlin(version = "1.3") public companion object Companion {
/*primary*/ private constructor Companion()
}
}
public final class BooleanArray {
@@ -117,6 +121,10 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte> {
public final fun <get-MAX_VALUE>(): kotlin.Byte
public const final val MIN_VALUE: kotlin.Byte
public final fun <get-MIN_VALUE>(): kotlin.Byte
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -155,12 +163,20 @@ public final class Char : kotlin.Comparable<kotlin.Char> {
public final fun <get-MAX_LOW_SURROGATE>(): kotlin.Char
public const final val MAX_SURROGATE: kotlin.Char
public final fun <get-MAX_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MAX_VALUE: kotlin.Char
public final fun <get-MAX_VALUE>(): kotlin.Char
public const final val MIN_HIGH_SURROGATE: kotlin.Char
public final fun <get-MIN_HIGH_SURROGATE>(): kotlin.Char
public const final val MIN_LOW_SURROGATE: kotlin.Char
public final fun <get-MIN_LOW_SURROGATE>(): kotlin.Char
public const final val MIN_SURROGATE: kotlin.Char
public final fun <get-MIN_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MIN_VALUE: kotlin.Char
public final fun <get-MIN_VALUE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -475,6 +491,10 @@ public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int> {
public final fun <get-MAX_VALUE>(): kotlin.Int
public const final val MIN_VALUE: kotlin.Int
public final fun <get-MIN_VALUE>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -561,6 +581,10 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
public final fun <get-MAX_VALUE>(): kotlin.Long
public const final val MIN_VALUE: kotlin.Long
public final fun <get-MIN_VALUE>(): kotlin.Long
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -673,6 +697,10 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short> {
public final fun <get-MAX_VALUE>(): kotlin.Short
public const final val MIN_VALUE: kotlin.Short
public final fun <get-MIN_VALUE>(): kotlin.Short
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}

View File

@@ -40,6 +40,10 @@ public final class Boolean : kotlin.Comparable<kotlin.Boolean>, java.io.Serializ
public final operator fun not(): kotlin.Boolean
public final infix fun or(/*0*/ other: kotlin.Boolean): kotlin.Boolean
public final infix fun xor(/*0*/ other: kotlin.Boolean): kotlin.Boolean
@kotlin.SinceKotlin(version = "1.3") public companion object Companion {
/*primary*/ private constructor Companion()
}
}
public final class BooleanArray : kotlin.Any, kotlin.Cloneable, java.io.Serializable {
@@ -119,6 +123,10 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
public final fun <get-MAX_VALUE>(): kotlin.Byte
public const final val MIN_VALUE: kotlin.Byte
public final fun <get-MIN_VALUE>(): kotlin.Byte
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -158,12 +166,20 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final fun <get-MAX_LOW_SURROGATE>(): kotlin.Char
public const final val MAX_SURROGATE: kotlin.Char
public final fun <get-MAX_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MAX_VALUE: kotlin.Char
public final fun <get-MAX_VALUE>(): kotlin.Char
public const final val MIN_HIGH_SURROGATE: kotlin.Char
public final fun <get-MIN_HIGH_SURROGATE>(): kotlin.Char
public const final val MIN_LOW_SURROGATE: kotlin.Char
public final fun <get-MIN_LOW_SURROGATE>(): kotlin.Char
public const final val MIN_SURROGATE: kotlin.Char
public final fun <get-MIN_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MIN_VALUE: kotlin.Char
public final fun <get-MIN_VALUE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -489,6 +505,10 @@ public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int>, java.io.S
public final fun <get-MAX_VALUE>(): kotlin.Int
public const final val MIN_VALUE: kotlin.Int
public final fun <get-MIN_VALUE>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -576,6 +596,10 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
public final fun <get-MAX_VALUE>(): kotlin.Long
public const final val MIN_VALUE: kotlin.Long
public final fun <get-MIN_VALUE>(): kotlin.Long
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -689,6 +713,10 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
public final fun <get-MAX_VALUE>(): kotlin.Short
public const final val MIN_VALUE: kotlin.Short
public final fun <get-MIN_VALUE>(): kotlin.Short
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}

View File

@@ -40,6 +40,10 @@ public final class Boolean : kotlin.Comparable<kotlin.Boolean>, java.io.Serializ
public final operator fun not(): kotlin.Boolean
public final infix fun or(/*0*/ other: kotlin.Boolean): kotlin.Boolean
public final infix fun xor(/*0*/ other: kotlin.Boolean): kotlin.Boolean
@kotlin.SinceKotlin(version = "1.3") public companion object Companion {
/*primary*/ private constructor Companion()
}
}
public final class BooleanArray : kotlin.Any, kotlin.Cloneable, java.io.Serializable {
@@ -119,6 +123,10 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
public final fun <get-MAX_VALUE>(): kotlin.Byte
public const final val MIN_VALUE: kotlin.Byte
public final fun <get-MIN_VALUE>(): kotlin.Byte
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -158,12 +166,20 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final fun <get-MAX_LOW_SURROGATE>(): kotlin.Char
public const final val MAX_SURROGATE: kotlin.Char
public final fun <get-MAX_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MAX_VALUE: kotlin.Char
public final fun <get-MAX_VALUE>(): kotlin.Char
public const final val MIN_HIGH_SURROGATE: kotlin.Char
public final fun <get-MIN_HIGH_SURROGATE>(): kotlin.Char
public const final val MIN_LOW_SURROGATE: kotlin.Char
public final fun <get-MIN_LOW_SURROGATE>(): kotlin.Char
public const final val MIN_SURROGATE: kotlin.Char
public final fun <get-MIN_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MIN_VALUE: kotlin.Char
public final fun <get-MIN_VALUE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -491,6 +507,10 @@ public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int>, java.io.S
public final fun <get-MAX_VALUE>(): kotlin.Int
public const final val MIN_VALUE: kotlin.Int
public final fun <get-MIN_VALUE>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -578,6 +598,10 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
public final fun <get-MAX_VALUE>(): kotlin.Long
public const final val MIN_VALUE: kotlin.Long
public final fun <get-MIN_VALUE>(): kotlin.Long
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -691,6 +715,10 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
public final fun <get-MAX_VALUE>(): kotlin.Short
public const final val MIN_VALUE: kotlin.Short
public final fun <get-MIN_VALUE>(): kotlin.Short
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}

View File

@@ -40,6 +40,10 @@ public final class Boolean : kotlin.Comparable<kotlin.Boolean>, java.io.Serializ
public final operator fun not(): kotlin.Boolean
public final infix fun or(/*0*/ other: kotlin.Boolean): kotlin.Boolean
public final infix fun xor(/*0*/ other: kotlin.Boolean): kotlin.Boolean
@kotlin.SinceKotlin(version = "1.3") public companion object Companion {
/*primary*/ private constructor Companion()
}
}
public final class BooleanArray : kotlin.Any, kotlin.Cloneable, java.io.Serializable {
@@ -119,6 +123,10 @@ public final class Byte : kotlin.Number, kotlin.Comparable<kotlin.Byte>, java.io
public final fun <get-MAX_VALUE>(): kotlin.Byte
public const final val MIN_VALUE: kotlin.Byte
public final fun <get-MIN_VALUE>(): kotlin.Byte
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -158,12 +166,20 @@ public final class Char : kotlin.Comparable<kotlin.Char>, java.io.Serializable {
public final fun <get-MAX_LOW_SURROGATE>(): kotlin.Char
public const final val MAX_SURROGATE: kotlin.Char
public final fun <get-MAX_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MAX_VALUE: kotlin.Char
public final fun <get-MAX_VALUE>(): kotlin.Char
public const final val MIN_HIGH_SURROGATE: kotlin.Char
public final fun <get-MIN_HIGH_SURROGATE>(): kotlin.Char
public const final val MIN_LOW_SURROGATE: kotlin.Char
public final fun <get-MIN_LOW_SURROGATE>(): kotlin.Char
public const final val MIN_SURROGATE: kotlin.Char
public final fun <get-MIN_SURROGATE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val MIN_VALUE: kotlin.Char
public final fun <get-MIN_VALUE>(): kotlin.Char
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -489,6 +505,10 @@ public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int>, java.io.S
public final fun <get-MAX_VALUE>(): kotlin.Int
public const final val MIN_VALUE: kotlin.Int
public final fun <get-MIN_VALUE>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -576,6 +596,10 @@ public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long>, java.io
public final fun <get-MAX_VALUE>(): kotlin.Long
public const final val MIN_VALUE: kotlin.Long
public final fun <get-MIN_VALUE>(): kotlin.Long
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}
@@ -689,6 +713,10 @@ public final class Short : kotlin.Number, kotlin.Comparable<kotlin.Short>, java.
public final fun <get-MAX_VALUE>(): kotlin.Short
public const final val MIN_VALUE: kotlin.Short
public final fun <get-MIN_VALUE>(): kotlin.Short
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BITS: kotlin.Int
public final fun <get-SIZE_BITS>(): kotlin.Int
@kotlin.SinceKotlin(version = "1.3") public const final val SIZE_BYTES: kotlin.Int
public final fun <get-SIZE_BYTES>(): kotlin.Int
}
}

View File

@@ -1,3 +1,3 @@
error: unknown API version: 239.42
Supported API versions: 1.0, 1.1, 1.2, 1.3 (EXPERIMENTAL)
Supported API versions: 1.0, 1.1, 1.2, 1.3
COMPILATION_ERROR

View File

@@ -1 +1,2 @@
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
OK

View File

@@ -1,4 +1,2 @@
compiler/testData/cli/jvm/coroutines.kt:1:1: error: the feature "coroutines" is experimental and disabled (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
suspend fun simple() = 5
^
COMPILATION_ERROR
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
OK

View File

@@ -1,2 +1,3 @@
warning: argument -Xcoroutines is passed multiple times. Only the last value will be used: enable
OK
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
OK

View File

@@ -1,4 +1,2 @@
compiler/testData/cli/jvm/coroutines.kt:1:1: warning: the feature "coroutines" is experimental (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
suspend fun simple() = 5
^
OK
warning: -Xcoroutines has no effect: coroutines are enabled anyway in 1.3 and beyond
OK

View File

@@ -1,3 +1,3 @@
error: unknown language version: 239.42
Supported language versions: 1.0, 1.1, 1.2, 1.3 (EXPERIMENTAL)
Supported language versions: 1.0, 1.1, 1.2, 1.3
COMPILATION_ERROR

View File

@@ -1,4 +1,3 @@
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/cli/jvm/releaseCoroutinesApiVersion1.2.kt:1:1: error: unsupported [cannot use release coroutines with api version less than 1.3]
suspend fun dummy() {}
^

View File

@@ -1,10 +1,11 @@
fun box(): String {
val c1: Char = 0.toChar()
val c1: Char = Char.MIN_VALUE
val c2 = c1 - 1
if (c2 < c1) return "fail: 0.toChar() - 1 should overflow to positive."
if (c2 < c1) return "fail: Char.MIN_VALUE - 1 should overflow to positive."
val c3 = c2 + 1
if (c3 > c2) return "fail: FFFF.toChar() + 1 should overflow to zero."
val c3: Char = Char.MAX_VALUE
val c4 = c3 + 1
if (c4 > c3) return "fail: Char.MAX_VALUE + 1 should overflow to zero."
return "OK"
}

View File

@@ -10,7 +10,7 @@ import kotlin.test.assertEquals
import kotlin.jvm.internal.FunctionBase
fun test(f: Function<*>, arity: Int) {
assertEquals(arity, (f as FunctionBase).getArity())
assertEquals(arity, (f as FunctionBase).arity)
}
fun foo(s: String, i: Int) {}

View File

@@ -16,7 +16,7 @@ suspend fun builder(c: suspend () -> Unit) {
}
fun test(f: Function<*>, arity: Int) {
assertEquals(arity, (f as FunctionBase).getArity())
assertEquals(arity, (f as FunctionBase).arity)
}
suspend fun foo(s: String, i: Int) {}

View File

@@ -0,0 +1,36 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// FILE: J.java
import kotlin.jvm.functions.FunctionN;
public class J {
public static String test() {
return KKt.call(new FunctionN<String>() {
@Override
public String invoke(Object... args) {
if (args.length != getArity()) throw new IllegalArgumentException("Incorrect arity: " + args.length);
return ((A) args[5]).getMessage() +
((A) args[28]).getMessage();
}
@Override
public int getArity() {
return 30;
}
});
}
}
// FILE: K.kt
class A(val message: String)
fun call(f: (A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A) -> String): String {
val a = A("XXX")
return f(a, a, a, a, a, A("O"), a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, A("K"), a)
}
fun box(): String = J.test()

View File

@@ -1,7 +1,6 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM, JVM_IR
// FILE: J.java
// import kotlin.jvm.functions.Arity;

View File

@@ -1,6 +1,5 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM, JVM_IR
class A(val value: Int) {
// for (i in 1..254) { print("p${"%03d".format(i)}: A, "); if (i % 10 == 0) println() }; println()

View File

@@ -1,6 +1,5 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND: JS_IR, JS
// IGNORE_BACKEND: JVM, JVM_IR
class A

View File

@@ -1,5 +1,4 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND: JVM, JVM_IR
class A

View File

@@ -1,5 +1,4 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND: JVM, JVM_IR
class A(val value: Int)

View File

@@ -1,7 +1,6 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM, JVM_IR
// FILE: J.java
// import kotlin.jvm.functions.Arity;

View File

@@ -2,7 +2,6 @@
// Implementing function interface is prohibited in JavaScript
// IGNORE_BACKEND: JS_IR, JS
// IGNORE_BACKEND: JVM, JVM_IR
class A(val value: String)

View File

@@ -1,6 +1,5 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_RUNTIME
// FILE: Test.java

View File

@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
const val M = 0.toChar()
const val M = Char.MIN_VALUE
fun box(): String {
var count = 0

View File

@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
const val M = 0.toChar()
const val M = Char.MIN_VALUE
fun box(): String {
var count = 0

View File

@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JS_IR
const val M = 0xFFFF.toChar()
const val M = Char.MAX_VALUE
fun box(): String {
var count = 0

View File

@@ -1,7 +1,7 @@
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
const val M = 0xFFFF.toChar()
const val M = Char.MAX_VALUE
fun box(): String {
var count = 0

View File

@@ -1,6 +1,5 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND: JS_IR, JS, NATIVE
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_REFLECT
class A {

View File

@@ -48,15 +48,14 @@ fun box(): String {
assertEquals(listOf("Entry"), nestedNames(MutableMap::class))
// Primitives
for (primitive in listOf(Byte::class, Double::class, Float::class, Int::class, Long::class, Short::class, Char::class)) {
for (primitive in listOf(Byte::class, Double::class, Float::class, Int::class, Long::class, Short::class, Char::class, Boolean::class)) {
assertEquals(listOf("Companion"), nestedNames(primitive))
}
assertEquals(emptyList<String>(), nestedNames(Boolean::class))
// Primitive arrays
for (primitiveArray in listOf(
ByteArray::class, DoubleArray::class, FloatArray::class, IntArray::class,
LongArray::class, ShortArray::class, CharArray::class, BooleanArray::class
ByteArray::class, DoubleArray::class, FloatArray::class, IntArray::class,
LongArray::class, ShortArray::class, CharArray::class, BooleanArray::class
)) {
assertEquals(emptyList<String>(), nestedNames(primitiveArray))
}

View File

@@ -1,6 +1,5 @@
// !LANGUAGE: +FunctionTypesWithBigArity
// IGNORE_BACKEND: JS_IR, JS, NATIVE
// IGNORE_BACKEND: JVM, JVM_IR
// WITH_REFLECT
import kotlin.test.assertEquals

View File

@@ -1,5 +1,5 @@
// WITH_UNSIGNED
// IGNORE_BACKEND: JVM_IR, JS_IR, JS
// IGNORE_BACKEND: JVM_IR, JS_IR
const val maxUByte: UByte = 0xFFu

View File

@@ -1,8 +1,8 @@
// IGNORE_BACKEND: JVM_IR
// WITH_UNSIGNED
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR, JS_IR
fun box(): String {
val good = 42.toUInt()
val u1 = 1u
val u2 = 2u
val u3 = u1 + u2

View File

@@ -1,7 +1,6 @@
// WITH_UNSIGNED
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS
fun box(): String {
var sum = 0u

View File

@@ -0,0 +1,10 @@
// WITH_UNSIGNED
// IGNORE_BACKEND: JVM_IR, JS_IR
fun box(): String {
val maxULong = 0xFFFF_FFFF_FFFF_FFFFuL
val zero = 0uL
if (zero >= maxULong) return "Fail"
return "OK"
}

View File

@@ -1,6 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// WITH_UNSIGNED
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR, JS_IR
fun box(): String {
val u1: UByte = 255u

View File

@@ -0,0 +1,27 @@
suspend fun dummy() {}
class C {
suspend fun dummy() = "OK"
}
class WithNested {
class Nested {
suspend fun dummy() = "OK"
}
}
class WithInner {
inner class Inner {
suspend fun dummy() = "OK"
}
}
val c: suspend () -> Unit = {}
class WithTypeParameter<T: suspend() -> Unit> {}
fun returnsSuspend() : suspend() -> Unit = {}
fun builder(c: suspend () -> Unit) {}
fun <T: suspend () -> Unit> withTypeParameter() = {}

View File

@@ -0,0 +1,29 @@
warning: language version 1.3 is experimental, there are no backwards compatibility guarantees for new language and library features
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:2:5: error: using 'c: suspend () -> Unit' is an error. Experimental coroutine cannot be used with API version 1.3
c()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:3:5: error: using 'constructor WithTypeParameter<T : suspend () -> Unit>()' is an error. Experimental coroutine cannot be used with API version 1.3
WithTypeParameter<suspend () -> Unit>()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:4:5: error: using 'returnsSuspend(): suspend () -> Unit' is an error. Experimental coroutine cannot be used with API version 1.3
returnsSuspend()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:5:5: error: using 'builder(suspend () -> Unit): Unit' is an error. Experimental coroutine cannot be used with API version 1.3
builder {}
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:6:5: error: using 'withTypeParameter(): () -> Unit' is an error. Experimental coroutine cannot be used with API version 1.3
withTypeParameter<suspend () -> Unit>()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:8:5: error: using 'dummy(): Unit' is an error. Experimental coroutine cannot be used with API version 1.3
dummy()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:9:9: error: using 'dummy(): String' is an error. Experimental coroutine cannot be used with API version 1.3
C().dummy()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:10:25: error: using 'dummy(): String' is an error. Experimental coroutine cannot be used with API version 1.3
WithNested.Nested().dummy()
^
compiler/testData/compileKotlinAgainstCustomBinaries/experimentalCoroutineCallFromRelease/release.kt:11:25: error: using 'dummy(): String' is an error. Experimental coroutine cannot be used with API version 1.3
WithInner().Inner().dummy()
^
COMPILATION_ERROR

View File

@@ -0,0 +1,12 @@
suspend fun callRelease() {
c()
WithTypeParameter<suspend () -> Unit>()
returnsSuspend()
builder {}
withTypeParameter<suspend () -> Unit>()
dummy()
C().dummy()
WithNested.Nested().dummy()
WithInner().Inner().dummy()
}

View File

@@ -1,5 +1,7 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JVM, JS, NATIVE, JVM_IR, JS_IR
import kotlin.coroutines.experimental.*
fun builder1(c: suspend () -> String): String {
@@ -39,11 +41,11 @@ fun ok(continuation: Continuation<String>): Any? {
}
fun box(): String {
if (builder1(::ok) != "OK") return "FAIL 1"
if (builder1 { cont: Continuation<String> -> "OK" } != "OK") return "FAIL 2"
if (builder1(fun (cont: Continuation<String>): Any? = "OK") != "OK") return "FAIL 3"
if (builder2 { cont: Continuation<String> -> this + "K" } != "OK") return "FAIL 5"
if (builder2(fun String.(cont: Continuation<String>): Any? = this + "K") != "OK") return "FAIL 6"
// if (builder1(::ok) != "OK") return "FAIL 1"
// if (builder1 { cont: Continuation<String> -> "OK" } != "OK") return "FAIL 2"
// if (builder1(fun (cont: Continuation<String>): Any? = "OK") != "OK") return "FAIL 3"
//
// if (builder2 { cont: Continuation<String> -> this + "K" } != "OK") return "FAIL 5"
// if (builder2(fun String.(cont: Continuation<String>): Any? = this + "K") != "OK") return "FAIL 6"
return "OK"
}

View File

@@ -1,5 +1,7 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JVM, JS, NATIVE, JVM_IR, JS_IR
val dummy1: suspend () -> String = { "OK" }
val dummy2: suspend String.() -> String = { this + "K" }
@@ -10,17 +12,17 @@ val dummy3: suspend String.(String) -> String = { s -> this + s }
import kotlin.coroutines.experimental.*
fun box(): String {
val continuation = object : Continuation<String> {
override val context = EmptyCoroutineContext
override fun resume(value: String) {
}
override fun resumeWithException(exception: Throwable) {
throw exception
}
}
if (dummy1(continuation) != "OK") return "FAIL 1"
if ("O".dummy2(continuation) != "OK") return "FAIL 2"
if ("O".dummy3("K", continuation) != "OK") return "FAIL 3"
// val continuation = object : Continuation<String> {
// override val context = EmptyCoroutineContext
// override fun resume(value: String) {
// }
//
// override fun resumeWithException(exception: Throwable) {
// throw exception
// }
// }
// if (dummy1(continuation) != "OK") return "FAIL 1"
// if ("O".dummy2(continuation) != "OK") return "FAIL 2"
// if ("O".dummy3("K", continuation) != "OK") return "FAIL 3"
return "OK"
}

View File

@@ -1,5 +1,7 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JVM, JS, NATIVE, JVM_IR, JS_IR
import kotlin.coroutines.experimental.*
fun (suspend () -> String).builder(): String {
@@ -25,8 +27,8 @@ fun ok(continuation: Continuation<String>): Any? {
}
fun box(): String {
if ((::ok).builder() != "OK") return "FAIL 1"
if (({ cont: Continuation<String> -> "OK" }).builder() != "OK") return "FAIL 2"
if ((fun (cont: Continuation<String>): Any? = "OK").builder() != "OK") return "FAIL 3"
// if ((::ok).builder() != "OK") return "FAIL 1"
// if (({ cont: Continuation<String> -> "OK" }).builder() != "OK") return "FAIL 2"
// if ((fun (cont: Continuation<String>): Any? = "OK").builder() != "OK") return "FAIL 3"
return "OK"
}

View File

@@ -1,5 +1,7 @@
// FILE: A.kt
// LANGUAGE_VERSION: 1.2
// TODO: Unmute when automatic conversion experimental <-> release will be implemented
// IGNORE_BACKEND: JVM, JS, NATIVE, JVM_IR, JS_IR
suspend fun dummy() = "OK"
@@ -29,19 +31,19 @@ class WithInner {
import kotlin.coroutines.experimental.*
fun box(): String {
val continuation = object : Continuation<String> {
override val context = EmptyCoroutineContext
override fun resume(value: String) {
}
override fun resumeWithException(exception: Throwable) {
throw exception
}
}
if (dummy(continuation) != "OK") return "FAIL 1"
if ("O".dummy(continuation) != "OK") return "FAIL 2"
if ("O".dummy("K", continuation) != "OK") return "FAIL 3"
if (C().dummy(continuation) != "OK") return "FAIL 4"
if (WithNested.Nested().dummy(continuation) != "OK") return "FAIL 5"
if (WithInner().Inner().dummy(continuation) != "OK") return "FAIL 6"
// val continuation = object : Continuation<String> {
// override val context = EmptyCoroutineContext
// override fun resume(value: String) {
// }
// override fun resumeWithException(exception: Throwable) {
// throw exception
// }
// }
// if (dummy(continuation) != "OK") return "FAIL 1"
// if ("O".dummy(continuation) != "OK") return "FAIL 2"
// if ("O".dummy("K", continuation) != "OK") return "FAIL 3"
// if (C().dummy(continuation) != "OK") return "FAIL 4"
// if (WithNested.Nested().dummy(continuation) != "OK") return "FAIL 5"
// if (WithInner().Inner().dummy(continuation) != "OK") return "FAIL 6"
return "OK"
}

View File

@@ -0,0 +1,29 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun fail1(c: suspend () -> Unit) {}
fun fail2(c: () -> Unit) {}
fun success1(c: suspend () -> Unit) {}
fun test1() {
fail1(<!TYPE_MISMATCH!>fun () {}<!>)
fun fail2(c: suspend () -> Unit) {}
fail2(<!TYPE_MISMATCH!>fun () {}<!>)
fun success1(c: () -> Unit) {}
success1(fun() {})
}
suspend fun fail3(c: suspend () -> Unit) {}
suspend fun fail4(c: () -> Unit) {}
suspend fun success2(c: suspend () -> Unit) {}
suspend fun test2() {
fail3(<!TYPE_MISMATCH!>fun () {}<!>)
fun fail4(c: suspend () -> Unit) {}
fail4(<!TYPE_MISMATCH!>fun () {}<!>)
fun success2(c: () -> Unit) {}
success2(fun() {})
}

View File

@@ -0,0 +1,10 @@
package
public fun fail1(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public fun fail2(/*0*/ c: () -> kotlin.Unit): kotlin.Unit
public suspend fun fail3(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public suspend fun fail4(/*0*/ c: () -> kotlin.Unit): kotlin.Unit
public fun success1(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public suspend fun success2(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit
public fun test1(): kotlin.Unit
public suspend fun test2(): kotlin.Unit

View File

@@ -1,10 +1,9 @@
// !WITH_NEW_INFERENCE
typealias SuspendFn = suspend () -> Unit
val test1f: suspend () -> Unit = fun () {}
val test2f: suspend Any.() -> Unit = fun Any.() {}
val test1f: suspend () -> Unit = <!TYPE_MISMATCH!>fun () {}<!>
val test2f: suspend Any.() -> Unit = <!TYPE_MISMATCH!>fun Any.() {}<!>
// This is a bug in the old inference and should be fixed in new inference
// see "Fix anonymous function literals handling in type checker" for more deatils
val test3f: suspend Any.(Int) -> Int = <!OI;TYPE_MISMATCH!>fun (k: Int) = k + 1<!>
val test4f: SuspendFn = <!OI;TYPE_MISMATCH!>fun Any.() {}<!>
val test3f: suspend Any.(Int) -> Int = <!TYPE_MISMATCH!>fun (k: Int) = k + 1<!>
val test4f: SuspendFn = <!TYPE_MISMATCH!>fun Any.() {}<!>

View File

@@ -1,5 +1,3 @@
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -EXPOSED_PARAMETER_TYPE
<!EXPLICIT_METADATA_IS_DISALLOWED!>@Metadata<!>
class A

View File

@@ -24,14 +24,14 @@ fun builder(c: <!UNSUPPORTED!>suspend<!> () -> Unit) {}
}
fun test2() {
kotlin.coroutines.experimental.buildSequence<Int> {
yield(1<!NO_VALUE_FOR_PARAMETER!>)<!>
kotlin.coroutines.experimental.<!DEPRECATION_ERROR, UNSUPPORTED!>buildSequence<!><Int> {
<!DEPRECATION_ERROR!>yield<!>(1)
}
kotlin.sequences.<!UNRESOLVED_REFERENCE!>buildSequence<!><Int> {
<!UNRESOLVED_REFERENCE!>yield<!>(1)
}
}
<!UNSUPPORTED!>suspend<!> fun test3(): Unit = <!TYPE_MISMATCH!>kotlin.coroutines.experimental.<!NO_VALUE_FOR_PARAMETER, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>suspendCoroutine<!> <!TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>_<!> -> Unit }<!><!>
<!UNSUPPORTED!>suspend<!> fun test3(): Unit = kotlin.coroutines.experimental.<!DEPRECATION_ERROR!>suspendCoroutine<!> { _ -> Unit }
<!UNSUPPORTED!>suspend<!> fun test4(): Unit = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>suspendCoroutine<!> { <!CANNOT_INFER_PARAMETER_TYPE!>_<!> -> Unit }

View File

@@ -6,5 +6,6 @@ public interface IntrinsicCompanionObject {
void testInt(IntCompanionObject i);
void testChar(CharCompanionObject c);
void testString(StringCompanionObject s);
void testBoolean(BooleanCompanionObject b);
void testEnum(EnumCompanionObject e);
}

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