diff options
author | John Hodge <tpg@ucc.asn.au> | 2016-08-05 12:51:11 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2016-08-05 12:51:11 +0800 |
commit | d3a7b742572e23a535571eb126a84a394c37dfe2 (patch) | |
tree | 9e6ab18b836539418105373d210e27b586fc8435 | |
parent | f3a6f968ac3b0c2c4e92801eaf35c27a8eb9a700 (diff) | |
download | mrust-d3a7b742572e23a535571eb126a84a394c37dfe2.tar.gz |
HIR Typecheck Check - ! matches anything
-rw-r--r-- | src/hir_typeck/expr_check.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp index 7b6b3705..f8cd8202 100644 --- a/src/hir_typeck/expr_check.cpp +++ b/src/hir_typeck/expr_check.cpp @@ -545,9 +545,16 @@ namespace { } void check_types_equal(const Span& sp, const ::HIR::TypeRef& l, const ::HIR::TypeRef& r) const { - if( l != r ) { + if( l.m_data.is_Diverge() || r.m_data.is_Diverge() ) { + // Diverge, matches everything. + // TODO: Is this always true? + } + else if( l != r ) { ERROR(sp, E0000, "Type mismatch - " << l << " != " << r); } + else { + // All good + } } void check_associated_type(const Span& sp, const ::HIR::TypeRef& res, |