Scratch: report errors at the correct line
^KT-24364 Fixed
This commit is contained in:
@@ -207,9 +207,8 @@ class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||
}
|
||||
|
||||
private fun ScratchFile.findExpression(psiElement: PsiElement): ScratchExpression? {
|
||||
val lineStart = psiElement.getLineNumber(true)
|
||||
val lineEnd = psiElement.getLineNumber(false)
|
||||
return getExpressions().firstOrNull { it.lineStart == lineStart || it.lineEnd == lineEnd }
|
||||
val elementLine = psiElement.getLineNumber()
|
||||
return getExpressions().firstOrNull { elementLine in it.lineStart..it.lineEnd }
|
||||
}
|
||||
|
||||
private fun ScratchFile.findExpression(lineStart: Int, lineEnd: Int): ScratchExpression? {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
foo.forEach { // ERROR: Unresolved reference: foo; Cannot choose among the following candidates wi...
|
||||
1 + 1
|
||||
}
|
||||
|
||||
fun goo(a: String) { // ERROR: Unresolved reference: goo
|
||||
super.goo(a)
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
foo.forEach {
|
||||
1 + 1
|
||||
}
|
||||
|
||||
fun goo(a: String) {
|
||||
super.goo(a)
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
foo.forEach { // ERROR: error: unresolved reference: foo
|
||||
1 + 1
|
||||
}
|
||||
|
||||
fun goo(a: String) { // ERROR: error: unresolved reference: goo
|
||||
super.goo(a)
|
||||
}
|
||||
Reference in New Issue
Block a user