diff options
-rw-r--r-- | src/hir_typeck/common.cpp | 12 | ||||
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 14 |
2 files changed, 10 insertions, 16 deletions
diff --git a/src/hir_typeck/common.cpp b/src/hir_typeck/common.cpp index dbe59702..2450f3fa 100644 --- a/src/hir_typeck/common.cpp +++ b/src/hir_typeck/common.cpp @@ -163,7 +163,11 @@ bool monomorphise_type_needed(const ::HIR::TypeRef& tpl) }); ), (UfcsInherent, - TODO(sp, "UfcsInherent - " << tpl); + return ::HIR::Path::Data::make_UfcsInherent({ + box$( clone_ty_with(sp, *e2.type, callback) ), + e2.item, + clone_ty_with__path_params(sp, e2.params, callback) + }); ) ) throw ""; @@ -319,11 +323,11 @@ bool monomorphise_type_needed(const ::HIR::TypeRef& tpl) ) throw ""; } -::HIR::TypeRef monomorphise_type_with_inner(const Span& sp, const ::HIR::TypeRef& tpl, t_cb_generic callback, bool allow_infer) +::HIR::TypeRef monomorphise_type_with_inner(const Span& sp, const ::HIR::TypeRef& outer_tpl, t_cb_generic callback, bool allow_infer) { - return clone_ty_with(sp, tpl, [&](const auto& tpl, auto& rv) { + return clone_ty_with(sp, outer_tpl, [&](const auto& tpl, auto& rv) { if( tpl.m_data.is_Infer() && !allow_infer ) - BUG(sp, "_ type found in monomorphisation target"); + BUG(sp, "_ type found in " << outer_tpl); if( tpl.m_data.is_Generic() ) { rv = callback(tpl).clone(); diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index ec963905..a1721b26 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -332,20 +332,10 @@ namespace { // --- Monomorphise the argument/return types (into current context) for(const auto& arg : fcn.m_args) { DEBUG("Arg " << arg.first << ": " << arg.second); - if( monomorphise_type_needed(arg.second) ) { - cache.m_arg_types.push_back( monomorphise_type_with(sp, arg.second, monomorph_cb, false) ); - } - else { - cache.m_arg_types.push_back( arg.second.clone() ); - } + cache.m_arg_types.push_back( monomorphise_type_with(sp, arg.second, monomorph_cb, false) ); } DEBUG("Ret " << fcn.m_return); - if( monomorphise_type_needed(fcn.m_return) ) { - cache.m_arg_types.push_back( monomorphise_type_with(sp, fcn.m_return, monomorph_cb, false) ); - } - else { - cache.m_arg_types.push_back( fcn.m_return.clone() ); - } + cache.m_arg_types.push_back( monomorphise_type_with(sp, fcn.m_return, monomorph_cb, false) ); // --- Apply bounds by adding them to the associated type ruleset apply_bounds_as_rules(context, sp, *cache.m_fcn_params, cache.m_monomorph_cb); |