diff options
author | John Hodge <tpg@mutabah.net> | 2016-07-10 20:43:03 +1000 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-07-10 20:43:03 +1000 |
commit | 97c86d34ed71e42a3246f8bb9f38ad866889891d (patch) | |
tree | 56a0de1cb72b2cf2c3e3174038b527af0b29b73e | |
parent | 1969cd243978292d3b94ac250077234c4fef5cba (diff) | |
download | mrust-97c86d34ed71e42a3246f8bb9f38ad866889891d.tar.gz |
HIR Typecheck CS - Only fire missing impl error when the types are fully known
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index a29026d0..ea436dae 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -1065,7 +1065,7 @@ namespace { (UfcsInherent, // TODO: If ivars are valid within the type of this UFCS, then resolution has to be deferred until iteration // - If they're not valid, then resolution can be done here. - TODO(sp, "Handle associated constants/functions in type - Can the type be infer?"); + ASSERT_BUG(sp, !this->context.m_ivars.type_contains_ivars(*e.type), "Found ivar in UfcsInherent"); #if 0 // - Locate function (and impl block) @@ -1142,6 +1142,7 @@ namespace { this->context.equate_types(node.span(), node.m_res_type, ty); #endif + TODO(sp, "Handle associated constants/functions in type - Can the type be infer?"); ) ) } @@ -2954,8 +2955,11 @@ namespace { // No applicable impl // - TODO: This should really only fire when there isn't an impl. But it currently fires when _ DEBUG("No impl of " << v.trait << context.m_ivars.fmt(v.params) << " for " << context.m_ivars.fmt_type(v.impl_ty)); - if( !context.m_ivars.type_contains_ivars(v.impl_ty) ) { - ERROR(sp, E0000, "Failed to find an impl of " << v.trait << v.params << " for " << context.m_ivars.fmt_type(v.impl_ty)); + bool is_known = !context.m_ivars.type_contains_ivars(v.impl_ty); + for(const auto& t : v.params.m_types) + is_known &= !context.m_ivars.type_contains_ivars(t); + if( is_known ) { + ERROR(sp, E0000, "Failed to find an impl of " << v.trait << context.m_ivars.fmt(v.params) << " for " << context.m_ivars.fmt_type(v.impl_ty)); } return false; } |