reflect: reflect.StructOf makes types that violate reflect.Type contracts #61433
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Consider the following code: https://go.dev/play/p/6MPHjq0B5km
It invokes
reflect.StructOf
method with two embedded fields, a struct and an interface. The resulting type has three methods, according toreflect.Type.NumMethod()
function. The method list isn't lexicographically sorted and contains duplicates.reflect.StructOf
has its limitations documented in godoc, but it doesn't explain the observed behavior.What did you expect to see?
Output:
What did you see instead?
Output:
The text was updated successfully, but these errors were encountered: