From 54f034a636dcf17ba79bef80d723a44daf0af420 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Thu, 23 Mar 2017 12:31:01 +0300 Subject: [PATCH] Place array literals in annotations feature under the version 1.2 --- .../collectionLiteralsInArgumentPosition.kt | 5 +---- .../collectionLiterals/collectionLiteralsWithConstants.kt | 3 +-- .../box/collectionLiterals/collectionLiteralsWithVarargs.kt | 5 +---- .../collectionLiterals/defaultAnnotationParameterValues.kt | 2 +- .../org/jetbrains/kotlin/config/LanguageVersionSettings.kt | 5 +++-- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt b/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt index 39f4efb0d85..f36122ea0a0 100644 --- a/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt +++ b/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsInArgumentPosition.kt @@ -1,3 +1,4 @@ +// LANGUAGE_VERSION: 1.2 // WITH_REFLECT // IGNORE_BACKEND: JS @@ -15,18 +16,14 @@ fun check(b: Boolean, message: String) { if (!b) throw RuntimeException(message) } -@Suppress("UNSUPPORTED_FEATURE") annotation class Foo(val a: FloatArray = [], val b: Array = [], val c: Array> = []) -@Suppress("UNSUPPORTED_FEATURE") @Foo(a = [1f, 2f, 1 / 0f]) fun test1() {} -@Suppress("UNSUPPORTED_FEATURE") @Foo(b = ["Hello", ", ", "Kot" + "lin"]) fun test2() {} -@Suppress("UNSUPPORTED_FEATURE") @Foo(c = [Int::class, Array::class, Foo::class]) fun test3() {} diff --git a/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt b/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt index 344de2e3359..72381b5137f 100644 --- a/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt +++ b/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithConstants.kt @@ -1,3 +1,4 @@ +// LANGUAGE_VERSION: 1.2 // WITH_REFLECT // IGNORE_BACKEND: JS @@ -14,7 +15,6 @@ fun check(b: Boolean, message: String) { if (!b) throw RuntimeException(message) } -@Suppress("UNSUPPORTED_FEATURE") annotation class Foo(val a: IntArray = [], val b: Array = []) const val ONE_INT = 1 @@ -22,7 +22,6 @@ const val ONE_FLOAT = 1f const val HELLO = "hello" const val C_CHAR = 'c' -@Suppress("UNSUPPORTED_FEATURE") @Foo( a = [ONE_INT, ONE_INT + ONE_FLOAT.toInt(), ONE_INT + 10, (ONE_INT % 1.0).toInt()], b = [HELLO, HELLO + C_CHAR, HELLO + ", Kotlin", C_CHAR.toString() + C_CHAR]) diff --git a/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt b/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt index a0e15d7948b..eaeeab4e98d 100644 --- a/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt +++ b/compiler/testData/codegen/box/collectionLiterals/collectionLiteralsWithVarargs.kt @@ -1,3 +1,4 @@ +// LANGUAGE_VERSION: 1.2 // WITH_REFLECT // IGNORE_BACKEND: JS @@ -15,17 +16,13 @@ fun check(b: Boolean, message: String) { if (!b) throw RuntimeException(message) } -@Suppress("UNSUPPORTED_FEATURE") annotation class Foo(vararg val a: String = ["a", "b"]) -@Suppress("UNSUPPORTED_FEATURE") annotation class Bar(vararg val a: KClass<*> = [Int::class]) -@Suppress("UNSUPPORTED_FEATURE") @Foo(*["/"]) fun test1() {} -@Suppress("UNSUPPORTED_FEATURE") @Bar(*[Long::class, String::class]) fun test2() {} diff --git a/compiler/testData/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt b/compiler/testData/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt index 73cfbb23a22..a8ba49def4d 100644 --- a/compiler/testData/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt +++ b/compiler/testData/codegen/box/collectionLiterals/defaultAnnotationParameterValues.kt @@ -1,3 +1,4 @@ +// LANGUAGE_VERSION: 1.2 // WITH_REFLECT // IGNORE_BACKEND: JS @@ -15,7 +16,6 @@ fun check(b: Boolean, message: String) { if (!b) throw RuntimeException(message) } -@Suppress("UNSUPPORTED_FEATURE") annotation class Foo( val a: IntArray = [], val b: IntArray = [1, 2, 3], diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index d016f9da99c..8b8c64edf5e 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -17,6 +17,7 @@ package org.jetbrains.kotlin.config import org.jetbrains.kotlin.config.LanguageVersion.KOTLIN_1_1 +import org.jetbrains.kotlin.config.LanguageVersion.KOTLIN_1_2 import org.jetbrains.kotlin.utils.DescriptionAware enum class LanguageFeature( @@ -48,14 +49,14 @@ enum class LanguageFeature( NoDelegationToJavaDefaultInterfaceMembers(KOTLIN_1_1), DefaultImportOfPackageKotlinComparisons(KOTLIN_1_1), + ArrayLiteralsInAnnotations(KOTLIN_1_2), + // Experimental features Coroutines(KOTLIN_1_1, ApiVersion.KOTLIN_1_1, "https://kotlinlang.org/docs/diagnostics/experimental-coroutines", State.ENABLED_WITH_WARNING), MultiPlatformProjects(sinceVersion = null, defaultState = State.DISABLED), - ArrayLiteralsInAnnotations(sinceVersion = null), - ; val presentableName: String