|
| 1 | +# F# in .NET 11 Preview 2 - Release Notes |
| 2 | + |
| 3 | +Here's a summary of what's new in F# in this Preview 2 release: |
| 4 | + |
| 5 | +- [New language feature: Simplified DIM interface hierarchies (preview)](#simplified-dim-interface-hierarchies) |
| 6 | +- [Compiler performance: Overload resolution caching (preview)](#overload-resolution-caching) |
| 7 | +- [FSharp.Core: Big-O complexity documentation for all collection functions](#big-o-complexity-documentation) |
| 8 | +- [Query expression fixes for EF Core and LINQ providers](#query-expression-fixes) |
| 9 | +- [IDE: Find All References and Rename overhaul](#find-all-references-and-rename-overhaul) |
| 10 | +- [Bug fixes](#bug-fixes-and-other-improvements) |
| 11 | + |
| 12 | +## Simplified DIM interface hierarchies |
| 13 | + |
| 14 | +When a C# interface provides a Default Interface Member (DIM) implementation for a base interface slot, F# no longer requires you to explicitly implement the already-covered slot. Given these C# interfaces: |
| 15 | + |
| 16 | +```csharp |
| 17 | +public interface IA { int M(); } |
| 18 | +public interface IB : IA { |
| 19 | + new int M(); |
| 20 | + int IA.M() => this.M() + 100; // DIM covers IA.M |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +F# previously required implementing both `IA` and `IB`. Now you only implement `IB`: |
| 25 | + |
| 26 | +```fsharp |
| 27 | +type C() = |
| 28 | + interface IB with member _.M() = 42 |
| 29 | +
|
| 30 | +(C() :> IB).M() // 42 |
| 31 | +(C() :> IA).M() // 142 (DIM forwards: this.M() + 100) |
| 32 | +``` |
| 33 | + |
| 34 | +This also works with diamond inheritance, generic interfaces, properties, events, structs, and object expressions. Requires `--langversion:preview`. ([RFC FS-1336](https://github.com/fsharp/fslang-design/pull/826), [Language suggestion #1430](https://github.com/fsharp/fslang-suggestions/issues/1430), [PR #19241](https://github.com/dotnet/fsharp/pull/19241)) |
| 35 | + |
| 36 | +## Overload resolution caching |
| 37 | + |
| 38 | +A new preview feature (`--langversion:preview`) caches overload resolution results for repeated method calls with the same argument types. In a benchmark compiling a file with 5,000 `Assert.Equal(x, y)` calls (a common pattern in test projects): |
| 39 | + |
| 40 | +| Metric | .NET 9 SDK | .NET 10 SDK | This feature | |
| 41 | +|---|---|---|---| |
| 42 | +| Typecheck time | 40.8s | 6.5s | **2.9s** | |
| 43 | +| GC0 collections | — | 115 | **21** | |
| 44 | + |
| 45 | +The cache is keyed on method group identity, argument types, and return type. It is automatically disabled for named arguments, SRTP constraints, and other context-dependent scenarios. ([#18807](https://github.com/dotnet/fsharp/issues/18807), [PR #19072](https://github.com/dotnet/fsharp/pull/19072)) |
| 46 | + |
| 47 | +## Big-O complexity documentation |
| 48 | + |
| 49 | +All 462 functions across `Array`, `List`, `Seq`, `Map`, and `Set` now include Big-O complexity in their XML docs, visible in IDE tooltips: |
| 50 | + |
| 51 | +```fsharp |
| 52 | +/// <remarks>This is an O(n) operation, where n is the length of the first list.</remarks> |
| 53 | +val append: list1: 'T list -> list2: 'T list -> 'T list |
| 54 | +
|
| 55 | +/// <remarks>This is an O(log(n)) operation.</remarks> |
| 56 | +val tryFind: key: 'Key -> table: Map<'Key, 'Value> -> 'Value option |
| 57 | +``` |
| 58 | + |
| 59 | +([PR #19240](https://github.com/dotnet/fsharp/pull/19240)) |
| 60 | + |
| 61 | +## Query expression fixes |
| 62 | + |
| 63 | +This release fixes **10 longstanding bugs** affecting `query { }` expressions and LINQ provider compatibility, some open for over 10 years. This significantly improves the F# story for Entity Framework Core, Cosmos DB, and other LINQ providers: |
| 64 | + |
| 65 | +- Tuple joins and groupBy now work correctly — `join b on ((a.Id1, a.Id2) = (b.Id1, b.Id2))` finally works. ([#7885](https://github.com/dotnet/fsharp/issues/7885), [#47](https://github.com/dotnet/fsharp/issues/47)) |
| 66 | +- Tuple projections preserve `IQueryable` instead of falling back to `Enumerable.Select`, enabling `ToListAsync()` and other async EF Core operations. ([#3782](https://github.com/dotnet/fsharp/issues/3782), [#15133](https://github.com/dotnet/fsharp/issues/15133)) |
| 67 | +- Array indexing in LINQ expressions generates proper `ArrayIndex` nodes, enabling Cosmos DB to translate array access. ([#16918](https://github.com/dotnet/fsharp/issues/16918)) |
| 68 | +- Anonymous record field ordering in expression trees is now consistent regardless of declaration order. ([#11131](https://github.com/dotnet/fsharp/issues/11131)) |
| 69 | +- Conditional queries without an else branch no longer cause type mismatch errors. ([#3445](https://github.com/dotnet/fsharp/issues/3445)) |
| 70 | +- Fixed false FS1182 warnings (unused variable) for query variables in `where`, `let`, `join`, and `select` clauses. ([#422](https://github.com/dotnet/fsharp/issues/422)) |
| 71 | + |
| 72 | +([PR #19243](https://github.com/dotnet/fsharp/pull/19243)) |
| 73 | + |
| 74 | +## Find All References and Rename overhaul |
| 75 | + |
| 76 | +A comprehensive pass over the Find All References (FAR) and Rename Symbol features fixes **15+ longstanding bugs**, some open for over 7 years: |
| 77 | + |
| 78 | +- Active pattern cases in signature files now found correctly. ([#19173](https://github.com/dotnet/fsharp/issues/19173), [#14969](https://github.com/dotnet/fsharp/issues/14969)) |
| 79 | +- Rename no longer incorrectly renames `get`/`set` keywords on properties. ([#18270](https://github.com/dotnet/fsharp/issues/18270)) |
| 80 | +- Rename now handles operators containing `.` (e.g., `-.-`). ([#17221](https://github.com/dotnet/fsharp/issues/17221)) |
| 81 | +- C# extension methods now found across all usages. ([#16993](https://github.com/dotnet/fsharp/issues/16993)) |
| 82 | +- DU case tester properties (`.IsCase`) now included. ([#16621](https://github.com/dotnet/fsharp/issues/16621)) |
| 83 | +- FAR on record types now includes copy-and-update expressions. ([#15290](https://github.com/dotnet/fsharp/issues/15290)) |
| 84 | +- Constructor definitions now find all usages. ([#14902](https://github.com/dotnet/fsharp/issues/14902)) |
| 85 | +- External DLL symbol searches now scoped to referencing projects only (performance). ([#10227](https://github.com/dotnet/fsharp/issues/10227)) |
| 86 | +- `#line` directive remapping now applied correctly. ([#9928](https://github.com/dotnet/fsharp/issues/9928)) |
| 87 | +- DU types inside modules now discoverable. ([#5545](https://github.com/dotnet/fsharp/issues/5545)) |
| 88 | +- Synthetic event handler values no longer appear in results. ([#4136](https://github.com/dotnet/fsharp/issues/4136)) |
| 89 | +- FAR no longer crashes on projects containing non-F# files like `.cshtml`. ([#16394](https://github.com/dotnet/fsharp/issues/16394)) |
| 90 | + |
| 91 | +([PR #19252](https://github.com/dotnet/fsharp/pull/19252), [PR #19311](https://github.com/dotnet/fsharp/pull/19311)) |
| 92 | + |
| 93 | +## Bug fixes and other improvements |
| 94 | + |
| 95 | +- Nullness: `int<meter>.ToString()` no longer returns `string | null` for value types. ([#17539](https://github.com/dotnet/fsharp/issues/17539)) |
| 96 | +- Nullness: Pipe operator warnings now point at the nullable argument, not the pipe operator. ([#18013](https://github.com/dotnet/fsharp/issues/18013)) |
| 97 | +- Nullness: Fixed false positive warning when passing non-null `AllowNullLiteral` constructor result. ([#18021](https://github.com/dotnet/fsharp/issues/18021)) |
| 98 | +- Nullness: `not null` constraint on type extensions is now allowed. ([#18334](https://github.com/dotnet/fsharp/issues/18334)) |
| 99 | +- Nullness: Tuple null elimination no longer over-infers non-null in pattern matching. ([#19042](https://github.com/dotnet/fsharp/issues/19042)) |
| 100 | +- Fixed FS0229 error when reading metadata from assemblies compiled with `LangVersion < 9.0`. ([PR #19260](https://github.com/dotnet/fsharp/pull/19260)) |
| 101 | +- Fixed FS3356 false positive for instance extension members with the same name on different types. ([PR #19260](https://github.com/dotnet/fsharp/pull/19260)) |
| 102 | +- Fixed graph-based type checking dependency resolution for duplicate module names across files. ([PR #19280](https://github.com/dotnet/fsharp/pull/19280)) |
| 103 | +- Fixed F# script default reference paths when an SDK directory is specified. ([PR #19270](https://github.com/dotnet/fsharp/pull/19270)) |
| 104 | + |
| 105 | +...and many others. |
| 106 | + |
| 107 | +F# updates: |
| 108 | + |
| 109 | +- [F# release notes](https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html) |
| 110 | +- [dotnet/fsharp repository](https://github.com/dotnet/fsharp) |
0 commit comments