Text file src/go/types/testdata/fixedbugs/issue50427.go2

     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 no longer parses type parameters for 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 S struct{}
    17  
    18  func (S) m[ /* ERROR "must have no type parameters" */ P any]() {}
    19  
    20  func _(s S) {
    21  	var _ interface{ m[ /* ERROR "must have no type parameters" */ P any](); n() } = s /* ERROR "does not implement" */
    22  
    23  }
    24  

View as plain text