Source file test/typeparam/issue49516.go

     1  // compile
     2  
     3  // Copyright 2021 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 p
     8  
     9  type Q[T any] struct {
    10  	s []T
    11  }
    12  
    13  func (q *Q[T]) Push(v ...T) {
    14  	q.s = append(q.s, v...)
    15  }
    16  
    17  func pushN(push func(*Q[int], ...int), n int) {
    18  	var q Q[int]
    19  	for i := 0; i < n; i++ {
    20  		push(&q, i)
    21  	}
    22  }
    23  
    24  func f() {
    25  	pushN((*Q[int]).Push, 100)
    26  }
    27  

View as plain text