refactor infer var storage cleanup the code, discovered while working on #118725
custom_encodable
encodable