Source file test/typeparam/issue49049.go

     1  // run
     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 main
     8  
     9  type A[T any] interface {
    10  	m()
    11  }
    12  
    13  type Z struct {
    14  	a,b int
    15  }
    16  
    17  func (z *Z) m() {
    18  }
    19  
    20  func test[T any]() {
    21  	var a A[T] = &Z{}
    22  	f := a.m
    23  	f()
    24  }
    25  func main() {
    26  	test[string]()
    27  }
    28  

View as plain text