Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
  • Loading branch information
MadhavJivrajani committed Jul 17, 2023
1 parent 9f67429 commit 4fc3a3d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# dummy comment
.PHONY: verify
verify: verify-fmt verify-lint verify-apidiff vet test

Expand Down
2 changes: 1 addition & 1 deletion set/ordered.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package set
// that supports the operators < <= >= >.
// If future releases of Go add new ordered types,
// this constraint will be modified to include them.
type ordered interface {
type orderedBrokenAPI interface {
integer | float | ~string
}

Expand Down
8 changes: 4 additions & 4 deletions set/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ import (
type Empty struct{}

// Set is a set of the same type elements, implemented via map[ordered]struct{} for minimal memory consumption.
type Set[E ordered] map[E]Empty
type Set[E orderedBrokenAPI] map[E]Empty

// New creates a new set.
func New[E ordered](items ...E) Set[E] {
func New[E orderedBrokenAPI](items ...E) Set[E] {
ss := Set[E]{}
ss.Insert(items...)
return ss
}

// KeySet creates a Set[E] from a keys of a map[E](? extends interface{}).
func KeySet[E ordered, A any](theMap map[E]A) Set[E] {
func KeySet[E orderedBrokenAPI, A any](theMap map[E]A) Set[E] {
ret := Set[E]{}
for key := range theMap {
ret.Insert(key)
Expand Down Expand Up @@ -158,7 +158,7 @@ func (s Set[E]) Equal(s2 Set[E]) bool {
return s.Len() == s.Len() && s.IsSuperset(s2)
}

type sortableSlice[E ordered] []E
type sortableSlice[E orderedBrokenAPI] []E

func (s sortableSlice[E]) Len() int {
return len(s)
Expand Down
2 changes: 1 addition & 1 deletion set/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func TestSetClearInSeparateFunction(t *testing.T) {
}
}

func clearSetAndAdd[T ordered](s Set[T], a T) {
func clearSetAndAdd[T orderedBrokenAPI](s Set[T], a T) {
s.Clear()
s.Insert(a)
}

0 comments on commit 4fc3a3d

Please sign in to comment.