Source file src/internal/types/testdata/spec/receivers.go

     1  // -gotypesalias=1
     2  
     3  // Copyright 2024 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package receivers
     8  
     9  // TODO(gri) add more tests checking the various restrictions on receivers
    10  
    11  type G[P any] struct{}
    12  type A[P any] = G[P]
    13  
    14  func (a A /* ERROR "cannot define new methods on generic alias type A[P any]" */ [P]) m() {}
    15  

View as plain text