Skip to content

Commit

Permalink
all: gofmt
Browse files Browse the repository at this point in the history
Gofmt to update doc comments to the new formatting.

(There are so many files in x/tools I am breaking up the
gofmt'ing into multiple CLs. This is the leftovers.)

For golang/go#51082.

Change-Id: Id9d440cde9de7093d2ffe06cbaa7098993823d6b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399363
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
  • Loading branch information
rsc authored and gopherbot committed Apr 12, 2022
1 parent d15fe1d commit 739de33
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
14 changes: 7 additions & 7 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ func OriginMethod(fn *types.Func) *types.Func {
//
// For example, consider the following type declarations:
//
// type Interface[T any] interface {
// Accept(T)
// }
// type Interface[T any] interface {
// Accept(T)
// }
//
// type Container[T any] struct {
// Element T
// }
// type Container[T any] struct {
// Element T
// }
//
// func (c Container[T]) Accept(t T) { c.Element = t }
// func (c Container[T]) Accept(t T) { c.Element = t }
//
// In this case, GenericAssignableTo reports that instantiations of Container
// are assignable to the corresponding instantiation of Interface.
Expand Down
2 changes: 1 addition & 1 deletion example/findtypeparams/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func MakePair[L, R Constraint](l L, r R) Pair[L, R] {
//!-input
`

//!+print
// !+print
func PrintTypeParams(fset *token.FileSet, file *ast.File) error {
conf := types.Config{Importer: importer.Default()}
info := &types.Info{
Expand Down
12 changes: 7 additions & 5 deletions normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ var ErrEmptyTypeSet = errors.New("empty type set")
// Structural type restrictions of a type parameter are created via
// non-interface types embedded in its constraint interface (directly, or via a
// chain of interface embeddings). For example, in the declaration
// type T[P interface{~int; m()}] int
//
// type T[P interface{~int; m()}] int
//
// the structural restriction of the type parameter P is ~int.
//
// With interface embedding and unions, the specification of structural type
// restrictions may be arbitrarily complex. For example, consider the
// following:
//
// type A interface{ ~string|~[]byte }
// type A interface{ ~string|~[]byte }
//
// type B interface{ int|string }
// type B interface{ int|string }
//
// type C interface { ~string|~int }
// type C interface { ~string|~int }
//
// type T[P interface{ A|B; C }] int
// type T[P interface{ A|B; C }] int
//
// In this example, the structural type restriction of P is ~string|int: A|B
// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int,
Expand Down
9 changes: 4 additions & 5 deletions typeterm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 739de33

Please sign in to comment.