-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reflect: inconsistent method indexing between Type.Method and Value.Method #22073
Comments
Edit: Disregard. I somehow mangled the test file when copying locally. |
It looks like the issue is Type.Method uses (*rtype).exportedMethods, which filters out unexported methods. However, Value.Method just directly indexes into t.uncommonType().methods(). It seems unfortunate that package reflect needs to filter methods like this anyway. I would think the compiler could just statically partition exported and unexported ones. |
I believe we need the unexported method data for itabs in the runtime. But you're right that it could be statically partitioned. |
Change https://golang.org/cl/66770 mentions this issue: |
@crawshaw Yeah, runtime itab construction and reflect.Implements both need non-exported methods. |
From @ianlancetaylor's example in #22053, this program prints "string int" but should print "string string": https://play.golang.org/p/Kw_V41dmX2
Possibly relatedly, this program segfaults when
int
is replaced by a local named type: https://play.golang.org/p/k45kuWP75S/cc @crawshaw
The text was updated successfully, but these errors were encountered: