diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ast/expr.cpp | 2 | ||||
-rw-r--r-- | src/expand/lang_item.cpp | 6 | ||||
-rw-r--r-- | src/expand/mod.cpp | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/ast/expr.cpp b/src/ast/expr.cpp index ecd60def..c2b2889f 100644 --- a/src/ast/expr.cpp +++ b/src/ast/expr.cpp @@ -385,7 +385,7 @@ NV(ExprNode_Block, { }) NV(ExprNode_Macro, { - BUG(node.get_pos(), "Hit unexpanded macro in expression"); + BUG(node.get_pos(), "Hit unexpanded macro in expression - " << node); }) NV(ExprNode_Flow, { diff --git a/src/expand/lang_item.cpp b/src/expand/lang_item.cpp index 186f2cea..f8aea8c3 100644 --- a/src/expand/lang_item.cpp +++ b/src/expand/lang_item.cpp @@ -103,7 +103,11 @@ void handle_lang_item(const Span& sp, AST::Crate& crate, const AST::Path& path, auto rv = crate.m_lang_items.insert( ::std::make_pair( name, ::AST::Path(path) ) ); if( !rv.second ) { - ERROR(sp, E0000, "Duplicate definition of language item '" << name << "' - " << rv.first->second << " and " << path); + const auto& other_path = rv.first->second; + if( path != other_path ) { + // HACK: Anon modules get visited twice, so can lead to duplicate annotations + ERROR(sp, E0000, "Duplicate definition of language item '" << name << "' - " << other_path << " and " << path); + } } } diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp index aeeab185..4b60bab2 100644 --- a/src/expand/mod.cpp +++ b/src/expand/mod.cpp @@ -332,6 +332,11 @@ struct CExpandExpr: this->current_block = &node; this->visit_vector(node.m_nodes); this->current_block = saved; + + // HACK! Run Expand_Mod twice on local modules. + if( node.m_local_mod ) { + Expand_Mod(crate, modstack, node.m_local_mod->path(), *node.m_local_mod); + } } void visit(::AST::ExprNode_Flow& node) override { this->visit_nodelete(node, node.m_value); |