diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 6 | ||||
-rw-r--r-- | src/hir_typeck/helpers.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index d2b369dd..f5d234e4 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -3528,7 +3528,6 @@ namespace { } } - DEBUG("TODO - Borrow Coercion " << context.m_ivars.fmt_type(ty_dst) << " from " << context.m_ivars.fmt_type(ty_src)); if( ty_dst.compare_with_placeholders(sp, ty_src, context.m_ivars.callback_resolve_infer()) != ::HIR::Compare::Unequal ) { context.equate_types(sp, ty_dst, ty_src); @@ -3536,9 +3535,11 @@ namespace { } // Keep trying + // TODO: If both types are fully known, then error. return false; } - bool check_coerce(Context& context, const Context::Coercion& v) { + bool check_coerce(Context& context, const Context::Coercion& v) + { ::HIR::ExprNodeP& node_ptr = *v.right_node_ptr; const auto& sp = node_ptr->span(); const auto& ty_dst = context.m_ivars.get_type(v.left_ty); @@ -3546,6 +3547,7 @@ namespace { TRACE_FUNCTION_F(v << " - " << ty_dst << " := " << ty_src); if( context.m_ivars.types_equal(ty_dst, ty_src) ) { + DEBUG("Equal"); return true; } diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp index 9a286f5f..5539131b 100644 --- a/src/hir_typeck/helpers.cpp +++ b/src/hir_typeck/helpers.cpp @@ -2350,6 +2350,7 @@ bool TraitResolution::find_method(const Span& sp, const HIR::t_trait_list& trait else if( ty.m_data.is_Path() && ty.m_data.as_Path().path.m_data.is_UfcsKnown() ) { const auto& e = ty.m_data.as_Path().path.m_data.as_UfcsKnown(); + DEBUG("UfcsKnown - Search associated type bounds in trait - " << e.trait); // UFCS known - Assuming that it's reached the maximum resolvable level (i.e. a type within is generic), search for trait bounds on the type const auto& trait = this->m_crate.get_trait_by_path(sp, e.trait.m_path); const auto& assoc_ty = trait.m_types.at( e.item ); @@ -2362,6 +2363,11 @@ bool TraitResolution::find_method(const Span& sp, const HIR::t_trait_list& trait continue ; DEBUG("- Found trait " << final_trait_path); + if( monomorphise_pathparams_needed(final_trait_path.m_params) ) { + // `Self` = ty + TODO(sp, "Monomorphise trait path " << final_trait_path << " into correct scope"); + } + // Found the method, return the UFCS path for it fcn_path = ::HIR::Path( ::HIR::Path::Data::make_UfcsKnown({ box$( ty.clone() ), |