From 609b469f75d77edf7e03dcdccc8caac28bef4e6f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 28 Oct 2016 12:34:36 +0800 Subject: HIR Typecheck Expr - Equate Self type in UfcsInherent method selection --- src/hir_typeck/expr_cs.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 768bc8fe..19cfee35 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -466,6 +466,14 @@ namespace { // Add trait bounds for all impl and function bounds apply_bounds_as_rules(context, sp, impl_ptr->m_params, cache.m_monomorph_cb); + // Equate `Self` and `impl_ptr->m_type` (after monomorph) + { + ::HIR::TypeRef tmp; + const auto& impl_ty_m = (monomorphise_type_needed(impl_ptr->m_type) ? tmp = monomorphise_type_with(sp, impl_ptr->m_type, cache.m_monomorph_cb) : impl_ptr->m_type); + + context.equate_types(sp, *e.type, impl_ty_m); + } + return true; } -- cgit v1.2.3