Skip to content

Misc. changes following recent records PR#44912

Merged
RikkiGibson merged 2 commits intodotnet:features/recordsfrom
cston:MiscRecords
Jun 6, 2020
Merged

Misc. changes following recent records PR#44912
RikkiGibson merged 2 commits intodotnet:features/recordsfrom
cston:MiscRecords

Conversation

@cston
Copy link
Contributor

@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

@cston cston requested a review from a team as a code owner June 6, 2020 06:43
@cston cston added this to the 16.7.P3 milestone Jun 6, 2020
=> 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
Contributor 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.

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
Member

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