We can sometimes get incomplete cache keys (e.g. from not accounting for used type IDs/etc. by an aliasee) when using aliases. This patch aims to fix that.
If you want me to build my own specific test for this, I'm happy to do so. Tweaking this existing test seems to work just as well, though. Please let me know :)