Skip to content

Commit fb43522

Browse files
authored
Merge pull request scala#11049 from harpocrates/fix-rename-import-sel-error-loc
fix: error location for aliased import selector
2 parents c392ee5 + 9bab860 commit fb43522

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ trait ContextErrors extends splain.SplainErrors {
519519
}
520520
sel match {
521521
case tree: Import => // selector name is unique; use it to improve position
522-
tree.selectors.find(_.introduces(name)) match {
522+
tree.selectors.find(_.hasName(name)) match {
523523
case Some(badsel) => issueTypeError(PosAndMsgTypeError(tree.posOf(badsel), errMsg))
524524
case _ => issueNormalTypeError(sel, errMsg)
525525
}

test/files/neg/t6340.check

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
t6340.scala:11: error: value D is not a member of object Foo
2-
import Foo.{ A, B, C, D, E, X, Y, Z }
2+
import Foo.{ A, B, C, D, E, F => G, X, Y, Z }
33
^
44
t6340.scala:11: error: value E is not a member of object Foo
5-
import Foo.{ A, B, C, D, E, X, Y, Z }
5+
import Foo.{ A, B, C, D, E, F => G, X, Y, Z }
66
^
7+
t6340.scala:11: error: value F is not a member of object Foo
8+
import Foo.{ A, B, C, D, E, F => G, X, Y, Z }
9+
^
710
t6340.scala:16: error: not found: type D
811
val d = new D
912
^
1013
t6340.scala:17: error: not found: type W
1114
val w = new W
1215
^
13-
4 errors
16+
5 errors

test/files/neg/t6340.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object Foo {
88
}
99

1010
object Test {
11-
import Foo.{ A, B, C, D, E, X, Y, Z }
11+
import Foo.{ A, B, C, D, E, F => G, X, Y, Z }
1212

1313
val a = new A
1414
val b = new B

0 commit comments

Comments
 (0)