1
0
mirror of https://github.com/golang/go synced 2024-11-17 07:04:44 -07:00
go/test/typeparam/issue50481.go
Robert Griesemer c295137ad8 go/types, types2: disallow multiple blank type parameters
Work-around for #50481: report an error for multiple
blank type parameters. It's always possible to use
non-blank names in those cases.

We expect to lift this restriction for 1.19.

For #50481.

Change-Id: Ifdd2d91340aac1da3387f7d80d46e44f5997c2a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/376058
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-01-07 00:02:57 +00:00

22 lines
852 B
Go

// errorcheck
// Copyright 2022 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
type _[_ any] struct{}
type _[_, _ any] struct{} // ERROR "cannot have multiple blank type parameters"
type _[_, _, _ any] struct{} // ERROR "cannot have multiple blank type parameters"
type _[a, _, b, _, c, _ any] struct{} // ERROR "cannot have multiple blank type parameters"
func _[_ any]() {}
func _[_, _ any]() {} // ERROR "cannot have multiple blank type parameters"
func _[_, _, _ any]() {} // ERROR "cannot have multiple blank type parameters"
func _[a, _, b, _, c, _ any]() {} // ERROR "cannot have multiple blank type parameters"
type S[P1, P2 any] struct{}
func (_ S[_, _]) m() {} // this is ok