-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
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
+ implicit_reopen #4101
+ implicit_reopen #4101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor suggestion, but I thought the description was good.
I didn't look at the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just drive-bys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting on the test cases:
I agree with @kallentu that it would be good to have cases where there is more than one step of implicit provision of class modifiers. E.g., class A
is interface, sealed class B extends A
is then implicitly interface
, and and so es sealed class C extends B
.
Similarly, being implicitly interface
can propagate through any number of mixin applications (and that case also does not seem to be covered):
interface mixin M1 {}
mixin M2 {}
...
mixin Mk {}
sealed class C with M1, ... Mk {} // Implicitly `interface`.
@kallentu also mentioned the following case (and I don't think it's covered yet), which is the second half of the first rule in my ruleset:
interface class S {}
base class I {}
sealed class A extends S implements I {} // Implicitly `final`.
A couple of other cases I couldn't spot are these ones (that's the second rule):
base class I {}
sealed class A implements I {} // Implicitly `base`.
final class I2 {}
sealed class A2 implements I2 {} // Implicitly `base`.
sealed mixin /* or mixin class */ M implements I {} // Implicitly `base`.
sealed mixin /* or mixin class */ M2 implements I2 {} // Implicitly `base`.
sealed mixin on I {} // Implicitly `base`.
sealed mixin on I2 {} // Implicitly `base`.
Source and tests updated. Nothing will pass until a new analyzer is released so still WIP. |
@eernstg, @kallentu : I added a handful of tests but would love for you to take a look... It looks like some of the cases we discussed above have been recently disallowed and will produce analyzer diagnostics (and so not a lint). If you see negative tests I should implement please let me know too. I'd much rather under than over report! |
(And needless to say, thank you all for your patience and perseverance. I think we're closing in!) |
* prefer_final_parameters tests * --
@bwilkerson, @kallentu, @eernstg: polite ping for a review... Hoping to get this in before the cut off. 🏁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've exhausted my brain for test cases (which you've added already) so I'll leave whatever is missing to Erik.
I think this is how I imagined the initial implementation for the lint -- LGTM
Oops, I missed this one. I'll take a look within the next couple of hours. |
No worries, @eernstg. Thanks so much! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Left a few comments.
Co-authored-by: Erik Ernst <[email protected]>
Co-authored-by: Erik Ernst <[email protected]>
Co-authored-by: Erik Ernst <[email protected]>
Co-authored-by: Erik Ernst <[email protected]>
Co-authored-by: Erik Ernst <[email protected]>
Thanks again to everyone for all the feedback! |
* + implicit_reopen * feedback * docs * class type aliases * fmt * fix description * hoist * -- * rebase * revisit * ++ * ++ * -- * ++ * + test * // * Fix dart-lang/linter#4165 by visiting SwitchPatternCase (dart-lang/linter#4169) * Use deps.dev for OpenSSF scorecard results link (dart-lang/linter#4184) * prefer_final_parameters tests (dart-lang/linter#4182) * prefer_final_parameters tests * -- * switch to the latest published version of the setup-dart action (dart-lang/linter#4186) * test cleanup (dart-lang/linter#4185) * Support analyzer 5.9.0 (dart-lang/linter#4188) * - mixin * rename * rename * Update lib/src/rules/implicit_reopen.dart Co-authored-by: Erik Ernst <[email protected]> * Update lib/src/rules/implicit_reopen.dart Co-authored-by: Erik Ernst <[email protected]> * Update lib/src/rules/implicit_reopen.dart Co-authored-by: Erik Ernst <[email protected]> * Update lib/src/rules/implicit_reopen.dart Co-authored-by: Erik Ernst <[email protected]> * Update lib/src/rules/implicit_reopen.dart Co-authored-by: Erik Ernst <[email protected]> * fdbk --------- Co-authored-by: Sam Rawlins <[email protected]> Co-authored-by: Parker Lougheed <[email protected]> Co-authored-by: Devon Carew <[email protected]> Co-authored-by: Erik Ernst <[email protected]>
UPDATE: ready to land! 🦅
Fixes: #3920.
This is a WIP but far enough along that I could benefit from some feedback.
Specifically:
General comments welcome too. (I'm less concerned w/ implementation at this point and more on capturing the right test cases FWIW but happy to receive any feedback at all.)
Thanks in advance!