Anchor does not support map types like HashMap and thus treats them as user defined types
basically just copy/pasting the type from the Rust code, i.e. HashMap<String,DataItem>.
This PR adds a transformer function that runs before types are processed. This transformer
tries to detect these cases and converts them to proper map type definitions.
This won't work for 100% of the cases and thus is a stop gap for the cases we encounter for our
anchor programs.
Additionaly at this point it only transforms fields for structs, i.e. if such an invalid map
definition is nested somehow, it will go undetected.
These limitations can be improved on with each new case we need to handle.
Anchor does not support map types like
HashMap
and thus treats them as user defined types basically just copy/pasting the type from the Rust code, i.e.HashMap<String,DataItem>
.This PR adds a transformer function that runs before types are processed. This transformer tries to detect these cases and converts them to proper map type definitions. This won't work for 100% of the cases and thus is a stop gap for the cases we encounter for our anchor programs. Additionaly at this point it only transforms fields for structs, i.e. if such an invalid map definition is nested somehow, it will go undetected. These limitations can be improved on with each new case we need to handle.
FIXES: #75