mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
ReduceNesting walks an else-if chain to its innermost if and asks ShouldReduceNesting whether to extract the else block, which ExtractElseBlock does by casting the block to Block. A chain with no trailing else reaches this with a bare Nop, yet the heuristic still approved it (its stats count a Nop as one statement), so the cast threw InvalidCastException. Take a Block in ShouldReduceNesting and skip the reduction at the call site when the else is absent. Assisted-by: Claude:claude-opus-4-8:Claude Codepull/3901/head
1 changed files with 7 additions and 5 deletions
Loading…
Reference in new issue