-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Added a new ConversionKind for Interpolated string #20416
Added a new ConversionKind for Interpolated string #20416
Conversation
@dotnet-bot retest ubuntu_14_debug_prtest please Retest by request from @cston, link to the failed build: https://ci.dot.net/job/dotnet_roslyn/job/features_ioperation/job/ubuntu_14_debug_prtest/114/console
|
Ping @dotnet/analyzer-ioperation? |
@dotnet/roslyn-compiler @AlekseyTs, can I get a couple of reviews please? |
@@ -31,6 +31,11 @@ public enum ConversionKind | |||
/// </summary> | |||
OperatorMethod = 0x5, | |||
/// <summary> | |||
/// Conversion is defined by the underlying type, and is created when an interoplated | |||
/// string expression is being converted to an IFormattable or FormattableString. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: interpolated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
LGTM |
Ping @AlekseyTs |
/// Conversion is defined by the underlying type, and is created when an interpolated | ||
/// string expression is being converted to an IFormattable or FormattableString. | ||
/// </summary> | ||
InterpolatedString = 0x6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InterpolatedString = 0x6, [](start = 8, length = 25)
Looking at the set of members in this enum, I am not sure if we should be adding InterpolatedString as a member. Should we simply use Basic/CSharp kind instead? For example, we don't try to be more specific about other conversions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we decided in the design group meeting that since this conversion exists in the spec for both languages, we should make this one of the public types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that we have made this decision, but I am not certain we actually looked at the list of existing kinds in the enum, which could lead us to a different decision. Anyway, we can go with the change as it is, but please bring this to design meeting to confirm that this is what we want.
@@ -139,6 +139,9 @@ private static ConversionKind GetConversionKind(CSharp.ConversionKind kind) | |||
case CSharp.ConversionKind.PointerToVoid: | |||
return Semantics.ConversionKind.CSharp; | |||
|
|||
case CSharp.ConversionKind.InterpolatedString: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case CSharp.ConversionKind.InterpolatedString: [](start = 16, length = 46)
It feels like we should simply add this case to the previous switch section.
Done with review pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'll hold off on submitting this until we decide if we actually want an |
I'm ok with this going in as is. I think we'l want to do an overall review of conversions and conversion kinds for V1 soon though. |
This adds support for interpolated strings to our public ConversionKind enum. I added support for C# as well. I'm going to hold off on implementing VB because of this issue: #20415. I'll fix that as part of a larger addition of tests for VB conversions, as part of the work for #17590. This PR fixes #20046. Tagging @dotnet/analyzer-ioperation @AlekseyTs for review.