dotnet/roslyn

Remove extraneous branch for empty strings in interpolated string handler CFG

开放

#57,611 创建于 2021年11月5日

 (0 条评论) (0 个反应) (1 位负责人)C# (4,257 个派生)batch import
Area-CompilersBugFeature - IOperationFeature - Interpolated String Improvementshelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

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.

贡献者指南