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? {
|
private fun ScratchFile.findExpression(psiElement: PsiElement): ScratchExpression? {
|
||||||
val lineStart = psiElement.getLineNumber(true)
|
val elementLine = psiElement.getLineNumber()
|
||||||
val lineEnd = psiElement.getLineNumber(false)
|
return getExpressions().firstOrNull { elementLine in it.lineStart..it.lineEnd }
|
||||||
return getExpressions().firstOrNull { it.lineStart == lineStart || it.lineEnd == lineEnd }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ScratchFile.findExpression(lineStart: Int, lineEnd: Int): ScratchExpression? {
|
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...
|
foo.forEach { // ERROR: Unresolved reference: foo; Cannot choose among the following candidates wi...
|
||||||
1 + 1
|
1 + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun goo(a: String) { // ERROR: Unresolved reference: goo
|
||||||
|
super.goo(a)
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
foo.forEach {
|
foo.forEach {
|
||||||
1 + 1
|
1 + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun goo(a: String) {
|
||||||
|
super.goo(a)
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
foo.forEach { // ERROR: error: unresolved reference: foo
|
foo.forEach { // ERROR: error: unresolved reference: foo
|
||||||
1 + 1
|
1 + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun goo(a: String) { // ERROR: error: unresolved reference: goo
|
||||||
|
super.goo(a)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user