Source file src/internal/types/testdata/fixedbugs/issue46275.go

     1  // Copyright 2021 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 issue46275
     6  
     7  type N[T any] struct {
     8  	*N[T]
     9  	t T
    10  }
    11  
    12  func (n *N[T]) Elem() T {
    13  	return n.t
    14  }
    15  
    16  type I interface {
    17  	Elem() string
    18  }
    19  
    20  func _() {
    21  	var n1 *N[string]
    22  	var _ I = n1
    23  	type NS N[string]
    24  	var n2 *NS
    25  	var _ I = n2
    26  }
    27  

View as plain text