Source file test/fixedbugs/issue80976.go

     1  // run
     2  
     3  // Copyright 2026 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  // Instantiated method type arguments might refer to a type instantiation that
     8  // ends with the method name. Here, Set is instantiated using a type which
     9  // refers to HashSet[int].
    10  
    11  package main
    12  
    13  type TypeMap struct{}
    14  
    15  //go:noinline
    16  func (tm *TypeMap) Set[T any](v T) {}
    17  
    18  type HashSet[T any] struct{}
    19  
    20  type res struct{ s HashSet[int] }
    21  
    22  func main() { (&TypeMap{}).Set(res{}) }
    23  

View as plain text