"Fossies" - the Fresh Open Source Software Archive

Member "go/test/typeparam/mdempsky/2.go" (26 Apr 2023, 339 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 // 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 main
    8 
    9 type T[A, B, C any] int
   10 
   11 func (T[A, B, C]) m(x int) {
   12     if x <= 0 {
   13         return
   14     }
   15     T[B, C, A](0).m(x - 1)
   16 }
   17 
   18 func main() {
   19     T[int8, int16, int32](0).m(3)
   20 }