From 59e15029d0dcf10c2cea1d13ca8c681758b2384a Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 9 Nov 2016 08:25:17 +0800 Subject: HIR Typecheck Expr - Treat an unbound type path as an ivar when searching for fields --- src/hir_typeck/expr_cs.cpp | 4 ++++ src/hir_typeck/helpers.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 1241f7b6..1f6dccdc 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -2647,6 +2647,10 @@ namespace { DEBUG("Hit ivar, returning early"); return ; } + if(ty.m_data.is_Path() && ty.m_data.as_Path().binding.is_Unbound()) { + DEBUG("Hit unbound path, returning early"); + return ; + } if( this->context.m_resolve.find_field(node.span(), ty, field_name, out_type) ) { this->context.equate_types(node.span(), node.m_res_type, out_type); break; diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index b7c995e4..6948e60c 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -3294,6 +3294,9 @@ unsigned int TraitResolution::autoderef_find_field(const Span& sp, const ::HIR:: if( ty.m_data.is_Infer() ) { return ~0u; } + if(ty.m_data.is_Path() && ty.m_data.as_Path().binding.is_Unbound()) { + return ~0u; + } if( this->find_field(sp, ty, field_name, field_type) ) { return deref_count; -- cgit v1.2.3