Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TESTING][Do Not Merge] #288

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
10 changes: 5 additions & 5 deletions set/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
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 @@
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 All @@ -168,12 +168,12 @@

// SortedList returns the contents as a sorted slice.
func (s Set[E]) SortedList() []E {
res := make(sortableSlice[E], 0, s.Len())
res = make(sortableSlice[E], 0, s.Len())

Check failure on line 171 in set/set.go

View workflow job for this annotation

GitHub Actions / lint

undefined: res

Check failure on line 171 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: res

Check failure on line 171 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: res

Check failure on line 171 in set/set.go

View workflow job for this annotation

GitHub Actions / build (1.21.x, windows-latest)

undefined: res

Check failure on line 171 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: res
for key := range s {
res = append(res, key)

Check failure on line 173 in set/set.go

View workflow job for this annotation

GitHub Actions / lint

undefined: res

Check failure on line 173 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: res

Check failure on line 173 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: res

Check failure on line 173 in set/set.go

View workflow job for this annotation

GitHub Actions / build (1.21.x, windows-latest)

undefined: res

Check failure on line 173 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: res
}
sort.Sort(res)

Check failure on line 175 in set/set.go

View workflow job for this annotation

GitHub Actions / lint

undefined: res

Check failure on line 175 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: res

Check failure on line 175 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: res

Check failure on line 175 in set/set.go

View workflow job for this annotation

GitHub Actions / build (1.21.x, windows-latest)

undefined: res

Check failure on line 175 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: res
return res

Check failure on line 176 in set/set.go

View workflow job for this annotation

GitHub Actions / lint

undefined: res (typecheck)

Check failure on line 176 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, ubuntu-latest)

undefined: res

Check failure on line 176 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.20.x, macos-latest)

undefined: res

Check failure on line 176 in set/set.go

View workflow job for this annotation

GitHub Actions / build (1.21.x, windows-latest)

undefined: res

Check failure on line 176 in set/set.go

View workflow job for this annotation

GitHub Actions / test (1.21.x, ubuntu-latest)

undefined: res
}

// UnsortedList returns the slice with contents in random order.
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)
}