diff options
-rw-r--r-- | src/hir_typeck/expr_check.cpp | 12 | ||||
-rw-r--r-- | src/mir/helpers.cpp | 7 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp index a5d34186..14cc488c 100644 --- a/src/hir_typeck/expr_check.cpp +++ b/src/hir_typeck/expr_check.cpp @@ -965,8 +965,16 @@ namespace { (Constant, auto cb = monomorphise_type_get_cb(sp, &*e.type, &e.trait.m_params, nullptr); ::HIR::TypeRef tmp; - const auto& ty = ( monomorphise_type_needed(ie.m_type) ? tmp = monomorphise_type_with(sp, ie.m_type, cb) : ie.m_type ); - check_types_equal(sp, node.m_res_type, ty); + const ::HIR::TypeRef* typ; + if(monomorphise_type_needed(ie.m_type)) { + tmp = monomorphise_type_with(sp, ie.m_type, cb); + m_resolve.expand_associated_types(sp, tmp); + typ = &tmp; + } + else { + typ = &ie.m_type; + } + check_types_equal(sp, node.m_res_type, *typ); ), (Static, TODO(sp, "Monomorpise associated static type - " << ie.m_type); diff --git a/src/mir/helpers.cpp b/src/mir/helpers.cpp index b90f3cf6..10c9c780 100644 --- a/src/mir/helpers.cpp +++ b/src/mir/helpers.cpp @@ -287,8 +287,11 @@ const ::HIR::TypeRef& MIR::TypeResolve::get_param_type(::HIR::TypeRef& tmp, cons auto v = m_resolve.get_value(this->sp, e.p, p, /*signature_only=*/true); if( const auto* ve = v.opt_Constant() ) { const auto& ty = (*ve)->m_type; - if( monomorphise_type_needed(ty) ) - MIR_TODO(*this, "get_const_type - Monomorphise type " << ty); + if( monomorphise_type_needed(ty) ) { + auto rv = p.monomorph(this->sp, ty); + m_resolve.expand_associated_types(this->sp, rv); + return rv; + } else return ty.clone(); } |