summaryrefslogtreecommitdiff
path: root/src/hir
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-01 16:06:23 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-01 16:06:23 +0800
commit6724e74e23f52c955a48f38a868605604956bf2a (patch)
tree3a6e57840cb11f049a3a9f4fb62206b5ccd1eea7 /src/hir
parentbdf2166e25572b9b03eb8155e2f5b4587378fbe4 (diff)
downloadmrust-6724e74e23f52c955a48f38a868605604956bf2a.tar.gz
HIR Typecheck - Altered ! handling to be an ivar type, fix fuzzy matches in expand_associated_types
Diffstat (limited to 'src/hir')
-rw-r--r--src/hir/hir.cpp1
-rw-r--r--src/hir/type.cpp4
-rw-r--r--src/hir/type.hpp1
3 files changed, 6 insertions, 0 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp
index 09187ae8..e090b795 100644
--- a/src/hir/hir.cpp
+++ b/src/hir/hir.cpp
@@ -48,6 +48,7 @@ namespace {
switch(right.m_data.as_Infer().ty_class)
{
case ::HIR::InferClass::None:
+ case ::HIR::InferClass::Diverge:
return left.m_data.is_Generic();
case ::HIR::InferClass::Integer:
TU_IFLET(::HIR::TypeRef::Data, left.m_data, Primitive, le,
diff --git a/src/hir/type.cpp b/src/hir/type.cpp
index a27d5dd0..6b90801f 100644
--- a/src/hir/type.cpp
+++ b/src/hir/type.cpp
@@ -49,6 +49,7 @@ void ::HIR::TypeRef::fmt(::std::ostream& os) const
switch(e.ty_class)
{
case ::HIR::InferClass::None: break;
+ case ::HIR::InferClass::Diverge:os << ":!"; break;
case ::HIR::InferClass::Float: os << ":f"; break;
case ::HIR::InferClass::Integer:os << ":i"; break;
}
@@ -462,6 +463,7 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
switch(xe.ty_class)
{
case ::HIR::InferClass::None:
+ case ::HIR::InferClass::Diverge:
// - If right is generic infer, assume it's good
//return true;
return Compare::Fuzzy;
@@ -694,6 +696,7 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
switch(e.ty_class)
{
case ::HIR::InferClass::None:
+ case ::HIR::InferClass::Diverge:
return Compare::Fuzzy;
case ::HIR::InferClass::Integer:
TU_IFLET( ::HIR::TypeRef::Data, right.m_data, Primitive, le,
@@ -735,6 +738,7 @@ bool ::HIR::TypeRef::match_test_generics(const Span& sp, const ::HIR::TypeRef& x
switch( e.ty_class )
{
case ::HIR::InferClass::None:
+ case ::HIR::InferClass::Diverge:
return Compare::Fuzzy;
case ::HIR::InferClass::Integer:
TU_IFLET( ::HIR::TypeRef::Data, left.m_data, Primitive, le,
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
index f01c0f1d..4f495fcd 100644
--- a/src/hir/type.hpp
+++ b/src/hir/type.hpp
@@ -21,6 +21,7 @@ typedef ::std::function< ::HIR::Compare(unsigned int, const ::HIR::TypeRef&) > t
enum class InferClass
{
None,
+ Diverge,
Integer,
Float,
};