Align addition of a synthesized override of object.Equals(object? obj) in records with the latest design.#45475
Merged
AlekseyTs merged 2 commits intodotnet:masterfrom Jun 29, 2020
Merged
Conversation
…) in records with the latest design. Related to dotnet#45296. From specification: The record type includes a synthesized override of object.Equals(object? obj). It is an error if the override is declared explicitly. The synthesized override returns Equals(other as R) where R is the record type.
Contributor
Author
|
@jcouv, @agocke, @cston , @RikkiGibson, @dotnet/roslyn-compiler Please review. |
AlekseyTs
commented
Jun 26, 2020
| : base(containingType, "Equals", containingType.Locations[0], (CSharpSyntaxNode)containingType.SyntaxReferences[0].GetSyntax(), MethodKind.Ordinary, | ||
| isIterator: false, isExtensionMethod: false, isPartial: false, hasBody: true, diagnostics) | ||
| { | ||
| var compilation = containingType.DeclaringCompilation; |
Contributor
Author
There was a problem hiding this comment.
var compilation = containingType.DeclaringCompilation; [](start = 12, length = 54)
This line is no longer needed. #Closed
333fred
reviewed
Jun 26, 2020
|
|
||
|
|
||
| // We put synthesized record members first so that errors about conflicts show up on user-defined members rather than all | ||
| // go to the record declaration |
Member
There was a problem hiding this comment.
go [](start = 15, length = 2)
Small nit: go -> going #Pending
Contributor
Author
AlekseyTs
commented
Jun 27, 2020
|
|
||
| var overridden = OverriddenMethod?.OriginalDefinition; | ||
|
|
||
| if (overridden is null || (overridden is SynthesizedRecordObjEquals && overridden.DeclaringCompilation == DeclaringCompilation)) |
Contributor
Author
There was a problem hiding this comment.
SynthesizedRecordObjEquals [](start = 53, length = 26)
This should be adjusted to handle a general case, but this PR doesn't have any. Fixed in the change that builds on top of this PR. #Resolved
Contributor
Author
cston
approved these changes
Jun 29, 2020
333fred
added a commit
to 333fred/roslyn
that referenced
this pull request
Jun 29, 2020
* upstream/master: (1226 commits) Remove unnecessary Clone() (dotnet#45469) Align addition of a synthesized override of object.Equals(object? obj) in records with the latest design. (dotnet#45475) Move SymbolSearch down to EditorFeatures (dotnet#45505) VisitType in MethodToClassRewriter for function pointers. Fix up nondeterminism in serializing naming style preferences Update dependencies from https://github.com/dotnet/arcade build 20200626.2 (dotnet#45482) Fix typo Move to vnext Add constant inerpolated strings to the test plan, update status for records. Don't emit ldftn when the result is unused. PR Feedback: * Additional tests for nested function contexts. * Override VisitFunctionPointerLoad in MethodToClassRewriter. * Adjust debug asserts. Add records to compiler test plan (dotnet#45434) Expand comment in CreateRecoverableText Replace binary serialization of encoding with a custom serializer. (dotnet#45374) LangVersion 9 (dotnet#44911) Avoid loading document text in AbstractObjectBrowserLibraryManager.DocumentChangedAsync Allow TryGetTextVersion to pass through to the initial source Ensure recoverable text is in temporary storage Fix test Updates the option page type GUID to match the one in pkgdef ...
333fred
added a commit
that referenced
this pull request
Jun 30, 2020
…e_168 * upstream/master: (102 commits) Change contrast ratio to get close to 1.5:1 (#45526) Revert "Move SymbolSearch down to EditorFeatures (#45505)" Delay accessibility checks to avoid cycles (#45441) Prevent trying to convert metadata references into circular project references Remove unnecessary Clone() (#45469) Align addition of a synthesized override of object.Equals(object? obj) in records with the latest design. (#45475) Move SymbolSearch down to EditorFeatures (#45505) VisitType in MethodToClassRewriter for function pointers. Fix up nondeterminism in serializing naming style preferences Update dependencies from https://github.com/dotnet/arcade build 20200626.2 (#45482) Fix typo Move to vnext Add constant inerpolated strings to the test plan, update status for records. Don't emit ldftn when the result is unused. PR Feedback: * Additional tests for nested function contexts. * Override VisitFunctionPointerLoad in MethodToClassRewriter. * Adjust debug asserts. Add records to compiler test plan (#45434) Expand comment in CreateRecoverableText Replace binary serialization of encoding with a custom serializer. (#45374) LangVersion 9 (#44911) Avoid loading document text in AbstractObjectBrowserLibraryManager.DocumentChangedAsync ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #45296.
From specification:
The record type includes a synthesized override of object.Equals(object? obj). It is an error if the override is declared explicitly. The synthesized override returns Equals(other as R) where R is the record type.