Fix handling of inline annotation dictionaries

This should fix issue #2835.