mirror of https://github.com/golang/go.git
cmd/compile/internal/syntax: fix/update various comments
Change-Id: I30b448c8fcdbad94afcd7ff0dfc5cfebb485bdd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/538855 Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
0aa2197279
commit
34a5830c26
|
|
@ -1147,7 +1147,7 @@ loop:
|
|||
}
|
||||
|
||||
// x[i:...
|
||||
// For better error message, don't simply use p.want(_Colon) here (issue #47704).
|
||||
// For better error message, don't simply use p.want(_Colon) here (go.dev/issue/47704).
|
||||
if !p.got(_Colon) {
|
||||
p.syntaxError("expected comma, : or ]")
|
||||
p.advance(_Comma, _Colon, _Rbrack)
|
||||
|
|
@ -2322,7 +2322,7 @@ func (p *parser) header(keyword token) (init SimpleStmt, cond Expr, post SimpleS
|
|||
// asking for a '{' rather than a ';' here leads to a better error message
|
||||
p.want(_Lbrace)
|
||||
if p.tok != _Lbrace {
|
||||
p.advance(_Lbrace, _Rbrace) // for better synchronization (e.g., issue #22581)
|
||||
p.advance(_Lbrace, _Rbrace) // for better synchronization (e.g., go.dev/issue/22581)
|
||||
}
|
||||
}
|
||||
if keyword == _For {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Test case for issue 23434: Better synchronization of
|
||||
// Test case for go.dev/issue/23434: Better synchronization of
|
||||
// parser after missing type. There should be exactly
|
||||
// one error each time, with now follow errors.
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ type T /* ERROR unexpected newline */
|
|||
|
||||
type Map map[int] /* ERROR unexpected newline */
|
||||
|
||||
// Examples from #23434:
|
||||
// Examples from go.dev/issue/23434:
|
||||
|
||||
func g() {
|
||||
m := make(map[string] /* ERROR unexpected ! */ !)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Test cases for issue 31092: Better synchronization of
|
||||
// Test cases for go.dev/issue/31092: Better synchronization of
|
||||
// parser after seeing an := rather than an = in a const,
|
||||
// type, or variable declaration.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// This file is like map.go2, but instead if importing chans, it contains
|
||||
// This file is like map.go, but instead of importing chans, it contains
|
||||
// the necessary functionality at the end of the file.
|
||||
|
||||
// Package orderedmap provides an ordered map, implemented as a binary tree.
|
||||
|
|
@ -23,7 +23,7 @@ type node[K, V any] struct {
|
|||
|
||||
// New returns a new map.
|
||||
func New[K, V any](compare func(K, K) int) *Map[K, V] {
|
||||
return &Map[K, V]{compare: compare}
|
||||
return &Map[K, V]{compare: compare}
|
||||
}
|
||||
|
||||
// find looks up key in the map, and returns either a pointer
|
||||
|
|
@ -85,7 +85,7 @@ func (m *Map[K, V]) InOrder() *Iterator[K, V] {
|
|||
// Stop sending values if sender.Send returns false,
|
||||
// meaning that nothing is listening at the receiver end.
|
||||
return f(n.left) &&
|
||||
sender.Send(keyValue[K, V]{n.key, n.val}) &&
|
||||
sender.Send(keyValue[K, V]{n.key, n.val}) &&
|
||||
f(n.right)
|
||||
}
|
||||
go func() {
|
||||
|
|
@ -119,7 +119,7 @@ func chans_Ranger[T any]() (*chans_Sender[T], *chans_Receiver[T])
|
|||
// A sender is used to send values to a Receiver.
|
||||
type chans_Sender[T any] struct {
|
||||
values chan<- T
|
||||
done <-chan bool
|
||||
done <-chan bool
|
||||
}
|
||||
|
||||
func (s *chans_Sender[T]) Send(v T) bool {
|
||||
|
|
@ -137,10 +137,10 @@ func (s *chans_Sender[T]) Close() {
|
|||
|
||||
type chans_Receiver[T any] struct {
|
||||
values <-chan T
|
||||
done chan<- bool
|
||||
done chan<- bool
|
||||
}
|
||||
|
||||
func (r *chans_Receiver[T]) Next() (T, bool) {
|
||||
v, ok := <-r.values
|
||||
return v, ok
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func f[a t, b t, c /* ERROR missing type constraint */ ]()
|
|||
|
||||
func f[a b, /* ERROR expected ] */ 0] ()
|
||||
|
||||
// issue #49482
|
||||
// go.dev/issue/49482
|
||||
type (
|
||||
t[a *[]int] struct{}
|
||||
t[a *t,] struct{}
|
||||
|
|
@ -35,7 +35,7 @@ type (
|
|||
t[a *struct{}|~t] struct{}
|
||||
)
|
||||
|
||||
// issue #51488
|
||||
// go.dev/issue/51488
|
||||
type (
|
||||
t[a *t|t,] struct{}
|
||||
t[a *t|t, b t] struct{}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ type (
|
|||
_[_ t|~struct{}] t
|
||||
_[_ ~t|~struct{}] t
|
||||
|
||||
// test cases for issue #49175
|
||||
// test cases for go.dev/issue/49175
|
||||
_[_ []t]t
|
||||
_[_ [1]t]t
|
||||
_[_ ~[]t]t
|
||||
|
|
@ -52,7 +52,7 @@ type (
|
|||
t [ /* ERROR type parameters must be named */ t[0]]t
|
||||
)
|
||||
|
||||
// test cases for issue #49174
|
||||
// test cases for go.dev/issue/49174
|
||||
func _[_ t]() {}
|
||||
func _[_ []t]() {}
|
||||
func _[_ [1]t]() {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue