From 3e63ff7d57e90289e5c03c94002a0777d3f75b6a Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 22 Sep 2017 12:47:22 +0800 Subject: HIR Typecheck - Fix bug with get_full_path on functions in the root crate --- src/hir/item_path.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/hir') 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) ); } } -- cgit v1.2.3