diff options
-rw-r--r-- | src/hir/item_path.hpp | 6 | ||||
-rw-r--r-- | src/hir_typeck/outer.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/hir/item_path.hpp b/src/hir/item_path.hpp index 9f9949e1..11e3b0f4 100644 --- a/src/hir/item_path.hpp +++ b/src/hir/item_path.hpp @@ -54,13 +54,17 @@ public: assert(parent); assert(name); - if( parent->name ) { + // If the parent has a name, or the parent is the crate root. + if( parent->name || !parent->ty ) { return get_simple_path(); } else if( parent->trait ) { + assert(parent->ty); + assert(parent->trait_params); return ::HIR::Path( parent->ty->clone(), ::HIR::GenericPath(parent->trait->clone(), parent->trait_params->clone()), ::std::string(name) ); } else { + assert(parent->ty); return ::HIR::Path( parent->ty->clone(), ::std::string(name) ); } } diff --git a/src/hir_typeck/outer.cpp b/src/hir_typeck/outer.cpp index 6358e47e..dddb7731 100644 --- a/src/hir_typeck/outer.cpp +++ b/src/hir_typeck/outer.cpp @@ -291,6 +291,8 @@ namespace { // If not, ensure taht we're checking a function return type, and error if not if( ! m_fcn_path ) ERROR(sp, E0000, "Use of an erased type outside of a function return - " << ty); + assert(m_fcn_ptr); + DEBUG(*m_fcn_path << " " << m_fcn_erased_count); ::HIR::PathParams params; for(unsigned int i = 0; i < m_fcn_ptr->m_params.m_types.size(); i ++) |