Fixed some issues with type lookups, and support global type lookups in restrictions
Allow using enum types in fun/struct/union declarations