diff options
Diffstat (limited to 'test/typeparam/combine.go')
-rw-r--r-- | test/typeparam/combine.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/typeparam/combine.go b/test/typeparam/combine.go index 0e120cf242..5dfdb78442 100644 --- a/test/typeparam/combine.go +++ b/test/typeparam/combine.go @@ -13,18 +13,18 @@ import ( type Gen[A any] func() (A, bool) func Combine[T1, T2, T any](g1 Gen[T1], g2 Gen[T2], join func(T1, T2) T) Gen[T] { - return func() (T, bool) { - var t T - t1, ok := g1() - if !ok { - return t, false - } - t2, ok := g2() - if !ok { - return t, false - } - return join(t1, t2), true - } + return func() (T, bool) { + var t T + t1, ok := g1() + if !ok { + return t, false + } + t2, ok := g2() + if !ok { + return t, false + } + return join(t1, t2), true + } } type Pair[A, B any] struct { @@ -37,7 +37,7 @@ func _NewPair[A, B any](a A, b B) Pair[A, B] { } func Combine2[A, B any](ga Gen[A], gb Gen[B]) Gen[Pair[A, B]] { - return Combine(ga, gb, _NewPair[A, B]) + return Combine(ga, gb, _NewPair[A, B]) } func main() { @@ -60,6 +60,6 @@ func main() { } gc4 := Combine2(g1, g3) if got, ok := gc4(); !ok || got.A != 3 || got.B != "y" { - panic (fmt.Sprintf("got %v, %v, wanted {3, y}, true", got, ok)) + panic(fmt.Sprintf("got %v, %v, wanted {3, y}, true", got, ok)) } } |