summaryrefslogtreecommitdiff
path: root/src/hir/hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-24 17:01:06 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-24 17:02:19 +0800
commit24ee7b3a8b6fc2a52f6b3485ffe5087d144e4a28 (patch)
tree912685e22b335ad766cd264e2dc3c4d7879402c0 /src/hir/hir.cpp
parent00fe2ba047251b0178681ce818a73003ab449785 (diff)
downloadmrust-24ee7b3a8b6fc2a52f6b3485ffe5087d144e4a28.tar.gz
HIR Typecheck Expr - Fix impl selection bug with an evil hack
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r--src/hir/hir.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp
index 8f35ba0c..c2ad4d00 100644
--- a/src/hir/hir.cpp
+++ b/src/hir/hir.cpp
@@ -73,14 +73,21 @@ namespace {
}
throw "";
}
- if( right.m_data.is_Generic() ) {
- return left.m_data.is_Generic();
- }
+ // A local generic could match anything, leave that up to the caller
if( left.m_data.is_Generic() ) {
- // True? (TODO: Check bounds?)
return true;
}
+ // A local UfcsKnown can only be becuase it couldn't be expanded earlier, assume it could match
+ if( left.m_data.is_Path() && left.m_data.as_Path().path.m_data.is_UfcsKnown() ) {
+ // True?
+ return true;
+ }
+
+ // If the RHS (provided) is generic, it can only match if it binds to a local type parameter
+ if( right.m_data.is_Generic() ) {
+ return left.m_data.is_Generic();
+ }
if( left.m_data.tag() != right.m_data.tag() ) {
return false;