]> Cypherpunks repositories - gostls13.git/commit
test: add a new test absdiff3.go which uses function callback
authorDan Scales <danscales@google.com>
Tue, 25 Jan 2022 17:50:03 +0000 (09:50 -0800)
committerDan Scales <danscales@google.com>
Tue, 25 Jan 2022 20:14:15 +0000 (20:14 +0000)
commit078ddecc327a20cec4751e66911197409e01f6d9
treed7be0eb804eccde8a31038f77c9a0051c32222e6
parent16d6a5233a183be7264295c66167d35c689f9372
test: add a new test absdiff3.go which uses function callback

We have disallowed having a typeparam on the right-hand-side of a type
declaration. So, we disabled much of the test absdiff.go. I recently
wrote a new test absdiff2.go to use a structure containing the type
param type, so I could attach a method properly and run the full test.

As a contrast, I thought I would create absdiff3.go, where the Abs
functionality is passed in as a function callback (but derived from a
generic function). This is simpler, and more inline with some of the
guidelines that Ian has been proposing (use passed-in functions rather
than requiring methods, when possible, for greater ease-of-use).

Only adds a new test absdiff3.go. (And fixes a comment in absdiff2.go.)

Change-Id: I6dd185b50a3baeec31f689a892319963468a7201
Reviewed-on: https://go-review.googlesource.com/c/go/+/380774
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
test/typeparam/absdiff2.go
test/typeparam/absdiff3.go [new file with mode: 0644]
test/typeparam/absdiffimp2.dir/a.go