Source file src/internal/types/testdata/fixedbugs/issue50427b.go
1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package p 6 7 // The parser does not accept type parameters for interface methods. 8 // In the past, type checking the code below led to a crash (#50427). 9 10 type T interface{ m[ /* ERROR "must have no type parameters" */ P any]() } 11 12 func _(t T) { 13 var _ interface{ m[ /* ERROR "must have no type parameters" */ P any](); n() } = t /* ERROR "does not implement" */ 14 } 15 16 // Type parameters on concrete methods are permitted as of Go 1.27. 17 18 type S struct{} 19 20 func (S) m[P any]() {} 21 22 func _(s S) { 23 var _ interface{ m[ /* ERROR "must have no type parameters" */ P any](); n() } = s /* ERROR "does not implement" */ 24 25 } 26