Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
plugin: type switches fail with reflect-created types #24399
cmd/compile generates type hashes using MD5, but package reflect uses FNV-1 when dynamically constructing anonymous types. This causes type switches (which first search on type hash) to misbehave when using package plugin:
Notably, the failure goes away if the array type is constructed after the plugin.Open call, or if there's an explicit
Actually, on top of the type hashes not matching, there are also duplicate runtime types. The latter alone causes type assertions to also fail.
I suspect both (duplicate type descriptors + mismatched type hashes) need to be fixed for type switches to work correctly though.