-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Closed
Copy link
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version
)?
$ go version devel go1.18-90fb5a4f97 Wed Dec 22 00:11:21 2021 +0000
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env
What did you do?
https://gotipplay.golang.org/p/-LsXizeqqJK
package main
import (
"fmt"
)
type Foo[T any] struct {
t T
}
func (f Foo[T]) Do[T any] () {
fmt.Println(f.t)
}
What did you expect to see?
The methods cannot have type parameters
compiler error
What did you see instead?
./prog.go:11:19: methods cannot have type parameters
./prog.go:11:20: invalid AST: method must have no type parameters
./prog.go:11:20: T redeclared in this block
prog.go:11:13: other declaration of T
Not a big deal, but it probably would be a better DX to report methods cannot have type parameters
only once.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.