Skip to content
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

rework avoid_types_on_closure_parameters to allow not-redundant types #3568

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

a14n
Copy link
Contributor

@a14n a14n commented Aug 1, 2022

Description

rework avoid_types_on_closure_parameters to allow not-redundant types

Fixes #3330
Fixes #2131
Fixes #1099

@coveralls
Copy link

coveralls commented Aug 1, 2022

Coverage Status

Coverage decreased (-0.1%) to 95.597% when pulling 0deed27 on a14n:rework_avoid_types_on_closure_parameters into 7d51bf6 on dart-lang:main.

@pq pq added needs internal testing set-internal-available Affects a rule that is allowed internally (but not generally required or recommended). labels Aug 2, 2022
@pq
Copy link
Member

pq commented Aug 2, 2022

Fantastic. We'll need to do an internal dry-run regardless , but if I understand the change correctly, this just addresses false-positives?

@a14n
Copy link
Contributor Author

a14n commented Aug 2, 2022

I understand the change correctly, this just addresses false-positives?

Yes it should relax the original version. So it shouldn't add new diagnostics.

} else if (staticParameterElement != null) {
expectedType = staticParameterElement.type;
} else if (parent is NamedExpression) {
expectedType = parent.element?.type;
Copy link
Contributor Author

@a14n a14n Aug 2, 2022

Choose a reason for hiding this comment

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

@bwilkerson I was surprised to have to add this line (to catch the Future.then(..., onError: ...) case). I thought staticParameterElement wouldn't have been null here. Is it the normal behaviour or a bug?

Copy link
Member

Choose a reason for hiding this comment

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

It does seem inconsistent that an expression used as an argument wouldn't have a staticParameterElement. I'm not sure whether there's a reason for the current behavior, but I'd like to explore changing it. We should probably open an issue in the sdk repo and loop Konstantin into the conversation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like this bug was already reported (by me :D) in dart-lang/sdk#45964

@pq
Copy link
Member

pq commented Aug 2, 2022

Yes it should relax the original version. So it shouldn't add new diagnostics.

Add? If these are false positives, I'd expect there to be fewer...

Sorry if I'm being thick!

@a14n
Copy link
Contributor Author

a14n commented Aug 2, 2022

@pq that's what I tried to say : fewer lints

@a14n
Copy link
Contributor Author

a14n commented Aug 8, 2022

We'll need to do an internal dry-run

Did you have a chance to run it internally?

@pq
Copy link
Member

pq commented Aug 8, 2022

Did you have a chance to run it internally?

Sorry, no. It may be a bit --- I'm still trying to land the last linter release in the SDK (https://dart-review.googlesource.com/c/sdk/+/253501) and have a backlog of other tasks.

Will definitely queue this up for our next release though.

Thanks for your patience!

@pq
Copy link
Member

pq commented Aug 8, 2022

(And also for the nudge!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
set-internal-available Affects a rule that is allowed internally (but not generally required or recommended).
Projects
None yet
4 participants