summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2017-01-03 00:14:18 +0800
committerJohn Hodge <tpg@mutabah.net>2017-01-03 00:14:18 +0800
commita25f03e36fc1deffb9deee1a16634b19d5cb677b (patch)
treefd1850fb4a7e272ababd6a35867a67104d14c5f3
parent63746ecbbf8a9e68a2c8ff1735032243ec29ee99 (diff)
downloadmrust-a25f03e36fc1deffb9deee1a16634b19d5cb677b.tar.gz
HIR Typecheck Expr - Expand associated types in visited paths
-rw-r--r--src/hir_typeck/expr_cs.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index bd4af2ee..65e759bb 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -3018,6 +3018,29 @@ namespace {
auto tmp = ::HIR::TypeRef(path.clone());
//auto tmp = ::HIR::TypeRef();
check_type_resolved_path(sp, path, tmp);
+ TU_MATCH(::HIR::Path::Data, (path.m_data), (pe),
+ (Generic,
+ for(auto& ty : pe.m_params.m_types)
+ ty = this->context.m_resolve.expand_associated_types(sp, mv$(ty));
+ ),
+ (UfcsInherent,
+ *pe.type = this->context.m_resolve.expand_associated_types(sp, mv$(*pe.type));
+ for(auto& ty : pe.params.m_types)
+ ty = this->context.m_resolve.expand_associated_types(sp, mv$(ty));
+ for(auto& ty : pe.impl_params.m_types)
+ ty = this->context.m_resolve.expand_associated_types(sp, mv$(ty));
+ ),
+ (UfcsKnown,
+ *pe.type = this->context.m_resolve.expand_associated_types(sp, mv$(*pe.type));
+ for(auto& ty : pe.params.m_types)
+ ty = this->context.m_resolve.expand_associated_types(sp, mv$(ty));
+ for(auto& ty : pe.trait.m_params.m_types)
+ ty = this->context.m_resolve.expand_associated_types(sp, mv$(ty));
+ ),
+ (UfcsUnknown,
+ throw "";
+ )
+ )
}
void check_type_resolved_path(const Span& sp, ::HIR::Path& path, const ::HIR::TypeRef& top_type) const {
TU_MATCH(::HIR::Path::Data, (path.m_data), (pe),