Repository navigation
FS-1031: values in a flat list or array stay elements - #860
xperiandri wants to merge 4 commits into
Conversation
A list or array of only values and ranges stays a literal, so a generic value next to a range is an element and not a unit statement. Also links the implementation PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new exception does not precisely define which expressions retain literal element typing.
1 open finding
What changed in this PR
Clarifies FS-1031’s interaction with FS-1069 for flat list and array expressions.
Changes:
- Links the active implementation PR.
- Specifies that flat values remain elements when mixed with ranges.
| File | Description |
|---|---|
RFCs/FS-1031-mixing-ranges-and-values-in-sequences.md |
Adds the literal-preservation exception and implementation link. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Name the constructs that are not plain expressions, so the exception to the FS-1069 rule has an exact boundary. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The implementation reports the error of the equivalent yield! (FS0193 in list, array and sequence expressions), not FS0001. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Pushed 6dceb66: the Diagnostics list said an element type mismatch is FS0001. The implementation (dotnet/fsharp#20759) reports the error of the equivalent |
… list Rule 2 now says a list or array of only ranges and non-statement expressions keeps literal typing, and names the statements by reference to rule 1. The keyword enumeration is gone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@T-Gro a suggestion for the Scaling section, based on the benchmarks added in dotnet/fsharp#20759. Scaling says checking MUST stay linear in the number of elements. It does not for any collection that goes through the sequence-expression checker, and one range among the elements sends a flat list or array there. Checking a list of
The two computed forms grow about 4x per doubling and cost the same, so this is the existing cost of -Checking MUST stay linear in it.
+Checking MUST NOT cost more than the equivalent `yield!` form.Making the checker itself linear would be a separate change, tracked in dotnet/fsharp#20887. Shall I put the softened sentence into this PR? |

A clarification that came out of the implementation, dotnet/fsharp#20759. Rule 2 now says that a list or array of only values and ranges stays a literal, so
let f c = [ 1; 2..3; c ]infersc: int, as[ 1; c ]does. The FS-1069 rule alone would makecaunitstatement, as inseq { 1; c }today. The checklist now links the implementation.🤖 Generated with Claude Code