mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
test: put type declaration back inside the function
Because issue #47631 has been fixed, remove TODO. Change-Id: Ic476616729f47485a18a5145bd28c87dd18b4492 Reviewed-on: https://go-review.googlesource.com/c/go/+/573775 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
c2c4a32f9e
commit
27fdef6168
@ -69,6 +69,10 @@ func m1[
|
|||||||
C1 interface{ chan int },
|
C1 interface{ chan int },
|
||||||
C2 interface{ chan int | chan string },
|
C2 interface{ chan int | chan string },
|
||||||
]() {
|
]() {
|
||||||
|
type m1S0 []int
|
||||||
|
type m1M0 map[string]int
|
||||||
|
type m1C0 chan int
|
||||||
|
|
||||||
_ = make([]int, 10)
|
_ = make([]int, 10)
|
||||||
_ = make(m1S0, 10)
|
_ = make(m1S0, 10)
|
||||||
_ = make(S1, 10)
|
_ = make(S1, 10)
|
||||||
@ -84,10 +88,6 @@ func m1[
|
|||||||
_ = make(C1)
|
_ = make(C1)
|
||||||
_ = make(C1, 10)
|
_ = make(C1, 10)
|
||||||
}
|
}
|
||||||
// TODO: put these type declarations back inside m1 when issue 47631 is fixed.
|
|
||||||
type m1S0 []int
|
|
||||||
type m1M0 map[string]int
|
|
||||||
type m1C0 chan int
|
|
||||||
|
|
||||||
// len/cap
|
// len/cap
|
||||||
|
|
||||||
|
@ -26,14 +26,12 @@ func at[T interface{ ~[]E }, E any](x T, i int) E {
|
|||||||
// type is itself, its "operational type" is defined by the type list in
|
// type is itself, its "operational type" is defined by the type list in
|
||||||
// the tybe bound, if any.
|
// the tybe bound, if any.
|
||||||
func _[T interface{ ~int }](x T) {
|
func _[T interface{ ~int }](x T) {
|
||||||
|
type myint int
|
||||||
var _ int = int(x)
|
var _ int = int(x)
|
||||||
var _ T = 42
|
var _ T = 42
|
||||||
var _ T = T(myint(42))
|
var _ T = T(myint(42))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: put this type declaration back inside the above function when issue 47631 is fixed.
|
|
||||||
type myint int
|
|
||||||
|
|
||||||
// Indexing a generic type which has a an array as core type.
|
// Indexing a generic type which has a an array as core type.
|
||||||
func _[T interface{ ~[10]int }](x T) {
|
func _[T interface{ ~[10]int }](x T) {
|
||||||
_ = x[9] // ok
|
_ = x[9] // ok
|
||||||
|
Loading…
x
Reference in New Issue
Block a user