diff options
author | John Hodge <tpg@mutabah.net> | 2016-06-10 22:34:42 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-06-10 22:34:42 +0800 |
commit | ab095ae14d46abe5bc33e7f7305ac27cc13e63ce (patch) | |
tree | 6af32fc7afde700a8666d696afa0f6bff62b7b11 /src | |
parent | c5f53bf6e0c85899ff6498c8150e621f4d0ef1c8 (diff) | |
download | mrust-ab095ae14d46abe5bc33e7f7305ac27cc13e63ce.tar.gz |
HIR Typecheck - Fixed resolution when a trait impl's argument hits an unresolved ivar
Diffstat (limited to 'src')
-rw-r--r-- | src/hir/hir.cpp | 3 | ||||
-rw-r--r-- | src/hir_typeck/expr_context.cpp | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp index 9b00bcc0..742a2edf 100644 --- a/src/hir/hir.cpp +++ b/src/hir/hir.cpp @@ -41,7 +41,8 @@ namespace { if( right.m_data.is_Infer() ) { // TODO: Why is this false? A _ type could match anything - return false; + return left.m_data.is_Generic(); + //return true; } if( right.m_data.is_Generic() ) { return left.m_data.is_Generic(); diff --git a/src/hir_typeck/expr_context.cpp b/src/hir_typeck/expr_context.cpp index 69f89452..da8e81b8 100644 --- a/src/hir_typeck/expr_context.cpp +++ b/src/hir_typeck/expr_context.cpp @@ -1137,10 +1137,14 @@ bool typeck::TypecheckContext::find_trait_impls(const ::HIR::SimplePath& trait, slot_r = &ty; } }; - impl.m_type.match_generics(sp, *e2.type, cb_get_infer, cb_res); + bool fail = false; + fail |= !impl.m_type.match_test_generics(sp, *e2.type, cb_get_infer, cb_res); for( unsigned int i = 0; i < impl.m_trait_args.m_types.size(); i ++ ) { - impl.m_trait_args.m_types[i].match_generics(sp, e2.trait.m_params.m_types.at(i), cb_get_infer, cb_res); + fail |= !impl.m_trait_args.m_types[i].match_test_generics(sp, e2.trait.m_params.m_types.at(i), cb_get_infer, cb_res); + } + if( fail ) { + return false; } auto expand_placeholder = [&](const auto& ty)->const auto& { if( ty.m_data.is_Infer() ) |