summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-11-16 12:56:32 +0800
committerJohn Hodge <tpg@mutabah.net>2016-11-16 12:56:32 +0800
commit0769120c317befaf3aa41d5859bbd588fa2326e6 (patch)
tree504899f5d3241f699cb9922dff913bbfd03a5c96
parent706125096527762be7ff3be3e28d75c5276797de (diff)
downloadmrust-0769120c317befaf3aa41d5859bbd588fa2326e6.tar.gz
HIR Typecheck Expr - Fix inferrence losing ! marker
-rw-r--r--src/hir_typeck/expr_cs.cpp5
-rw-r--r--src/hir_typeck/helpers.cpp22
2 files changed, 24 insertions, 3 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index a1721b26..1a32fba6 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -4141,7 +4141,10 @@ namespace {
}
}
- if( ty_dst.compare_with_placeholders(sp, ty_src, context.m_ivars.callback_resolve_infer()) != ::HIR::Compare::Unequal )
+ if( ty_dst.m_data.is_Path() && ty_dst.m_data.as_Path().binding.is_Unbound() )
+ {
+ }
+ else if( ty_dst.compare_with_placeholders(sp, ty_src, context.m_ivars.callback_resolve_infer()) != ::HIR::Compare::Unequal )
{
context.equate_types(sp, ty_dst, ty_src);
return true;
diff --git a/src/hir_typeck/helpers.cpp b/src/hir_typeck/helpers.cpp
index a488fda4..2ce2e7ac 100644
--- a/src/hir_typeck/helpers.cpp
+++ b/src/hir_typeck/helpers.cpp
@@ -631,16 +631,31 @@ void HMTypeInferrence::ivar_unify(unsigned int left_slot, unsigned int right_slo
auto& root_ivar = this->get_pointed_ivar(right_slot);
TU_IFLET(::HIR::TypeRef::Data, root_ivar.type->m_data, Infer, re,
- if(re.ty_class != ::HIR::InferClass::None && re.ty_class != ::HIR::InferClass::Diverge) {
+ if( re.ty_class == ::HIR::InferClass::Diverge )
+ {
+ TU_IFLET(::HIR::TypeRef::Data, left_ivar.type->m_data, Infer, le,
+ if( le.ty_class == ::HIR::InferClass::None ) {
+ le.ty_class = ::HIR::InferClass::Diverge;
+ }
+ )
+ }
+ else if(re.ty_class != ::HIR::InferClass::None)
+ {
TU_MATCH_DEF(::HIR::TypeRef::Data, (left_ivar.type->m_data), (le),
(
ERROR(sp, E0000, "Type unificiation of literal with invalid type - " << *left_ivar.type);
),
(Infer,
- if( le.ty_class != ::HIR::InferClass::None && le.ty_class != re.ty_class )
+ if( le.ty_class == ::HIR::InferClass::Diverge )
+ {
+ }
+ else if( le.ty_class != ::HIR::InferClass::None && le.ty_class != re.ty_class )
{
ERROR(sp, E0000, "Unifying types with mismatching literal classes - " << *left_ivar.type << " := " << *root_ivar.type);
}
+ else
+ {
+ }
le.ty_class = re.ty_class;
),
(Primitive,
@@ -648,6 +663,9 @@ void HMTypeInferrence::ivar_unify(unsigned int left_slot, unsigned int right_slo
)
)
}
+ else
+ {
+ }
)
else {
BUG(sp, "Unifying over a concrete type - " << *root_ivar.type);