https://go.dev/play/p/3Ru8nGnvTQY
The above program reports at run-time "panic: interface conversion: interface { T() go.shape.int_0 } is nil, not int".
I think the correct error is "panic: interface conversion: interface { T() int } is nil, not int".
The problem is the call to s.reflectType(src) in ssagen/ssa.go. This is too late to do dictionary lookups, so we end up using the *runtime._type for the shape type, rather than the user type.
We should push all the reflectdata.TypePtr / reflectdata.TypeLinksym calls earlier into the frontend, so they can be replaced with dictionary accesses when appropriate. Same applies to reflectdata.ITabAddr and reflectdata.ITabLSym.
/cc @randall77 @dr2chase @cuonglm
https://go.dev/play/p/3Ru8nGnvTQY
The above program reports at run-time "panic: interface conversion: interface { T() go.shape.int_0 } is nil, not int".
I think the correct error is "panic: interface conversion: interface { T() int } is nil, not int".
The problem is the call to
s.reflectType(src)in ssagen/ssa.go. This is too late to do dictionary lookups, so we end up using the *runtime._type for the shape type, rather than the user type.We should push all the
reflectdata.TypePtr/reflectdata.TypeLinksymcalls earlier into the frontend, so they can be replaced with dictionary accesses when appropriate. Same applies toreflectdata.ITabAddrandreflectdata.ITabLSym./cc @randall77 @dr2chase @cuonglm