File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2015,11 +2015,24 @@ object Parsers {
2015
2015
/** ImportSelector ::= id [`=>' id | `=>' `_']
2016
2016
*/
2017
2017
def importSelector (): Tree = {
2018
+ val start = in.offset
2018
2019
val from = termIdentOrWildcard()
2019
2020
if (from.name != nme.WILDCARD && in.token == ARROW )
2020
2021
atPos(startOffset(from), in.skipToken()) {
2021
- Thicket (from, termIdentOrWildcard())
2022
+ val start2 = in.offset
2023
+ val to = termIdentOrWildcard()
2024
+ val toWithPos =
2025
+ if (to.name == nme.ERROR )
2026
+ // error identifiers don't consume any characters, so atPos(start)(id) wouldn't set a position.
2027
+ // Some testcases would then fail in Positioned.checkPos. Set a position anyway!
2028
+ atPos(start2, start2, in.lastOffset)(to)
2029
+ else
2030
+ to
2031
+ Thicket (from, toWithPos)
2022
2032
}
2033
+ else if (from.name == nme.ERROR ) {
2034
+ atPos(start, start, in.lastOffset)(from)
2035
+ }
2023
2036
else from
2024
2037
}
2025
2038
You can’t perform that action at this time.
0 commit comments