From d3a7b742572e23a535571eb126a84a394c37dfe2 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 5 Aug 2016 12:51:11 +0800 Subject: HIR Typecheck Check - ! matches anything --- src/hir_typeck/expr_check.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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, -- cgit v1.2.3