diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt index 45de071791f..9f94c736e72 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirDefaultErrorMessages.kt @@ -7,6 +7,8 @@ package org.jetbrains.kotlin.fir.analysis.diagnostics import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.DECLARATION_NAME +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.FIR import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.NULLABLE_STRING import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.PROPERTY_NAME import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.SYMBOL @@ -90,9 +92,10 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { } companion object { - // * - The old FE reports these diagnostics with additional parameters + // * - The old FE reports these diagnostics with additional parameters // & - New diagnostic that has no analogues in the old FE - // + - Better message required + // + - Better message required + // # - The new diagnostic differs from the old FE's one val MAP = FirDiagnosticFactoryToRendererMap("FIR").also { map -> // Miscellaneous map.put(SYNTAX_ERROR, "Syntax error") @@ -151,15 +154,15 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension { map.put(VAR_ANNOTATION_PARAMETER, "An annotation parameter cannot be 'var'") map.put(NOT_AN_ANNOTATION_CLASS, "Illegal annotation class: {0}", NULLABLE_STRING) - // Exposed visibility group - map.put(EXPOSED_TYPEALIAS_EXPANDED_TYPE, "{0} typealias exposes {2} in expanded type{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_FUNCTION_RETURN_TYPE, "{0} function exposes its {2} return type{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_RECEIVER_TYPE, "{0} member exposes its {2} receiver type{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_PROPERTY_TYPE, "{0} property exposes its {2} type{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_PARAMETER_TYPE, "{0} function exposes its {2} parameter type{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_SUPER_INTERFACE, "''{0}'' sub-interface exposes its ''{2}'' supertype{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_SUPER_CLASS, "''{0}'' subclass exposes its ''{2}'' supertype{1}", TO_STRING, TO_STRING, TO_STRING) - map.put(EXPOSED_TYPE_PARAMETER_BOUND, "''{0}'' generic exposes its ''{2}'' parameter bound type{1}", TO_STRING, TO_STRING, TO_STRING) + // Exposed visibility group // # + map.put(EXPOSED_TYPEALIAS_EXPANDED_TYPE, "{0} typealias exposes {2} in expanded type ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_FUNCTION_RETURN_TYPE, "{0} function exposes its {2} return type ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_RECEIVER_TYPE, "{0} member exposes its {2} receiver type ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_PROPERTY_TYPE, "{0} property exposes its {2} type ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_PARAMETER_TYPE, "{0} function exposes its {2} parameter type ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_SUPER_INTERFACE, "{0} sub-interface exposes its {2} supertype ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_SUPER_CLASS, "{0} subclass exposes its {2} supertype ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) + map.put(EXPOSED_TYPE_PARAMETER_BOUND, "{0} generic exposes its {2} parameter bound type ''{1}''", TO_STRING, DECLARATION_NAME, TO_STRING) // Modifiers map.put(INAPPLICABLE_INFIX_MODIFIER, "''infix'' modifier is inapplicable on this function: {0}", TO_STRING) diff --git a/compiler/testData/cli/jvm/firError.out b/compiler/testData/cli/jvm/firError.out index 227a5ce78d0..e9c2373330d 100644 --- a/compiler/testData/cli/jvm/firError.out +++ b/compiler/testData/cli/jvm/firError.out @@ -1,10 +1,10 @@ compiler/testData/cli/jvm/firError.kt:5:13: error: x must be initialized before access println(x) ^ -compiler/testData/cli/jvm/firError.kt:10:16: error: public subclass exposes its private supertype Private +compiler/testData/cli/jvm/firError.kt:10:16: error: public subclass exposes its private supertype 'Private' class Public : Private() { ^ -compiler/testData/cli/jvm/firError.kt:11:9: error: public property exposes its private type Private +compiler/testData/cli/jvm/firError.kt:11:9: error: public property exposes its private type 'Private' val x: Private ^ COMPILATION_ERROR