-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to provide custom diagnostic messages when unwrapping cal…
…ls (#13597) ## Summary You can now call `return_ty_result` to operate on a `Result` directly thereby using your own diagnostics, as in: ```rust return dunder_getitem_method .call(self.db, &[slice_ty]) .return_ty_result(self.db, value.as_ref().into(), self) .unwrap_or_else(|err| { self.add_diagnostic( (&**value).into(), "call-non-callable", format_args!( "Method `__getitem__` is not callable on object of type '{}'.", value_ty.display(self.db), ), ); err.return_ty() }); ```
- Loading branch information
1 parent
961fc98
commit ef45185
Showing
2 changed files
with
156 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters