@@ -1385,12 +1385,12 @@ module internal SymbolReader =
13851385
13861386 let readMemberOrVal ( ctx : ReadingContext ) ( v : FSharpMemberOrFunctionOrValue ) =
13871387 let requireQualifiedAccess =
1388- hasAttrib < RequireQualifiedAccessAttribute > v.ApparentEnclosingEntity.Attributes
1389- // Hack for FSHarp.Core - `Option` module doesn't have RQA but really should have
1390- || ( v.ApparentEnclosingEntity.Namespace = Some " Microsoft.FSharp.Core "
1391- && v.ApparentEnclosingEntity.DisplayName = " Option" )
1392- || ( v.ApparentEnclosingEntity. Namespace = Some " Microsoft.FSharp.Core"
1393- && v.ApparentEnclosingEntity. DisplayName = " ValueOption" )
1388+ v.ApparentEnclosingEntity
1389+ |> Option.exists ( fun aee ->
1390+ hasAttrib < RequireQualifiedAccessAttribute > aee.Attributes
1391+ // Hack for FSHarp.Core - ` Option` module doesn't have RQA but really should have
1392+ || ( aee. Namespace = Some " Microsoft.FSharp.Core" && aee.DisplayName = " Option " )
1393+ || ( aee.Namespace = Some " Microsoft.FSharp.Core " && aee. DisplayName = " ValueOption" ) )
13941394
13951395 let customOpName =
13961396 match tryFindAttrib< CustomOperationAttribute> v.Attributes with
@@ -1406,7 +1406,8 @@ module internal SymbolReader =
14061406 // This module doesn't have RequireQualifiedAccessAttribute and anyway we want the name to show
14071407 // usage of its members as Array.Parallel.map
14081408 let specialCase1 =
1409- v.ApparentEnclosingEntity.TryFullName = Some " Microsoft.FSharp.Collections.ArrayModule.Parallel"
1409+ v.ApparentEnclosingEntity
1410+ |> Option.exists ( fun aee -> aee.TryFullName = Some " Microsoft.FSharp.Collections.ArrayModule.Parallel" )
14101411
14111412 let argInfos , retInfo = FSharpType.Prettify( v.CurriedParameterGroups, v.ReturnParameter)
14121413
@@ -1439,7 +1440,13 @@ module internal SymbolReader =
14391440
14401441 match v.IsMember, v.IsInstanceMember, v.LogicalName, v.DisplayName, customOpName with
14411442 // Constructors
1442- | _, _, " .ctor" , _, _ -> span [] [ !! v.ApparentEnclosingEntity.DisplayName; fullArgUsage ]
1443+ | _, _, " .ctor" , _, _ ->
1444+ span
1445+ []
1446+ [ match v.ApparentEnclosingEntity with
1447+ | None -> ()
1448+ | Some aee -> !! aee.DisplayName
1449+ fullArgUsage ]
14431450
14441451 // Indexers
14451452 | _, true , _, " Item" , _ -> span [] [ !! " this[" ; fullArgUsage; !! " ]" ]
@@ -1515,7 +1522,9 @@ module internal SymbolReader =
15151522 | _, false , _, name, _ ->
15161523 span
15171524 []
1518- [ !!( v.ApparentEnclosingEntity.DisplayName + " ." + name)
1525+ [ match v.ApparentEnclosingEntity with
1526+ | None -> !! name
1527+ | Some aee -> !!( aee.DisplayName + " ." + name)
15191528 if preferNoParens then
15201529 !! "  "
15211530 fullArgUsage ]
@@ -1552,7 +1561,7 @@ module internal SymbolReader =
15521561 // Hence getting the generic argument count if this is a little trickier
15531562 let numGenericParamsOfApparentParent =
15541563 let pty = v.ApparentEnclosingEntity
1555- pty. GenericParameters.Count
1564+ pty |> Option.map _. GenericParameters.Count |> Option.defaultValue 0
15561565
15571566 // Ensure that there is enough number of elements to skip
15581567 let tps =
@@ -1586,10 +1595,9 @@ module internal SymbolReader =
15861595 let extendedType =
15871596 if v.IsExtensionMember then
15881597 try
1589- Some(
1590- v.ApparentEnclosingEntity,
1591- formatTyconRefAsHtml ctx.UrlMap v.ApparentEnclosingEntity |> codeHtml
1592- )
1598+ match v.ApparentEnclosingEntity with
1599+ | Some aee -> Some( aee, formatTyconRefAsHtml ctx.UrlMap aee |> codeHtml)
1600+ | None -> None
15931601 with _ ->
15941602 None
15951603 else
0 commit comments