File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -117,14 +117,19 @@ impl<I: Interner> Forest<I> {
117117 pub ( super ) fn any_future_answer (
118118 & self ,
119119 table : TableIndex ,
120- answer : AnswerIndex ,
120+ mut answer_index : AnswerIndex ,
121121 mut test : impl FnMut ( & Substitution < I > ) -> bool ,
122122 ) -> bool {
123- if let Some ( answer) = self . tables [ table] . answer ( answer) {
123+ // Check any cached answers, starting at `answer_index`.
124+ while let Some ( answer) = self . tables [ table] . answer ( answer_index) {
124125 info ! ( "answer cached = {:?}" , answer) ;
125- return test ( & answer. subst . value . subst ) ;
126+ if test ( & answer. subst . value . subst ) {
127+ return true ;
128+ }
129+ answer_index. increment ( ) ;
126130 }
127131
132+ // Check any unsolved strands, which may give further answers.
128133 self . tables [ table]
129134 . strands ( )
130135 . any ( |strand| test ( & strand. canonical_ex_clause . value . subst ) )
Original file line number Diff line number Diff line change @@ -225,3 +225,26 @@ fn integers_are_sized() {
225225 }
226226 }
227227}
228+
229+ /// Simplified version of a goal that needs to be solved for type checking
230+ /// `1 + 2`.
231+ #[ test]
232+ fn ambiguous_add ( ) {
233+ test ! {
234+ program {
235+ #[ non_enumerable]
236+ trait Add <Rhs > { type Output ; }
237+
238+ impl <' a> Add <& ' a u32 > for u32 { type Output = <u32 as Add <u32 >>:: Output ; }
239+ impl Add <u32 > for u32 { type Output = u32 ; }
240+ }
241+
242+ goal {
243+ exists<int T , U , V > {
244+ <T as Add <U >>:: Output = V
245+ }
246+ } yields {
247+ "Ambiguous; no inference guidance"
248+ }
249+ }
250+ }
You can’t perform that action at this time.
0 commit comments