diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-01-03 22:57:59 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-01-03 22:57:59 +0800 |
commit | 1c752cfb7f0fced838e9228aecd3908222958465 (patch) | |
tree | d0e2b49eac299478e14545286f4add421697c6cc | |
parent | 5ff7238a4caf78da70987cd9e0851add01425590 (diff) | |
download | mrust-1c752cfb7f0fced838e9228aecd3908222958465.tar.gz |
Typecheck Expressions - Handle placeholder params better
-rw-r--r-- | src/hir_typeck/impl_ref.cpp | 9 | ||||
-rw-r--r-- | src/hir_typeck/impl_ref.hpp | 9 |
2 files changed, 10 insertions, 8 deletions
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<const ::HIR::TypeRef&(const ::HIR::TypeRef&)> get_cb_monomorph_traitimpl(const Span& sp) const; |