diff options
author | John Hodge <tpg@mutabah.net> | 2017-01-08 18:05:13 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-01-08 18:05:13 +0800 |
commit | c4d3a92a8f0a0f48470443b583d44f868c58c3b3 (patch) | |
tree | ead5b71809f9b4f611869c684e700f57de673a14 | |
parent | afd2e1f51aa63c33892a8532c04cc50c27c4ddb8 (diff) | |
download | mrust-c4d3a92a8f0a0f48470443b583d44f868c58c3b3.tar.gz |
HIR Typecheck Expr - Tweak
-rw-r--r-- | src/hir_typeck/helpers.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index a6543d77..921b7dfb 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -2807,10 +2807,25 @@ bool TraitResolution::find_trait_impls_crate(const Span& sp, auto cb_infer = [&](const auto& ty)->const auto& { if( ty.m_data.is_Infer() ) return this->m_ivars.get_type(ty); + #if 0 else if( ty.m_data.is_Generic() && ty.m_data.as_Generic().binding >> 8 == 2 ) { // Generic group 2 = Placeholders unsigned int i = ty.m_data.as_Generic().binding % 256; - TODO(sp, "Obtain placeholder " << i); + ASSERT_BUG(sp, i < impl_params.size(), "Placeholder param out of range - " << i << " >= " << placeholders.size()); + if( impl_params[i] ) + { + DEBUG("[ftic_check_params:cb_infer] " << ty << " = " << *impl_params[i]); + return *impl_params[i]; + } + else + { + ASSERT_BUG(sp, i < placeholders.size(), "Placeholder param out of range - " << i << " >= " << placeholders.size()); + const auto& ph = placeholders[i]; + if( ph.m_data.is_Generic() && ph.m_data.as_Generic().binding == i ) + TODO(sp, "[ftic_check_params:cb_infer] Placeholder " << i << " not yet bound"); + return ph; + } } + #endif else return ty; }; |