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

Records won't allow properties to hide names from the base #76557

Open
alrz opened this issue Dec 23, 2024 · 0 comments
Open

Records won't allow properties to hide names from the base #76557

alrz opened this issue Dec 23, 2024 · 0 comments

Comments

@alrz
Copy link
Member

alrz commented Dec 23, 2024

Version Used: 98ea496

Steps to Reproduce:

abstract record R1
{
    public sealed record Derived(E E) : R1; // error CS8866 (expected?)
    public enum E { }
}
abstract class R2
{
    public sealed class Derived : R2
    {
        public Derived(E E) => this.E = E;
        public new E E { get; } // notice the `new` modifier
    }
    public enum E { }
}

Expected Behavior: No errors or at least a warning.

Actual Behavior: error CS8866: Record member 'R1.E' must be a readable instance property or field of type 'R1.E' to match positional parameter 'E'.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 23, 2024
@jaredpar jaredpar added Feature - Records Records and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 6, 2025
@jaredpar jaredpar added this to the Backlog milestone Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants