mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
Assigning through a ref-conditional, (cond ? ref a : ref b) = value, was emitted without the parentheses, so it re-parsed as cond ? ref a : (ref b = value) and failed to compile (CS8156 / CS0201). The target was only parenthesized above assignment precedence, but a conditional binds tighter than assignment, so the check let it through. Require the assignment target to have precedence above the conditional operator. Ordinary lvalues (locals, fields, indexers) are primary expressions and are unaffected; the postfix ++ form already parenthesized correctly via unary precedence. Covers plain and compound assignments alike. Assisted-by: Claude:claude-opus-4-8:Claude Codepull/4086/head
2 changed files with 11 additions and 2 deletions
Loading…
Reference in new issue