From 1c752cfb7f0fced838e9228aecd3908222958465 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 3 Jan 2019 22:57:59 +0800 Subject: Typecheck Expressions - Handle placeholder params better --- src/hir_typeck/impl_ref.cpp | 9 +++++++++ src/hir_typeck/impl_ref.hpp | 9 +-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/hir_typeck/impl_ref.cpp b/src/hir_typeck/impl_ref.cpp index d2dc9fe6..1aa8fc2b 100644 --- a/src/hir_typeck/impl_ref.cpp +++ b/src/hir_typeck/impl_ref.cpp @@ -56,6 +56,15 @@ bool ImplRef::overlaps_with(const ::HIR::Crate& crate, const ImplRef& other) con ) return false; } +bool ImplRef::has_magic_params() const +{ + TU_IFLET(Data, m_data, TraitImpl, e, + for(const auto& t : e.params_ph) + if( visit_ty_with(t, [](const ::HIR::TypeRef& t){ return t.m_data.is_Generic() && (t.m_data.as_Generic().binding >> 8) == 2; }) ) + return true; + ) + return false; +} bool ImplRef::type_is_specialisable(const char* name) const { TU_MATCH(Data, (this->m_data), (e), diff --git a/src/hir_typeck/impl_ref.hpp b/src/hir_typeck/impl_ref.hpp index b1190c61..84d0b404 100644 --- a/src/hir_typeck/impl_ref.hpp +++ b/src/hir_typeck/impl_ref.hpp @@ -59,14 +59,7 @@ struct ImplRef bool more_specific_than(const ImplRef& other) const; bool overlaps_with(const ::HIR::Crate& crate, const ImplRef& other) const; - bool has_magic_params() const { - TU_IFLET(Data, m_data, TraitImpl, e, - for(const auto& t : e.params_ph) - if( t.m_data.is_Generic() && (t.m_data.as_Generic().binding >> 8) == 2 ) - return true; - ) - return false; - } + bool has_magic_params() const; /// HELPER: Returns callback to monomorphise a type using parameters from Data::TraitImpl ::std::function get_cb_monomorph_traitimpl(const Span& sp) const; -- cgit v1.2.3