Skip to content

Commit 12e4d2a

Browse files
dsymecartermp
authored andcommitted
add some docs (#6138)
* add some docs * more docs * more docs * more docs/spacing * more docs/spacing * more docs/spacing
1 parent 7584974 commit 12e4d2a

File tree

6 files changed

+957
-315
lines changed

6 files changed

+957
-315
lines changed

src/fsharp/IlxGen.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ let StorageForVal m v eenv =
764764
try eenv.valsInScope.[v]
765765
with :? KeyNotFoundException ->
766766
assert false
767-
errorR(Error(FSComp.SR.ilUndefinedValue(showL(vspecAtBindL v)),m))
767+
errorR(Error(FSComp.SR.ilUndefinedValue(showL(valAtBindL v)),m))
768768
notlazy (Arg 668(* random value for post-hoc diagnostic analysis on generated tree *) )
769769
v.Force()
770770

src/fsharp/Optimizer.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -976,11 +976,11 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi =
976976
// Under those checks, the further hidden* checks may be subsumed (meaning, not required anymore).
977977

978978
let hiddenTycon, hiddenTyconRepr, hiddenVal, hiddenRecdField, hiddenUnionCase =
979-
Zset.memberOf mhi.mhiTycons,
980-
Zset.memberOf mhi.mhiTyconReprs,
981-
Zset.memberOf mhi.mhiVals,
982-
Zset.memberOf mhi.mhiRecdFields,
983-
Zset.memberOf mhi.mhiUnionCases
979+
Zset.memberOf mhi.HiddenTycons,
980+
Zset.memberOf mhi.HiddenTyconReprs,
981+
Zset.memberOf mhi.HiddenVals,
982+
Zset.memberOf mhi.HiddenRecdFields,
983+
Zset.memberOf mhi.HiddenUnionCases
984984

985985
let rec abstractExprInfo ivalue =
986986
match ivalue with
@@ -3229,7 +3229,7 @@ and OptimizeModuleExpr cenv env x =
32293229
not (ValueIsUsedOrHasEffect cenv (fun () -> fvs.FreeLocals) (bind, binfo)) &&
32303230

32313231
// Check the thing is hidden by the signature (if any)
3232-
hidden.mhiVals.Contains bind.Var &&
3232+
hidden.HiddenVals.Contains bind.Var &&
32333233

32343234
// Check the thing is not compiled as a static field or property, since reflected definitions and other reflective stuff might need it
32353235
not (IsCompiledAsStaticProperty cenv.g bind.Var))

src/fsharp/SignatureConformance.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) =
3737
// Used when checking attributes.
3838
let sigToImplRemap =
3939
let remap = Remap.Empty
40-
let remap = (remapInfo.mrpiEntities,remap) ||> List.foldBack (fun (implTcref ,signTcref) acc -> addTyconRefRemap signTcref implTcref acc)
41-
let remap = (remapInfo.mrpiVals ,remap) ||> List.foldBack (fun (implValRef,signValRef) acc -> addValRemap signValRef.Deref implValRef.Deref acc)
40+
let remap = (remapInfo.RepackagedEntities,remap) ||> List.foldBack (fun (implTcref ,signTcref) acc -> addTyconRefRemap signTcref implTcref acc)
41+
let remap = (remapInfo.RepackagedVals ,remap) ||> List.foldBack (fun (implValRef,signValRef) acc -> addValRemap signValRef.Deref implValRef.Deref acc)
4242
remap
4343

4444
// For all attributable elements (types, modules, exceptions, record fields, unions, parameters, generic type parameters)

