1
0
mirror of https://github.com/golang/go synced 2024-11-24 02:30:12 -07:00
go/test/typeparam/issue48609.go
Ian Lance Taylor 79ff663754 constraints: remove Slice/Map/Chan
Now that we permit arbitrary types as constraints, we no longer need them.

For #48424

Change-Id: I15fef26a563988074650cb0801895b002c44148a
Reviewed-on: https://go-review.googlesource.com/c/go/+/359258
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-10-27 22:17:35 +00:00

17 lines
296 B
Go

// compile -G=3
// Copyright 2021 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 p
func f[T ~chan E, E any](e E) T {
ch := make(T)
go func() {
defer close(ch)
ch <- e
}()
return ch
}