@@ -36,7 +36,6 @@ import (
3636"strings"
3737
3838"github.com/google/go-cmp/cmp/internal/diff"
39- "github.com/google/go-cmp/cmp/internal/flags"
4039"github.com/google/go-cmp/cmp/internal/function"
4140"github.com/google/go-cmp/cmp/internal/value"
4241)
@@ -319,7 +318,6 @@ func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool {
319318}
320319
321320func (s * state ) callTRFunc (f , v reflect.Value , step Transform ) reflect.Value {
322- v = sanitizeValue (v , f .Type ().In (0 ))
323321if ! s .dynChecker .Next () {
324322return f .Call ([]reflect.Value {v })[0 ]
325323}
@@ -343,8 +341,6 @@ func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value {
343341}
344342
345343func (s * state ) callTTBFunc (f , x , y reflect.Value ) bool {
346- x = sanitizeValue (x , f .Type ().In (0 ))
347- y = sanitizeValue (y , f .Type ().In (1 ))
348344if ! s .dynChecker .Next () {
349345return f .Call ([]reflect.Value {x , y })[0 ].Bool ()
350346}
@@ -372,19 +368,6 @@ func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) {
372368ret = f .Call (vs )[0 ]
373369}
374370
375- // sanitizeValue converts nil interfaces of type T to those of type R,
376- // assuming that T is assignable to R.
377- // Otherwise, it returns the input value as is.
378- func sanitizeValue (v reflect.Value , t reflect.Type ) reflect.Value {
379- // TODO(≥go1.10): Workaround for reflect bug (https://golang.org/issue/22143).
380- if ! flags .AtLeastGo110 {
381- if v .Kind () == reflect .Interface && v .IsNil () && v .Type () != t {
382- return reflect .New (t ).Elem ()
383- }
384- }
385- return v
386- }
387-
388371func (s * state ) compareStruct (t reflect.Type , vx , vy reflect.Value ) {
389372var addr bool
390373var vax , vay reflect.Value // Addressable versions of vx and vy
0 commit comments