FE1.0/FIR: slightly fix diagnostic messages about OptIn
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user