]> Cypherpunks.ru repositories - gostls13.git/blob - test/typeparam/issue45817.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / typeparam / issue45817.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 import (
10         "fmt"
11 )
12
13 type s[T any] struct {
14         a T
15 }
16
17 func (x s[T]) f() T {
18         return x.a
19 }
20 func main() {
21         x := s[int]{a: 7}
22         f := x.f
23         if got, want := f(), 7; got != want {
24                 panic(fmt.Sprintf("got %d, want %d", got, want))
25         }
26 }