Open
Description
Shouldn't be possible to rethrow
in a switch expression since we can throw e
?
Random example:
void main() {
try {
// some code that might throw
} catch (e) {
return switch (e) {
Exception() => print('Return what this function asks for (void).'),
Error() => throw e, //Works, but warning "Use 'rethrow' to rethrow a caught exception."
_ => rethrow, // Error "Undefined name 'rethrow'"
};
}
}
Inside a catch
clause I think we could allow a rethrow
statement.