aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2022-04-20 22:19:49 -0700
committerRobert Griesemer <gri@golang.org>2022-05-03 14:51:51 +0000
commit920b9ab57dc6be573e8da705f13cf17ebab65342 (patch)
tree11b807db5976b5ab6f6c7a82b305cb4cd959b963 /src/runtime/string.go
parent3e00bd0ae4482064aa9eac0695078b1096ee913a (diff)
downloadgo-920b9ab57dc6be573e8da705f13cf17ebab65342.tar.xz
cmd/compile/internal/syntax: accept all valid type parameter lists
Type parameter lists starting with the form [name *T|...] or [name (X)|...] may look like an array length expression [x]. Only after parsing the entire initial expression and checking whether the expression contains type elements or is followed by a comma can we make the final decision. This change simplifies the existing parsing strategy: instead of trying to make an upfront decision with limited information (which is insufficient), the parser now parses the start of a type parameter list or array length specification as expression. In a second step, if the expression can be split into a name followed by a type element, or a name followed by an ordinary expression which is succeeded by a comma, we assume a type parameter list (because it can't be an array length). In all other cases we assume an array length specification. Fixes #49482. Change-Id: I269b6291999bf60dc697d33d24a5635f01e065b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/402256 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/string.go')
0 files changed, 0 insertions, 0 deletions