Bob the Warlock has blown all of his spell slots. The friendly party druid casts Animal Forms on Bob, and while in his animal form he takes a Short Rest. After the rest completes, he drops out of animal form for whatever reason. Does Bob have his spell slots back, or does he have to take a rest while in his Warlock form to regain htem?
Rules Do What They Say
Unless overridden by another rule (specific beats general), spells and features do exactly what they say.
With Polymorph, You Don't Have The Feature
The Polymorph spell description contains the line:
The target’s game statistics, including mental ability scores, are replaced by the statistics of the chosen beast.
Class features are part of your statistics. Which means that at the time of the rest you don't have the Pact Magic feature. So despite having rested, while you rested you didn't have the feature that allows the slot to recharge.
Shapechange and Wild Shape Keep Class Features
Both the spell shapechange and the druid class feature Wild Shape contain the language:
Your game statistics are replaced by the statistics of the chosen creature, though you retain your alignment and Intelligence, Wisdom, and Charisma scores You also retain all of your skill and saving throw proficiencies [...]
You retain the benefit of any features from your class, race, or other source and can use them, provided that your new form is physically capable of doing so.
So, you'd be able to recharge your spell slots while shapechanged or Wild Shaped. Note that the "You retain" is an exception to the normal state of having your statistics replaced.