You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This special-casing allows us to update FSharp.Core to avoid boxing
when caling the `string` function on enums and signed integral types
going forward while still allowing the updated version of FSharp.Core
to be fully compatible with older compilers.
Adding support for some form of constraint in library-only static
optimizations instead would have been problematic for multiple reasons.
Supporting something like `when 'T : enum<'U>` would have required
additional modifications to the compiler and would not have been
consumable by older compilers. It would also introduce a new type
variable. While something like `when 'T : 'T & #Enum` is already
syntactically valid, it would add that constraint to the entire `string`
function without further modification to the typechecker. It would also
not be consumable by older compilers.
I think adding a special case for enums is justifiable since (1) enums are a
special kind of type to begin with, and (2) static optimization
constraints are only allowed in FSharp.Core, so the change to the
language itself is quite small.
Copy file name to clipboardExpand all lines: docs/release-notes/.FSharp.Compiler.Service/10.0.100.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,10 @@
12
12
* Shorthand lambda: fix completion for chained calls and analysis for unfinished expression ([PR #18560](https://github.com/dotnet/fsharp/pull/18560))
13
13
* Completion: fix previous namespace considered opened [PR #18609](https://github.com/dotnet/fsharp/pull/18609)
14
14
15
+
### Added
16
+
17
+
* Add support for `when 'T : Enum` library-only library-only static optimization constraint. ([PR #18546](https://github.com/dotnet/fsharp/pull/18546))
0 commit comments