FE1.0/FIR: slightly fix diagnostic messages about OptIn

This commit is contained in:
Mikhail Glukhikh
2022-03-10 16:26:41 +03:00
committed by Space
parent 6b53ac8367
commit 5810ac01d2
8 changed files with 18 additions and 18 deletions
@@ -39,18 +39,18 @@ object OptInNames {
@Suppress("unused")
val USE_EXPERIMENTAL_FQ_NAMES = OPT_IN_FQ_NAMES
fun buildDefaultDiagnosticMessage(prefix: String, fqName: FqName): String {
return "$prefix with '@${fqName.asString()}' or '@OptIn(${fqName.asString()}::class)'"
fun buildDefaultDiagnosticMessage(prefix: String, markerName: String): String {
return "$prefix with '@$markerName' or '@OptIn($markerName::class)'"
}
fun buildMessagePrefix(verb: String): String =
"This declaration needs OptIn. Its usage $verb be marked"
"This declaration needs opt-in. Its usage $verb be marked"
fun buildOverrideMessage(supertypeName: String, markerMessage: String?, verb: String, markerName: String): String {
val basePrefix = "Base declaration of supertype '$supertypeName' needs OptIn. "
val basePrefix = "Base declaration of supertype '$supertypeName' needs opt-in. "
val markerMessageOrStub = markerMessage
?.takeIf { it.isNotBlank() }?.let { if (it.endsWith(".")) "$it " else "$it. " } ?: ""
val baseSuffix = "The declaration override $verb be annotated with '@$markerName'"
val baseSuffix = buildDefaultDiagnosticMessage("The declaration override $verb be annotated", markerName)
return basePrefix + markerMessageOrStub + baseSuffix
}
}