summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2017-08-22 21:22:09 +0800
committerJohn Hodge <tpg@mutabah.net>2017-08-22 21:22:09 +0800
commit0eb50366561cd91bed78b3e721e6ea94dbecded1 (patch)
tree53dd1ab175275bfe902d36a9deda5219b9003442 /src
parent251e49aef76e46af5005978ac25650aab4f94313 (diff)
downloadmrust-0eb50366561cd91bed78b3e721e6ea94dbecded1.tar.gz
Typecheck/MIR - Some missing EAT invocations
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_check.cpp12
-rw-r--r--src/mir/helpers.cpp7
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();
}