diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-20 10:08:40 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-20 10:08:40 +0800 |
commit | eb7b67e0f98180b1578e3d34ff00203b0131c98f (patch) | |
tree | 3964c32e8f195dc7a53777ffaeedd66993f53446 /src | |
parent | 5ab49fc3ef65679b8569c55ec26ea7ccd7022ba0 (diff) | |
download | mrust-eb7b67e0f98180b1578e3d34ff00203b0131c98f.tar.gz |
HIR Typecheck - Associated constant result type
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_check.cpp | 5 | ||||
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp index d0b2a21b..4af51aa6 100644 --- a/src/hir_typeck/expr_check.cpp +++ b/src/hir_typeck/expr_check.cpp @@ -914,7 +914,10 @@ namespace { } TU_MATCH( ::HIR::TraitValueItem, (it->second), (ie), (Constant, - TODO(sp, "Monomorpise associated constant type - " << ie.m_type); + 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); ), (Static, TODO(sp, "Monomorpise associated static type - " << ie.m_type); diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index c6d15a21..0a9b913f 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -1508,7 +1508,10 @@ namespace { } TU_MATCH( ::HIR::TraitValueItem, (it->second), (ie), (Constant, - TODO(sp, "Monomorpise associated constant type - " << ie.m_type); + 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 ); + this->context.equate_types(sp, node.m_res_type, ty); ), (Static, TODO(sp, "Monomorpise associated static type - " << ie.m_type); |