forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypedTreeOps.fsi
More file actions
executable file
·2707 lines (1722 loc) · 102 KB
/
Copy pathTypedTreeOps.fsi
File metadata and controls
executable file
·2707 lines (1722 loc) · 102 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
/// Defines derived expression manipulation and construction functions.
module internal FSharp.Compiler.TypedTreeOps
open System.Collections.Generic
open System.Collections.Immutable
open Internal.Utilities.Collections
open Internal.Utilities.Library
open Internal.Utilities.Rational
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.DiagnosticsLogger
open FSharp.Compiler.CompilerGlobalState
open FSharp.Compiler.Syntax
open FSharp.Compiler.Text
open FSharp.Compiler.Xml
open FSharp.Compiler.TypedTree
open FSharp.Compiler.TcGlobals
type Erasure =
| EraseAll
| EraseMeasures
| EraseNone
/// Check the equivalence of two types up to an erasure flag
val typeEquivAux: Erasure -> TcGlobals -> TType -> TType -> bool
/// Check the equivalence of two types
val typeEquiv: TcGlobals -> TType -> TType -> bool
/// Check the equivalence of two units-of-measure
val measureEquiv: TcGlobals -> Measure -> Measure -> bool
/// Get the unit of measure for an annotated type
val getMeasureOfType: TcGlobals -> TType -> (TyconRef * Measure) option
/// Reduce a type to its more canonical form subject to an erasure flag, inference equations and abbreviations
val stripTyEqnsWrtErasure: Erasure -> TcGlobals -> TType -> TType
/// Build a function type
val mkFunTy: TcGlobals -> TType -> TType -> TType
/// Build a type-forall anonymous generic type if necessary
val mkForallTyIfNeeded: Typars -> TType -> TType
val (+->): Typars -> TType -> TType
/// Build a curried function type
val mkIteratedFunTy: TcGlobals -> TTypes -> TType -> TType
/// Get the natural type of a single argument amongst a set of curried arguments
val typeOfLambdaArg: range -> Val list -> TType
/// Get the type corresponding to a lambda
val mkLambdaTy: TcGlobals -> Typars -> TTypes -> TType -> TType
/// Get the curried type corresponding to a lambda
val mkMultiLambdaTy: TcGlobals -> range -> Val list -> TType -> TType
/// Module publication, used while compiling fslib.
val ensureCcuHasModuleOrNamespaceAtPath: CcuThunk -> Ident list -> CompilationPath -> XmlDoc -> unit
/// Ignore 'Expr.Link' in an expression
val stripExpr: Expr -> Expr
/// Ignore 'Expr.Link' and 'Expr.DebugPoint' in an expression
val stripDebugPoints: Expr -> Expr
/// Match any 'Expr.Link' and 'Expr.DebugPoint' in an expression, providing the inner expression and a function to rebuild debug points
val (|DebugPoints|): Expr -> Expr * (Expr -> Expr)
/// Get the values for a set of bindings
val valsOfBinds: Bindings -> Vals
/// Look for a use of an F# value, possibly including application of a generic thing to a set of type arguments
val (|ExprValWithPossibleTypeInst|_|): Expr -> (ValRef * ValUseFlag * TType list * range) option
/// Build decision trees imperatively
type MatchBuilder =
/// Create a new builder
new: DebugPointAtBinding * range -> MatchBuilder
/// Add a new destination target
member AddTarget: DecisionTreeTarget -> int
/// Add a new destination target that is an expression result
member AddResultTarget: Expr -> DecisionTree
/// Finish the targets
member CloseTargets: unit -> DecisionTreeTarget list
/// Build the overall expression
member Close: DecisionTree * range * TType -> Expr
/// Add an if-then-else boolean conditional node into a decision tree
val mkBoolSwitch: range -> Expr -> DecisionTree -> DecisionTree -> DecisionTree
/// Build a conditional expression
val primMkCond: DebugPointAtBinding -> range -> TType -> Expr -> Expr -> Expr -> Expr
/// Build a conditional expression
val mkCond: DebugPointAtBinding -> range -> TType -> Expr -> Expr -> Expr -> Expr
/// Build a conditional expression that checks for non-nullness
val mkNonNullCond: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr
/// Build an if-then statement
val mkIfThen: TcGlobals -> range -> Expr -> Expr -> Expr
/// Build an expression corresponding to the use of a value
/// Note: try to use exprForValRef or the expression returned from mkLocal instead of this.
val exprForVal: range -> Val -> Expr
/// Build an expression corresponding to the use of a reference to a value
val exprForValRef: range -> ValRef -> Expr
/// Make a new local value and build an expression to reference it
val mkLocal: range -> string -> TType -> Val * Expr
/// Make a new compiler-generated local value and build an expression to reference it
val mkCompGenLocal: range -> string -> TType -> Val * Expr
/// Make a new mutable compiler-generated local value and build an expression to reference it
val mkMutableCompGenLocal: range -> string -> TType -> Val * Expr
/// Make a new mutable compiler-generated local value, 'let' bind it to an expression
/// 'invisibly' (no sequence point etc.), and build an expression to reference it
val mkCompGenLocalAndInvisibleBind: TcGlobals -> string -> range -> Expr -> Val * Expr * Binding
/// Build a lambda expression taking multiple values
val mkMultiLambda: range -> Val list -> Expr * TType -> Expr
/// Rebuild a lambda during an expression tree traversal
val rebuildLambda: range -> Val option -> Val option -> Val list -> Expr * TType -> Expr
/// Build a lambda expression taking a single value
val mkLambda: range -> Val -> Expr * TType -> Expr
/// Build a generic lambda expression (type abstraction)
val mkTypeLambda: range -> Typars -> Expr * TType -> Expr
/// Build an object expression
val mkObjExpr: TType * Val option * Expr * ObjExprMethod list * (TType * ObjExprMethod list) list * range -> Expr
/// Build an type-chose expression, indicating that a local free choice of a type variable
val mkTypeChoose: range -> Typars -> Expr -> Expr
/// Build an iterated (curried) lambda expression
val mkLambdas: TcGlobals -> range -> Typars -> Val list -> Expr * TType -> Expr
/// Build an iterated (tupled+curried) lambda expression
val mkMultiLambdasCore: TcGlobals -> range -> Val list list -> Expr * TType -> Expr * TType
/// Build an iterated generic (type abstraction + tupled+curried) lambda expression
val mkMultiLambdas: TcGlobals -> range -> Typars -> Val list list -> Expr * TType -> Expr
/// Build a lambda expression that corresponds to the implementation of a member
val mkMemberLambdas: TcGlobals -> range -> Typars -> Val option -> Val option -> Val list list -> Expr * TType -> Expr
/// Build a 'while' loop expression
val mkWhile: TcGlobals -> DebugPointAtWhile * SpecialWhileLoopMarker * Expr * Expr * range -> Expr
/// Build a 'for' loop expression
val mkIntegerForLoop:
TcGlobals -> DebugPointAtFor * DebugPointAtInOrTo * Val * Expr * ForLoopStyle * Expr * Expr * range -> Expr
/// Build a 'try/with' expression
val mkTryWith:
TcGlobals ->
Expr (* filter val *) *
Val (* filter expr *) *
Expr (* handler val *) *
Val (* handler expr *) *
Expr *
range *
TType *
DebugPointAtTry *
DebugPointAtWith ->
Expr
/// Build a 'try/finally' expression
val mkTryFinally: TcGlobals -> Expr * Expr * range * TType * DebugPointAtTry * DebugPointAtFinally -> Expr
/// Build a user-level value binding
val mkBind: DebugPointAtBinding -> Val -> Expr -> Binding
/// Build a user-level let-binding
val mkLetBind: range -> Binding -> Expr -> Expr
/// Build a user-level value sequence of let bindings
val mkLetsBind: range -> Binding list -> Expr -> Expr
/// Build a user-level value sequence of let bindings
val mkLetsFromBindings: range -> Bindings -> Expr -> Expr
/// Build a user-level let expression
val mkLet: DebugPointAtBinding -> range -> Val -> Expr -> Expr -> Expr
/// Make a binding that binds a function value to a lambda taking multiple arguments
val mkMultiLambdaBind:
TcGlobals -> Val -> DebugPointAtBinding -> range -> Typars -> Val list list -> Expr * TType -> Binding
// Compiler generated bindings may involve a user variable.
// Compiler generated bindings may give rise to a sequence point if they are part of
// an SPAlways expression. Compiler generated bindings can arise from for example, inlining.
val mkCompGenBind: Val -> Expr -> Binding
/// Make a set of bindings that bind compiler generated values to corresponding expressions.
/// Compiler-generated bindings do not give rise to a sequence point in debugging.
val mkCompGenBinds: Val list -> Exprs -> Bindings
/// Make a let-expression that locally binds a compiler-generated value to an expression.
/// Compiler-generated bindings do not give rise to a sequence point in debugging.
val mkCompGenLet: range -> Val -> Expr -> Expr -> Expr
/// Make a let-expression that locally binds a compiler-generated value to an expression, where the expression
/// is returned by the given continuation. Compiler-generated bindings do not give rise to a sequence point in debugging.
val mkCompGenLetIn: range -> string -> TType -> Expr -> (Val * Expr -> Expr) -> Expr
/// Make a let-expression that locally binds a value to an expression in an "invisible" way.
/// Invisible bindings are not given a sequence point and should not have side effects.
val mkInvisibleLet: range -> Val -> Expr -> Expr -> Expr
/// Make a binding that binds a value to an expression in an "invisible" way.
/// Invisible bindings are not given a sequence point and should not have side effects.
val mkInvisibleBind: Val -> Expr -> Binding
/// Make a set of bindings that bind values to expressions in an "invisible" way.
/// Invisible bindings are not given a sequence point and should not have side effects.
val mkInvisibleBinds: Vals -> Exprs -> Bindings
/// Make a let-rec expression that locally binds values to expressions where self-reference back to the values is possible.
val mkLetRecBinds: range -> Bindings -> Expr -> Expr
/// GeneralizedType (generalizedTypars, tauTy)
///
/// generalizedTypars -- the truly generalized type parameters
/// tauTy -- the body of the generalized type. A 'tau' type is one with its type parameters stripped off.
type GeneralizedType = GeneralizedType of Typars * TType
/// Make the right-hand side of a generalized binding, incorporating the generalized generic parameters from the type
/// scheme into the right-hand side as type generalizations.
val mkGenericBindRhs: TcGlobals -> range -> Typars -> GeneralizedType -> Expr -> Expr
/// Test if the type parameter is one of those being generalized by a type scheme.
val isBeingGeneralized: Typar -> GeneralizedType -> bool
/// Make the expression corresponding to 'expr1 && expr2'
val mkLazyAnd: TcGlobals -> range -> Expr -> Expr -> Expr
/// Make the expression corresponding to 'expr1 || expr2'
val mkLazyOr: TcGlobals -> range -> Expr -> Expr -> Expr
/// Make a byref type
val mkByrefTy: TcGlobals -> TType -> TType
/// Make a byref type with a in/out kind inference parameter
val mkByrefTyWithInference: TcGlobals -> TType -> TType -> TType
/// Make a in-byref type with a in kind parameter
val mkInByrefTy: TcGlobals -> TType -> TType
/// Make an out-byref type with an out kind parameter
val mkOutByrefTy: TcGlobals -> TType -> TType
/// Make an expression that constructs a union case, e.g. 'Some(expr)'
val mkUnionCaseExpr: UnionCaseRef * TypeInst * Exprs * range -> Expr
/// Make an expression that constructs an exception value
val mkExnExpr: TyconRef * Exprs * range -> Expr
/// Make an expression that is IL assembly code
val mkAsmExpr: ILInstr list * TypeInst * Exprs * TTypes * range -> Expr
/// Make an expression that coerces one expression to another type
val mkCoerceExpr: Expr * TType * range * TType -> Expr
/// Make an expression that re-raises an exception
val mkReraise: range -> TType -> Expr
/// Make an expression that re-raises an exception via a library call
val mkReraiseLibCall: TcGlobals -> TType -> range -> Expr
/// Make an expression that gets an item from a tuple
val mkTupleFieldGet: TcGlobals -> TupInfo * Expr * TypeInst * int * range -> Expr
/// Make an expression that gets an item from an anonymous record
val mkAnonRecdFieldGet: TcGlobals -> AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr
/// Make an expression that gets an item from an anonymous record (via the address of the value if it is a struct)
val mkAnonRecdFieldGetViaExprAddr: AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr
/// Make an expression that gets an instance field from a record or class (via the address of the value if it is a struct)
val mkRecdFieldGetViaExprAddr: Expr * RecdFieldRef * TypeInst * range -> Expr
/// Make an expression that gets the address of an instance field from a record or class (via the address of the value if it is a struct)
val mkRecdFieldGetAddrViaExprAddr: readonly: bool * Expr * RecdFieldRef * TypeInst * range -> Expr
/// Make an expression that gets a static field from a record or class
val mkStaticRecdFieldGet: RecdFieldRef * TypeInst * range -> Expr
/// Make an expression that sets a static field in a record or class
val mkStaticRecdFieldSet: RecdFieldRef * TypeInst * Expr * range -> Expr
/// Make an expression that gets the address of a static field in a record or class
val mkStaticRecdFieldGetAddr: readonly: bool * RecdFieldRef * TypeInst * range -> Expr
/// Make an expression that sets an instance the field of a record or class (via the address of the value if it is a struct)
val mkRecdFieldSetViaExprAddr: Expr * RecdFieldRef * TypeInst * Expr * range -> Expr
/// Make an expression that gets the tag of a union value (via the address of the value if it is a struct)
val mkUnionCaseTagGetViaExprAddr: Expr * TyconRef * TypeInst * range -> Expr
/// Make a 'TOp.UnionCaseProof' expression, which proves a union value is over a particular case (used only for ref-unions, not struct-unions)
val mkUnionCaseProof: Expr * UnionCaseRef * TypeInst * range -> Expr
/// Build a 'TOp.UnionCaseFieldGet' expression for something we've already determined to be a particular union case. For ref-unions,
/// the input expression has 'TType_ucase', which is an F# compiler internal "type" corresponding to the union case. For struct-unions,
/// the input should be the address of the expression.
val mkUnionCaseFieldGetProvenViaExprAddr: Expr * UnionCaseRef * TypeInst * int * range -> Expr
/// Build a 'TOp.UnionCaseFieldGetAddr' expression for a field of a union when we've already determined the value to be a particular union case. For ref-unions,
/// the input expression has 'TType_ucase', which is an F# compiler internal "type" corresponding to the union case. For struct-unions,
/// the input should be the address of the expression.
val mkUnionCaseFieldGetAddrProvenViaExprAddr: readonly: bool * Expr * UnionCaseRef * TypeInst * int * range -> Expr
/// Build a 'TOp.UnionCaseFieldGetAddr' expression for a field of a union when we've already determined the value to be a particular union case. For ref-unions,
/// the input expression has 'TType_ucase', which is an F# compiler internal "type" corresponding to the union case. For struct-unions,
/// the input should be the address of the expression.
val mkUnionCaseFieldGetUnprovenViaExprAddr: Expr * UnionCaseRef * TypeInst * int * range -> Expr
/// Build a 'TOp.UnionCaseFieldSet' expression. For ref-unions, the input expression has 'TType_ucase', which is
/// an F# compiler internal "type" corresponding to the union case. For struct-unions,
/// the input should be the address of the expression.
val mkUnionCaseFieldSet: Expr * UnionCaseRef * TypeInst * int * Expr * range -> Expr
/// Like mkUnionCaseFieldGetUnprovenViaExprAddr, but for struct-unions, the input should be a copy of the expression.
val mkUnionCaseFieldGetUnproven: TcGlobals -> Expr * UnionCaseRef * TypeInst * int * range -> Expr
/// Make an expression that gets an instance field from an F# exception value
val mkExnCaseFieldGet: Expr * TyconRef * int * range -> Expr
/// Make an expression that sets an instance field in an F# exception value
val mkExnCaseFieldSet: Expr * TyconRef * int * Expr * range -> Expr
/// Make an expression that gets the address of an element in an array
val mkArrayElemAddress:
TcGlobals -> readonly: bool * ILReadonly * bool * ILArrayShape * TType * Expr list * range -> Expr
/// The largest tuple before we start encoding, i.e. 7
val maxTuple: int
/// The number of fields in the largest tuple before we start encoding, i.e. 7
val goodTupleFields: int
/// Check if a TyconRef is for a .NET tuple type. Currently this includes Tuple`1 even though
/// that' not really part of the target set of TyconRef used to represent F# tuples.
val isCompiledTupleTyconRef: TcGlobals -> TyconRef -> bool
/// Get a TyconRef for a .NET tuple type
val mkCompiledTupleTyconRef: TcGlobals -> bool -> int -> TyconRef
/// Convert from F# tuple types to .NET tuple types.
val mkCompiledTupleTy: TcGlobals -> bool -> TTypes -> TType
/// Convert from F# tuple creation expression to .NET tuple creation expressions
val mkCompiledTuple: TcGlobals -> bool -> TTypes * Exprs * range -> TyconRef * TTypes * Exprs * range
/// Make a TAST expression representing getting an item fromm a tuple
val mkGetTupleItemN: TcGlobals -> range -> int -> ILType -> bool -> Expr -> TType -> Expr
/// Evaluate the TupInfo to work out if it is a struct or a ref. Currently this is very simple
/// but TupInfo may later be used carry variables that infer structness.
val evalTupInfoIsStruct: TupInfo -> bool
/// Evaluate the AnonRecdTypeInfo to work out if it is a struct or a ref.
val evalAnonInfoIsStruct: AnonRecdTypeInfo -> bool
/// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged
val convertToTypeWithMetadataIfPossible: TcGlobals -> TType -> TType
/// An exception representing a warning for a defensive copy of an immutable struct
exception DefensiveCopyWarning of string * range
type Mutates =
| AddressOfOp
| DefinitelyMutates
| PossiblyMutates
| NeverMutates
/// Helper to create an expression that dereferences an address.
val mkDerefAddrExpr: mAddrGet: range -> expr: Expr -> mExpr: range -> exprTy: TType -> Expr
/// Helper to take the address of an expression
val mkExprAddrOfExprAux:
TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Val * Expr) option * Expr * bool * bool
/// Take the address of an expression, or force it into a mutable local. Any allocated
/// mutable local may need to be kept alive over a larger expression, hence we return
/// a wrapping function that wraps "let mutable loc = Expr in ..." around a larger
/// expression.
val mkExprAddrOfExpr:
TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Expr -> Expr) * Expr * bool * bool
/// Maps Val to T, based on stamps
[<Struct; NoEquality; NoComparison>]
type ValMap<'T> =
member Contents: StampMap<'T>
member Item: Val -> 'T with get
member TryFind: Val -> 'T option
member ContainsVal: Val -> bool
member Add: Val -> 'T -> ValMap<'T>
member Remove: Val -> ValMap<'T>
member IsEmpty: bool
static member Empty: ValMap<'T>
static member OfList: (Val * 'T) list -> ValMap<'T>
/// Mutable data structure mapping Val's to T based on stamp keys
[<Sealed; NoEquality; NoComparison>]
type ValHash<'T> =
member Values: seq<'T>
member TryFind: Val -> 'T option
member Add: Val * 'T -> unit
static member Create: unit -> ValHash<'T>
/// Maps Val's to list of T based on stamp keys
[<Struct; NoEquality; NoComparison>]
type ValMultiMap<'T> =
member ContainsKey: Val -> bool
member Find: Val -> 'T list
member Add: Val * 'T -> ValMultiMap<'T>
member Remove: Val -> ValMultiMap<'T>
member Contents: StampMap<'T list>
static member Empty: ValMultiMap<'T>
/// Maps type parameters to entries based on stamp keys
[<Sealed>]
type TyparMap<'T> =
/// Get the entry for the given type parameter
member Item: Typar -> 'T with get
/// Determine is the map contains an entry for the given type parameter
member ContainsKey: Typar -> bool
/// Try to find the entry for the given type parameter
member TryFind: Typar -> 'T option
/// Make a new map, containing a new entry for the given type parameter
member Add: Typar * 'T -> TyparMap<'T>
/// The empty map
static member Empty: TyparMap<'T>
/// Maps TyconRef to T based on stamp keys
[<NoEquality; NoComparison; Sealed>]
type TyconRefMap<'T> =
/// Get the entry for the given type definition
member Item: TyconRef -> 'T with get
/// Try to find the entry for the given type definition
member TryFind: TyconRef -> 'T option
/// Determine is the map contains an entry for the given type definition
member ContainsKey: TyconRef -> bool
/// Make a new map, containing a new entry for the given type definition
member Add: TyconRef -> 'T -> TyconRefMap<'T>
/// Remove the entry for the given type definition, if any
member Remove: TyconRef -> TyconRefMap<'T>
/// Determine if the map is empty
member IsEmpty: bool
/// The empty map
static member Empty: TyconRefMap<'T>
/// Make a new map, containing entries for the given type definitions
static member OfList: (TyconRef * 'T) list -> TyconRefMap<'T>
/// Maps TyconRef to list of T based on stamp keys
[<Struct; NoEquality; NoComparison>]
type TyconRefMultiMap<'T> =
/// Fetch the entries for the given type definition
member Find: TyconRef -> 'T list
/// Make a new map, containing a new entry for the given type definition
member Add: TyconRef * 'T -> TyconRefMultiMap<'T>
/// The empty map
static member Empty: TyconRefMultiMap<'T>
/// Make a new map, containing a entries for the given type definitions
static member OfList: (TyconRef * 'T) list -> TyconRefMultiMap<'T>
/// An ordering for value definitions, based on stamp
val valOrder: IComparer<Val>
/// An ordering for type definitions, based on stamp
val tyconOrder: IComparer<Tycon>
/// An ordering for record fields, based on stamp
val recdFieldRefOrder: IComparer<RecdFieldRef>
/// An ordering for type parameters, based on stamp
val typarOrder: IComparer<Typar>
/// Equality for type definition references
val tyconRefEq: TcGlobals -> TyconRef -> TyconRef -> bool
/// Equality for value references
val valRefEq: TcGlobals -> ValRef -> ValRef -> bool
//-------------------------------------------------------------------------
// Operations on types: substitution
//-------------------------------------------------------------------------
/// Represents an instantiation where types replace type parameters
type TyparInstantiation = (Typar * TType) list
/// Represents an instantiation where type definition references replace other type definition references
type TyconRefRemap = TyconRefMap<TyconRef>
/// Represents an instantiation where value references replace other value references
type ValRemap = ValMap<ValRef>
/// Represents a combination of substitutions/instantiations where things replace other things during remapping
[<NoEquality; NoComparison>]
type Remap =
{ tpinst: TyparInstantiation
valRemap: ValRemap
tyconRefRemap: TyconRefRemap
removeTraitSolutions: bool }
static member Empty: Remap
val addTyconRefRemap: TyconRef -> TyconRef -> Remap -> Remap
val addValRemap: Val -> Val -> Remap -> Remap
val mkTyparInst: Typars -> TTypes -> TyparInstantiation
val mkTyconRefInst: TyconRef -> TypeInst -> TyparInstantiation
val emptyTyparInst: TyparInstantiation
val instType: TyparInstantiation -> TType -> TType
val instTypes: TyparInstantiation -> TypeInst -> TypeInst
val instTyparConstraints: TyparInstantiation -> TyparConstraint list -> TyparConstraint list
val instTrait: TyparInstantiation -> TraitConstraintInfo -> TraitConstraintInfo
val generalTyconRefInst: TyconRef -> TypeInst
/// From typars to types
val generalizeTypars: Typars -> TypeInst
val generalizeTyconRef: TcGlobals -> TyconRef -> TTypes * TType
val generalizedTyconRef: TcGlobals -> TyconRef -> TType
val mkTyparToTyparRenaming: Typars -> Typars -> TyparInstantiation * TTypes
//-------------------------------------------------------------------------
// See through typar equations from inference and/or type abbreviation equations.
//-------------------------------------------------------------------------
val reduceTyconRefAbbrev: TyconRef -> TypeInst -> TType
val reduceTyconRefMeasureableOrProvided: TcGlobals -> TyconRef -> TypeInst -> TType
val reduceTyconRefAbbrevMeasureable: TyconRef -> Measure
/// set bool to 'true' to allow shortcutting of type parameter equation chains during stripping
val stripTyEqnsA: TcGlobals -> bool -> TType -> TType
val stripTyEqns: TcGlobals -> TType -> TType
val stripTyEqnsAndMeasureEqns: TcGlobals -> TType -> TType
val tryNormalizeMeasureInType: TcGlobals -> TType -> TType
/// See through F# exception abbreviations
val stripExnEqns: TyconRef -> Tycon
val recdFieldsOfExnDefRef: TyconRef -> RecdField list
val recdFieldTysOfExnDefRef: TyconRef -> TType list
//-------------------------------------------------------------------------
// Analyze types. These all look through type abbreviations and
// inference equations, i.e. are "stripped"
//-------------------------------------------------------------------------
val destForallTy: TcGlobals -> TType -> Typars * TType
val destFunTy: TcGlobals -> TType -> TType * TType
val destAnyTupleTy: TcGlobals -> TType -> TupInfo * TTypes
val destRefTupleTy: TcGlobals -> TType -> TTypes
val destStructTupleTy: TcGlobals -> TType -> TTypes
val destTyparTy: TcGlobals -> TType -> Typar
val destAnyParTy: TcGlobals -> TType -> Typar
val destMeasureTy: TcGlobals -> TType -> Measure
val tryDestForallTy: TcGlobals -> TType -> Typars * TType
val isFunTy: TcGlobals -> TType -> bool
val isForallTy: TcGlobals -> TType -> bool
val isAnyTupleTy: TcGlobals -> TType -> bool
val isRefTupleTy: TcGlobals -> TType -> bool
val isStructTupleTy: TcGlobals -> TType -> bool
val isStructAnonRecdTy: TcGlobals -> TType -> bool
val isAnonRecdTy: TcGlobals -> TType -> bool
val isUnionTy: TcGlobals -> TType -> bool
val isReprHiddenTy: TcGlobals -> TType -> bool
val isFSharpObjModelTy: TcGlobals -> TType -> bool
val isRecdTy: TcGlobals -> TType -> bool
val isFSharpStructOrEnumTy: TcGlobals -> TType -> bool
val isFSharpEnumTy: TcGlobals -> TType -> bool
val isTyparTy: TcGlobals -> TType -> bool
val isAnyParTy: TcGlobals -> TType -> bool
val tryAnyParTy: TcGlobals -> TType -> Typar voption
val tryAnyParTyOption: TcGlobals -> TType -> Typar option
val isMeasureTy: TcGlobals -> TType -> bool
val mkAppTy: TyconRef -> TypeInst -> TType
val mkProvenUnionCaseTy: UnionCaseRef -> TypeInst -> TType
val isProvenUnionCaseTy: TType -> bool
val isAppTy: TcGlobals -> TType -> bool
val tryAppTy: TcGlobals -> TType -> (TyconRef * TypeInst) voption
val destAppTy: TcGlobals -> TType -> TyconRef * TypeInst
val tcrefOfAppTy: TcGlobals -> TType -> TyconRef
val tryTcrefOfAppTy: TcGlobals -> TType -> TyconRef voption
val tryDestTyparTy: TcGlobals -> TType -> Typar voption
val tryDestFunTy: TcGlobals -> TType -> (TType * TType) voption
val tryDestAnonRecdTy: TcGlobals -> TType -> (AnonRecdTypeInfo * TType list) voption
val argsOfAppTy: TcGlobals -> TType -> TypeInst
val mkInstForAppTy: TcGlobals -> TType -> TyparInstantiation
/// Try to get a TyconRef for a type without erasing type abbreviations
val tryNiceEntityRefOfTy: TType -> TyconRef voption
val tryNiceEntityRefOfTyOption: TType -> TyconRef option
val domainOfFunTy: TcGlobals -> TType -> TType
val rangeOfFunTy: TcGlobals -> TType -> TType
val stripFunTy: TcGlobals -> TType -> TType list * TType
val stripFunTyN: TcGlobals -> int -> TType -> TType list * TType
val applyForallTy: TcGlobals -> TType -> TypeInst -> TType
val tryDestAnyTupleTy: TcGlobals -> TType -> TupInfo * TType list
val tryDestRefTupleTy: TcGlobals -> TType -> TType list
//-------------------------------------------------------------------------
// Compute actual types of union cases and fields given an instantiation
// of the generic type parameters of the enclosing type.
//-------------------------------------------------------------------------
val actualResultTyOfUnionCase: TypeInst -> UnionCaseRef -> TType
val actualTysOfUnionCaseFields: TyparInstantiation -> UnionCaseRef -> TType list
val actualTysOfInstanceRecdFields: TyparInstantiation -> TyconRef -> TType list
val actualTyOfRecdField: TyparInstantiation -> RecdField -> TType
val actualTyOfRecdFieldRef: RecdFieldRef -> TypeInst -> TType
val actualTyOfRecdFieldForTycon: Tycon -> TypeInst -> RecdField -> TType
//-------------------------------------------------------------------------
// Top types: guaranteed to be compiled to .NET methods, and must be able to
// have user-specified argument names (for stability w.r.t. reflection)
// and user-specified argument and return attributes.
//-------------------------------------------------------------------------
type UncurriedArgInfos = (TType * ArgReprInfo) list
type CurriedArgInfos = UncurriedArgInfos list
type TraitWitnessInfos = TraitWitnessInfo list
val destTopForallTy: TcGlobals -> ValReprInfo -> TType -> Typars * TType
val GetTopTauTypeInFSharpForm: TcGlobals -> ArgReprInfo list list -> TType -> range -> CurriedArgInfos * TType
val GetValReprTypeInFSharpForm:
TcGlobals -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType * ArgReprInfo
val IsCompiledAsStaticProperty: TcGlobals -> Val -> bool
val IsCompiledAsStaticPropertyWithField: TcGlobals -> Val -> bool
val GetValReprTypeInCompiledForm:
TcGlobals ->
ValReprInfo ->
int ->
TType ->
range ->
Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
val GetFSharpViewOfReturnType: TcGlobals -> TType option -> TType
val NormalizeDeclaredTyparsForEquiRecursiveInference: TcGlobals -> Typars -> Typars
//-------------------------------------------------------------------------
// Compute the return type after an application
//-------------------------------------------------------------------------
val applyTys: TcGlobals -> TType -> TType list * 'T list -> TType
//-------------------------------------------------------------------------
// Compute free variables in types
//-------------------------------------------------------------------------
val emptyFreeTypars: FreeTypars
val unionFreeTypars: FreeTypars -> FreeTypars -> FreeTypars
val emptyFreeTycons: FreeTycons
val unionFreeTycons: FreeTycons -> FreeTycons -> FreeTycons
val emptyFreeTyvars: FreeTyvars
val isEmptyFreeTyvars: FreeTyvars -> bool
val unionFreeTyvars: FreeTyvars -> FreeTyvars -> FreeTyvars
val emptyFreeLocals: FreeLocals
val unionFreeLocals: FreeLocals -> FreeLocals -> FreeLocals
/// Represents the options to activate when collecting free variables
[<Sealed>]
type FreeVarOptions =
/// During backend code generation of state machines, register a template replacement for struct types.
/// This may introduce new free variables related to the instantiation of the struct type.
member WithTemplateReplacement: (TyconRef -> bool) * Typars -> FreeVarOptions
val CollectLocalsNoCaching: FreeVarOptions
val CollectTyparsNoCaching: FreeVarOptions
val CollectTyparsAndLocalsNoCaching: FreeVarOptions
val CollectTyparsAndLocals: FreeVarOptions
val CollectLocals: FreeVarOptions
val CollectLocalsWithStackGuard: unit -> FreeVarOptions
val CollectTyparsAndLocalsWithStackGuard: unit -> FreeVarOptions
val CollectTypars: FreeVarOptions
val CollectAllNoCaching: FreeVarOptions
val CollectAll: FreeVarOptions
val accFreeInTypes: FreeVarOptions -> TType list -> FreeTyvars -> FreeTyvars
val accFreeInType: FreeVarOptions -> TType -> FreeTyvars -> FreeTyvars
val accFreeInTypars: FreeVarOptions -> Typars -> FreeTyvars -> FreeTyvars
val freeInType: FreeVarOptions -> TType -> FreeTyvars
val freeInTypes: FreeVarOptions -> TType list -> FreeTyvars
val freeInVal: FreeVarOptions -> Val -> FreeTyvars
// This one puts free variables in canonical left-to-right order.
val freeInTypeLeftToRight: TcGlobals -> bool -> TType -> Typars
val freeInTypesLeftToRight: TcGlobals -> bool -> TType list -> Typars
val freeInTypesLeftToRightSkippingConstraints: TcGlobals -> TType list -> Typars
val freeInModuleTy: ModuleOrNamespaceType -> FreeTyvars
val isDimensionless: TcGlobals -> TType -> bool
//---------------------------------------------------------------------------
// TType modifications and comparisons
//---------------------------------------------------------------------------
val stripMeasuresFromTy: TcGlobals -> TType -> TType
//-------------------------------------------------------------------------
// Equivalence of types (up to substitution of type variables in the left-hand type)
//-------------------------------------------------------------------------
[<NoEquality; NoComparison>]
type TypeEquivEnv =
{ EquivTypars: TyparMap<TType>
EquivTycons: TyconRefRemap }
static member Empty: TypeEquivEnv
member BindEquivTypars: Typars -> Typars -> TypeEquivEnv
static member FromTyparInst: TyparInstantiation -> TypeEquivEnv
static member FromEquivTypars: Typars -> Typars -> TypeEquivEnv
val traitsAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool
val traitsAEquiv: TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool
val traitKeysAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TraitWitnessInfo -> TraitWitnessInfo -> bool
val traitKeysAEquiv: TcGlobals -> TypeEquivEnv -> TraitWitnessInfo -> TraitWitnessInfo -> bool
val typarConstraintsAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool
val typarConstraintsAEquiv: TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool
val typarsAEquiv: TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool
val typeAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool
val typeAEquiv: TcGlobals -> TypeEquivEnv -> TType -> TType -> bool
val returnTypesAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool
val returnTypesAEquiv: TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool
val tcrefAEquiv: TcGlobals -> TypeEquivEnv -> TyconRef -> TyconRef -> bool
val valLinkageAEquiv: TcGlobals -> TypeEquivEnv -> Val -> Val -> bool
val anonInfoEquiv: AnonRecdTypeInfo -> AnonRecdTypeInfo -> bool
//-------------------------------------------------------------------------
// Erasure of types wrt units-of-measure and type providers
//-------------------------------------------------------------------------
// Return true if this type is a nominal type that is an erased provided type
val isErasedType: TcGlobals -> TType -> bool
// Return all components (units-of-measure, and types) of this type that would be erased
val getErasedTypes: TcGlobals -> TType -> TType list
//-------------------------------------------------------------------------
// Unit operations
//-------------------------------------------------------------------------
val MeasurePower: Measure -> int -> Measure
val ListMeasureVarOccsWithNonZeroExponents: Measure -> (Typar * Rational) list
val ListMeasureConOccsWithNonZeroExponents: TcGlobals -> bool -> Measure -> (TyconRef * Rational) list
val ProdMeasures: Measure list -> Measure
val MeasureVarExponent: Typar -> Measure -> Rational
val MeasureExprConExponent: TcGlobals -> bool -> TyconRef -> Measure -> Rational
val normalizeMeasure: TcGlobals -> Measure -> Measure
//-------------------------------------------------------------------------
// Members
//-------------------------------------------------------------------------
val GetTypeOfMemberInFSharpForm: TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType * ArgReprInfo
val GetTypeOfMemberInMemberForm:
TcGlobals -> ValRef -> Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
val GetTypeOfIntrinsicMemberInCompiledForm:
TcGlobals -> ValRef -> Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
val GetMemberTypeInMemberForm:
TcGlobals ->
SynMemberFlags ->
ValReprInfo ->
int ->
TType ->
range ->
Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
/// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst)
val PartitionValTyparsForApparentEnclosingType:
TcGlobals -> Val -> (Typars * Typars * Typars * TyparInstantiation * TType list) option
/// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst)
val PartitionValTypars: TcGlobals -> Val -> (Typars * Typars * Typars * TyparInstantiation * TType list) option
/// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst)
val PartitionValRefTypars: TcGlobals -> ValRef -> (Typars * Typars * Typars * TyparInstantiation * TType list) option
/// Count the number of type parameters on the enclosing type
val CountEnclosingTyparsOfActualParentOfVal: Val -> int
val ReturnTypeOfPropertyVal: TcGlobals -> Val -> TType
val ArgInfosOfPropertyVal: TcGlobals -> Val -> UncurriedArgInfos
val ArgInfosOfMember: TcGlobals -> ValRef -> CurriedArgInfos
val GetMemberCallInfo: TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * bool * bool * bool * bool * bool
//-------------------------------------------------------------------------
// Printing
//-------------------------------------------------------------------------
type TyparConstraintsWithTypars = (Typar * TyparConstraint) list
module PrettyTypes =
val NeedsPrettyTyparName: Typar -> bool
val NewPrettyTypars: TyparInstantiation -> Typars -> string list -> Typars * TyparInstantiation
val PrettyTyparNames: (Typar -> bool) -> string list -> Typars -> string list
/// Assign previously generated pretty names to typars
val AssignPrettyTyparNames: Typars -> string list -> unit
val PrettifyType: TcGlobals -> TType -> TType * TyparConstraintsWithTypars
val PrettifyInstAndTyparsAndType:
TcGlobals ->
TyparInstantiation * Typars * TType ->
(TyparInstantiation * Typars * TType) * TyparConstraintsWithTypars
val PrettifyTypePair: TcGlobals -> TType * TType -> (TType * TType) * TyparConstraintsWithTypars
val PrettifyTypes: TcGlobals -> TTypes -> TTypes * TyparConstraintsWithTypars
/// same as PrettifyTypes, but allows passing the types along with a discriminant value
/// useful to prettify many types that need to be sorted out after prettifying operation
/// took place.