diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-05-15 16:19:51 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-05-15 16:19:51 +0800 |
commit | 08c7a7e2cb1b8b137a252edf0c615cd81477adf8 (patch) | |
tree | 29c0210528a956a66e14fd73b92e499634a7aee0 /src | |
parent | 9d3c9143b17ff55d3f0bd8194eb8d978e5b14676 (diff) | |
download | mrust-08c7a7e2cb1b8b137a252edf0c615cd81477adf8.tar.gz |
HIR Typecheck - Fix greedily picking the most specific impl when typechecking
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 52af3924..7c73644d 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -5109,17 +5109,17 @@ namespace { // if not more specific than the existing best, ignore. if( ! impl.more_specific_than(best_impl) ) { - // Ignore DEBUG("[check_associated] - Less specific than existing"); + // NOTE: This picks the _least_ specific impl + possible_impl_ty = impl.get_impl_type(); + possible_params = impl.get_trait_params(); + best_impl = mv$(impl); count -= 1; } // If the existing best is not more specific than the new one, use the new one else if( ! best_impl.more_specific_than(impl) ) { DEBUG("[check_associated] - More specific than existing - " << impl); - possible_impl_ty = impl.get_impl_type(); - possible_params = impl.get_trait_params(); - best_impl = mv$(impl); count -= 1; } else |