From 0e436bf3b8c83c9c4c9976415ef21434df6c58ef Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 23 Aug 2019 07:26:14 +0800 Subject: Typecheck Expressions - Fix case where a UFC isn't expanded before being used in coercion --- src/hir_typeck/expr_cs.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index ac4a5e86..af076092 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -5813,6 +5813,12 @@ namespace { // Literal infer, keep going (but remember how many times we dereferenced?) } + if( TU_TEST1(out_ty.m_data, Path, .binding.is_Unbound()) ) + { + DEBUG("Src derefed to unbound type (" << out_ty << "), return Unknown"); + return CoerceResult::Unknown; + } + types.push_back( out_ty.clone() ); // Types aren't equal @@ -6089,9 +6095,11 @@ namespace { // If the destination is an Unbound path, return Unknown if( TU_TEST1(dst.m_data, Path, .binding.is_Unbound()) ) { + DEBUG("Unbound destination"); return CoerceResult::Unknown; } + DEBUG("Reached end of check_unsize_tys, return Equality"); // TODO: Determine if this unsizing could ever happen. return CoerceResult::Equality; -- cgit v1.2.3