You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal is to prevent the case where a pass fails (currently with Err(())) but no error is reported (via Diagnostic::error().report) which leads to a failed assertion and a reported internal compiler error in main.
Defined in crate::diagnostic for now as ErrorReported
Ideally, no “plain” constructor but returned by Reporter::report/Diagnostic::report.
However, this won't work with crate::resolver::scope::RegistrationError::DuplicateDefinition which doesn't immediately result in a reported diagnostic by design. Which means we probably need to expose some constructor named sth. like ErrorReported::promise_error_will_be_reported()ErrorReported::error_will_be_reported_unchecked unless we find a way too make this type-safe
Change crate::error's Result definition to default E to ErrorReported instead of ()
Remove the #![allow(clippy::result_unit_err)] in the crate roots as it will no longer be necessary
Require Error variants of possibly erroneous (→ PossiblyErroneous) data to hold/be contstructed with an ErrorReported changing PossiblyErroneous::error to take an _: ErrorReported as an argument. ErrorReported has to impl Clone because AST nodes are Clone but that is not an issue. Discarding is also not a problem right now (since a positive error count leads to a failing exit status even without an ErrorReported (maybe we want to change it making it more strict))
Store ErrorReported in Health::Tainted to be able to make Health and Outcome combinators correct (i.e. remove their calls to ErrorReported::error_will_be_reported_unchecked)
Diagnostic::{warning,debug}().report(reporter) also yields an ErrorReported even though only a warning or debug message, respectively, was issued. ErrorReported should only be obtainable by ::{error, bug}()
SilentReporter yields a ErrorReported. Instead, it should return () or similar. We can achieve this (I think) by making the Reporter enum a trait and adding an assoc type Output
The text was updated successfully, but these errors were encountered:
Works towards making it harder to accidentally abort compilation due to an error
*without emitting a diagnostic* (#130).
Instead of blindly creating `()`, `ErrorReported::error_will_be_reported_unchecked()`
needs to be used in non-trivial cases forcing the programmer to ponder if it's
correct what they are doing.
fmease
changed the title
Define and use an abstract ErrorReported type instead of ()
Define and use an abstract ErasedReportedError type instead of ()Apr 10, 2022
Heavily inspired by
rustc
.Err(())
) but no error is reported (viaDiagnostic::error().report
) which leads to a failed assertion and a reported internal compiler error inmain
.crate::diagnostic
for now asErrorReported
Reporter::report
/Diagnostic::report
.However, this won't work with
crate::resolver::scope::RegistrationError::DuplicateDefinition
which doesn't immediately result in a reported diagnostic by design. Which means we probably need to expose some constructor named sth. likeErrorReported::promise_error_will_be_reported()
ErrorReported::error_will_be_reported_unchecked
unless we find a way too make this type-safecrate::error
'sResult
definition to defaultE
toErrorReported
instead of()
#![allow(clippy::result_unit_err)
] in the crate roots as it will no longer be necessaryError
variants of possibly erroneous (→PossiblyErroneous
) data to hold/be contstructed with anErrorReported
changingPossiblyErroneous::error
to take an_: ErrorReported
as an argument.ErrorReported
has to implClone
because AST nodes areClone
but that is not an issue. Discarding is also not a problem right now (since a positive error count leads to a failing exit status even without anErrorReported
(maybe we want to change it making it more strict))ErrorReported
inHealth::Tainted
to be able to makeHealth
andOutcome
combinators correct (i.e. remove their calls toErrorReported::error_will_be_reported_unchecked
)ErrorReported
(in [WIP] Fix exposure related bugs #137)Diagnostic::{warning,debug}().report(reporter)
also yields anErrorReported
even though only a warning or debug message, respectively, was issued.ErrorReported
should only be obtainable by::{error, bug}()
SilentReporter
yields aErrorReported
. Instead, it should return()
or similar. We can achieve this (I think) by making theReporter
enum a trait and adding an assoc typeOutput
The text was updated successfully, but these errors were encountered: