File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
crates/hir-ty/src/tests/regression Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,40 @@ trait T2: Sized {
128128 ) ;
129129}
130130
131+ #[ test]
132+ fn regression_type_checker_does_not_eagerly_select_predicates_from_where_clauses ( ) {
133+ // This was a very long standing issue (#5514) with a lot of duplicates, that was
134+ // fixed by the switch to the new trait solver, so it deserves a long name and a
135+ // honorable mention.
136+ check_infer (
137+ r#"
138+ //- minicore: from
139+
140+ struct Foo;
141+ impl Foo {
142+ fn method(self) -> i32 { 0 }
143+ }
144+
145+ fn f<T: Into<Foo>>(u: T) {
146+ let x = u.into();
147+ x.method();
148+ }
149+ "# ,
150+ expect ! [ [ r#"
151+ 38..42 'self': Foo
152+ 51..56 '{ 0 }': i32
153+ 53..54 '0': i32
154+ 79..80 'u': T
155+ 85..126 '{ ...d(); }': ()
156+ 95..96 'x': Foo
157+ 99..100 'u': T
158+ 99..107 'u.into()': Foo
159+ 113..114 'x': Foo
160+ 113..123 'x.method()': i32
161+ "# ] ] ,
162+ ) ;
163+ }
164+
131165#[ test]
132166fn opaque_generics ( ) {
133167 check_infer (
You can’t perform that action at this time.
0 commit comments