"Fossies" - the Fresh Open Source Software Archive

Member "go/test/typeparam/issue50598.dir/a0.go" (26 Apr 2023, 398 Bytes) of package /linux/misc/go1.20.4.src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 a0
    6 
    7 type Builder[T any] struct{}
    8 
    9 func (r Builder[T]) New1() T {
   10     var v T
   11     return v
   12 }
   13 
   14 func (r Builder[T]) New2() T {
   15     var v T
   16     return v
   17 }
   18 
   19 type IntBuilder struct{}
   20 
   21 func (b IntBuilder) New() int {
   22     return Builder[int]{}.New2()
   23 }