src/fsharp/TastOps.fs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,7 +3442,7 @@ module DebugPrint = begin
34423442
let rec MemberL (v:Val) (membInfo:ValMemberInfo) =
34433443
(aboveListL [ wordL(tagText "compiled_name! = ") ^^ wordL (tagText v.CompiledName) ;
34443444
wordL(tagText "membInfo-slotsig! = ") ^^ listL slotSigL membInfo.ImplementedSlotSigs ])
3445-
and vspecAtBindL v =
3445+
and valAtBindL v =
34463446
let vL = valL v in
34473447
let mutL = (if v.IsMutable then wordL(tagText "mutable") ++ vL else vL)
34483448
mutL --- (aboveListL (List.concat [[wordL(tagText ":") ^^ typeL v.Type];
@@ -3512,7 +3512,7 @@ module DebugPrint = begin
35123512
then emptyL
35133513
else
35143514
let iimplsLs = iimpls |> List.map (fun (ty, _, _) -> wordL(tagText "interface") --- typeL ty)
3515-
let adhocLs = adhoc |> List.map (fun vref -> vspecAtBindL vref.Deref)
3515+
let adhocLs = adhoc |> List.map (fun vref -> valAtBindL vref.Deref)
35163516
(wordL(tagText "with") @@-- aboveListL (iimplsLs @ adhocLs)) @@ wordL(tagText "end")
35173517

35183518
let layoutUnionCaseArgTypes argtys = sepListL (wordL(tagText "*")) (List.map typeL argtys)
@@ -3559,7 +3559,7 @@ module DebugPrint = begin
35593559
let vsprs =
35603560
tycon.MembersOfFSharpTyconSorted
35613561
|> List.filter (fun v -> v.IsDispatchSlot)
3562-
|> List.map (fun vref -> vspecAtBindL vref.Deref)
3562+
|> List.map (fun vref -> valAtBindL vref.Deref)
35633563
let vals = tycon.TrueFieldsAsList |> List.map (fun f -> (if f.IsStatic then wordL(tagText "static") else emptyL) ^^ wordL(tagText "val") ^^ layoutRecdField f)
35643564
let alldecls = inherits @ vsprs @ vals
35653565
let emptyMeasure = match tycon.TypeOrMeasureKind with TyparKind.Measure -> isNil alldecls | _ -> false
@@ -3590,7 +3590,7 @@ module DebugPrint = begin
35903590
//--------------------------------------------------------------------------
35913591

35923592
and bindingL (TBind(v, repr, _)) =
3593-
vspecAtBindL v --- (wordL(tagText "=") ^^ exprL repr)
3593+
valAtBindL v --- (wordL(tagText "=") ^^ exprL repr)
35943594

35953595
and exprL expr = exprWrapL false expr
35963596
and atomL expr = exprWrapL true expr // true means bracket if needed to be atomic expr
@@ -3628,11 +3628,11 @@ module DebugPrint = begin
36283628
| ThenDoSeq -> "; (*ThenDo*)"
36293629
((exprL x0 ^^ rightL (tagText flag)) @@ exprL x1) |> wrap
36303630
| Expr.Lambda(_, _, baseValOpt, argvs, body, _, _) ->
3631-
let formalsL = spaceListL (List.map vspecAtBindL argvs) in
3631+
let formalsL = spaceListL (List.map valAtBindL argvs) in
36323632
let bindingL =
36333633
match baseValOpt with
36343634
| None -> wordL(tagText "lam") ^^ formalsL ^^ rightL(tagText ".")
3635-
| Some basev -> wordL(tagText "lam") ^^ (leftL(tagText "base=") ^^ vspecAtBindL basev) --- formalsL ^^ rightL(tagText ".") in
3635+
| Some basev -> wordL(tagText "lam") ^^ (leftL(tagText "base=") ^^ valAtBindL basev) --- formalsL ^^ rightL(tagText ".") in
36363636
(bindingL ++ exprL body) |> wrap
36373637
| Expr.TyLambda(_, argtyvs, body, _, _) ->
36383638
((wordL(tagText "LAM") ^^ spaceListL (List.map typarL argtyvs) ^^ rightL(tagText ".")) ++ exprL body) |> wrap
@@ -3727,7 +3727,7 @@ module DebugPrint = begin
37273727
| Expr.Obj (_lambdaId, ty, basev, ccall, overrides, iimpls, _) ->
37283728
wordL(tagText "OBJ:") ^^ aboveListL [typeL ty;
37293729
exprL ccall;
3730-
optionL vspecAtBindL basev;
3730+
optionL valAtBindL basev;
37313731
aboveListL (List.map overrideL overrides);
37323732
aboveListL (List.map iimplL iimpls)]
37333733

@@ -3812,7 +3812,7 @@ module DebugPrint = begin
38123812
and tmethodL (TObjExprMethod(TSlotSig(nm, _, _, _, _, _), _, tps, vs, e, _)) =
38133813
(wordL(tagText "TObjExprMethod") --- (wordL (tagText nm)) ^^ wordL(tagText "=")) --
38143814
(wordL(tagText "METH-LAM") --- angleBracketListL (List.map typarL tps) ^^ rightL(tagText ".")) ---
3815-
(wordL(tagText "meth-lam") --- tupleL (List.map (List.map vspecAtBindL >> tupleL) vs) ^^ rightL(tagText ".")) ---
3815+
(wordL(tagText "meth-lam") --- tupleL (List.map (List.map valAtBindL >> tupleL) vs) ^^ rightL(tagText ".")) ---
38163816
(atomL e)
38173817
and overrideL tmeth = wordL(tagText "with") ^^ tmethodL tmeth
38183818
and iimplL (ty, tmeths) = wordL(tagText "impl") ^^ aboveListL (typeL ty :: List.map tmethodL tmeths)
@@ -3850,33 +3850,33 @@ let SigTypeOfImplFile (TImplFile(_, _, mexpr, _, _, _)) = mexpr.Type
38503850
//--------------------------------------------------------------------------
38513851

38523852
type SignatureRepackageInfo =
3853-
{ mrpiVals : (ValRef * ValRef) list;
3854-
mrpiEntities: (TyconRef * TyconRef) list }
3853+
{ RepackagedVals : (ValRef * ValRef) list;
3854+
RepackagedEntities: (TyconRef * TyconRef) list }
38553855

3856-
member remapInfo.ImplToSigMapping = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.mrpiEntities }
3857-
static member Empty = { mrpiVals = []; mrpiEntities= [] }
3856+
member remapInfo.ImplToSigMapping = { TypeEquivEnv.Empty with EquivTycons = TyconRefMap.OfList remapInfo.RepackagedEntities }
3857+
static member Empty = { RepackagedVals = []; RepackagedEntities= [] }
38583858

38593859
type SignatureHidingInfo =
3860-
{ mhiTycons : Zset<Tycon>;
3861-
mhiTyconReprs : Zset<Tycon>;
3862-
mhiVals : Zset<Val>;
3863-
mhiRecdFields : Zset<RecdFieldRef>;
3864-
mhiUnionCases : Zset<UnionCaseRef> }
3860+
{ HiddenTycons : Zset<Tycon>;
3861+
HiddenTyconReprs : Zset<Tycon>;
3862+
HiddenVals : Zset<Val>;
3863+
HiddenRecdFields : Zset<RecdFieldRef>;
3864+
HiddenUnionCases : Zset<UnionCaseRef> }
38653865

38663866
static member Empty =
3867-
{ mhiTycons = Zset.empty tyconOrder;
3868-
mhiTyconReprs = Zset.empty tyconOrder;
3869-
mhiVals = Zset.empty valOrder;
3870-
mhiRecdFields = Zset.empty recdFieldRefOrder;
3871-
mhiUnionCases = Zset.empty unionCaseRefOrder }
3867+
{ HiddenTycons = Zset.empty tyconOrder;
3868+
HiddenTyconReprs = Zset.empty tyconOrder;
3869+
HiddenVals = Zset.empty valOrder;
3870+
HiddenRecdFields = Zset.empty recdFieldRefOrder;
3871+
HiddenUnionCases = Zset.empty unionCaseRefOrder }
38723872

38733873
let addValRemap v v' tmenv =
38743874
{ tmenv with valRemap= tmenv.valRemap.Add v (mkLocalValRef v') }
38753875

38763876
let mkRepackageRemapping mrpi =
3877-
{ valRemap = ValMap.OfList (mrpi.mrpiVals |> List.map (fun (vref, x) -> vref.Deref, x));
3877+
{ valRemap = ValMap.OfList (mrpi.RepackagedVals |> List.map (fun (vref, x) -> vref.Deref, x));
38783878
tpinst = emptyTyparInst;
3879-
tyconRefRemap = TyconRefMap.OfList mrpi.mrpiEntities
3879+
tyconRefRemap = TyconRefMap.OfList mrpi.RepackagedEntities
38803880
removeTraitSolutions = false }
38813881

38823882
//--------------------------------------------------------------------------
@@ -3888,18 +3888,18 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) =
38883888
match sigtyconOpt with
38893889
| None ->
38903890
// The type constructor is not present in the signature. Hence it is hidden.
3891-
let mhi = { mhi with mhiTycons = Zset.add entity mhi.mhiTycons }
3891+
let mhi = { mhi with HiddenTycons = Zset.add entity mhi.HiddenTycons }
38923892
(mrpi, mhi)
38933893
| Some sigtycon ->
38943894
// The type constructor is in the signature. Hence record the repackage entry
38953895
let sigtcref = mkLocalTyconRef sigtycon
38963896
let tcref = mkLocalTyconRef entity
3897-
let mrpi = { mrpi with mrpiEntities = ((tcref, sigtcref) :: mrpi.mrpiEntities) }
3897+
let mrpi = { mrpi with RepackagedEntities = ((tcref, sigtcref) :: mrpi.RepackagedEntities) }
38983898
// OK, now look for hidden things
38993899
let mhi =
39003900
if (match entity.TypeReprInfo with TNoRepr -> false | _ -> true) && (match sigtycon.TypeReprInfo with TNoRepr -> true | _ -> false) then
39013901
// The type representation is absent in the signature, hence it is hidden
3902-
{ mhi with mhiTyconReprs = Zset.add entity mhi.mhiTyconReprs }
3902+
{ mhi with HiddenTyconReprs = Zset.add entity mhi.HiddenTyconReprs }
39033903
else
39043904
// The type representation is present in the signature.
39053905
// Find the fields that have been hidden or which were non-public anyway.
@@ -3912,7 +3912,7 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) =
39123912
| _ ->
39133913
// The field is not in the signature. Hence it is regarded as hidden.
39143914
let rfref = tcref.MakeNestedRecdFieldRef rfield
3915-
{ mhi with mhiRecdFields = Zset.add rfref mhi.mhiRecdFields })
3915+
{ mhi with HiddenRecdFields = Zset.add rfref mhi.HiddenRecdFields })
39163916
entity.AllFieldsArray
39173917
|> List.foldBack (fun (ucase:UnionCase) mhi ->
39183918
match sigtycon.GetUnionCaseByName ucase.DisplayName with
@@ -3922,7 +3922,7 @@ let accEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi) =
39223922
| _ ->
39233923
// The constructor is not in the signature. Hence it is regarded as hidden.
39243924
let ucref = tcref.MakeNestedUnionCaseRef ucase
3925-
{ mhi with mhiUnionCases = Zset.add ucref mhi.mhiUnionCases })
3925+
{ mhi with HiddenUnionCases = Zset.add ucref mhi.HiddenUnionCases })
39263926
(entity.UnionCasesAsList)
39273927
(mrpi, mhi)
39283928

