-
Notifications
You must be signed in to change notification settings - Fork 86
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
Tuple conversion are incorrectly specified #1155
Comments
Oops… I suggest this error has crept in due to the melding of tuple construction and tuple conversion into a single operation – the implicit tuple conversion §10.2.13. Possible fix:
A possible criticism of this approach is that it might define/imply (depending on wording) something like |
FWIW, I've always viewed this operation as doing exactly that, and the compiler optimized to avoid creating the tuple. We use that exact wording when talking about expression-bodied constructors that do something like |
Describe the bug
The compiler implements both a tuple type conversion, and a tuple literal conversion from expression. The spec currently only covers that latter conversion. As a concrete example of a feature that explicitly designed for and allowed, but the spec says is illegal:
Specifically, https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/conversions.md#10213-implicit-tuple-conversions is the only conversions portion of the specification that touches tuples, and it covers
tuple expressions
. These are defined by https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/expressions.md#1286-tuple-expressions. Int3 = t2
,t2
is not a tuple expression, but is instead a simple name: https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/expressions.md#1284-simple-names; since we're not dealing tuple expressions, implicit tuple conversions don't apply, and the spec says that no conversion should exist fromt2
tot3
.The text was updated successfully, but these errors were encountered: