Properly handle local and nested scoping of messages and enums