File tree Expand file tree Collapse file tree 4 files changed +18
-16
lines changed
src/compiler/scala/tools/nsc/ast/parser Expand file tree Collapse file tree 4 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -2825,9 +2825,11 @@ self =>
28252825 if (! h.isMask)
28262826 t.find(_.rename == h.rename).foreach { duplicate =>
28272827 val msg =
2828- if (h.isRename || duplicate.isRename) s " ${h.rename} is an ambiguous name on import "
2828+ if (h.isRename || duplicate.isRename)
2829+ if (h.name == duplicate.name) s " ${h.name} is renamed twice to ${h.rename}"
2830+ else s " ${h.rename} is an ambiguous name on import "
28292831 else s " ${h.rename} is imported twice "
2830- syntaxError(h .renamePos, msg)
2832+ syntaxError(duplicate .renamePos, msg)
28312833 }
28322834 h :: checkSelectors(t)
28332835 }
Original file line number Diff line number Diff line change 11t12813.scala:5: error: a is imported twice
22import O.{a, a} // error
3- ^
4- t12813.scala:8: error: b is an ambiguous name on import
3+ ^
4+ t12813.scala:8: error: a is renamed twice to b
55import O.{a => b, a => b} // error
6- ^
6+ ^
77t12813.scala:10: error: b is an ambiguous name on import
88import O.{a => b, toString => b} // error
9- ^
9+ ^
1010t12813.scala:11: error: toString is an ambiguous name on import
1111import O.{a => toString, toString} // error
12- ^
12+ ^
1313t12813.scala:12: error: toString is an ambiguous name on import
1414import O.{toString, a => toString} // error
15- ^
15+ ^
16165 errors
Original file line number Diff line number Diff line change 11t12813b.scala:5: error: a is imported twice
22import O.{a, a} // error
3- ^
4- t12813b.scala:8: error: b is an ambiguous name on import
3+ ^
4+ t12813b.scala:8: error: a is renamed twice to b
55import O.{a => b, a => b} // error
6- ^
6+ ^
77t12813b.scala:10: error: b is an ambiguous name on import
88import O.{a => b, toString => b} // error
9- ^
9+ ^
1010t12813b.scala:11: error: toString is an ambiguous name on import
1111import O.{a => toString, toString} // error
12- ^
12+ ^
1313t12813b.scala:12: error: toString is an ambiguous name on import
1414import O.{toString, a => toString} // error
15- ^
15+ ^
1616t12813b.scala:14: error: wildcard import must be in last position
1717import O.{given, a, _} // error 3
1818 ^
Original file line number Diff line number Diff line change 1- t12813c.scala:6: error: abcdefghij is an ambiguous name on import
1+ t12813c.scala:6: error: a is renamed twice to abcdefghij
22import O.{a => abcdefghij, a => abcdefghij}
3- ^
3+ ^
441 error
You can’t perform that action at this time.
0 commit comments