@@ -3931,13 +3931,13 @@ let accSubEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi)
39313931
match sigtyconOpt with
39323932
| None ->
39333933
// The type constructor is not present in the signature. Hence it is hidden.
3934-
let mhi = { mhi with mhiTycons = Zset.add entity mhi.mhiTycons }
3934+
let mhi = { mhi with HiddenTycons = Zset.add entity mhi.HiddenTycons }
39353935
(mrpi, mhi)
39363936
| Some sigtycon ->
39373937
// The type constructor is in the signature. Hence record the repackage entry
39383938
let sigtcref = mkLocalTyconRef sigtycon
39393939
let tcref = mkLocalTyconRef entity
3940-
let mrpi = { mrpi with mrpiEntities = ((tcref, sigtcref) :: mrpi.mrpiEntities) }
3940+
let mrpi = { mrpi with RepackagedEntities = ((tcref, sigtcref) :: mrpi.RepackagedEntities) }
39413941
(mrpi, mhi)
39423942

39433943
let valLinkageAEquiv g aenv (v1:Val) (v2:Val) =
@@ -3955,11 +3955,11 @@ let accValRemap g aenv (msigty:ModuleOrNamespaceType) (implVal:Val) (mrpi, mhi)
39553955
match sigValOpt with
39563956
| None ->
39573957
if verbose then dprintf "accValRemap, hide = %s#%d\n" implVal.LogicalName implVal.Stamp
3958-
let mhi = { mhi with mhiVals = Zset.add implVal mhi.mhiVals }
3958+
let mhi = { mhi with HiddenVals = Zset.add implVal mhi.HiddenVals }
39593959
(mrpi, mhi)
39603960
| Some (sigVal:Val) ->
39613961
// The value is in the signature. Add the repackage entry.
3962-
let mrpi = { mrpi with mrpiVals = (vref, mkLocalValRef sigVal) :: mrpi.mrpiVals }
3962+
let mrpi = { mrpi with RepackagedVals = (vref, mkLocalValRef sigVal) :: mrpi.RepackagedVals }
39633963
(mrpi, mhi)
39643964

39653965
let getCorrespondingSigTy nm (msigty:ModuleOrNamespaceType) =
@@ -4053,25 +4053,25 @@ let ComputeRemappingFromImplementationToSignature g mdef msigty =
40534053
let accTyconHidingInfoAtAssemblyBoundary (tycon:Tycon) mhi =
40544054
if not (canAccessFromEverywhere tycon.Accessibility) then
40554055
// The type constructor is not public, hence hidden at the assembly boundary.
4056-
{ mhi with mhiTycons = Zset.add tycon mhi.mhiTycons }
4056+
{ mhi with HiddenTycons = Zset.add tycon mhi.HiddenTycons }
40574057
elif not (canAccessFromEverywhere tycon.TypeReprAccessibility) then
4058-
{ mhi with mhiTyconReprs = Zset.add tycon mhi.mhiTyconReprs }
4058+
{ mhi with HiddenTyconReprs = Zset.add tycon mhi.HiddenTyconReprs }
40594059
else
40604060
mhi
40614061
|> Array.foldBack
40624062
(fun (rfield:RecdField) mhi ->
40634063
if not (canAccessFromEverywhere rfield.Accessibility) then
40644064
let tcref = mkLocalTyconRef tycon
40654065
let rfref = tcref.MakeNestedRecdFieldRef rfield
4066-
{ mhi with mhiRecdFields = Zset.add rfref mhi.mhiRecdFields }
4066+
{ mhi with HiddenRecdFields = Zset.add rfref mhi.HiddenRecdFields }
40674067
else mhi)
40684068
tycon.AllFieldsArray
40694069
|> List.foldBack
40704070
(fun (ucase:UnionCase) mhi ->
40714071
if not (canAccessFromEverywhere ucase.Accessibility) then
40724072
let tcref = mkLocalTyconRef tycon
40734073
let ucref = tcref.MakeNestedUnionCaseRef ucase
4074-
{ mhi with mhiUnionCases = Zset.add ucref mhi.mhiUnionCases }
4074+
{ mhi with HiddenUnionCases = Zset.add ucref mhi.HiddenUnionCases }
40754075
else mhi)
40764076
(tycon.UnionCasesAsList)
40774077

@@ -4086,7 +4086,7 @@ let accValHidingInfoAtAssemblyBoundary (vspec:Val) mhi =
40864086
// anything that's not a module or member binding gets assembly visibility
40874087
not vspec.IsMemberOrModuleBinding then
40884088
// The value is not public, hence hidden at the assembly boundary.
4089-
{ mhi with mhiVals = Zset.add vspec mhi.mhiVals }
4089+
{ mhi with HiddenVals = Zset.add vspec mhi.HiddenVals }
40904090
else
40914091
mhi
40924092

@@ -4121,10 +4121,10 @@ let IsHidden setF accessF remapF debugF =
41214121
if verbose then dprintf "IsHidden, #mrmi = %d, %s = %b\n" mrmi.Length (showL (debugF x)) res;
41224122
res
41234123

4124-
let IsHiddenTycon mrmi x = IsHidden (fun mhi -> mhi.mhiTycons) (fun tc -> tc.Accessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x
4125-
let IsHiddenTyconRepr mrmi x = IsHidden (fun mhi -> mhi.mhiTyconReprs) (fun v -> v.TypeReprAccessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x
4126-
let IsHiddenVal mrmi x = IsHidden (fun mhi -> mhi.mhiVals) (fun v -> v.Accessibility) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) DebugPrint.valL mrmi x
4127-
let IsHiddenRecdField mrmi x = IsHidden (fun mhi -> mhi.mhiRecdFields) (fun rfref -> rfref.RecdField.Accessibility) (fun rpi x -> remapRecdFieldRef rpi.tyconRefRemap x) DebugPrint.recdFieldRefL mrmi x
4124+
let IsHiddenTycon mrmi x = IsHidden (fun mhi -> mhi.HiddenTycons) (fun tc -> tc.Accessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x
4125+
let IsHiddenTyconRepr mrmi x = IsHidden (fun mhi -> mhi.HiddenTyconReprs) (fun v -> v.TypeReprAccessibility) (fun rpi x -> (remapTyconRef rpi.tyconRefRemap (mkLocalTyconRef x)).Deref) DebugPrint.tyconL mrmi x
4126+
let IsHiddenVal mrmi x = IsHidden (fun mhi -> mhi.HiddenVals) (fun v -> v.Accessibility) (fun rpi x -> (remapValRef rpi (mkLocalValRef x)).Deref) DebugPrint.valL mrmi x
4127+
let IsHiddenRecdField mrmi x = IsHidden (fun mhi -> mhi.HiddenRecdFields) (fun rfref -> rfref.RecdField.Accessibility) (fun rpi x -> remapRecdFieldRef rpi.tyconRefRemap x) DebugPrint.recdFieldRefL mrmi x
41284128

41294129

41304130
//--------------------------------------------------------------------------

0 commit comments

Comments
 (0)