aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-02-21 12:47:49 +0000
committerFlorian Diebold <[email protected]>2020-02-21 13:06:19 +0000
commite50201345ecc91b9eeb284cd04c6b55f9c5ce0fd (patch)
treebfea7d01b69ecc97d57ba7749c08682a7c82169e /crates/ra_hir_ty/src/tests
parentdb1bbb11fbe85a5230452359e80535a2169d0929 (diff)
Normalize associated types in types coming from Chalk
Fixes #3232.
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r--crates/ra_hir_ty/src/tests/traits.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs
index aa2018944..7d796d0b9 100644
--- a/crates/ra_hir_ty/src/tests/traits.rs
+++ b/crates/ra_hir_ty/src/tests/traits.rs
@@ -1910,3 +1910,45 @@ fn test() -> impl Trait<i32> {
1910 "### 1910 "###
1911 ); 1911 );
1912} 1912}
1913
1914#[test]
1915fn assoc_types_from_bounds() {
1916 assert_snapshot!(
1917 infer(r#"
1918//- /main.rs
1919#[lang = "fn_once"]
1920trait FnOnce<Args> {
1921 type Output;
1922}
1923
1924trait T {
1925 type O;
1926}
1927
1928impl T for () {
1929 type O = ();
1930}
1931
1932fn f<X, F>(_v: F)
1933where
1934 X: T,
1935 F: FnOnce(&X::O),
1936{ }
1937
1938fn main() {
1939 f::<(), _>(|z| { z; });
1940}
1941"#),
1942 @r###"
1943 [147; 149) '_v': F
1944 [192; 195) '{ }': ()
1945 [207; 238) '{ ... }); }': ()
1946 [213; 223) 'f::<(), _>': fn f<(), |&()| -> ()>(|&()| -> ()) -> ()
1947 [213; 235) 'f::<()... z; })': ()
1948 [224; 234) '|z| { z; }': |&()| -> ()
1949 [225; 226) 'z': &()
1950 [228; 234) '{ z; }': ()
1951 [230; 231) 'z': &()
1952 "###
1953 );
1954}