make 'as' not throw if the expression does not have the type. #5031
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-obsolete
Closed as the reported issue is no longer relevant
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
The 'as' cast operator throws if its operand does not have the specified type.
That makes it useless without a prior type test (or implicit knowledge), but in that case, it doing an explicit test is redundant. I find myself not using it because I don't want to introduce an extra, unnecessary, test.
I suggest changing it to make it either simpler or useful on its own.
That is, either:
The text was updated successfully, but these errors were encountered: