aboutsummaryrefslogtreecommitdiff
path: root/test/typeparam/list.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-07-28 13:39:30 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-07-28 21:40:40 +0000
commit53557530093938e19c21f6b02a482939ac6e634b (patch)
tree18d51aa04629aaad621399e997306118b36a5952 /test/typeparam/list.go
parent473e493d18c277d69e40a4930af045d474ff2be4 (diff)
downloadgo-53557530093938e19c21f6b02a482939ac6e634b.tar.gz
go-53557530093938e19c21f6b02a482939ac6e634b.zip
[dev.typeparams] test/typeparam: gofmt -w
We don't usually reformat the test directory, but all of the files in test/typeparam are syntactically valid. I suspect the misformattings here are because developers aren't re-installing gofmt with -tags=typeparams, not intentionally exercising non-standard formatting. Change-Id: I3767d480434c19225568f3c7d656dc8589197183 Reviewed-on: https://go-review.googlesource.com/c/go/+/338093 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'test/typeparam/list.go')
-rw-r--r--test/typeparam/list.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/typeparam/list.go b/test/typeparam/list.go
index c63c9bff79..adfe72f1de 100644
--- a/test/typeparam/list.go
+++ b/test/typeparam/list.go
@@ -11,10 +11,10 @@ import (
)
type Ordered interface {
- ~int | ~int8 | ~int16 | ~int32 | ~int64 |
- ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
- ~float32 | ~float64 |
- ~string
+ ~int | ~int8 | ~int16 | ~int32 | ~int64 |
+ ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
+ ~float32 | ~float64 |
+ ~string
}
// _List is a linked list of ordered values of type T.
@@ -34,9 +34,9 @@ func (l *_List[T]) Largest() T {
}
type OrderedNum interface {
- ~int | ~int8 | ~int16 | ~int32 | ~int64 |
- ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
- ~float32 | ~float64
+ ~int | ~int8 | ~int16 | ~int32 | ~int64 |
+ ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
+ ~float32 | ~float64
}
// _ListNum is a linked _List of ordered numeric values of type T.
@@ -64,40 +64,40 @@ func main() {
i2 := &_List[int]{i3, 3}
i1 := &_List[int]{i2, 2}
if got, want := i1.Largest(), 3; got != want {
- panic(fmt.Sprintf("got %d, want %d", got, want))
+ panic(fmt.Sprintf("got %d, want %d", got, want))
}
b3 := &_List[byte]{nil, byte(1)}
b2 := &_List[byte]{b3, byte(3)}
b1 := &_List[byte]{b2, byte(2)}
if got, want := b1.Largest(), byte(3); got != want {
- panic(fmt.Sprintf("got %d, want %d", got, want))
+ panic(fmt.Sprintf("got %d, want %d", got, want))
}
f3 := &_List[float64]{nil, 13.5}
f2 := &_List[float64]{f3, 1.2}
f1 := &_List[float64]{f2, 4.5}
if got, want := f1.Largest(), 13.5; got != want {
- panic(fmt.Sprintf("got %f, want %f", got, want))
+ panic(fmt.Sprintf("got %f, want %f", got, want))
}
s3 := &_List[string]{nil, "dd"}
s2 := &_List[string]{s3, "aa"}
s1 := &_List[string]{s2, "bb"}
if got, want := s1.Largest(), "dd"; got != want {
- panic(fmt.Sprintf("got %s, want %s", got, want))
+ panic(fmt.Sprintf("got %s, want %s", got, want))
}
j3 := &_ListNum[int]{nil, 1}
j2 := &_ListNum[int]{j3, 32}
j1 := &_ListNum[int]{j2, 2}
if got, want := j1.ClippedLargest(), 2; got != want {
- panic(fmt.Sprintf("got %d, want %d", got, want))
+ panic(fmt.Sprintf("got %d, want %d", got, want))
}
g3 := &_ListNum[float64]{nil, 13.5}
g2 := &_ListNum[float64]{g3, 1.2}
g1 := &_ListNum[float64]{g2, 4.5}
if got, want := g1.ClippedLargest(), 4.5; got != want {
- panic(fmt.Sprintf("got %f, want %f", got, want))
+ panic(fmt.Sprintf("got %f, want %f", got, want))
}
}