mirror of https://github.com/golang/go.git
cmd/go2go: use predeclared comparable in maps test
(But embedding comparable doesn't work yet.) Change-Id: I977ca97597de47c79edb56b385c970392afb87f0
This commit is contained in:
parent
10b59aa539
commit
2044d8b94b
|
|
@ -5,13 +5,6 @@
|
|||
// Package maps implements simple functions to manipulate maps in various ways.
|
||||
package maps
|
||||
|
||||
contract comparable(T) {
|
||||
T int, int8, int16, int32, int64,
|
||||
uint, uint8, uint16, uint32, uint64, uintptr,
|
||||
float32, float64,
|
||||
string
|
||||
}
|
||||
|
||||
// Keys returns the keys of the map m.
|
||||
// The keys will be an indeterminate order.
|
||||
func Keys(type K, V comparable(K))(m map[K]V) []K {
|
||||
|
|
@ -33,8 +26,17 @@ func Values(type K, V comparable(K))(m map[K]V) []V {
|
|||
}
|
||||
|
||||
contract twocomparable(K, V) {
|
||||
comparable(K)
|
||||
comparable(V)
|
||||
// Should be
|
||||
// comparable(K)
|
||||
// comparable(V)
|
||||
K int, int8, int16, int32, int64,
|
||||
uint, uint8, uint16, uint32, uint64, uintptr,
|
||||
float32, float64,
|
||||
string
|
||||
V int, int8, int16, int32, int64,
|
||||
uint, uint8, uint16, uint32, uint64, uintptr,
|
||||
float32, float64,
|
||||
string
|
||||
}
|
||||
|
||||
// Equal reports whether two maps contain the same key/value pairs.
|
||||
|
|
|
|||
Loading…
Reference in New Issue