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

Misc. changes following recent records PR #44912

Merged
merged 2 commits into from
Jun 6, 2020

Conversation

cston
Copy link
Member

@cston cston commented Jun 6, 2020

Address feedback following #44882:

  • Additional tests
  • IsVirtual and IsOverride cannot both be true
  • Delete struct parameter case from SynthesizedRecordEquals
  • Removed PROTOTYPE comments from RecordTests

@@ -104,9 +102,9 @@ internal override ImmutableArray<string> GetAppliedConditionalSymbols()
internal override IEnumerable<SecurityAttribute> GetSecurityInformation()
=> Array.Empty<SecurityAttribute>();

internal override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) => false;
internal override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) => true;
Copy link
Contributor

@AlekseyTs AlekseyTs Jun 6, 2020

Choose a reason for hiding this comment

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

internal override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false) => true; [](start = 8, length = 100)

It looks like meaningful changes in this file a obsolete after #44852 #Closed

ordinal: 0,
isStruct ? RefKind.In : RefKind.None));
RefKind.None));
ReturnTypeWithAnnotations = TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Boolean));
Copy link
Contributor

Choose a reason for hiding this comment

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

compilation.GetSpecialType(SpecialType.System_Boolean) [](start = 67, length = 54)

We should use static helper from Binder, which reports use-site diagnostics.

Copy link
Member Author

Choose a reason for hiding this comment

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

Logged #44915.

null :
F.ObjectNotEqual(other, F.Null(F.SpecialType(SpecialType.System_Object)));
Debug.Assert(!other.Type.IsStructType());
retExpr = F.ObjectNotEqual(other, F.Null(F.SpecialType(SpecialType.System_Object)));
Copy link
Contributor

Choose a reason for hiding this comment

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

F.SpecialType [](start = 61, length = 13)

Is this going to report use-site error, if any?

@AlekseyTs
Copy link
Contributor

            TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Object), NullableAnnotation.Annotated),

We should use static helper from Binder, which reports use-site diagnostics.


Refers to: src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordObjEquals.cs:32 in b7e1fe9. [](commit_id = b7e1fe9, deletion_comment = False)

@AlekseyTs
Copy link
Contributor

        ReturnTypeWithAnnotations = TypeWithAnnotations.Create(compilation.GetSpecialType(SpecialType.System_Boolean));

We should use static helper from Binder, which reports use-site diagnostics.


Refers to: src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordObjEquals.cs:35 in b7e1fe9. [](commit_id = b7e1fe9, deletion_comment = False)

@AlekseyTs
Copy link
Contributor

Done with review pass (iteration 1)

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 (iteration 2), use-site errors can be followed up on at a later time.

@@ -54,7 +55,7 @@ public SynthesizedRecordEqualityContractProperty(NamedTypeSymbol containingType,

public override bool IsStatic => false;

public override bool IsVirtual => true;
public override bool IsVirtual { get; }
Copy link
Member

Choose a reason for hiding this comment

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

I didn't understand that change. Seems like it should always be virtual, so that derived record types could override the equality contract.

On the other hand, this makes me wonder, should IsSealed below be based on whether the record type is sealed?

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, the PR description explain and clarifies ("IsVirtual and IsOverride cannot both be true"). Thanks!


In reply to: 436283471 [](ancestors = 436283471)

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 2)

@RikkiGibson
Copy link
Contributor

Squash merging based on Chuck's suggestion

@RikkiGibson RikkiGibson merged commit 4be66fe into dotnet:features/records Jun 6, 2020
@cston cston deleted the MiscRecords branch June 6, 2020 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants