From 98d652f6755b342e8c4dfadaeca1045e0ec10456 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sun, 23 Aug 2026 21:10:25 +0200 Subject: [PATCH 1/2] Name resolution: CheckIWSAM only needs the intrinsic methods AllMethInfosOfTypeInScope is IntrinsicMethInfosOfType @ ExtensionMethInfosOfTypeInScope, and with AllResults the extension half always runs, but the predicate discards every extension member it finds. Call IntrinsicMethInfosOfType directly with the arguments AllMethInfosOfTypeInScope passed it, which also drops the NameEnv only the extension scan needed. It is exported from the signature rather than substituting InfoReader.GetIntrinsicMethInfosOfType, which does not apply ExcludeHiddenOfMethInfos. Co-Authored-By: Claude Opus 5 --- .../Checking/Expressions/CheckExpressions.fs | 2 +- src/Compiler/Checking/NameResolution.fsi | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index ecc4565e12f..060697a697b 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -4678,7 +4678,7 @@ and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref = let ty = generalizedTyconRef g tcref if iwsam = WarnOnIWSAM.Yes && isInterfaceTy g ty && checkConstraints = CheckCxs then - let meths = AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults cenv.infoReader env.NameEnv None env.eAccessRights IgnoreOverrides m ty + let meths = IntrinsicMethInfosOfType cenv.infoReader None env.eAccessRights AllowMultiIntfInstantiations.Yes IgnoreOverrides m ty if meths |> List.exists (fun meth -> not meth.IsInstance && meth.IsDispatchSlot && not meth.IsExtensionMember) then let tcref = tcrefOfAppTy g ty diff --git a/src/Compiler/Checking/NameResolution.fsi b/src/Compiler/Checking/NameResolution.fsi index d7da7bf16fa..fac10862948 100755 --- a/src/Compiler/Checking/NameResolution.fsi +++ b/src/Compiler/Checking/NameResolution.fsi @@ -687,6 +687,18 @@ val internal ExtensionPropInfosOfTypeInScope: ty: TType -> PropInfo list +/// Get the intrinsic methods of a type (both declared and inherited), without the extension methods in +/// scope. Callers that filter extension members out again should use this and skip the extension scan. +val internal IntrinsicMethInfosOfType: + infoReader: InfoReader -> + optFilter: string option -> + ad: AccessorDomain -> + allowMultiIntfInst: TypeHierarchy.AllowMultiIntfInstantiations -> + findFlag: FindMemberFlag -> + m: range -> + ty: TType -> + MethInfo list + /// Get the available methods of a type (both declared and inherited) val internal AllMethInfosOfTypeInScope: collectionSettings: ResultCollectionSettings -> From 3bb87bb5616607d21f8e39e85aa6bcfc90a7c50f Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 9 Sep 2026 22:48:02 +0200 Subject: [PATCH 2/2] Release notes Co-Authored-By: Claude Fable 5.1 --- docs/release-notes/.FSharp.Compiler.Service/11.0.100.md | 1 + 1 file changed, 1 insertion(+) 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 ed1e382d6c7..5a5b36abbcb 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -163,6 +163,7 @@ * Debug: rework conditional erasure, fix stepping over literals ([PR #19897](https://github.com/dotnet/fsharp/pull/19897)) * Record spreads ([RFC FS-1151](https://github.com/fsharp/fslang-design/pull/805), [PR #18927](https://github.com/dotnet/fsharp/pull/18927), [PR #20206](https://github.com/dotnet/fsharp/pull/20206)) * Debug: fix if and match condition sequence points ([PR #19932](https://github.com/dotnet/fsharp/pull/19932)) +* Name resolution: CheckIWSAM only needs the intrinsic methods ([PR #20490](https://github.com/dotnet/fsharp/pull/20490)) * Surface the synthesized all-fields constructor of F# record types to F# code under the `RecordConstructorSyntax` preview feature, via a new `MethInfo.RecdCtor` case. ([PR #19974](https://github.com/dotnet/fsharp/pull/19974)) * Under `--reflectionfree`, discriminated unions, records and anonymous records now get a [generated `ToString`](../../reflectionfree-printing.md) (rendering each field like `Option` does) instead of falling back to the namespace-qualified type name. ([PR #19976](https://github.com/dotnet/fsharp/pull/19976)) * Support common types of `NotNullIfNotNullAttribute` usage. If a method parameter is marked with `NotNullIfNotNullAttribute`, the compiler will now honor this attribute and mark the return type as non-null. ([PR #19977](https://github.com/dotnet/fsharp/pull/19977))