-
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
C# 7.0 tuples - Invalid code generation for expression trees #12797
Comments
At first sight, it seems a substitution a la |
I have a spot fix in my fork for expression tree futures @ bartdesmet@994f964. I haven't studied the code base extensively for the places where tuple types are retargeted to their underlying types, so the right fix may be in a different location. I'm planning to play around more with the intersection of expression trees and tuple types in the next few weeks. |
The syntax |
Great, that will fix it :-). Do we have an up-to-date document on the C# 7.0 features and their language surface, reflecting latest decisions? I'm basing my investigations on the docs/features MD files right now. |
#10891 should make this problem unreachable since the code would be cause a compile error |
Repro steps:
Quick inspection shows that the generated IL code has:
This should call the
GetMethodFromHandle
overload with aRuntimeTypeHandle
parameter that should be set toldtoken valuetype System.ValueTuple
2<int32,int32>`. In contrast, the following works fine:It seems the difference is noticed here:
That method returns 2 for the use of the tuple literal
(1, 2)
but 0 for the use ofnew (int, int)(1, 2)
. Looking higher up in theLocalRewriter
it seems thatVisitObjectCreationExpression
receives the constructor of the tuple type but it never gets retargeted to theTupleUnderlyingType
unlike what happens in theVisitTupleLiteral
case.The text was updated successfully, but these errors were encountered: