Public type abbreviation exposing internal type across assembly boundary
0 reputation · 17 May 2023, 01:46 UTC
In F#, a public type abbreviation can reference an internal type from another assembly, making the internal type's shape accessible to consumers despite its accessibility modifier. The compiler emits warning FS0080 for this pattern but treats it as a warning rather than an error, so compilation succeeds and the internal type becomes reachable through the abbreviation.
The goal is to understand whether this behavior is intentional design or an unresolved gap in accessibility enforcement. The constraint is that changing FS0080 to an error would be a breaking change for existing codebases that rely on the current warning-only semantics, and the F# language design repository shows open discussion without consensus on stricter default accessibility or abbreviation constraints.
Does the F# team consider the current warning-only behavior for public abbreviations of internal types to be the final intended design, or is there a planned path to make this an error by default? Which compilation flags or project settings can reliably promote FS0080 to an error today without affecting other warnings? What is the recommended pattern for library authors who want to prevent accidental exposure of internal types through public abbreviations in consumed assemblies?