98. Reject ++, numeric-only unary +, fmt AST equivalence, and indented lambda block bodies (2026-11-21)
++is a lexer error ("CP Lang concatenates with+") with a+fix-it; unary+is numeric-only (E0302otherwise);cpl fmtcorpus test checks parsed AST equivalence.- Reason: Previously
xs ++ [v] ++ yslexed as+followed by unary+, the parser silently dropped unary+, andcpl fmtrewrote it toxs + +[v] + +yswhich ran onList. NowUnOp::Posis preserved in the AST, checked as numeric-only (E0302on non-numeric operands),++is rejected incpl-syntax::lexerwith a machine-applicable+fix-it (applied bycpl fix), andcpl-fmt::tests::formats_the_whole_corpuscompares span-stripped parsed ASTs before and after formatting across all 1000+ corpus.cpfiles. - Reverse: Remove the
(b'+', b'+', _)arm incrates/cpl-syntax/src/lexer.rsandUnOp::Posacrosscpl-syntax/cpl-check/cpl-ir/cpl-interp/cpl-codegen.
- Reason: Previously
- Indented block bodies after
=>on lambdas and table comprehensions, plus bracketedmatch/if/elseblocks.- Reason: Accepted syntax so multi-statement lambdas work cleanly in table comprehensions (
[0..=s, 0..n] (i, j) =>\n ...), named arguments (by: x =>\n ...), and call arguments without wrapping in braces. The lexer trackslayout_blocksinside brackets soNewline/Indent/Dedenttokens are emitted for=>blocks (andmatch/if/elseblocks ending in:) inside(...)/[...],split_itemskeeps bracketed items intact, andParser::lambda_bodyparsesNewline + IndentintoExprKind::Block(Block)whose value is its last expression (matchingfn ... :, formatter, LSP folding, and--trace). - Reverse: Remove
layout_blocksincrates/cpl-syntax/src/lexer.rs,bracketsincrates/cpl-syntax/src/items.rs, andlambda_bodyincrates/cpl-syntax/src/parser/expr.rs.
- Reason: Accepted syntax so multi-statement lambdas work cleanly in table comprehensions (