diff --git a/src/cmd/go2go/testdata/go2path/src/alg/alg.go2 b/src/cmd/go2go/testdata/go2path/src/alg/alg.go2 index 593610d2b1..3d1b420f60 100644 --- a/src/cmd/go2go/testdata/go2path/src/alg/alg.go2 +++ b/src/cmd/go2go/testdata/go2path/src/alg/alg.go2 @@ -5,10 +5,10 @@ // Package alg provides basic algorithms. package alg -import "contracts" +import "constraints" // Max returns the maximum of two values of some ordered type. -func Max(type T contracts.Ordered)(a, b T) T { +func Max(type T constraints.Ordered)(a, b T) T { if a < b { return b } @@ -16,7 +16,7 @@ func Max(type T contracts.Ordered)(a, b T) T { } // Min returns the minimum of two values of some ordered type. -func Min(type T contracts.Ordered)(a, b T) T { +func Min(type T constraints.Ordered)(a, b T) T { if a < b { return a } diff --git a/src/cmd/go2go/testdata/go2path/src/contracts/contracts.go2 b/src/cmd/go2go/testdata/go2path/src/constraints/constraints.go2 similarity index 90% rename from src/cmd/go2go/testdata/go2path/src/contracts/contracts.go2 rename to src/cmd/go2go/testdata/go2path/src/constraints/constraints.go2 index 0d2fc8ebed..ee757c4af6 100644 --- a/src/cmd/go2go/testdata/go2path/src/contracts/contracts.go2 +++ b/src/cmd/go2go/testdata/go2path/src/constraints/constraints.go2 @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package contracts defines some useful type bounds. -package contracts +// Package constraints defines some useful type constraints. +package constraints // Ordered permits any ordered type: any type that supports // the operations <, <=, >=, >, as well as == and !=. diff --git a/src/cmd/go2go/testdata/go2path/src/gsort/gsort.go2 b/src/cmd/go2go/testdata/go2path/src/gsort/gsort.go2 index f1c97bee18..3558f194fa 100644 --- a/src/cmd/go2go/testdata/go2path/src/gsort/gsort.go2 +++ b/src/cmd/go2go/testdata/go2path/src/gsort/gsort.go2 @@ -8,11 +8,11 @@ package gsort import ( "sort" - "contracts" + "constraints" ) // orderedSlice is a slice of values of some ordered type. -type orderedSlice(type Elem contracts.Ordered) []Elem +type orderedSlice(type Elem constraints.Ordered) []Elem // orderedSlice implements sort.Interface. @@ -30,7 +30,7 @@ func (s orderedSlice(Elem)) Less(i, j int) bool { func (s orderedSlice(Elem)) Swap(i, j int) { s[i], s[j] = s[j], s[i] } // OrderedSlice sorts a slice of any ordered type in ascending order. -func OrderedSlice(type Elem contracts.Ordered)(s []Elem) { +func OrderedSlice(type Elem constraints.Ordered)(s []Elem) { sort.Sort(orderedSlice(Elem)(s)) } diff --git a/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2 b/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2 index 412a946f73..9be9fa9e45 100644 --- a/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2 +++ b/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2 @@ -9,7 +9,7 @@ import ( "sort" "testing" - "contracts" + "constraints" "slices" ) @@ -31,7 +31,7 @@ func TestSortOrderedStrings(t *testing.T) { testOrdered(t, strs, sort.Strings) } -func testOrdered(type Elem contracts.Ordered)(t *testing.T, s []Elem, sorter func([]Elem)) { +func testOrdered(type Elem constraints.Ordered)(t *testing.T, s []Elem, sorter func([]Elem)) { s1 := make([]Elem, len(s)) copy(s1, s) s2 := make([]Elem, len(s)) diff --git a/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2 b/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2 index 49d2b4ac1b..d997e4ab4f 100644 --- a/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2 +++ b/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2 @@ -11,7 +11,7 @@ import ( "context" "chans" - "contracts" + "constraints" ) // Map is an ordered map. @@ -37,7 +37,7 @@ func New(type K, V)(compare func(K, K) int) *Map(K, V) { // NewOrdered returns a new map whose key is an ordered type. // This is like New, but does not require providing a compare function. // The map compare function uses the obvious key ordering. -func NewOrdered(type K contracts.Ordered, V interface{})() *Map(K, V) { +func NewOrdered(type K constraints.Ordered, V interface{})() *Map(K, V) { return New(K, V)(func(k1, k2 K) int { switch { case k1 < k2: diff --git a/src/cmd/go2go/testdata/go2path/src/slices/slices.go2 b/src/cmd/go2go/testdata/go2path/src/slices/slices.go2 index 69036c1586..ab687d6e20 100644 --- a/src/cmd/go2go/testdata/go2path/src/slices/slices.go2 +++ b/src/cmd/go2go/testdata/go2path/src/slices/slices.go2 @@ -8,7 +8,7 @@ package slices import ( "alg" - "contracts" + "constraints" ) // Equal reports whether two slices are equal: the same length and all @@ -76,7 +76,7 @@ func Filter(type Elem)(s []Elem, f func(Elem) bool) []Elem { // Max returns the maximum element in a slice of some ordered type. // If the slice is empty it returns the zero value of the element type. -func Max(type Elem contracts.Ordered)(s []Elem) Elem { +func Max(type Elem constraints.Ordered)(s []Elem) Elem { if len(s) == 0 { var zero Elem return zero @@ -86,7 +86,7 @@ func Max(type Elem contracts.Ordered)(s []Elem) Elem { // Min returns the minimum element in a slice of some ordered type. // If the slice is empty it returns the zero value of the element type. -func Min(type Elem contracts.Ordered)(s []Elem) Elem { +func Min(type Elem constraints.Ordered)(s []Elem) Elem { if len(s) == 0 { var zero Elem return zero diff --git a/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2 b/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2 index 0e4b57aaa5..5c2cdeeaf2 100644 --- a/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2 +++ b/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2 @@ -9,7 +9,7 @@ import ( "strings" "testing" - "contracts" + "constraints" ) func TestEqual(t *testing.T) { @@ -42,7 +42,7 @@ func TestEqual(t *testing.T) { } } -func offByOne(type Elem contracts.Integer)(a, b Elem) bool { +func offByOne(type Elem constraints.Integer)(a, b Elem) bool { return a == b + 1 || a == b - 1 }