Source file test/fixedbugs/issue54911.go

     1  // compile
     2  
     3  // Copyright 2022 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 Set[T comparable] map[T]struct{}
    10  
    11  func (s Set[T]) Add() Set[T] {
    12  	return s
    13  }
    14  
    15  func (s Set[T]) Copy() Set[T] {
    16  	return Set[T].Add(s)
    17  }
    18  
    19  func main() {
    20  	_ = Set[int]{42: {}}
    21  }
    22  

View as plain text