...

Text file src/cmd/gofmt/testdata/typeparams.input

Documentation: cmd/gofmt/testdata

     1// Copyright 2020 The Go Authors. All rights reserved.
     2// Use of this source code is governed by a BSD-style
     3// license that can be found in the LICENSE file.
     4
     5//gofmt
     6
     7package typeparams
     8
     9type T[  P any] struct{}
    10type T[P1, P2, P3 any] struct{}
    11
    12type T[P C] struct{}
    13type T[P1,P2, P3 C] struct{}
    14
    15type T[P C[P]] struct{}
    16type T[P1, P2, P3 C[P1,P2,P3]] struct{}
    17
    18func f[P any](x P)
    19func f[P1, P2, P3 any](x1 P1, x2 P2, x3 P3) struct{}
    20
    21func f[P interface{}](x P)
    22func f[P1, P2, P3 interface{ m1(P1); ~P2|~P3 }](x1 P1, x2 P2, x3 P3) struct{}
    23func f[P any](T1[P], T2[P]) T3[P]
    24
    25func (x T[P]) m()
    26func ((T[P])) m(x T[P]) P
    27
    28func _() {
    29	type _ []T[P]
    30	var _ []T[P]
    31	_ = []T[P]{}
    32}

View as plain text