We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One regular scenario when using extensions is to do pattern matching on this.
this
For example:
extension on num { void example() { if (this is int) doSomethingWithInts(this); else doSomethingWithDoubles(this); } }
The problem is, this is not promoted after doing type-checks on it. This forces us to either use casts or dereference this.
For example a common pattern I've used is:
final that = this; if (that is int) doSomethingWithInts(that);
But this feels redundant. Would it be possible to promote this when doing type checks on it?
The text was updated successfully, but these errors were encountered:
Duplicate of #1397
Reading the comments, it looks like this was supposed to be part of the promotion of the private final fields feature (#2020).
cc @stereotype441
Sorry, something went wrong.
Closing since this is a dupp. Sorry I missed it
No branches or pull requests
One regular scenario when using extensions is to do pattern matching on
this
.For example:
The problem is,
this
is not promoted after doing type-checks on it. This forces us to either use casts or dereferencethis
.For example a common pattern I've used is:
But this feels redundant. Would it be possible to promote
this
when doing type checks on it?The text was updated successfully, but these errors were encountered: