-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Description
Test program: https://play.golang.org/p/Jnga2_6Rmdf
Currently the v.M() and v.u.M() calls successfully print "M", but the v.u2.M() call panics due to accessing an unexported field.
I think the v.u.M() line should also panic. v.u is unexported just like v.u2, and the promoted method is already exposed on v's method set, so there's no need to be able to invoke v.u.M() via reflection. (This distinguishes it from accessing promoted fields, which requires allowing traversal through unexported fields.)
I think reflect.Value.Method should have been updated to use v.flag.ro() in golang.org/cl/66331 like all the other methods. I suspect I just overlooked it because it didn't fit the pattern of all the other cases.
/cc @ianlancetaylor
mvdan
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.