-
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
Support binary interpolation addition #55059
Support binary interpolation addition #55059
Conversation
/cc @stephentoub fyi. |
Yay. Thanks. |
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
Outdated
Show resolved
Hide resolved
@dotnet/roslyn-compiler for a second review. |
Looking |
Not blocking this PR, but we should also think about deconstruction declaration. It should behave like local declarations. In reply to: 887677366 In reply to: 887677366 In reply to: 887677366 In reply to: 887677366 #Closed Refers to: src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs:11710 in 0f97ce1. [](commit_id = 0f97ce1, deletion_comment = False) |
Do we have tests for various groupings with parens: In reply to: 887677366 Refers to: src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs:11710 in 0f97ce1. [](commit_id = 0f97ce1, deletion_comment = False) |
src/Compilers/CSharp/Portable/BoundTree/BoundBinaryOperator.UncommonData.cs
Show resolved
Hide resolved
I'm having some trouble getting an overall picture from this PR. If we're converting a suitable unconverted binary op, what are the desired type and converted type for the binary op and for the interpolated string operands? I don't have a clear idea what I should expect. In reply to: 887718786 Refers to: src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs:11710 in 0f97ce1. [](commit_id = 0f97ce1, deletion_comment = False) |
src/Compilers/CSharp/Portable/Binder/Binder_InterpolatedString.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/BoundTree/BoundBinaryOperator.UncommonData.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Binder/Binder_InterpolatedString.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Test/Semantic/Semantics/NullableReferenceTypesTests.cs
Show resolved
Hide resolved
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.
Done with review (iteration 3). Haven't yet much looked at tests
The of the operator and all interpolated string components is In reply to: 887936166 Refers to: src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs:11710 in 0f97ce1. [](commit_id = 0f97ce1, deletion_comment = False) |
Deconstruction and tuples appear to just work, actually, so I'll add a couple of tests to cover. In reply to: 888491370 Refers to: src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs:11710 in 0f97ce1. [](commit_id = 0f97ce1, deletion_comment = False) |
Glad that deconstruction just worked out. Refers to: src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs:12045 in cbac96b. [](commit_id = cbac96b, deletion_comment = False) |
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.
Done with review pass (iteration 5). One question left unaddressed
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 Thanks (iteration 6). Please follow-up on a test that is affected (remaining open issue)
} | ||
// https://github.com/dotnet/roslyn/issues/54583 | ||
// Better handle the constructor propogation | ||
//public override BoundNode? VisitInterpolatedString(BoundInterpolatedString node) |
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.
Nit: can we get rid of the commented code? either enter the function and return node, or remove.
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 intentionally left this in to leave a place for the issue comment.
Will this target 17.0p3? Branch should change if so |
…ere a single interpolated string.
…latedStringHandler in expression trees.
d9cdf0e
to
8b6880c
Compare
This adds support for treating binary addition of interpolated strings as if they were a single string, for the purposes of conversions to custom handler types and lowering. I implemented this by delaying binding of binary additions composed entirely of interpolated strings until use, and adjusting all the points that currently expect a string to instead expect either an interpolated string or a binary addition of interpolated strings. @dotnet/roslyn-compiler for review: I'd suggest reviewing commit-by-commit. Commit 1 implements the basic changes just for interpolated strings used as strings, and the second commit adds support for conversions. Closes #54584.
Test plan: #51499