Move condition out of maybe_report_ambiguous_plus and maybe_recover_from_bad_type_plus.

This commit is contained in:
Nicholas Nethercote 2022-05-19 15:59:52 +10:00
parent a148a32fdc
commit 7a37e0c2ff
2 changed files with 9 additions and 16 deletions

View file

@ -315,8 +315,11 @@ impl<'a> Parser<'a> {
let mut ty = self.mk_ty(span, kind);
// Try to recover from use of `+` with incorrect priority.
self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty);
self.maybe_recover_from_bad_type_plus(allow_plus, &ty)?;
if matches!(allow_plus, AllowPlus::Yes) {
self.maybe_recover_from_bad_type_plus(&ty)?;
} else {
self.maybe_report_ambiguous_plus(impl_dyn_multi, &ty);
}
if let RecoverQuestionMark::Yes = recover_question_mark {
ty = self.maybe_recover_from_question_mark(ty);
}