[generics] Typo for type with type argument

140 views
Skip to first unread message

Christian Persson

unread,
Sep 21, 2020, 12:08:57 PM9/21/20
to golan...@googlegroups.com
Hello golang-nuts,

I have found a small typo in the current draft for generics. In the section "Function argument type inference" (https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#function-argument-type-inference), there is a function NewPair:

func NewPair[F any](f1, f2 F) *Pair(F) { ... }

The return type should be *Pair[F] (brackets instead of parentheses), right?

Kind regards,
Christian Persson

Ian Lance Taylor

unread,
Sep 21, 2020, 1:11:59 PM9/21/20
to Christian Persson, golang-nuts
On Mon, Sep 21, 2020 at 9:08 AM Christian Persson <chri...@cpersson.se> wrote:
>
> I have found a small typo in the current draft for generics. In the section "Function argument type inference" (https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#function-argument-type-inference), there is a function NewPair:
>
> func NewPair[F any](f1, f2 F) *Pair(F) { ... }
>
> The return type should be *Pair[F] (brackets instead of parentheses), right?

Thanks for catching this. Sent https://golang.org/cl/256303 to fix it.

Ian
Reply all
Reply to author
Forward
0 new messages