@@ -858,6 +858,15 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)
858
858
else
859
859
None
860
860
861
+ let tryGetShortMemberNameFromMemberName ( memberName : string ) =
862
+ let sub = removeParen memberName
863
+ let lastPeriod = sub.LastIndexOf( " ." )
864
+
865
+ if lastPeriod > 0 then
866
+ Some( memberName.Substring( lastPeriod + 1 ))
867
+ else
868
+ None
869
+
861
870
let getMemberName keepParts hasModuleSuffix ( memberNameNoParen : string ) =
862
871
let splits = memberNameNoParen.Split( '.' ) |> Array.toList
863
872
@@ -992,6 +1001,13 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)
992
1001
let simple = getMemberName 1 false typeName
993
1002
externalDocsLink false simple typeName typeName
994
1003
1004
+ let mfvToCref ( mfv : FSharpMemberOrFunctionOrValue ) =
1005
+ let entityUrlBaseName = getUrlBaseNameForRegisteredEntity mfv.DeclaringEntity.Value
1006
+
1007
+ { IsInternal = true
1008
+ ReferenceLink = internalCrossReferenceForMember entityUrlBaseName mfv
1009
+ NiceName = mfv.DeclaringEntity.Value.DisplayName + " ." + mfv.DisplayName }
1010
+
995
1011
let tryResolveCrossReferenceForMemberByXmlSig ( memberXmlSig : string ) =
996
1012
assert
997
1013
( memberXmlSig.StartsWith( " M:" )
@@ -1000,13 +1016,7 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)
1000
1016
|| memberXmlSig.StartsWith( " E:" ))
1001
1017
1002
1018
match xmlDocNameToSymbol.TryGetValue( memberXmlSig) with
1003
- | true , (:? FSharpMemberOrFunctionOrValue as memb) when memb.DeclaringEntity.IsSome ->
1004
- let entityUrlBaseName = getUrlBaseNameForRegisteredEntity memb.DeclaringEntity.Value
1005
-
1006
- { IsInternal = true
1007
- ReferenceLink = internalCrossReferenceForMember entityUrlBaseName memb
1008
- NiceName = memb.DeclaringEntity.Value.DisplayName + " ." + memb.DisplayName }
1009
- |> Some
1019
+ | true , (:? FSharpMemberOrFunctionOrValue as memb) when memb.DeclaringEntity.IsSome -> memb |> mfvToCref |> Some
1010
1020
| _ ->
1011
1021
// If we can't find the exact symbol for the member, don't despair, look for the type
1012
1022
let memberName = memberXmlSig.Substring( 2 ) |> removeParen
@@ -1019,10 +1029,19 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)
1019
1029
| true , (:? FSharpEntity as entity) ->
1020
1030
let urlBaseName = getUrlBaseNameForRegisteredEntity entity
1021
1031
1022
- Some
1023
- { IsInternal = true
1024
- ReferenceLink = internalCrossReference urlBaseName
1025
- NiceName = getMemberName 2 entity.HasFSharpModuleSuffix memberName }
1032
+ // See if we find the member that was intended, otherwise default to containing entity
1033
+ tryGetShortMemberNameFromMemberName memberName
1034
+ |> Option.bind ( fun shortName ->
1035
+ entity.MembersFunctionsAndValues
1036
+ |> Seq.tryFind ( fun mfv -> mfv.DisplayName = shortName))
1037
+ |> function
1038
+ | Some mb -> Some( mfvToCref mb)
1039
+ | None ->
1040
+ Some
1041
+ { IsInternal = true
1042
+ ReferenceLink = internalCrossReference urlBaseName
1043
+ NiceName = getMemberName 2 entity.HasFSharpModuleSuffix memberName }
1044
+
1026
1045
| _ ->
1027
1046
// A reference to something external, currently assumed to be in .NET
1028
1047
let simple = getMemberName 2 false memberName
0 commit comments