aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-02-07 15:24:09 +0000
committerFlorian Diebold <[email protected]>2020-02-07 17:28:10 +0000
commit6c70619b0126bc0e40bd9df39dcd6e711cac69c5 (patch)
treec9812b922e3f7ec753ff18e0b17b0f54f18ea737 /crates/ra_hir_ty/src/infer
parentdded90a748737c3661aad043524f2248e324c867 (diff)
Deal better with implicit type parameters and argument lists
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r--crates/ra_hir_ty/src/infer/expr.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 8c360bcad..00ae35953 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -647,8 +647,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
647 generic_args: Option<&GenericArgs>, 647 generic_args: Option<&GenericArgs>,
648 receiver_ty: &Ty, 648 receiver_ty: &Ty,
649 ) -> Substs { 649 ) -> Substs {
650 let (total_len, _parent_len, child_len) = 650 let (parent_params, self_params, type_params, impl_trait_params) =
651 def_generics.as_ref().map_or((0, 0, 0), |g| g.len_split()); 651 def_generics.as_ref().map_or((0, 0, 0, 0), |g| g.provenance_split());
652 assert_eq!(self_params, 0); // method shouldn't have another Self param
653 let total_len = parent_params + type_params + impl_trait_params;
652 let mut substs = Vec::with_capacity(total_len); 654 let mut substs = Vec::with_capacity(total_len);
653 // Parent arguments are unknown, except for the receiver type 655 // Parent arguments are unknown, except for the receiver type
654 if let Some(parent_generics) = def_generics.as_ref().map(|p| p.iter_parent()) { 656 if let Some(parent_generics) = def_generics.as_ref().map(|p| p.iter_parent()) {
@@ -663,7 +665,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
663 // handle provided type arguments 665 // handle provided type arguments
664 if let Some(generic_args) = generic_args { 666 if let Some(generic_args) = generic_args {
665 // if args are provided, it should be all of them, but we can't rely on that 667 // if args are provided, it should be all of them, but we can't rely on that
666 for arg in generic_args.args.iter().take(child_len) { 668 for arg in generic_args.args.iter().take(type_params) {
667 match arg { 669 match arg {
668 GenericArg::Type(type_ref) => { 670 GenericArg::Type(type_ref) => {
669 let ty = self.make_ty(type_ref); 671 let ty = self.make_ty(type_ref);