You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that reflect.Type.NumMethod() returns 0 when called on interface types. This behavior is particularly problematic for functionalities like CBOR unmarshalling that rely on NumMethod() for type resolution.
Potential Source of Issue
This issue may stem from changes made in the following commit: acba074
The relevant code is:
Here, numMethods is incremented only under the hasMethodSet condition, which is set to false if the type is an interface. This might not be the intended functionality.
The code above is expected to print the type *main.A but instead it prints []uint8. Removing the if hasMethodSet condition from the code reference above results with the desired behavior.
The text was updated successfully, but these errors were encountered:
Description
It appears that
reflect.Type.NumMethod()
returns 0 when called on interface types. This behavior is particularly problematic for functionalities like CBOR unmarshalling that rely on NumMethod() for type resolution.Potential Source of Issue
This issue may stem from changes made in the following commit: acba074
The relevant code is:
Here,
numMethods
is incremented only under thehasMethodSet
condition, which is set to false if the type is an interface. This might not be the intended functionality.Example of Affected Code
Expected Behavior
The code above is expected to print the type
*main.A
but instead it prints[]uint8
. Removing theif hasMethodSet
condition from the code reference above results with the desired behavior.The text was updated successfully, but these errors were encountered: