diff options
-rw-r--r-- | crates/ra_hir_ty/src/lower.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/regression.rs | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index af3db2e1d..2c2ecee9c 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs | |||
@@ -331,7 +331,7 @@ pub(super) fn substs_from_path_segment( | |||
331 | if let Some(generic_args) = &segment.args_and_bindings { | 331 | if let Some(generic_args) = &segment.args_and_bindings { |
332 | // if args are provided, it should be all of them, but we can't rely on that | 332 | // if args are provided, it should be all of them, but we can't rely on that |
333 | let self_param_correction = if add_self_param { 1 } else { 0 }; | 333 | let self_param_correction = if add_self_param { 1 } else { 0 }; |
334 | let child_len = child_len + self_param_correction; | 334 | let child_len = child_len - self_param_correction; |
335 | for arg in generic_args.args.iter().take(child_len) { | 335 | for arg in generic_args.args.iter().take(child_len) { |
336 | match arg { | 336 | match arg { |
337 | GenericArg::Type(type_ref) => { | 337 | GenericArg::Type(type_ref) => { |
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index 8b3aa8564..13c5f62e4 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs | |||
@@ -365,3 +365,20 @@ fn issue_2669() { | |||
365 | "### | 365 | "### |
366 | ) | 366 | ) |
367 | } | 367 | } |
368 | |||
369 | #[test] | ||
370 | fn issue_2705() { | ||
371 | assert_snapshot!( | ||
372 | infer(r#" | ||
373 | trait Trait {} | ||
374 | fn test() { | ||
375 | <Trait<u32>>::foo() | ||
376 | } | ||
377 | "#), | ||
378 | @r###" | ||
379 | [26; 53) '{ ...oo() }': () | ||
380 | [32; 49) '<Trait...>::foo': {unknown} | ||
381 | [32; 51) '<Trait...:foo()': () | ||
382 | "### | ||
383 | ); | ||
384 | } | ||