Revert "Add info about the end of range in scripting REPL compiler messages"

This reverts commit af251caf, because it breaks daemon/client
compatibility, which we'd like to keep as much as possible
This commit is contained in:
Ilya Chernikov
2020-05-15 15:12:37 +02:00
parent 3793e485b6
commit fb6ef38370
9 changed files with 18 additions and 103 deletions
@@ -37,20 +37,10 @@ class ScriptDiagnosticsMessageCollector(private val parentMessageCollector: Mess
if (mappedSeverity != null) {
val mappedLocation = location?.let {
if (it.line < 0 && it.column < 0) null // special location created by CompilerMessageLocation.create
else if (it.lineEnd < 0 && it.columnEnd < 0) SourceCode.Location(
SourceCode.Position(
it.line,
it.column
)
)
else SourceCode.Location(
SourceCode.Position(
it.line,
it.column
),
SourceCode.Position(
it.lineEnd,
it.columnEnd
)
)
}
@@ -86,8 +86,6 @@ class JvmIdeServicesTest : TestCase() {
} else {
assertEquals(3, loc.line)
assertEquals(11, loc.column)
assertEquals(3, loc.lineEnd)
assertEquals(14, loc.columnEnd)
}
} else {
fail("Result should be an error")
@@ -117,8 +115,6 @@ class JvmIdeServicesTest : TestCase() {
} else {
assertEquals(3, loc.line)
assertEquals(13, loc.column)
assertEquals(3, loc.lineEnd)
assertEquals(16, loc.columnEnd)
}
} else {
fail("Result should be an error")
@@ -398,8 +394,6 @@ private fun <T> ResultWithDiagnostics<T>.getErrors(): CompilationErrors =
report.sourcePath,
loc.start.line,
loc.start.col,
loc.end?.line,
loc.end?.col,
null
)?.toString()?.let {
"$it "
@@ -418,8 +412,6 @@ private fun <T> ResultWithDiagnostics<T>.getErrors(): CompilationErrors =
it.sourcePath,
loc.start.line,
loc.start.col,
loc.end?.line,
loc.end?.col,
null
)
}
@@ -186,10 +186,10 @@ class ReplCompletionAndErrorsAnalysisTest : TestCase() {
val c = foob
""".trimIndent()
expect {
addError(1, 16, 1, 20, "Type mismatch: inferred type is String but Int was expected", "ERROR")
addError(1, 22, 1, 26, "The floating-point literal does not conform to the expected type String", "ERROR")
addError(2, 14, 2, 19, "Type mismatch: inferred type is String but Int was expected", "ERROR")
addError(3, 9, 3, 13, "Unresolved reference: foob", "ERROR")
addError(1, 16, "Type mismatch: inferred type is String but Int was expected", "ERROR")
addError(1, 22, "The floating-point literal does not conform to the expected type String", "ERROR")
addError(2, 14, "Type mismatch: inferred type is String but Int was expected", "ERROR")
addError(3, 9, "Unresolved reference: foob", "ERROR")
}
}
}
@@ -280,15 +280,14 @@ class ReplCompletionAndErrorsAnalysisTest : TestCase() {
}
val errors = ExpectedList<ScriptDiagnostic>(run::doErrorCheck)
fun addError(startLine: Int, startCol: Int, endLine: Int, endCol: Int, message: String, severity: String) {
fun addError(startLine: Int, startCol: Int, message: String, severity: String) {
errors.add(
ScriptDiagnostic(
ScriptDiagnostic.unspecifiedError,
message,
ScriptDiagnostic.Severity.valueOf(severity),
location = SourceCode.Location(
SourceCode.Position(startLine, startCol),
SourceCode.Position(endLine, endCol)
SourceCode.Position(startLine, startCol)
)
)
)