Source file test/typeparam/issue51423.dir/a.go

     1  // Copyright 2022 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 a
     6  
     7  type Comparator[T any] func(v1, v2 T) int
     8  
     9  func CompareInt[T ~int](a, b T) int {
    10  	if a < b {
    11  		return -1
    12  	}
    13  	if a == b {
    14  		return 0
    15  	}
    16  	return 1
    17  }
    18  

View as plain text