Skip to content

Instantly share code, notes, and snippets.

@FreekingDean
Created December 3, 2018 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FreekingDean/a7dc19ba2390cbf40386e94ea841294d to your computer and use it in GitHub Desktop.
Save FreekingDean/a7dc19ba2390cbf40386e94ea841294d to your computer and use it in GitHub Desktop.
Patch! :D
diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go
index 629186829a..fabae194be 100644
--- a/src/cmd/compile/internal/gc/subr.go
+++ b/src/cmd/compile/internal/gc/subr.go
@@ -1710,6 +1710,23 @@ func implements(t, iface *types.Type, m, samename **types.Field, ptr *int) bool
return false
}
tm := tms[i]
+
+ for _, f := range types.ParamsResults {
+ // Loop over fields in structs, ignoring argument names.
+ fs1, fs2 := f(tm.Type).FieldSlice(), f(im.Type).FieldSlice()
+ if len(fs1) != len(fs2) {
+ return false
+ }
+ for i, f1 := range fs1 {
+ f2 := fs2[i]
+ if f2.Type.IsInterface() {
+ return implements(f1.Type, f2.Type, m, samename, ptr)
+ }
+ if f1.IsDDD() != f2.IsDDD() || !types.Identical(f1.Type, f2.Type) {
+ return false
+ }
+ }
+ }
if tm.Nointerface() || !types.Identical(tm.Type, im.Type) {
*m = im
*samename = tm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment