-
-
Notifications
You must be signed in to change notification settings - Fork 879
Enforce Explicit Types and Target Type new #2951
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
Enforce Explicit Types and Target Type new #2951
Conversation
OK Then let's go this way. This PR is complete from my side. When this one is merged I will open a draft for the Collection Expressions so we have a clear view how it is gonna be for this repo. Sounds good? |
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.
Thanks for doing this; much better!
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles; | |||
/// <param name="l">The l value (lightness) component.</param> | |||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |||
public Hsl(float h, float s, float l) | |||
: this(new Vector3(h, s, l)) | |||
: this(new(h, s, l)) |
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.
@JimBobSquarePants I'm late to the party again, but I dislike this particular group of the changes. Now a code reader needs to navigate to the other method definition to see what type is being instantiated here, which makes it harder/slower to read the code. Same for return new(...)
and similar expressions which remove type information completely from a given line.
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.
Yeah that's a drawback about this. I will create a PR which tackles this. Rider/Resharper has more settings for this and was probably a bit more aggressive. Could you check that branch out and look what VS is doing? #2958
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.
Thanks! #2958 looks good based on the diff, but I can't tell if it's missing something without pulling the code down and review offline.
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.
Apologies, I missed this. According to IDE0090 the analyzer should only be flagging when the type is apparent. Is Rider/Resharper buggy?
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.
Rider generates a warning at that rule stating that this one is unknown/unsupported.
It has more granular editorconfig settings.
Prerequisites
Description
Reworkes #2855 after too Manz conflicts