Skip to content

Commit

Permalink
Handle 'ExplicitBackingFields' compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zoobestik committed Jan 9, 2024
1 parent a41be21 commit c40c5e3
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,25 @@ fun <T> CLICompiler<*>.tryCompilation(inputDirectory: Path, inputFiles: List<Pat
message: String,
location: CompilerMessageSourceLocation?
): String {
val textInterval = location?.let {
TextInterval(
start = TextInterval.TextPosition(minusOne(location.line), minusOne(location.column)),
end = TextInterval.TextPosition(minusOne(location.lineEnd), minusOne(location.columnEnd))
)
when {
// suppress -XXLanguage:+ExplicitBackingFields
severity == STRONG_WARNING && message.contains("ExplicitBackingFields") ->
return ""
}

val messageSeverity: ProjectSeveriry = when (severity) {
EXCEPTION, ERROR -> ProjectSeveriry.ERROR
STRONG_WARNING, WARNING -> ProjectSeveriry.WARNING
INFO, LOGGING, OUTPUT -> return ""
}

val textInterval = location?.let {
TextInterval(
start = TextInterval.TextPosition(minusOne(location.line), minusOne(location.column)),
end = TextInterval.TextPosition(minusOne(location.lineEnd), minusOne(location.columnEnd))
)
}

val errorFilePath = location?.path?.let(::Path)?.outputFilePathString() ?: defaultFileName

val className = if (!message.startsWith(UNRESOLVED_REFERENCE_PREFIX) && severity == ERROR) "red_wavy_line" else messageSeverity.name
Expand Down

0 comments on commit c40c5e3

Please sign in to comment.