mirror of
https://github.com/golang/go
synced 2024-07-20 09:44:05 +00:00
9743e9b6d8
For hidden closure built during stenciling to implement a function instantiation, the function may come from other package, not local package, which causes the ICE for code that re-export the hidden closure after inlining. To fix it, use the closure package for export writer when writing out the closure itself. Fixes #51423 Change-Id: I23b067ba14e2d602a0fc3b2e99bd9317afbe53ff Reviewed-on: https://go-review.googlesource.com/c/go/+/391574 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
18 lines
318 B
Go
18 lines
318 B
Go
// Copyright 2022 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package a
|
|
|
|
type Comparator[T any] func(v1, v2 T) int
|
|
|
|
func CompareInt[T ~int](a, b T) int {
|
|
if a < b {
|
|
return -1
|
|
}
|
|
if a == b {
|
|
return 0
|
|
}
|
|
return 1
|
|
}
|