It would be nice to switch to reportUniqueWarnings from
reportError in this class, but first of all it needs a cleanup.
This patch:
- Eliminates autos.
- Removes code duplication.
- Changes how the code works with Expected<>.
- Introduces 2 new usings to make the code a bit shorter.