Skip to content

Conversation

AlekseyTs
Copy link
Contributor

@AlekseyTs AlekseyTs commented May 6, 2025

Relates to test plan #76130

@AlekseyTs AlekseyTs added Area-Compilers Feature - Extension Everything The extension everything feature labels May 6, 2025
@AlekseyTs AlekseyTs requested review from jjonescz and jcouv May 6, 2025 03:03
@AlekseyTs AlekseyTs requested a review from a team as a code owner May 6, 2025 03:03
@ghost ghost added the untriaged Issues and PRs which have not yet been triaged by a lead label May 6, 2025
@AlekseyTs AlekseyTs requested a review from a team May 6, 2025 13:23
@AlekseyTs
Copy link
Contributor Author

@jcouv, @dotnet/roslyn-compiler For the second review

@jcouv jcouv self-assigned this May 6, 2025

this.CheckUnsafeModifier(declarationModifiers, diagnostics);

if (isCompoundAssignmentOrIncrementAssignment)
Copy link
Member

@jcouv jcouv May 6, 2025

Choose a reason for hiding this comment

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

Is this covered by test? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this covered by test?

I am not sure what this question is about. There is no change at this position in the latest revision. Consider reviewing the latest revision. I had to do a merge to resolve a conflict. Apparently CodeFlow is now going crazy on merge commits and showing changes from them as undone in previous commits.

case RefKind.In:
case RefKind.RefReadOnlyParameter:
// 'in' and 'ref readonly' receivers are disallowed for anything that is not a concrete struct (class or a type parameter)
if (extensionParameter.Type is { TypeKind: not TypeKind.TypeParameter, IsValueType: true })
Copy link
Member

@jcouv jcouv May 6, 2025

Choose a reason for hiding this comment

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

extensionParameter.Type is { TypeKind: not TypeKind.TypeParameter, IsValueType: true }

Would it be simpler to check .TypeKind == TypeKind.Struct? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps

{
if (extensionParameter.Name == "")
{
diagnostics.Add(ErrorCode.ERR_InstanceMemberWithUnnamedExtensionsParameter, _location, Name);
Copy link
Member

@jcouv jcouv May 6, 2025

Choose a reason for hiding this comment

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

Is this covered by test?

This is the line I was trying to point to (producing ERR_InstanceMemberWithUnnamedExtensionsParameter diagnostic) #Closed

{
extension(ref S1? s1)
{
public void operator {{{op}}}() {}
Copy link
Member

@jcouv jcouv May 6, 2025

Choose a reason for hiding this comment

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

nit: consider adding number comments (// N) to make it easier to review this long test. Same below in CompoundAssignment_001_Declaration #Closed

Copy link
Contributor Author

@AlekseyTs AlekseyTs May 6, 2025

Choose a reason for hiding this comment

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

consider adding number comments

I am using #line directives, not planning to use comments because they are creating a maintenance issues since some devs confuse them with a form of a base-line

jcouv
jcouv previously approved these changes May 6, 2025
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

Done with review pass (iteration 2)

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

Done with review pass (iteration 2)

@jcouv jcouv dismissed their stale review May 6, 2025 20:28

mistake

@AlekseyTs AlekseyTs requested a review from jcouv May 6, 2025 21:12
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 3)

@AlekseyTs AlekseyTs merged commit 5a81d90 into dotnet:features/extensions May 6, 2025
24 checks passed
return true; // An error scenario
}

if (checkStrippedType && type.IsNullableType())
Copy link
Member

@jcouv jcouv May 6, 2025

Choose a reason for hiding this comment

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

We should keep track of this and include in a spec update. Also applies to the proposed validation rules (marked PROTOTYPE in other file) #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should keep track of this and include in a spec update

We certainly can re-confirm the behavior, but it follows the current speclet, which doesn't prevent declaration of operators for Nullable<T>. The other place (marked PROTOTYPE in other file) is adding restrictions that are not mentioned in the speclet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - Extension Everything The extension everything feature untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants