From c3a6cacd573c85bf07471718358bf5e260e389c4 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 16 Nov 2016 13:28:09 +0800 Subject: HIR Typecheck Expr - Don't assert if impl params aren't known (just fill them with new ivars) --- src/hir_typeck/expr_cs.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 1a32fba6..7c260ddc 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -420,9 +420,13 @@ namespace { context.equate_types(sp, impl_ty_mono, *e.type); } - // - Check that all entries were populated by the above function - for(const auto& ty : impl_params.m_types) { - assert( ty != ::HIR::TypeRef() ); + + // Fill unknown parametrs with ivars + for(auto& ty : impl_params.m_types) { + if( ty == ::HIR::TypeRef() ) { + // Allocate a new ivar for the param + ty = context.m_ivars.new_ivar_tr(); + } } } -- cgit v1.2.3