Change information
Commit message:
internal/astutil: fix \r bug in PosInStringLiteral
While investigating golang/go#77675 I realized that there
would be a similar problem in PosInStringLiteral:
BasicLit.Value does not record \r carriage returns,
so we need to account for them by pretending we saw
one before each \n iff the literal contained any
carriage returns, which we can infer from a discrepancy
between its Pos-End range and the length of Value.
This change fixes that bug and adds the missing test.
(Ideally the logic in Hover--see CL 748322--would be moved to a
function in this package that is dual to PosInStringLiteral and
also has a test.)
Updates golang/go#77675
Change-Id: I1be3cbe2dddd72d936f399f177fe138541dde240
Files:
- M internal/astutil/stringlit.go
Change size: S
Delta: 1 file changed, 10 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Hongxiang Jiang
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI