-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-set-recommendedtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
In flutter/engine#50255 @jonahwilliams and I debugged a tough "this program doesn't catch errors" bug.
It was basically narrowed down to this minimal program:
void main() async {
try {
innerProgram();
} catch (e, s) {
exit(1);
}
}
void innerProgram() async {
try {
await runAndFail();
} finally {
// BUG: Even if a failure happens, the program will terminate.
exit(0);
}
}
void runAndFail() async {
throw 'Fail';
}https://dart.dev/tools/linter-rules/control_flow_in_finally appears to be able to philosophically catch this bug.
I wonder if we could enhance it to lint functions that return Never, i.e.:
void main() {
try {} finally {
// LINT
throw 'Big Bad';
}
}
void main() {
Never panic() => throw 'Big Bad';
try {} finally {
// LINT
panic();
}
}
void main() {
try {} finally {
// LINT
exit(0);
}
}Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-set-recommendedtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug