Added hint url for coroutines and multiplatform diagnostics.
This commit is contained in:
@@ -19,13 +19,13 @@ package org.jetbrains.kotlin.config
|
||||
import org.jetbrains.kotlin.config.LanguageVersion.KOTLIN_1_1
|
||||
import org.jetbrains.kotlin.utils.DescriptionAware
|
||||
|
||||
enum class LanguageFeature(val sinceVersion: LanguageVersion?) {
|
||||
enum class LanguageFeature(val sinceVersion: LanguageVersion?, val hintUrl: String? = null) {
|
||||
// Note: names of these entries are also used in diagnostic tests and in user-visible messages (see presentableText below)
|
||||
TypeAliases(KOTLIN_1_1),
|
||||
BoundCallableReferences(KOTLIN_1_1),
|
||||
LocalDelegatedProperties(KOTLIN_1_1),
|
||||
TopLevelSealedInheritance(KOTLIN_1_1),
|
||||
Coroutines(KOTLIN_1_1),
|
||||
Coroutines(KOTLIN_1_1, "https://kotlinlang.org/docs/diagnostics/experimental-coroutines"),
|
||||
AdditionalBuiltInsMembers(KOTLIN_1_1),
|
||||
DataClassInheritance(KOTLIN_1_1),
|
||||
InlineProperties(KOTLIN_1_1),
|
||||
@@ -42,17 +42,19 @@ enum class LanguageFeature(val sinceVersion: LanguageVersion?) {
|
||||
SafeCallBoundSmartCasts(KOTLIN_1_1),
|
||||
|
||||
// Experimental features
|
||||
MultiPlatformProjects(null),
|
||||
MultiPlatformProjects(null, "https://kotlinlang.org/docs/diagnostics/experimental-multitraget-projects"),
|
||||
MultiPlatformDoNotCheckImpl(null),
|
||||
|
||||
WarnOnCoroutines(null),
|
||||
ErrorOnCoroutines(null)
|
||||
;
|
||||
|
||||
val presentableText: String
|
||||
val presentableName: String
|
||||
// E.g. "DestructuringLambdaParameters" -> ["Destructuring", "Lambda", "Parameters"] -> "destructuring lambda parameters"
|
||||
get() = name.split("(?<!^)(?=[A-Z])".toRegex()).joinToString(separator = " ", transform = String::toLowerCase)
|
||||
|
||||
val presentableText get() = if (hintUrl == null) presentableName else "$presentableName (See: $hintUrl)"
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun fromString(str: String) = values().find { it.name == str }
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// !DIAGNOSTICS_NUMBER: 1
|
||||
// !DIAGNOSTICS: UNSUPPORTED_FEATURE
|
||||
// !MESSAGE_TYPE: TEXT
|
||||
|
||||
impl fun test() {}
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- urlMultiproject1 -->
|
||||
The feature is experimental and should be turned on explicitly via a command line option or in IDE settings: multi platform projects (See: https://kotlinlang.org/docs/diagnostics/experimental-multitraget-projects)
|
||||
@@ -317,4 +317,10 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/upperBoundViolatedInTypeAliasConstructorCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("urlMultiproject.kt")
|
||||
public void testUrlMultiproject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/urlMultiproject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user