-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Compiler shouldn't allow extension method called "Clone" on records. #48287
Comments
Closing out as i do not see any language rules we've specified that would disallow this. If you would like to propose a language rule here, please open a discussion over at dotnet/csharplang. Thanks :) |
@CyrusNajmabadi I just came across #40726 and found:
Did that meant records shouldn't indeed have Clone extension methods? Why it has a check mark while it doesn't seem to be done yet? cc: @jcouv |
This was checked because the question was resolved ("no"). That test plan tracks the C# 9 work for records. |
@jcouv Clone extension methods on records are currently allowed. Is there any work/tracking issue to disallow it? |
What we we decided is that when looking up the Clone method we wouldn't bind to extension methods. It's not that you can't write the extension method. It's just that the compiler won't use it. |
@CyrusNajmabadi There is probably something I'm misunderstanding. I see that currently it's being used: I'm also not sure how to use the existing Clone? I can't normally call it: |
Currently, the following code compiles without errors:
SharpLab.
The text was updated successfully, but these errors were encountered: