Bugfix : make sure nullness does not break XmlDoc info import for met… · dotnet/fsharp@006f91e · GitHub
Skip to content

Commit 006f91e

Browse files
authored
Bugfix : make sure nullness does not break XmlDoc info import for methods and types (#17741)
* Remove nullness signal in string-based type encoding of a symbol (since it is used for xmldoc lookup) * release notes * Discard unused values
1 parent b9df594 commit 006f91e

5 files changed

Lines changed: 64 additions & 27 deletions

File tree

‎docs/release-notes/.FSharp.Compiler.Service/9.0.100.md‎

Lines changed: 1 addition & 0 deletions

‎src/Compiler/TypedTree/TcGlobals.fs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ type TcGlobals(
193193
realsig: bool) =
194194

195195
let v_langFeatureNullness = langVersion.SupportsFeature LanguageFeature.NullnessChecking
196-
197-
let v_renderNullness = checkNullness && v_langFeatureNullness
198-
196+
199197
let v_knownWithNull =
200198
if v_langFeatureNullness then KnownWithNull else KnownAmbivalentToNull
201199

@@ -1113,8 +1111,6 @@ type TcGlobals(
11131111

11141112
member _.langFeatureNullness = v_langFeatureNullness
11151113

1116-
member _.renderNullnessAnnotations = v_renderNullness
1117-
11181114
member _.knownWithNull = v_knownWithNull
11191115

11201116
member _.knownWithoutNull = v_knownWithoutNull

‎src/Compiler/TypedTree/TcGlobals.fsi‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,6 @@ type internal TcGlobals =
10551055

10561056
member reference_equality_inner_vref: FSharp.Compiler.TypedTree.ValRef
10571057

1058-
member renderNullnessAnnotations: bool
1059-
10601058
member reraise_info: IntrinsicValRef
10611059

10621060
member reraise_vref: FSharp.Compiler.TypedTree.ValRef

‎src/Compiler/TypedTree/TypedTreeOps.fs‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8926,10 +8926,7 @@ let typarEnc _g (gtpsType, gtpsMethod) typar =
89268926
warning(InternalError("Typar not found during XmlDoc generation", typar.Range))
89278927
"``0"
89288928

8929-
let nullnessEnc (g:TcGlobals) (nullness:Nullness) =
8930-
if g.renderNullnessAnnotations then nullness.ToFsharpCodeString() else ""
8931-
8932-
let rec typeEnc g (gtpsType, gtpsMethod) ty =
8929+
let rec typeEnc g (gtpsType, gtpsMethod) ty =
89338930
let stripped = stripTyEqnsAndMeasureEqns g ty
89348931
match stripped with
89358932
| TType_forall _ ->
@@ -8943,26 +8940,26 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty =
89438940
let ety = destNativePtrTy g ty
89448941
typeEnc g (gtpsType, gtpsMethod) ety + "*"
89458942

8946-
| TType_app (_, _, nullness) when isArrayTy g ty ->
8943+
| TType_app (_, _, _nullness) when isArrayTy g ty ->
89478944
let tcref, tinst = destAppTy g ty
89488945
let rank = rankOfArrayTyconRef g tcref
89498946
let arraySuffix = "[" + String.concat ", " (List.replicate (rank-1) "0:") + "]"
8950-
typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix + nullnessEnc g nullness
8947+
typeEnc g (gtpsType, gtpsMethod) (List.head tinst) + arraySuffix
89518948

89528949
| TType_ucase (_, tinst)
89538950
| TType_app (_, tinst, _) ->
8954-
let tyName,nullness =
8951+
let tyName =
89558952
let ty = stripTyEqnsAndMeasureEqns g ty
89568953
match ty with
8957-
| TType_app (tcref, _tinst, nullness) ->
8954+
| TType_app (tcref, _tinst, _nullness) ->
89588955
// Generic type names are (name + "`" + digits) where name does not contain "`".
89598956
// In XML doc, when used in type instances, these do not use the ticks.
89608957
let path = Array.toList (fullMangledPathToTyconRef tcref) @ [tcref.CompiledName]
8961-
textOfPath (List.map DemangleGenericTypeName path),nullness
8958+
textOfPath (List.map DemangleGenericTypeName path)
89628959
| _ ->
89638960
assert false
89648961
failwith "impossible"
8965-
tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst + nullnessEnc g nullness
8962+
tyName + tyargsEnc g (gtpsType, gtpsMethod) tinst
89668963

89678964
| TType_anon (anonInfo, tinst) ->
89688965
sprintf "%s%s" anonInfo.ILTypeRef.FullName (tyargsEnc g (gtpsType, gtpsMethod) tinst)
@@ -8973,11 +8970,11 @@ let rec typeEnc g (gtpsType, gtpsMethod) ty =
89738970
else
89748971
sprintf "System.Tuple%s"(tyargsEnc g (gtpsType, gtpsMethod) tys)
89758972

8976-
| TType_fun (domainTy, rangeTy, nullness) ->
8977-
"Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy] + nullnessEnc g nullness
8973+
| TType_fun (domainTy, rangeTy, _nullness) ->
8974+
"Microsoft.FSharp.Core.FSharpFunc" + tyargsEnc g (gtpsType, gtpsMethod) [domainTy; rangeTy]
89788975

8979-
| TType_var (typar, nullness) ->
8980-
typarEnc g (gtpsType, gtpsMethod) typar + nullnessEnc g nullness
8976+
| TType_var (typar, _nullness) ->
8977+
typarEnc g (gtpsType, gtpsMethod) typar
89818978

89828979
| TType_measure _ -> "?"
89838980

‎tests/FSharp.Compiler.Service.Tests/TooltipTests.fs‎

Lines changed: 51 additions & 6 deletions

0 commit comments

Comments
 (0)