dotnet/roslyn
Remove extraneous branch for empty strings in interpolated string handler CFG
Aperta
#57.611 aperta il 5 nov 2021
Area-CompilersBugFeature - IOperationFeature - Interpolated String Improvementshelp wanted
Metriche repository
- Star
- (20.414 stelle)
- Metriche merge PR
- (Merge medio 6g 17h) (256 PR mergiate in 30 g)
Descrizione
When an interpolated string handler is created for an empty string, and the constructor of the handler uses an out bool success parameter, we generate an unnecessary branch in the CFG for the code, demonstrated in the InterpolatedStringHandlerConversionFlow_16 test. We could take the approach Aleksey detailed in his review to remove that branch, but we will have to wire a CreateDiscardSymbol method through the semantic model to be able to create an IDiscardOperation for the parameter value. This is presently undone.