go/test/typeparam/issue50317.go
Robert Griesemer 042548b1fd cmd/compile: report type parameter error for methods only once
Move switch to enable method type parameters entirely
to the parser, by adding the mode AllowMethodTypeParams.
Ensure that the error messages are consistent.
Remove unnecessary code in the type checker.

Fixes #50317.

Change-Id: I4f3958722400bdb919efa4c494b85cf62f4002bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/376054
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-01-06 23:39:43 +00:00

16 lines
354 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 S struct{}
func (S) _[_ any]() {} // ERROR "method must have no type parameters"
type _ interface {
m[_ any]() // ERROR "method must have no type parameters"
}