-
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
Enforce that ValueTuple types are structs #11689
Comments
CC @AlekseyTs |
@VSadov Could you provide more examples where such enforcement would be useful? |
Not only this is costly. It is also dangerous as it is likely to cause circularity during binding. I learned this the hard way while working on Non-nullable Reference Types. Checks whether a type is a value type should be postponed as much as possible. |
I think we should try. |
It does not need to be a 100% comprehensive check. |
I think we should do the opposite, i.e. don't assume that it is a struct, or verify this assumption only where implementation makes such assumption (ideally there should be no places like that). So, before we start trying something, we should review places where the assumption is made and evaluate how important/need that assumption. |
We seem to be gradually taking some direct or indirect dependencies on tuples being structs already - we allow nullable conversions, may consider ctor invocations equivalent to element-wise assignments into a local with default value, etc...
There is no point in having special support for a case where ValueTuple are classes and it is more robust to just require tuple underlying types to be structs.
The text was updated successfully, but these errors were encountered: