Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita2f3dcd

Browse files
authored
docs and cleanup (#4894)
* docs and cleanup* fix build* fix build* fix build
1 parenta3d131e commita2f3dcd

File tree

13 files changed

+298
-274
lines changed

13 files changed

+298
-274
lines changed

‎src/fsharp/AccessibilityLogic.fs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,5 +341,3 @@ let IsPropInfoAccessible g amap m ad = function
341341
letIsFieldInfoAccessible ad(rfref:RecdFieldInfo)=
342342
IsAccessible ad rfref.RecdField.Accessibility
343343

344-
345-

‎src/fsharp/AttributeChecking.fs‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/// on items from name resolution
55
moduleinternalMicrosoft.FSharp.Compiler.AttributeChecking
66

7+
openSystem.Collections.Generic
78
openMicrosoft.FSharp.Compiler.AbstractIL.IL
89
openMicrosoft.FSharp.Compiler.AbstractIL.Internal.Library
910

@@ -503,3 +504,23 @@ let CheckRecdFieldInfoAttributes g (x:RecdFieldInfo) m =
503504
CheckRecdFieldAttributes g x.RecdFieldRef m
504505

505506

507+
// Identify any security attributes
508+
letIsSecurityAttribute(g:TcGlobals)amap(casmap:Dictionary<Stamp,bool>)(Attrib(tcref,_,_,_,_,_,_))m=
509+
// There's no CAS on Silverlight, so we have to be careful here
510+
match g.attrib_SecurityAttributewith
511+
| None->false
512+
| Some attr->
513+
match attr.TyconRef.TryDerefwith
514+
| VSome_->
515+
lettcs= tcref.Stamp
516+
match casmap.TryGetValue(tcs)with
517+
|true, c-> c
518+
|_->
519+
letexists= ExistsInEntireHierarchyOfType(fun t-> typeEquiv g t(mkAppTy attr.TyconRef[])) g amap m AllowMultiIntfInstantiations.Yes(mkAppTy tcref[])
520+
casmap.[tcs]<- exists
521+
exists
522+
| VNone->false
523+
524+
letIsSecurityCriticalAttribute g(Attrib(tcref,_,_,_,_,_,_))=
525+
(tyconRefEq g tcref g.attrib_SecurityCriticalAttribute.TyconRef|| tyconRefEq g tcref g.attrib_SecuritySafeCriticalAttribute.TyconRef)
526+

‎src/fsharp/CompileOps.fs‎

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
moduleinternalMicrosoft.FSharp.Compiler.CompileOps
55

66
openSystem
7-
openSystem.Collections.Concurrent
87
openSystem.Collections.Generic
98
openSystem.Diagnostics
109
openSystem.IO
11-
openSystem.Runtime.CompilerServices
1210
openSystem.Text
1311

1412
openInternal.Utilities
15-
openInternal.Utilities.Text
1613
openInternal.Utilities.Collections
1714
openInternal.Utilities.Filename
15+
openInternal.Utilities.Text
1816

1917
openMicrosoft.FSharp.Compiler.AbstractIL
2018
openMicrosoft.FSharp.Compiler.AbstractIL.IL
@@ -25,28 +23,27 @@ open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX
2523
openMicrosoft.FSharp.Compiler.AbstractIL.Diagnostics
2624

2725
openMicrosoft.FSharp.Compiler
28-
openMicrosoft.FSharp.Compiler.TastPickle
29-
openMicrosoft.FSharp.Compiler.Range
30-
openMicrosoft.FSharp.Compiler.TypeChecker
31-
openMicrosoft.FSharp.Compiler.DiagnosticMessage
3226
openMicrosoft.FSharp.Compiler.Ast
3327
openMicrosoft.FSharp.Compiler.AttributeChecking
28+
openMicrosoft.FSharp.Compiler.ConstraintSolver
29+
openMicrosoft.FSharp.Compiler.DiagnosticMessage
3430
openMicrosoft.FSharp.Compiler.ErrorLogger
35-
openMicrosoft.FSharp.Compiler.Tast
36-
openMicrosoft.FSharp.Compiler.Tastops
37-
openMicrosoft.FSharp.Compiler.Tastops.DebugPrint
38-
openMicrosoft.FSharp.Compiler.TcGlobals
31+
openMicrosoft.FSharp.Compiler.Import
32+
openMicrosoft.FSharp.Compiler.Infos
3933
openMicrosoft.FSharp.Compiler.Lexhelp
4034
openMicrosoft.FSharp.Compiler.Lib
41-
openMicrosoft.FSharp.Compiler.Infos
42-
openMicrosoft.FSharp.Compiler.ConstraintSolver
43-
openMicrosoft.FSharp.Compiler.ReferenceResolver
44-
openMicrosoft.FSharp.Compiler.SignatureConformance
35+
openMicrosoft.FSharp.Compiler.MethodCalls
4536
openMicrosoft.FSharp.Compiler.MethodOverrides
4637
openMicrosoft.FSharp.Compiler.NameResolution
4738
openMicrosoft.FSharp.Compiler.PrettyNaming
48-
openMicrosoft.FSharp.Compiler.Import
49-
39+
openMicrosoft.FSharp.Compiler.Range
40+
openMicrosoft.FSharp.Compiler.ReferenceResolver
41+
openMicrosoft.FSharp.Compiler.SignatureConformance
42+
openMicrosoft.FSharp.Compiler.TastPickle
43+
openMicrosoft.FSharp.Compiler.TypeChecker
44+
openMicrosoft.FSharp.Compiler.Tast
45+
openMicrosoft.FSharp.Compiler.Tastops
46+
openMicrosoft.FSharp.Compiler.TcGlobals
5047

5148
#if!NO_EXTENSIONTYPING
5249
openMicrosoft.FSharp.Compiler.ExtensionTyping

‎src/fsharp/IlxGen.fs‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ module internal Microsoft.FSharp.Compiler.IlxGen
99
openSystem.IO
1010
openSystem.Reflection
1111
openSystem.Collections.Generic
12+
1213
openInternal.Utilities
1314
openInternal.Utilities.Collections
15+
1416
openMicrosoft.FSharp.Compiler.AbstractIL
1517
openMicrosoft.FSharp.Compiler.AbstractIL.IL
1618
openMicrosoft.FSharp.Compiler.AbstractIL.Internal
@@ -20,21 +22,20 @@ open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
2022
openMicrosoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants
2123

2224
openMicrosoft.FSharp.Compiler
25+
openMicrosoft.FSharp.Compiler.AttributeChecking
26+
openMicrosoft.FSharp.Compiler.Ast
27+
openMicrosoft.FSharp.Compiler.ErrorLogger
28+
openMicrosoft.FSharp.Compiler.Infos
2329
openMicrosoft.FSharp.Compiler.Import
30+
openMicrosoft.FSharp.Compiler.Layout
31+
openMicrosoft.FSharp.Compiler.Lib
32+
openMicrosoft.FSharp.Compiler.PrettyNaming
33+
openMicrosoft.FSharp.Compiler.Range
2434
openMicrosoft.FSharp.Compiler.Tast
2535
openMicrosoft.FSharp.Compiler.Tastops
2636
openMicrosoft.FSharp.Compiler.Tastops.DebugPrint
27-
openMicrosoft.FSharp.Compiler.Range
28-
openMicrosoft.FSharp.Compiler.Ast
29-
openMicrosoft.FSharp.Compiler.ErrorLogger
30-
openMicrosoft.FSharp.Compiler.PrettyNaming
3137
openMicrosoft.FSharp.Compiler.TcGlobals
32-
openMicrosoft.FSharp.Compiler.Layout
33-
openMicrosoft.FSharp.Compiler.Lib
3438
openMicrosoft.FSharp.Compiler.TypeRelations
35-
openMicrosoft.FSharp.Compiler.TypeChecker
36-
openMicrosoft.FSharp.Compiler.Infos
37-
3839

3940
letIsNonErasedTypar(tp:Typar)=not tp.IsErased
4041
letDropErasedTypars(tps:Typar list)= tps|> List.filter IsNonErasedTypar

‎src/fsharp/MethodCalls.fs‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ open Microsoft.FSharp.Compiler.Tastops
1919
openMicrosoft.FSharp.Compiler.Tastops.DebugPrint
2020
openMicrosoft.FSharp.Compiler.TcGlobals
2121
openMicrosoft.FSharp.Compiler.TypeRelations
22+
openMicrosoft.FSharp.Compiler.AttributeChecking
2223

2324
#if!NO_EXTENSIONTYPING
2425
openMicrosoft.FSharp.Compiler.ExtensionTyping
@@ -1218,3 +1219,54 @@ module ProvidedMethodCalls =
12181219
letmethName= mi.PUntaint((fun mb-> mb.Name), m)
12191220
raise( tpe.WithContext(typeName, methName))// loses original stack trace
12201221
#endif
1222+
1223+
1224+
1225+
letRecdFieldInstanceChecks g amap ad m(rfinfo:RecdFieldInfo)=
1226+
if rfinfo.IsStaticthen error(Error(FSComp.SR.tcStaticFieldUsedWhenInstanceFieldExpected(), m))
1227+
CheckRecdFieldInfoAttributes g rfinfo m|> CommitOperationResult
1228+
CheckRecdFieldInfoAccessible amap m ad rfinfo
1229+
1230+
letILFieldInstanceChecks g amap ad m(finfo:ILFieldInfo)=
1231+
if finfo.IsStaticthen error(Error(FSComp.SR.tcStaticFieldUsedWhenInstanceFieldExpected(), m))
1232+
CheckILFieldInfoAccessible g amap m ad finfo
1233+
CheckILFieldAttributes g finfo m
1234+
1235+
letMethInfoChecks g amap isInstance tyargsOpt objArgs ad m(minfo:MethInfo)=
1236+
if minfo.IsInstance<> isInstancethen
1237+
if isInstancethen
1238+
error(Error(FSComp.SR.csMethodIsNotAnInstanceMethod(minfo.LogicalName), m))
1239+
else
1240+
error(Error(FSComp.SR.csMethodIsNotAStaticMethod(minfo.LogicalName), m))
1241+
1242+
// keep the original accessibility domain to determine type accessibility
1243+
letadOriginal= ad
1244+
// Eliminate the 'protected' portion of the accessibility domain for instance accesses
1245+
letad=
1246+
match objArgs, adwith
1247+
|[objArg], AccessibleFrom(paths, Some tcref)->
1248+
letobjArgTy= tyOfExpr g objArg
1249+
letty= generalizedTyconRef tcref
1250+
// We get to keep our rights if the type we're in subsumes the object argument type
1251+
if TypeFeasiblySubsumesType0 g amap m ty CanCoerce objArgTythen
1252+
ad
1253+
// We get to keep our rights if this is a base call
1254+
elif IsBaseCall objArgsthen
1255+
ad
1256+
else
1257+
AccessibleFrom(paths, None)
1258+
|_-> ad
1259+
1260+
ifnot(IsTypeAndMethInfoAccessible amap m adOriginal ad minfo)then
1261+
error(Error(FSComp.SR.tcMethodNotAccessible(minfo.LogicalName), m))
1262+
1263+
if isAnyTupleTy g minfo.ApparentEnclosingType&&not minfo.IsExtensionMember&&(minfo.LogicalName.StartsWith"get_Item"|| minfo.LogicalName.StartsWith"get_Rest")then
1264+
warning(Error(FSComp.SR.tcTupleMemberNotNormallyUsed(), m))
1265+
1266+
CheckMethInfoAttributes g m tyargsOpt minfo|> CommitOperationResult
1267+
1268+
exception FieldNotMutableofDisplayEnv*Tast.RecdFieldRef*range
1269+
1270+
letCheckRecdFieldMutation m denv(rfinfo:RecdFieldInfo)=
1271+
ifnot rfinfo.RecdField.IsMutablethen error(FieldNotMutable(denv, rfinfo.RecdFieldRef, m))
1272+

‎src/fsharp/Optimizer.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ open Microsoft.FSharp.Compiler
1919
openMicrosoft.FSharp.Compiler.Lib
2020
openMicrosoft.FSharp.Compiler.Range
2121
openMicrosoft.FSharp.Compiler.Ast
22+
openMicrosoft.FSharp.Compiler.AttributeChecking
2223
openMicrosoft.FSharp.Compiler.ErrorLogger
2324
openMicrosoft.FSharp.Compiler.Infos
2425
openMicrosoft.FSharp.Compiler.Tast
2526
openMicrosoft.FSharp.Compiler.TastPickle
2627
openMicrosoft.FSharp.Compiler.Tastops
2728
openMicrosoft.FSharp.Compiler.Tastops.DebugPrint
28-
openMicrosoft.FSharp.Compiler.TypeChecker
2929
openMicrosoft.FSharp.Compiler.TcGlobals
3030
openMicrosoft.FSharp.Compiler.Layout
3131
openMicrosoft.FSharp.Compiler.Layout.TaggedTextOps

‎src/fsharp/PostInferenceChecks.fs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ open Microsoft.FSharp.Compiler.PrettyNaming
2424
openMicrosoft.FSharp.Compiler.InfoReader
2525
openMicrosoft.FSharp.Compiler.TypeRelations
2626

27-
28-
2927
//--------------------------------------------------------------------------
3028
// TestHooks - for dumping range to support source transforms
3129
//--------------------------------------------------------------------------

‎src/fsharp/QuotationTranslator.fs‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ open System.Collections.Generic
1919

2020
moduleQP= Microsoft.FSharp.Compiler.QuotationPickler
2121

22-
2322
letverboseCReflect= condition"VERBOSE_CREFLECT"
2423

25-
2624
[<RequireQualifiedAccess>]
2725
typeIsReflectedDefinition=
28-
| Yes
29-
| No
26+
| Yes
27+
| No
3028

3129
[<RequireQualifiedAccess>]
3230
typeQuotationSerializationFormat=
33-
/// Indicates that type references are emitted as integer indexes into a supplied table
34-
| FSharp_40_Plus
35-
| FSharp_20_Plus
31+
/// Indicates that type references are emitted as integer indexes into a supplied table
32+
| FSharp_40_Plus
33+
| FSharp_20_Plus
3634

3735
typeQuotationGenerationScope=
3836
{ g:TcGlobals
@@ -74,10 +72,10 @@ type QuotationGenerationScope =
7472
QuotationSerializationFormat.FSharp_20_Plus
7573

7674
typeQuotationTranslationEnv=
77-
{//Map from Val to binding index
75+
{///Map from Val to binding index
7876
vs:ValMap<int>
7977
nvs:int
80-
//Map from typar stamps to binding index
78+
///Map from typar stamps to binding index
8179
tyvs:StampMap<int>
8280
// Map for values bound by the
8381
// 'let v = isinst e in .... if nonnull v then ...v .... '

‎src/fsharp/TastOps.fs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,6 +1814,10 @@ let emptyFreeTyvars =
18141814
FreeTraitSolutions= emptyFreeLocals
18151815
FreeTypars= emptyFreeTypars}
18161816

1817+
letisEmptyFreeTyvars ftyvs=
1818+
Zset.isEmpty ftyvs.FreeTypars&&
1819+
Zset.isEmpty ftyvs.FreeTycons
1820+
18171821
letunionFreeTyvars fvs1 fvs2=
18181822
if fvs1=== emptyFreeTyvarsthen fvs2else
18191823
if fvs2=== emptyFreeTyvarsthen fvs1else
@@ -2002,6 +2006,12 @@ let freeInVal opts v = accFreeInVal opts v emptyFreeTyvars
20022006
letfreeInTyparConstraints opts v= accFreeInTyparConstraints opts v emptyFreeTyvars
20032007
letaccFreeInTypars opts tps acc= List.foldBack(accFreeTyparRef opts) tps acc
20042008

2009+
let recaddFreeInModuleTy(mtyp:ModuleOrNamespaceType)acc=
2010+
QueueList.foldBack(typeOfVal>> accFreeInType CollectAllNoCaching) mtyp.AllValsAndMembers
2011+
(QueueList.foldBack(fun(mspec:ModuleOrNamespace)acc-> addFreeInModuleTy mspec.ModuleOrNamespaceType acc) mtyp.AllEntities acc)
2012+
2013+
letfreeInModuleTy mtyp= addFreeInModuleTy mtyp emptyFreeTyvars
2014+
20052015

20062016
//--------------------------------------------------------------------------
20072017
// Free in type, left-to-right order preserved. This is used to determine the
@@ -8284,3 +8294,12 @@ let BindUnitVars g (mvs:Val list, paramInfos:ArgReprInfo list, body) =
82848294
|_-> mvs, body
82858295

82868296

8297+
letisThreadOrContextStatic g attrs=
8298+
HasFSharpAttributeOpt g g.attrib_ThreadStaticAttribute attrs||
8299+
HasFSharpAttributeOpt g g.attrib_ContextStaticAttribute attrs
8300+
8301+
letmkUnitDelayLambda(g:TcGlobals)m e=
8302+
letuv,_= mkCompGenLocal m"unitVar" g.unit_ty
8303+
mkLambda m uv(e, tyOfExpr g e)
8304+
8305+

‎src/fsharp/TastOps.fsi‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ val mkMultiLambdaBind : Val -> SequencePointInfoForBinding -> range -> Typars ->
136136
val mkCompGenBind: Val-> Expr-> Binding
137137
val mkCompGenBinds: Val list-> Exprs-> Bindings
138138
val mkCompGenLet: range-> Val-> Expr-> Expr-> Expr
139+
val mkCompGenLetIn: range-> string-> TType-> Expr->(Val* Expr-> Expr)-> Expr
139140

140141
// Invisible bindings are never given a sequence point and should never have side effects
141142
val mkInvisibleLet: range-> Val-> Expr-> Expr-> Expr
@@ -521,6 +522,7 @@ val emptyFreeTycons : FreeTycons
521522
val unionFreeTycons: FreeTycons-> FreeTycons-> FreeTycons
522523

523524
val emptyFreeTyvars: FreeTyvars
525+
val isEmptyFreeTyvars: FreeTyvars-> bool
524526
val unionFreeTyvars: FreeTyvars-> FreeTyvars-> FreeTyvars
525527

526528
val emptyFreeLocals: FreeLocals
@@ -550,6 +552,7 @@ val freeInTypeLeftToRight : TcGlobals -> bool -> TType -> Typars
550552
val freeInTypesLeftToRight: TcGlobals-> bool-> TType list-> Typars
551553
val freeInTypesLeftToRightSkippingConstraints: TcGlobals-> TType list-> Typars
552554

555+
val freeInModuleTy: ModuleOrNamespaceType-> FreeTyvars
553556

554557
val isDimensionless: TcGlobals-> TType-> bool
555558

@@ -1547,3 +1550,8 @@ val (|InnerExprPat|) : Expr -> Expr
15471550
valallValsOfModDef:ModuleOrNamespaceExpr->seq<Val>
15481551

15491552
valBindUnitVars:TcGlobals->(Val list* ArgReprInfo list* Expr)->Val list* Expr
1553+
1554+
val isThreadOrContextStatic: TcGlobals-> Attrib list-> bool
1555+
1556+
val mkUnitDelayLambda: TcGlobals-> range-> Expr-> Expr
1557+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp