diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index f8d7f2b642b..306da6738b0 100644 --- a/crates/hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs @@ -1283,6 +1283,35 @@ fn f() { ); } +#[test] +fn resolve_const_generic_array_methods() { + check_types( + r#" +#[lang = "array"] +impl [T; N] { + pub fn map(self, f: F) -> [U; N] + where + F: FnMut(T) -> U, + { loop {} } +} + +#[lang = "slice"] +impl [T] { + pub fn map(self, f: F) -> &[U] + where + F: FnMut(T) -> U, + { loop {} } +} + +fn f() { + let v = [1, 2].map::<_, usize>(|x| -> x * 2); + v; + //^ [usize; _] +} + "#, + ); +} + #[test] fn skip_array_during_method_dispatch() { check_types(