...

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

Documentation: internal/types/testdata/fixedbugs

     1  // Copyright 2023 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 p
     6  
     7  import (
     8  	"sort"
     9  	"strings"
    10  )
    11  
    12  func f[int any](x int) {
    13  	x = 0 /* ERRORx "cannot use 0.*(as int.*with int declared at|type parameter)" */
    14  }
    15  
    16  // test case from issue
    17  
    18  type Set[T comparable] map[T]struct{}
    19  
    20  func (s *Set[string]) String() string {
    21  	keys := make([]string, 0, len(*s))
    22  	for k := range *s {
    23  		keys = append(keys, k)
    24  	}
    25  	sort.Strings(keys /* ERRORx "cannot use keys.*with string declared at.*|type parameter" */ )
    26  	return strings /* ERROR "cannot use strings.Join" */ .Join(keys /* ERRORx "cannot use keys.*with string declared at.*|type parameter" */ , ",")
    27  }
    28  

View as plain text