[Test] Sort FIR diagnostics by offset for consistent rendering

This commit is contained in:
Brian Norman
2023-06-07 06:37:24 -05:00
committed by Space Team
parent 2abe04132b
commit 5fe5113344
6 changed files with 14 additions and 14 deletions
@@ -1,3 +1,3 @@
/kt45461_2.kt:(253,260): warning: Type argument for a type parameter S can't be inferred because it has incompatible upper bounds: kotlin/String, K (multiple incompatible classes: kotlin/String, kotlin/Int). This will become an error in a future release
/kt45461_2.kt:(198,201): warning: 'kotlin/Int' is a final type, and thus a value of the type parameter is predetermined
/kt45461_2.kt:(253,260): warning: Type argument for a type parameter S can't be inferred because it has incompatible upper bounds: kotlin/String, K (multiple incompatible classes: kotlin/String, kotlin/Int). This will become an error in a future release
@@ -1,5 +1,5 @@
/kt45461_25.fir.kt:(176,180): warning: Unchecked cast: kotlin/Nothing? to S
/kt45461_25.fir.kt:(276,283): error: Type argument for a type parameter S can't be inferred because it has incompatible upper bounds: kotlin/String, K (multiple incompatible classes: kotlin/String, kotlin/Int)
/kt45461_25.fir.kt:(206,209): warning: 'kotlin/Int' is a final type, and thus a value of the type parameter is predetermined
/kt45461_25.fir.kt:(276,283): error: Type argument for a type parameter S can't be inferred because it has incompatible upper bounds: kotlin/String, K (multiple incompatible classes: kotlin/String, kotlin/Int)
@@ -1,5 +1,5 @@
/kt48765.kt:(282,285): warning: Type argument for a type parameter T can't be inferred because it has incompatible upper bounds: kotlin/String, kotlin/Number (multiple incompatible classes). This will become an error in a future release
/kt48765.kt:(379,383): warning: Unchecked cast: kotlin/String to T
/kt48765.kt:(345,351): warning: 'kotlin/String' is a final type, and thus a value of the type parameter is predetermined
/kt48765.kt:(379,383): warning: Unchecked cast: kotlin/String to T
@@ -342,7 +342,7 @@ class FirDiagnosticsHandler(testServices: TestServices) : FirAnalysisHandler(tes
if (DiagnosticsDirectives.RENDER_DIAGNOSTICS_FULL_TEXT !in module.directives) return
if (diagnostics.isEmpty()) return
val reportedDiagnostics = diagnostics.map {
val reportedDiagnostics = diagnostics.sortedBy { it.textRanges.first().startOffset }.map {
val severity = AnalyzerWithCompilerReport.convertSeverity(it.severity).toString().toLowerCaseAsciiOnly()
val message = RootDiagnosticRendererFactory(it).render(it)
"/${file.name}:${it.textRanges.first()}: $severity: $message"