Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

unnecessary_this on field initializers #1189

Merged

Conversation

a14n
Copy link
Contributor

@a14n a14n commented Oct 1, 2018

No description provided.

@a14n
Copy link
Contributor Author

a14n commented Oct 1, 2018

BTW I wonder when this is required in field initializer... Never ?

@a14n a14n force-pushed the unnecessary_this-field-initializers branch from 68fc678 to db336a3 Compare October 1, 2018 19:48
Copy link
Member

@bwilkerson bwilkerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a breaking change. In the future it would be good to open an issue and have a discussion about such changes, but I'm willing to gamble that most existing users of this lint would want these cases found as well.

@bwilkerson
Copy link
Member

I wonder when this is required in field initializer... Never ?

Yes, never. The spec says that an initializer of the form x = e is equivalent to this.x = e.

@bwilkerson bwilkerson merged commit 82c22fa into dart-lang:master Oct 1, 2018
@a14n
Copy link
Contributor Author

a14n commented Oct 1, 2018

It's not a breaking change: it's a fix of a bug regarding the effective dart rule DON’T use this. when not needed to avoid shadowing :) There's even an example with that case!

@a14n a14n deleted the unnecessary_this-field-initializers branch October 1, 2018 20:10
@a14n
Copy link
Contributor Author

a14n commented Oct 1, 2018

Yes, never. The spec says that an initializer of the form x = e is equivalent to this.x = e.

Thanks! Good to know.

@bwilkerson
Copy link
Member

There's even an example with that case!

Ah, I didn't realize that. (It's been a long time since I read the guide. :-)

@a14n a14n mentioned this pull request Oct 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants