Skip to content

Remove warning from 'in enum' extension methods#80708

Merged
jjonescz merged 25 commits intodotnet:mainfrom
stbau04:feature/73746-fix-in-this
Oct 27, 2025
Merged

Remove warning from 'in enum' extension methods#80708
jjonescz merged 25 commits intodotnet:mainfrom
stbau04:feature/73746-fix-in-this

Conversation

@stbau04
Copy link
Contributor

@stbau04 stbau04 commented Oct 14, 2025

Fixes #73746

Probably also some changes are wanted for the new extension members (as they currently have the same check as modified in this pr and there is nothing in the proposal that would hint for that), gonne create an issue as soon as this pr is closed/merged
Also gonna create discussions on the csharplang repo regarding the restrictions for type parameters that are constrained to struct and ref readonly, both as discussed in the issue
(to avoid potential duplicate discussions i would create both after this is finished)

@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Oct 14, 2025
@stbau04 stbau04 marked this pull request as ready for review October 16, 2025 21:45
@stbau04 stbau04 requested a review from a team as a code owner October 16, 2025 21:45
@stbau04
Copy link
Contributor Author

stbau04 commented Oct 21, 2025

@jjonescz Would you maybe have a moment to take a look?

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Oct 21, 2025

We should add similar set of tests for new extension blocks. Should be fine to do that in the same files #Closed

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Oct 21, 2025

Probably also some changes are wanted for the new extension members (as they currently have the same check as modified in this pr and there is nothing in the proposal that would hint for that), gonne create an issue as soon as this pr is closed/merged

I think we should simply go ahead and fix extension members too. Extension members and classic extension methods should be compatible. In other words, it should be possible to convert a classic extension method to an instance method of an extension block. I think the spec mentions the compatibility requirement.

The fact that the logic is duplicated is not a coincidence. #Closed

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Oct 21, 2025

Done with review pass (commit 9) #Closed

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 20)

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Oct 24, 2025

        if (op is ">" or "<" or ">=" or "<=" or "==" or "!=")

Always true now? #Closed


Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs:19538 in 9138d89. [](commit_id = 9138d89, deletion_comment = False)

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Oct 24, 2025

        if (op is ">" or "<" or ">=" or "<=" or "==" or "!=")

Always true now? #Closed


Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionOperatorsTests.cs:19615 in 9138d89. [](commit_id = 9138d89, deletion_comment = False)

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 23)

@stbau04 stbau04 requested a review from AlekseyTs October 24, 2025 09:58
Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 24)

@AlekseyTs
Copy link
Contributor

@dotnet/roslyn-compiler For a second review on a community PR

@AlekseyTs AlekseyTs requested review from a team, jcouv and jjonescz October 24, 2025 13:49
@AlekseyTs AlekseyTs added the Feature - Extension Everything The extension everything feature label Oct 24, 2025
@stbau04
Copy link
Contributor Author

stbau04 commented Oct 24, 2025

Would it be ready to merge?

@jjonescz jjonescz merged commit 459ce89 into dotnet:main Oct 27, 2025
24 checks passed
@jjonescz
Copy link
Member

Thanks @stbau04!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee. Feature - Extension Everything The extension everything feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusing error message when using in this with an enum

4 participants