Source file test/typeparam/devirtualize1.go

     1  // run
     2  
     3  // Copyright 2023 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 S struct {
    10  	x int
    11  }
    12  
    13  func (t *S) M1() {
    14  }
    15  
    16  func F[T any](x T) any {
    17  	return x
    18  }
    19  
    20  func main() {
    21  	F(&S{}).(interface{ M1() }).M1()
    22  }
    23  

View as plain text