Skip to content

Commit 2a5a02f

Browse files
forkibaronfel
authored andcommitted
Reduce Number of isAppTy calls (#8275)
1 parent 68f731f commit 2a5a02f

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/fsharp/symbols/SymbolHelpers.fs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -839,19 +839,22 @@ module internal SymbolHelpers =
839839
// This may explore assemblies that are not in the reference set.
840840
// In this case just assume the item is not suppressed.
841841
protectAssemblyExploration true (fun () ->
842-
match item with
843-
| Item.Types(it, [ty]) ->
844-
isAppTy g ty &&
845-
g.suppressed_types
846-
|> List.exists (fun supp ->
847-
let generalizedSupp = generalizedTyconRef supp
848-
// check the display name is precisely the one we're suppressing
849-
isAppTy g generalizedSupp && it = supp.DisplayName &&
850-
// check if they are the same logical type (after removing all abbreviations)
851-
let tcr1 = tcrefOfAppTy g ty
852-
let tcr2 = tcrefOfAppTy g generalizedSupp
853-
tyconRefEq g tcr1 tcr2)
854-
| _ -> false)
842+
match item with
843+
| Item.Types(it, [ty]) ->
844+
match tryDestAppTy g ty with
845+
| ValueSome tcr1 ->
846+
g.suppressed_types
847+
|> List.exists (fun supp ->
848+
let generalizedSupp = generalizedTyconRef supp
849+
// check the display name is precisely the one we're suppressing
850+
match tryDestAppTy g generalizedSupp with
851+
| ValueSome tcr2 ->
852+
it = supp.DisplayName &&
853+
// check if they are the same logical type (after removing all abbreviations)
854+
tyconRefEq g tcr1 tcr2
855+
| _ -> false)
856+
| _ -> false
857+
| _ -> false)
855858

856859
/// Filter types that are explicitly suppressed from the IntelliSense (such as uppercase "FSharpList", "Option", etc.)
857860
let RemoveExplicitlySuppressed (g: TcGlobals) (items: ItemWithInst list) =

0 commit comments

Comments
 (0)