aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/analysis/fillstruct/testdata/src/typeparams/typeparams.go
blob: 90290613d879191ed99ceb4c83c2e66456fd4ab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package fillstruct

type emptyStruct[A any] struct{}

var _ = emptyStruct[int]{}

type basicStruct[T any] struct {
	foo T
}

var _ = basicStruct[int]{}

type fooType[T any] T

type twoArgStruct[F, B any] struct {
	foo fooType[F]
	bar fooType[B]
}

var _ = twoArgStruct[string, int]{}

var _ = twoArgStruct[int, string]{
	bar: "bar",
}

type nestedStruct struct {
	bar   string
	basic basicStruct[int]
}

var _ = nestedStruct{}

func _[T any]() {
	type S struct{ t T }
	x := S{}
	_ = x
}