diff --git a/src/protocol/parser/token_parsing.rs b/src/protocol/parser/token_parsing.rs index 47f02e7f6c2367f467a348b4363af2e28a590014..1a81840b3c5a4c112d01c7cd0e032cc66ba87ecd 100644 --- a/src/protocol/parser/token_parsing.rs +++ b/src/protocol/parser/token_parsing.rs @@ -540,7 +540,8 @@ fn is_reserved_expression_keyword(text: &[u8]) -> bool { match text { KW_LET | KW_CAST | KW_LIT_TRUE | KW_LIT_FALSE | KW_LIT_NULL | - KW_FUNC_GET | KW_FUNC_PUT | KW_FUNC_FIRES | KW_FUNC_CREATE | KW_FUNC_ASSERT | KW_FUNC_LENGTH | KW_FUNC_PRINT => true, + // TODO: Remove this once global namespace errors work @nocommit + // KW_FUNC_GET | KW_FUNC_PUT | KW_FUNC_FIRES | KW_FUNC_CREATE | KW_FUNC_ASSERT | KW_FUNC_LENGTH | KW_FUNC_PRINT => true, _ => false, } } @@ -603,15 +604,16 @@ pub(crate) fn construct_symbol_conflict_error( format!("the type '{}' imported here", symbol.name.as_str()), Some(import.as_symbols().span) ); - } else { - // This is a defined symbol. So this must mean that the - // error was caused by it being defined. - debug_assert_eq!(definition.defined_in_module, module.root_id); - + } else if definition.defined_in_module == module.root_id { + // This is a symbol defined in the same module return ( format!("the type '{}' defined here", symbol.name.as_str()), Some(definition.identifier_span) ) + } else { + // Not imported, not defined in the module, so must be + // a global + return (format!("the global '{}'", symbol.name.as_str()), None) } } }