From e0aee1f23c9978aba20ab42039f5c35133e845c1 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Sat, 11 Mar 2023 14:11:03 -0800 Subject: [PATCH] reflect: Type.AssignableTo(): you can assign anything to interface{} --- src/reflect/type.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/reflect/type.go b/src/reflect/type.go index 45af9683..328f5900 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -795,6 +795,11 @@ func (t *rawType) AssignableTo(u Type) bool { if t == u.(*rawType) { return true } + + if u.Kind() == Interface && u.NumMethod() == 0 { + return true + } + if u.Kind() == Interface { panic("reflect: unimplemented: AssignableTo with interface") }