diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-22 12:47:22 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-23 11:18:30 +0800 |
commit | 3e63ff7d57e90289e5c03c94002a0777d3f75b6a (patch) | |
tree | e11021572df6d0a53ed4e43571967eaf598e175b /src/hir/item_path.hpp | |
parent | 1af51991c707e59979a244320b9264e8c1230925 (diff) | |
download | mrust-3e63ff7d57e90289e5c03c94002a0777d3f75b6a.tar.gz |
HIR Typecheck - Fix bug with get_full_path on functions in the root crate
Diffstat (limited to 'src/hir/item_path.hpp')
-rw-r--r-- | src/hir/item_path.hpp | 6 |
1 files changed, 5 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) ); } } |