Skip to content

F# 10.0.400 breaks Aether optics — confirmed upstream compiler bug (dotnet/fsharp#20253) #450

Description

@7sharp9

Follow-up to #447.

Root cause confirmed

Not our code, not Aether-specific. Upstream F# compiler regression, filed independently the same day: dotnet/fsharp#20253, "SDK 10.0.400 regression: cross-assembly inline SRTP call throws in Release." Identical repro: Aether 8.3.1, Dynamic invocation of op_HatEquals is not supported at Aether.Optic.set. Broken on 10.0.400, works on 10.0.303. Open, Backlog, unassigned, no fix PR yet.

What we additionally verified locally

  • Not limited to Optic.set/^=. Optic.get/^. and lens composition >-> hit the same failure mode (repro'd in GenCORE.Lib/MinMax.fs and GenCORE.Lib/Patient.fs under 10.0.400).
  • Eta-expanding call sites does not fix it, the compiler still emits an internal curried closure that fails.
  • Bypassing Aether's dispatch and calling the Lens/Prism tuple's functions directly (fst/snd) does avoid it, verified against 10.0.400.

Current mitigation

PR #449 pins global.json to 10.0.302/latestPatch. Sufficient until upstream fixes #20253.

Optional follow-up (not urgent while the pin holds)

Replace Aether with a small hand-rolled, non-generic Lens/Prism module (get/set/compose as plain functions) across the affected files: MinMax.fs, GenCORE.Lib/Patient.fs, GenORDER.Lib/Patient.fs, ZForm.Lib/DoseRule.fs, PatientCategory.fs. To remove the dependency and this whole class of SRTP fragility. Track dotnet/fsharp#20253 before considering unpinning the SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions