Skip to content

feat(Attributes): Add unified [<Assignment>]; obsolete the six legacy#315

Open
dimension-zero wants to merge 3 commits into
fsprojects:masterfrom
dimension-zero:pr/27-assignment-attr-consolidation
Open

feat(Attributes): Add unified [<Assignment>]; obsolete the six legacy#315
dimension-zero wants to merge 3 commits into
fsprojects:masterfrom
dimension-zero:pr/27-assignment-attr-consolidation

Conversation

@dimension-zero
Copy link
Copy Markdown
Contributor

feat(Attributes): Add unified []; obsolete the six legacy

  • Attributes.fs: New AssignmentAttribute(separator, ?allowSpaced)
    subsumes CustomAssignment / EqualsAssignment / ColonAssignment /
    CustomAssignmentOrSpaced / EqualsAssignmentOrSpaced /
    ColonAssignmentOrSpaced. The legacy six are now marked []
    with a deprecation message pointing at the equivalent
    [<Assignment(...)>] invocation. Behaviour and storage layout are
    preserved.
  • Attributes.fs: Add a file-scoped #nowarn 44 so the legacy attributes
    that derive from now-obsolete bases (EqualsAssignmentAttribute :>
    CustomAssignmentAttribute, etc.) still compile inside this file.
    Callers outside the file still see the obsolete warning.
  • PreCompute.fs customAssignmentSeparator: read AssignmentAttribute
    first; if present it wins. Mixing the new attribute with any of the
    legacy six is rejected with a clear error so we don't have to invent
    a merge policy. The legacy two-attribute matrix is preserved
    byte-identical for callers still using it.

Strictly additive at the binary level; existing code emits a
deprecation warning only.


test(AssignmentAttribute): Coverage for unified [] attr

7 new tests:

  • [<Assignment("=")>] parses --port=8080 and rejects spaced --port 8080.
  • [<Assignment("=")>] result matches the legacy []
    parity case.
  • [<Assignment(":", allowSpaced = true)>] accepts both --tag:value and
    --tag value spaced forms.
  • Parity with [].
  • Mixing [] with the legacy [] on the same
    case raises a clear ArguException whose message mentions Assignment —
    the rejection prevents accidental double-attribution.

The file uses #nowarn 44 because it deliberately exercises the obsolete
legacy attributes alongside the new one. Net suite on this branch:
112 -> 119.


dimension-zero and others added 3 commits May 23, 2026 18:21
* Attributes.fs: New AssignmentAttribute(separator, ?allowSpaced)
  subsumes CustomAssignment / EqualsAssignment / ColonAssignment /
  CustomAssignmentOrSpaced / EqualsAssignmentOrSpaced /
  ColonAssignmentOrSpaced. The legacy six are now marked [<Obsolete>]
  with a deprecation message pointing at the equivalent
  [<Assignment(...)>] invocation. Behaviour and storage layout are
  preserved.
* Attributes.fs: Add a file-scoped #nowarn 44 so the legacy attributes
  that derive from now-obsolete bases (EqualsAssignmentAttribute :>
  CustomAssignmentAttribute, etc.) still compile inside this file.
  Callers outside the file still see the obsolete warning.
* PreCompute.fs customAssignmentSeparator: read AssignmentAttribute
  first; if present it wins. Mixing the new attribute with any of the
  legacy six is rejected with a clear error so we don't have to invent
  a merge policy. The legacy two-attribute matrix is preserved
  byte-identical for callers still using it.

Strictly additive at the binary level; existing code emits a
deprecation warning only.
7 new tests:
* [<Assignment("=")>] parses --port=8080 and rejects spaced --port 8080.
* [<Assignment("=")>] result matches the legacy [<EqualsAssignment>]
  parity case.
* [<Assignment(":", allowSpaced = true)>] accepts both --tag:value and
  --tag value spaced forms.
* Parity with [<ColonAssignmentOrSpaced>].
* Mixing [<Assignment>] with the legacy [<CustomAssignment>] on the same
  case raises a clear ArguException whose message mentions Assignment —
  the rejection prevents accidental double-attribution.

The file uses #nowarn 44 because it deliberately exercises the obsolete
legacy attributes alongside the new one. Net suite on this branch:
112 -> 119.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant