From: Robert Griesemer Date: Mon, 22 Nov 2021 19:43:46 +0000 (-0800) Subject: spec: fix Swap example (correctly swap type arguments and parameters) X-Git-Tag: go1.18beta1~206 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0244343088e074c5f92b42a9812521f711a69410;p=gostls13.git spec: fix Swap example (correctly swap type arguments and parameters) Thanks to @danscales for noticing the mistake. Change-Id: I547ee80a78419765b82d39d7b34dc8d3bf962c35 Reviewed-on: https://go-review.googlesource.com/c/go/+/366215 Trust: Robert Griesemer Reviewed-by: Ian Lance Taylor Reviewed-by: Dan Scales --- diff --git a/doc/go_spec.html b/doc/go_spec.html index bf589f0ae6..ecd2f084c9 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -2808,7 +2808,7 @@ type Pair[A, B any] struct { b B } -func (p Pair[A, B]) Swap() Pair[A, B] { return Pair[A, B]{p.b, p.a} } +func (p Pair[A, B]) Swap() Pair[B, A] { return Pair[B, A]{p.b, p.a} } func (p Pair[First, _]) First() First { return p.a }