Update records spec with new warning (#3883)

* Update records spec with new warning

* Update proposals/csharp-9.0/records.md

Co-authored-by: Fred Silberberg <fred@silberberg.xyz>

Co-authored-by: Fred Silberberg <fred@silberberg.xyz>
This commit is contained in:
Youssef Victor 2020-09-12 01:07:40 +02:00 committed by GitHub
parent b4b5b530da
commit ca09fc178f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,6 +66,9 @@ The synthesized property returns `typeof(R)` where `R` is the record type.
The record type implements `System.IEquatable<R>` and includes a synthesized strongly-typed overload of `Equals(R? other)` where `R` is the record type.
The method is `public`, and the method is `virtual` unless the record type is `sealed`.
The method can be declared explicitly. It is an error if the explicit declaration does not match the expected signature or accessibility, or the explicit declaration doesn't allow overriding it in a derived type and the record type is not `sealed`.
If either `Equals(R? other)` or `GetHashCode` are user-defined (not synthesized), but not both, a warning is produced.
```C#
public virtual bool Equals(R? other);
```