go/api/next
Alan Donovan 8e734ec954 go/ast: fix BasicLit.End position for raw strings containing \r
This CL causes the parser to record in a new field, BasicLit.EndPos,
the actual end position of each literal token, and to use it in
BasicLit.End. Previously, the End was computed heuristically as
Pos + len(Value). This heuristic is incorrect for a multiline
raw string literal on Windows, since the scanner normalizes
\r\n to \n.

Unfortunately the actual end position is not returned by the
Scanner.Scan method, so the scanner and parser conspire
using a global variable in the go/internal/scannerhook
package to communicate.

+ test, api change, relnote

Fixes #76031

Change-Id: I57c18a44e85f7403d470ba23d41dcdcc5a9432c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/720060
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-17 10:52:48 -08:00
..
49097.txt net: context aware Dialer.Dial functions 2025-08-11 14:26:10 -07:00
51945.txt errors: add AsType 2025-09-30 10:22:08 -07:00
61642.txt net/netip: export Prefix.Compare, fix ordering 2025-09-03 15:10:15 -07:00
63963.txt crypto/ecdsa: deprecate direct use of big.Int fields in keys 2025-09-09 12:20:39 -07:00
65954.txt log/slog: add multiple handlers support for logger 2025-09-04 11:07:44 -07:00
67546.txt database/sql: allow drivers to override Scan behavior 2025-08-11 14:27:36 -07:00
67813.txt net/http: add HTTP2Config.StrictMaxConcurrentRequests 2025-09-26 16:14:14 -07:00
68021.txt go/ast: add ParseDirective for parsing directive comments 2025-10-21 14:49:10 -07:00
70352.txt os: add (*Process).WithHandle 2025-09-15 12:17:42 -07:00
71287.txt cmd/go, testing: add TB.ArtifactDir and -artifacts flag 2025-10-07 14:39:32 -07:00
73161.txt net/http/httputil: deprecate ReverseProxy.Director 2025-10-02 12:53:31 -07:00
73627.txt crypto/mlkem/mlkemtest: add derandomized Encapsulate768/1024 2025-11-17 09:54:06 -08:00
73794.txt bytes: add Buffer.Peek 2025-11-03 09:39:00 -08:00
75302.txt crypto/rsa: deprecate PKCS#1 v1.5 encryption 2025-11-15 15:41:23 -08:00
75849.txt go/token: add (*File).End method 2025-11-17 09:47:47 -08:00
76031.txt go/ast: fix BasicLit.End position for raw strings containing \r 2025-11-17 10:52:48 -08:00