diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-13 07:26:00 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-13 07:26:00 +0800 |
commit | db9f12f158444c94a9e625461ed1424dd9baf8a5 (patch) | |
tree | 020ec1bc87a9c64fa456b5bb0b150844ff0a416e | |
parent | 912b426c753dd0c1de2acdf80dee6eefc5fea409 (diff) | |
download | mrust-db9f12f158444c94a9e625461ed1424dd9baf8a5.tar.gz |
HIR - Match function types
-rw-r--r-- | src/hir/type.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/hir/type.cpp b/src/hir/type.cpp index 15100c15..b6e930da 100644 --- a/src/hir/type.cpp +++ b/src/hir/type.cpp @@ -688,7 +688,20 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x return te.inner->match_test_generics_fuzz( sp, *xe.inner, resolve_placeholder, callback ); ), (Function, - TODO(sp, "Function"); + if( te.is_unsafe != xe.is_unsafe ) + return Compare::Unequal; + if( te.m_abi != xe.m_abi ) + return Compare::Unequal; + if( te.m_arg_types.size() != xe.m_arg_types.size() ) + return Compare::Unequal; + auto rv = Compare::Equal; + for( unsigned int i = 0; i < te.m_arg_types.size(); i ++ ) { + rv &= te.m_arg_types[i] .match_test_generics_fuzz( sp, xe.m_arg_types[i], resolve_placeholder, callback ); + if( rv == Compare::Unequal ) + return rv; + } + rv &= te.m_rettype->match_test_generics_fuzz( sp, *xe.m_rettype, resolve_placeholder, callback ); + return rv; ), (Closure, if( te.node != xe.node ) |