diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index e209c5e9efc..339458b1d49 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -189,6 +189,7 @@ * IL: cache the ILTypeRef of a type def ([PR #20259](https://github.com/dotnet/fsharp/pull/20259)) * IL: use empty tables for members when possible ([PR #20249](https://github.com/dotnet/fsharp/pull/20249)) * Make Entity's adhoc members list lazy ([PR #20286](https://github.com/dotnet/fsharp/pull/20286/changes)) +* Constraint solver: `TryD` is now `inline` with `[]` on its always-run continuation, so the argument closures are no longer allocated at the (very hot) constraint-solver call sites; `IgnoreFailedMemberConstraintResolution` is `inline` so its forwarded continuation stays a literal. ([PR #20367](https://github.com/dotnet/fsharp/pull/20367)) ### Changed * The `--warnaserror` option now ignores unrecognized diagnostic identifiers in warning lists while still applying recognized F# warning codes. ([PR #20246](https://github.com/dotnet/fsharp/pull/20246)) diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index 838a534f2a2..fcdfa301dd0 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -589,7 +589,7 @@ exception NonRigidTypar of displayEnv: DisplayEnv * string option * range * TTyp exception AbortForFailedMemberConstraintResolution /// This is used internally in method overload resolution -let IgnoreFailedMemberConstraintResolution f1 f2 = +let inline IgnoreFailedMemberConstraintResolution ([] f1) f2 = TryD f1 (function diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fs b/src/Compiler/Facilities/DiagnosticsLogger.fs index 77351b7dd89..8f1689f2cf7 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fs +++ b/src/Compiler/Facilities/DiagnosticsLogger.fs @@ -747,7 +747,7 @@ let rec Iterate2D f xs ys = /// Keep the warnings, propagate the error to the exception continuation. [] -let TryD f g = +let inline TryD ([] f) g = match f () with | ErrorResult(warns, err) -> trackErrors { diff --git a/src/Compiler/Facilities/DiagnosticsLogger.fsi b/src/Compiler/Facilities/DiagnosticsLogger.fsi index 66377aac861..1d148e65c05 100644 --- a/src/Compiler/Facilities/DiagnosticsLogger.fsi +++ b/src/Compiler/Facilities/DiagnosticsLogger.fsi @@ -408,7 +408,7 @@ val IterateIdxD: f: (int -> 'T -> OperationResult) -> xs: 'T list -> Opera /// Stop on first error. Accumulate warnings and continue. val Iterate2D: f: ('T -> 'b -> OperationResult) -> xs: 'T list -> ys: 'b list -> OperationResult -val TryD: f: (unit -> OperationResult<'T>) -> g: (exn -> OperationResult<'T>) -> OperationResult<'T> +val inline TryD: f: (unit -> OperationResult<'T>) -> g: (exn -> OperationResult<'T>) -> OperationResult<'T> val RepeatWhileD: nDeep: int -> body: (int -> OperationResult) -> OperationResult