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