TypedTreeOps.fsi 100.0 KB
Newer Older
1
// Copyright (c) Microsoft Corporation.  All Rights Reserved.  See License.txt in the project root for license information.
L
latkin 已提交
2

D
Don Syme 已提交
3
/// Defines derived expression manipulation and construction functions.
4
module internal FSharp.Compiler.TypedTreeOps
L
latkin 已提交
5 6

open System.Collections.Generic
D
Don Syme 已提交
7 8
open System.Collections.Immutable
open Internal.Utilities.Collections
9
open Internal.Utilities.Library
D
Don Syme 已提交
10
open Internal.Utilities.Rational
11
open FSharp.Compiler.AbstractIL.IL
D
Don Syme 已提交
12
open FSharp.Compiler.DiagnosticsLogger
13
open FSharp.Compiler.CompilerGlobalState
D
Don Syme 已提交
14 15
open FSharp.Compiler.Syntax
open FSharp.Compiler.Text
16
open FSharp.Compiler.Xml
17
open FSharp.Compiler.TypedTree
D
Don Syme 已提交
18
open FSharp.Compiler.TcGlobals
L
latkin 已提交
19

20 21 22 23
type Erasure =
    | EraseAll
    | EraseMeasures
    | EraseNone
L
latkin 已提交
24

25
/// Check the equivalence of two types up to an erasure flag
D
Don Syme 已提交
26
val typeEquivAux: Erasure -> TcGlobals -> TType -> TType -> bool
27

28
/// Check the equivalence of two types
D
Don Syme 已提交
29
val typeEquiv: TcGlobals -> TType -> TType -> bool
30 31

/// Check the equivalence of two units-of-measure
D
Don Syme 已提交
32
val measureEquiv: TcGlobals -> Measure -> Measure -> bool
33

34 35 36
/// Get the unit of measure for an annotated type
val getMeasureOfType: TcGlobals -> TType -> (TyconRef * Measure) option

E
Eugene Auduchinok 已提交
37
/// Reduce a type to its more canonical form subject to an erasure flag, inference equations and abbreviations
L
latkin 已提交
38 39
val stripTyEqnsWrtErasure: Erasure -> TcGlobals -> TType -> TType

40
/// Build a function type
D
Don Syme 已提交
41
val mkFunTy: TcGlobals -> TType -> TType -> TType
42 43

/// Build a type-forall anonymous generic type if necessary
D
Don Syme 已提交
44
val mkForallTyIfNeeded: Typars -> TType -> TType
45

46
val (+->): Typars -> TType -> TType
47 48

/// Build a curried function type
D
Don Syme 已提交
49
val mkIteratedFunTy: TcGlobals -> TTypes -> TType -> TType
50 51

/// Get the natural type of a single argument amongst a set of curried arguments
D
Don Syme 已提交
52
val typeOfLambdaArg: range -> Val list -> TType
53

54
/// Get the type corresponding to a lambda
D
Don Syme 已提交
55
val mkLambdaTy: TcGlobals -> Typars -> TTypes -> TType -> TType
L
latkin 已提交
56

57
/// Get the curried type corresponding to a lambda
D
Don Syme 已提交
58
val mkMultiLambdaTy: TcGlobals -> range -> Val list -> TType -> TType
L
latkin 已提交
59

60
/// Module publication, used while compiling fslib.
61
val ensureCcuHasModuleOrNamespaceAtPath: CcuThunk -> Ident list -> CompilationPath -> XmlDoc -> unit
L
latkin 已提交
62

63
/// Ignore 'Expr.Link' in an expression
D
Don Syme 已提交
64
val stripExpr: Expr -> Expr
L
latkin 已提交
65

66 67 68 69
/// 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
70
val (|DebugPoints|): Expr -> Expr * (Expr -> Expr)
71

72
/// Get the values for a set of bindings
73
val valsOfBinds: Bindings -> Vals
L
latkin 已提交
74

D
Don Syme 已提交
75
/// Look for a use of an F# value, possibly including application of a generic thing to a set of type arguments
D
Don Syme 已提交
76
val (|ExprValWithPossibleTypeInst|_|): Expr -> (ValRef * ValUseFlag * TType list * range) option
L
latkin 已提交
77

D
Don Syme 已提交
78
/// Build decision trees imperatively
L
latkin 已提交
79
type MatchBuilder =
D
Don Syme 已提交
80 81

    /// Create a new builder
D
Don Syme 已提交
82
    new: DebugPointAtBinding * range -> MatchBuilder
D
Don Syme 已提交
83 84

    /// Add a new destination target
D
Don Syme 已提交
85
    member AddTarget: DecisionTreeTarget -> int
D
Don Syme 已提交
86 87

    /// Add a new destination target that is an expression result
88
    member AddResultTarget: Expr -> DecisionTree
D
Don Syme 已提交
89 90

    /// Finish the targets
D
Don Syme 已提交
91
    member CloseTargets: unit -> DecisionTreeTarget list
L
latkin 已提交
92

D
Don Syme 已提交
93
    /// Build the overall expression
D
Don Syme 已提交
94
    member Close: DecisionTree * range * TType -> Expr
L
latkin 已提交
95

D
Don Syme 已提交
96
/// Add an if-then-else boolean conditional node into a decision tree
97
val mkBoolSwitch: range -> Expr -> DecisionTree -> DecisionTree -> DecisionTree
D
Don Syme 已提交
98 99

/// Build a conditional expression
100
val primMkCond: DebugPointAtBinding -> range -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
101 102

/// Build a conditional expression
103
val mkCond: DebugPointAtBinding -> range -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
104 105

/// Build a conditional expression that checks for non-nullness
D
Don Syme 已提交
106
val mkNonNullCond: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr
L
latkin 已提交
107

D
Don Syme 已提交
108
/// Build an if-then statement
109
val mkIfThen: TcGlobals -> range -> Expr -> Expr -> Expr
L
latkin 已提交
110

D
Don Syme 已提交
111
/// Build an expression corresponding to the use of a value
112
/// Note: try to use exprForValRef or the expression returned from mkLocal instead of this.
D
Don Syme 已提交
113
val exprForVal: range -> Val -> Expr
D
Don Syme 已提交
114 115

/// Build an expression corresponding to the use of a reference to a value
D
Don Syme 已提交
116
val exprForValRef: range -> ValRef -> Expr
L
latkin 已提交
117

D
Don Syme 已提交
118
/// Make a new local value and build an expression to reference it
D
Don Syme 已提交
119
val mkLocal: range -> string -> TType -> Val * Expr
D
Don Syme 已提交
120 121

/// Make a new compiler-generated local value and build an expression to reference it
D
Don Syme 已提交
122
val mkCompGenLocal: range -> string -> TType -> Val * Expr
D
Don Syme 已提交
123 124

/// Make a new mutable compiler-generated local value and build an expression to reference it
D
Don Syme 已提交
125
val mkMutableCompGenLocal: range -> string -> TType -> Val * Expr
L
latkin 已提交
126

127
/// Make a new mutable compiler-generated local value, 'let' bind it to an expression
D
Don Syme 已提交
128
/// 'invisibly' (no sequence point etc.), and build an expression to reference it
129
val mkCompGenLocalAndInvisibleBind: TcGlobals -> string -> range -> Expr -> Val * Expr * Binding
L
latkin 已提交
130

D
Don Syme 已提交
131
/// Build a lambda expression taking multiple values
D
Don Syme 已提交
132
val mkMultiLambda: range -> Val list -> Expr * TType -> Expr
D
Don Syme 已提交
133 134

/// Rebuild a lambda during an expression tree traversal
D
Don Syme 已提交
135
val rebuildLambda: range -> Val option -> Val option -> Val list -> Expr * TType -> Expr
D
Don Syme 已提交
136

137
/// Build a lambda expression taking a single value
D
Don Syme 已提交
138
val mkLambda: range -> Val -> Expr * TType -> Expr
D
Don Syme 已提交
139 140

/// Build a generic lambda expression (type abstraction)
D
Don Syme 已提交
141
val mkTypeLambda: range -> Typars -> Expr * TType -> Expr
D
Don Syme 已提交
142 143

/// Build an object expression
D
Don Syme 已提交
144
val mkObjExpr: TType * Val option * Expr * ObjExprMethod list * (TType * ObjExprMethod list) list * range -> Expr
D
Don Syme 已提交
145 146

/// Build an type-chose expression, indicating that a local free choice of a type variable
D
Don Syme 已提交
147
val mkTypeChoose: range -> Typars -> Expr -> Expr
D
Don Syme 已提交
148 149

/// Build an iterated (curried) lambda expression
D
Don Syme 已提交
150
val mkLambdas: TcGlobals -> range -> Typars -> Val list -> Expr * TType -> Expr
D
Don Syme 已提交
151 152

/// Build an iterated (tupled+curried) lambda expression
D
Don Syme 已提交
153
val mkMultiLambdasCore: TcGlobals -> range -> Val list list -> Expr * TType -> Expr * TType
D
Don Syme 已提交
154 155

/// Build an iterated generic (type abstraction + tupled+curried) lambda expression
D
Don Syme 已提交
156
val mkMultiLambdas: TcGlobals -> range -> Typars -> Val list list -> Expr * TType -> Expr
D
Don Syme 已提交
157 158

/// Build a lambda expression that corresponds to the implementation of a member
D
Don Syme 已提交
159
val mkMemberLambdas: TcGlobals -> range -> Typars -> Val option -> Val option -> Val list list -> Expr * TType -> Expr
L
latkin 已提交
160

D
Don Syme 已提交
161
/// Build a 'while' loop expression
D
Don Syme 已提交
162
val mkWhile: TcGlobals -> DebugPointAtWhile * SpecialWhileLoopMarker * Expr * Expr * range -> Expr
D
Don Syme 已提交
163 164

/// Build a 'for' loop expression
165 166
val mkIntegerForLoop:
    TcGlobals -> DebugPointAtFor * DebugPointAtInOrTo * Val * Expr * ForLoopStyle * Expr * Expr * range -> Expr
D
Don Syme 已提交
167 168

/// Build a 'try/with' expression
169 170 171 172 173 174 175 176 177 178 179 180
val mkTryWith:
    TcGlobals ->
    Expr (* filter val *) *
    Val (* filter expr *) *
    Expr (* handler val *) *
    Val (* handler expr *) *
    Expr *
    range *
    TType *
    DebugPointAtTry *
    DebugPointAtWith ->
        Expr
L
latkin 已提交
181

D
Don Syme 已提交
182
/// Build a 'try/finally' expression
D
Don Syme 已提交
183
val mkTryFinally: TcGlobals -> Expr * Expr * range * TType * DebugPointAtTry * DebugPointAtFinally -> Expr
L
latkin 已提交
184

D
Don Syme 已提交
185
/// Build a user-level value binding
D
Don Syme 已提交
186
val mkBind: DebugPointAtBinding -> Val -> Expr -> Binding
D
Don Syme 已提交
187 188

/// Build a user-level let-binding
D
Don Syme 已提交
189
val mkLetBind: range -> Binding -> Expr -> Expr
D
Don Syme 已提交
190 191

/// Build a user-level value sequence of let bindings
D
Don Syme 已提交
192
val mkLetsBind: range -> Binding list -> Expr -> Expr
D
Don Syme 已提交
193 194

/// Build a user-level value sequence of let bindings
D
Don Syme 已提交
195
val mkLetsFromBindings: range -> Bindings -> Expr -> Expr
D
Don Syme 已提交
196 197

/// Build a user-level let expression
D
Don Syme 已提交
198
val mkLet: DebugPointAtBinding -> range -> Val -> Expr -> Expr -> Expr
D
Don Syme 已提交
199 200

/// Make a binding that binds a function value to a lambda taking multiple arguments
201 202
val mkMultiLambdaBind:
    TcGlobals -> Val -> DebugPointAtBinding -> range -> Typars -> Val list list -> Expr * TType -> Binding
L
latkin 已提交
203 204 205 206

// 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.
D
Don Syme 已提交
207
val mkCompGenBind: Val -> Expr -> Binding
D
Don Syme 已提交
208 209 210

/// 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.
D
Don Syme 已提交
211
val mkCompGenBinds: Val list -> Exprs -> Bindings
D
Don Syme 已提交
212 213 214

/// 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.
D
Don Syme 已提交
215
val mkCompGenLet: range -> Val -> Expr -> Expr -> Expr
D
Don Syme 已提交
216 217 218

/// 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.
D
Don Syme 已提交
219
val mkCompGenLetIn: range -> string -> TType -> Expr -> (Val * Expr -> Expr) -> Expr
L
latkin 已提交
220

D
Don Syme 已提交
221 222
/// 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.
D
Don Syme 已提交
223
val mkInvisibleLet: range -> Val -> Expr -> Expr -> Expr
D
Don Syme 已提交
224 225 226

/// 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.
D
Don Syme 已提交
227
val mkInvisibleBind: Val -> Expr -> Binding
D
Don Syme 已提交
228 229 230

/// 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.
D
Don Syme 已提交
231
val mkInvisibleBinds: Vals -> Exprs -> Bindings
D
Don Syme 已提交
232 233

/// Make a let-rec expression that locally binds values to expressions where self-reference back to the values is possible.
D
Don Syme 已提交
234
val mkLetRecBinds: range -> Bindings -> Expr -> Expr
235

D
Don Syme 已提交
236
/// GeneralizedType (generalizedTypars, tauTy)
L
latkin 已提交
237
///
238
///    generalizedTypars -- the truly generalized type parameters
D
dungpa 已提交
239
///    tauTy  --  the body of the generalized type. A 'tau' type is one with its type parameters stripped off.
D
Don Syme 已提交
240
type GeneralizedType = GeneralizedType of Typars * TType
L
latkin 已提交
241

D
Don Syme 已提交
242 243
/// 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.
D
Don Syme 已提交
244
val mkGenericBindRhs: TcGlobals -> range -> Typars -> GeneralizedType -> Expr -> Expr
L
latkin 已提交
245

D
Don Syme 已提交
246
/// Test if the type parameter is one of those being generalized by a type scheme.
D
Don Syme 已提交
247
val isBeingGeneralized: Typar -> GeneralizedType -> bool
L
latkin 已提交
248

D
Don Syme 已提交
249
/// Make the expression corresponding to 'expr1 && expr2'
D
Don Syme 已提交
250
val mkLazyAnd: TcGlobals -> range -> Expr -> Expr -> Expr
D
Don Syme 已提交
251 252

/// Make the expression corresponding to 'expr1 || expr2'
D
Don Syme 已提交
253
val mkLazyOr: TcGlobals -> range -> Expr -> Expr -> Expr
D
Don Syme 已提交
254

255
/// Make a byref type
D
Don Syme 已提交
256
val mkByrefTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
257 258

/// Make a byref type with a in/out kind inference parameter
D
Don Syme 已提交
259
val mkByrefTyWithInference: TcGlobals -> TType -> TType -> TType
D
Don Syme 已提交
260 261

/// Make a in-byref type with a in kind parameter
D
Don Syme 已提交
262
val mkInByrefTy: TcGlobals -> TType -> TType
L
latkin 已提交
263

D
Don Syme 已提交
264
/// Make an out-byref type with an out kind parameter
D
Don Syme 已提交
265
val mkOutByrefTy: TcGlobals -> TType -> TType
L
latkin 已提交
266

D
Don Syme 已提交
267
/// Make an expression that constructs a union case, e.g. 'Some(expr)'
D
Don Syme 已提交
268
val mkUnionCaseExpr: UnionCaseRef * TypeInst * Exprs * range -> Expr
D
Don Syme 已提交
269 270

/// Make an expression that constructs an exception value
D
Don Syme 已提交
271
val mkExnExpr: TyconRef * Exprs * range -> Expr
D
Don Syme 已提交
272 273

/// Make an expression that is IL assembly code
D
Don Syme 已提交
274
val mkAsmExpr: ILInstr list * TypeInst * Exprs * TTypes * range -> Expr
D
Don Syme 已提交
275 276

/// Make an expression that coerces one expression to another type
D
Don Syme 已提交
277
val mkCoerceExpr: Expr * TType * range * TType -> Expr
L
latkin 已提交
278

D
Don Syme 已提交
279
/// Make an expression that re-raises an exception
D
Don Syme 已提交
280
val mkReraise: range -> TType -> Expr
L
latkin 已提交
281

D
Don Syme 已提交
282
/// Make an expression that re-raises an exception via a library call
D
Don Syme 已提交
283
val mkReraiseLibCall: TcGlobals -> TType -> range -> Expr
284

D
Don Syme 已提交
285
/// Make an expression that gets an item from a tuple
D
Don Syme 已提交
286
val mkTupleFieldGet: TcGlobals -> TupInfo * Expr * TypeInst * int * range -> Expr
D
Don Syme 已提交
287 288

/// Make an expression that gets an item from an anonymous record
D
Don Syme 已提交
289
val mkAnonRecdFieldGet: TcGlobals -> AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr
D
Don Syme 已提交
290 291

/// Make an expression that gets an item from an anonymous record (via the address of the value if it is a struct)
D
Don Syme 已提交
292
val mkAnonRecdFieldGetViaExprAddr: AnonRecdTypeInfo * Expr * TypeInst * int * range -> Expr
D
Don Syme 已提交
293 294

/// Make an expression that gets an instance field from a record or class (via the address of the value if it is a struct)
295
val mkRecdFieldGetViaExprAddr: Expr * RecdFieldRef * TypeInst * range -> Expr
D
Don Syme 已提交
296 297

/// 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)
D
Don Syme 已提交
298
val mkRecdFieldGetAddrViaExprAddr: readonly: bool * Expr * RecdFieldRef * TypeInst * range -> Expr
D
Don Syme 已提交
299

300
/// Make an expression that gets a static field from a record or class
D
Don Syme 已提交
301
val mkStaticRecdFieldGet: RecdFieldRef * TypeInst * range -> Expr
D
Don Syme 已提交
302

303
/// Make an expression that sets a static field in a record or class
D
Don Syme 已提交
304
val mkStaticRecdFieldSet: RecdFieldRef * TypeInst * Expr * range -> Expr
D
Don Syme 已提交
305

306 307
/// Make an expression that gets the address of a static field in a record or class
val mkStaticRecdFieldGetAddr: readonly: bool * RecdFieldRef * TypeInst * range -> Expr
D
Don Syme 已提交
308 309

/// 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)
D
Don Syme 已提交
310
val mkRecdFieldSetViaExprAddr: Expr * RecdFieldRef * TypeInst * Expr * range -> Expr
D
Don Syme 已提交
311 312

/// Make an expression that gets the tag of a union value (via the address of the value if it is a struct)
D
Don Syme 已提交
313
val mkUnionCaseTagGetViaExprAddr: Expr * TyconRef * TypeInst * range -> Expr
D
Don Syme 已提交
314 315

/// Make a 'TOp.UnionCaseProof' expression, which proves a union value is over a particular case (used only for ref-unions, not struct-unions)
316
val mkUnionCaseProof: Expr * UnionCaseRef * TypeInst * range -> Expr
D
Don Syme 已提交
317 318 319 320

/// 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.
321
val mkUnionCaseFieldGetProvenViaExprAddr: Expr * UnionCaseRef * TypeInst * int * range -> Expr
D
Don Syme 已提交
322 323 324 325

/// 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.
326
val mkUnionCaseFieldGetAddrProvenViaExprAddr: readonly: bool * Expr * UnionCaseRef * TypeInst * int * range -> Expr
D
Don Syme 已提交
327 328 329 330

/// 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.
331
val mkUnionCaseFieldGetUnprovenViaExprAddr: Expr * UnionCaseRef * TypeInst * int * range -> Expr
D
Don Syme 已提交
332

333
/// Build a 'TOp.UnionCaseFieldSet' expression. For ref-unions, the input expression has 'TType_ucase', which is
D
Don Syme 已提交
334 335
/// an F# compiler internal "type" corresponding to the union case. For struct-unions,
/// the input should be the address of the expression.
336
val mkUnionCaseFieldSet: Expr * UnionCaseRef * TypeInst * int * Expr * range -> Expr
D
Don Syme 已提交
337 338

/// Like mkUnionCaseFieldGetUnprovenViaExprAddr, but for struct-unions, the input should be a copy of the expression.
339
val mkUnionCaseFieldGetUnproven: TcGlobals -> Expr * UnionCaseRef * TypeInst * int * range -> Expr
D
Don Syme 已提交
340

341
/// Make an expression that gets an instance field from an F# exception value
D
Don Syme 已提交
342
val mkExnCaseFieldGet: Expr * TyconRef * int * range -> Expr
D
Don Syme 已提交
343

344 345
/// Make an expression that sets an instance field in an F# exception value
val mkExnCaseFieldSet: Expr * TyconRef * int * Expr * range -> Expr
D
Don Syme 已提交
346

D
Don Syme 已提交
347
/// Make an expression that gets the address of an element in an array
348 349
val mkArrayElemAddress:
    TcGlobals -> readonly: bool * ILReadonly * bool * ILArrayShape * TType * Expr list * range -> Expr
L
latkin 已提交
350

351
/// The largest tuple before we start encoding, i.e. 7
D
Don Syme 已提交
352
val maxTuple: int
353 354

/// The number of fields in the largest tuple before we start encoding, i.e. 7
D
Don Syme 已提交
355
val goodTupleFields: int
356 357 358

/// 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.
D
Don Syme 已提交
359
val isCompiledTupleTyconRef: TcGlobals -> TyconRef -> bool
360 361

/// Get a TyconRef for a .NET tuple type
D
Don Syme 已提交
362
val mkCompiledTupleTyconRef: TcGlobals -> bool -> int -> TyconRef
363 364

/// Convert from F# tuple types to .NET tuple types.
D
Don Syme 已提交
365
val mkCompiledTupleTy: TcGlobals -> bool -> TTypes -> TType
366 367

/// Convert from F# tuple creation expression to .NET tuple creation expressions
D
Don Syme 已提交
368
val mkCompiledTuple: TcGlobals -> bool -> TTypes * Exprs * range -> TyconRef * TTypes * Exprs * range
369 370

/// Make a TAST expression representing getting an item fromm a tuple
D
Don Syme 已提交
371
val mkGetTupleItemN: TcGlobals -> range -> int -> ILType -> bool -> Expr -> TType -> Expr
L
latkin 已提交
372

373 374
/// 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.
D
Don Syme 已提交
375
val evalTupInfoIsStruct: TupInfo -> bool
D
Don Syme 已提交
376

377
/// Evaluate the AnonRecdTypeInfo to work out if it is a struct or a ref.
D
Don Syme 已提交
378
val evalAnonInfoIsStruct: AnonRecdTypeInfo -> bool
L
latkin 已提交
379

380
/// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged
D
Don Syme 已提交
381
val convertToTypeWithMetadataIfPossible: TcGlobals -> TType -> TType
382

D
Don Syme 已提交
383
/// An exception representing a warning for a defensive copy of an immutable struct
384
exception DefensiveCopyWarning of string * range
D
Don Syme 已提交
385

386 387 388 389 390
type Mutates =
    | AddressOfOp
    | DefinitelyMutates
    | PossiblyMutates
    | NeverMutates
D
Don Syme 已提交
391

392 393 394
/// Helper to create an expression that dereferences an address.
val mkDerefAddrExpr: mAddrGet: range -> expr: Expr -> mExpr: range -> exprTy: TType -> Expr

D
Don Syme 已提交
395
/// Helper to take the address of an expression
396 397
val mkExprAddrOfExprAux:
    TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Val * Expr) option * Expr * bool * bool
L
latkin 已提交
398

D
Don Syme 已提交
399 400 401 402
/// 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.
403 404
val mkExprAddrOfExpr:
    TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Expr -> Expr) * Expr * bool * bool
L
latkin 已提交
405 406

/// Maps Val to T, based on stamps
407 408
[<Struct; NoEquality; NoComparison>]
type ValMap<'T> =
D
Don Syme 已提交
409

D
Don Syme 已提交
410
    member Contents: StampMap<'T>
D
Don Syme 已提交
411

D
Don Syme 已提交
412
    member Item: Val -> 'T with get
D
Don Syme 已提交
413

D
Don Syme 已提交
414
    member TryFind: Val -> 'T option
D
Don Syme 已提交
415

D
Don Syme 已提交
416
    member ContainsVal: Val -> bool
D
Don Syme 已提交
417

D
Don Syme 已提交
418
    member Add: Val -> 'T -> ValMap<'T>
D
Don Syme 已提交
419

D
Don Syme 已提交
420
    member Remove: Val -> ValMap<'T>
D
Don Syme 已提交
421

D
Don Syme 已提交
422
    member IsEmpty: bool
D
Don Syme 已提交
423

D
Don Syme 已提交
424
    static member Empty: ValMap<'T>
D
Don Syme 已提交
425

D
Don Syme 已提交
426
    static member OfList: (Val * 'T) list -> ValMap<'T>
L
latkin 已提交
427 428 429 430

/// Mutable data structure mapping Val's to T based on stamp keys
[<Sealed; NoEquality; NoComparison>]
type ValHash<'T> =
D
Don Syme 已提交
431

D
Don Syme 已提交
432
    member Values: seq<'T>
D
Don Syme 已提交
433

D
Don Syme 已提交
434
    member TryFind: Val -> 'T option
D
Don Syme 已提交
435

D
Don Syme 已提交
436
    member Add: Val * 'T -> unit
L
latkin 已提交
437

D
Don Syme 已提交
438
    static member Create: unit -> ValHash<'T>
L
latkin 已提交
439 440 441 442

/// Maps Val's to list of T based on stamp keys
[<Struct; NoEquality; NoComparison>]
type ValMultiMap<'T> =
443

D
Don Syme 已提交
444
    member ContainsKey: Val -> bool
445

D
Don Syme 已提交
446
    member Find: Val -> 'T list
447

D
Don Syme 已提交
448
    member Add: Val * 'T -> ValMultiMap<'T>
449

D
Don Syme 已提交
450
    member Remove: Val -> ValMultiMap<'T>
451

D
Don Syme 已提交
452
    member Contents: StampMap<'T list>
453

D
Don Syme 已提交
454
    static member Empty: ValMultiMap<'T>
L
latkin 已提交
455

D
Don Syme 已提交
456
/// Maps type parameters to entries based on stamp keys
L
latkin 已提交
457
[<Sealed>]
458
type TyparMap<'T> =
459

D
Don Syme 已提交
460
    /// Get the entry for the given type parameter
D
Don Syme 已提交
461
    member Item: Typar -> 'T with get
462

D
Don Syme 已提交
463
    /// Determine is the map contains an entry for the given type parameter
D
Don Syme 已提交
464
    member ContainsKey: Typar -> bool
465

D
Don Syme 已提交
466
    /// Try to find the entry for the given type parameter
D
Don Syme 已提交
467
    member TryFind: Typar -> 'T option
468

D
Don Syme 已提交
469
    /// Make a new map, containing a new entry for the given type parameter
470
    member Add: Typar * 'T -> TyparMap<'T>
471

D
Don Syme 已提交
472
    /// The empty map
473
    static member Empty: TyparMap<'T>
L
latkin 已提交
474 475

/// Maps TyconRef to T based on stamp keys
D
Don Syme 已提交
476
[<NoEquality; NoComparison; Sealed>]
L
latkin 已提交
477
type TyconRefMap<'T> =
478

D
Don Syme 已提交
479
    /// Get the entry for the given type definition
D
Don Syme 已提交
480
    member Item: TyconRef -> 'T with get
481

D
Don Syme 已提交
482
    /// Try to find the entry for the given type definition
D
Don Syme 已提交
483
    member TryFind: TyconRef -> 'T option
484

D
Don Syme 已提交
485
    /// Determine is the map contains an entry for the given type definition
D
Don Syme 已提交
486
    member ContainsKey: TyconRef -> bool
487

D
Don Syme 已提交
488
    /// Make a new map, containing a new entry for the given type definition
D
Don Syme 已提交
489
    member Add: TyconRef -> 'T -> TyconRefMap<'T>
490

D
Don Syme 已提交
491
    /// Remove the entry for the given type definition, if any
D
Don Syme 已提交
492
    member Remove: TyconRef -> TyconRefMap<'T>
493

D
Don Syme 已提交
494
    /// Determine if the map is empty
D
Don Syme 已提交
495
    member IsEmpty: bool
496

D
Don Syme 已提交
497
    /// The empty map
D
Don Syme 已提交
498
    static member Empty: TyconRefMap<'T>
499

D
Don Syme 已提交
500
    /// Make a new map, containing entries for the given type definitions
D
Don Syme 已提交
501
    static member OfList: (TyconRef * 'T) list -> TyconRefMap<'T>
L
latkin 已提交
502 503 504 505

/// Maps TyconRef to list of T based on stamp keys
[<Struct; NoEquality; NoComparison>]
type TyconRefMultiMap<'T> =
506

D
Don Syme 已提交
507
    /// Fetch the entries for the given type definition
D
Don Syme 已提交
508
    member Find: TyconRef -> 'T list
509

D
Don Syme 已提交
510
    /// Make a new map, containing a new entry for the given type definition
D
Don Syme 已提交
511
    member Add: TyconRef * 'T -> TyconRefMultiMap<'T>
512

D
Don Syme 已提交
513
    /// The empty map
D
Don Syme 已提交
514
    static member Empty: TyconRefMultiMap<'T>
L
latkin 已提交
515

D
Don Syme 已提交
516
    /// Make a new map, containing a entries for the given type definitions
D
Don Syme 已提交
517
    static member OfList: (TyconRef * 'T) list -> TyconRefMultiMap<'T>
L
latkin 已提交
518

D
Don Syme 已提交
519 520
/// An ordering for value definitions, based on stamp
val valOrder: IComparer<Val>
L
latkin 已提交
521

D
Don Syme 已提交
522 523
/// An ordering for type definitions, based on stamp
val tyconOrder: IComparer<Tycon>
L
latkin 已提交
524

D
Don Syme 已提交
525 526
/// An ordering for record fields, based on stamp
val recdFieldRefOrder: IComparer<RecdFieldRef>
L
latkin 已提交
527

D
Don Syme 已提交
528 529 530 531
/// An ordering for type parameters, based on stamp
val typarOrder: IComparer<Typar>

/// Equality for type definition references
D
Don Syme 已提交
532
val tyconRefEq: TcGlobals -> TyconRef -> TyconRef -> bool
D
Don Syme 已提交
533 534

/// Equality for value references
D
Don Syme 已提交
535
val valRefEq: TcGlobals -> ValRef -> ValRef -> bool
L
latkin 已提交
536 537 538

//-------------------------------------------------------------------------
// Operations on types: substitution
539
//-------------------------------------------------------------------------
L
latkin 已提交
540

D
Don Syme 已提交
541
/// Represents an instantiation where types replace type parameters
D
Don Syme 已提交
542
type TyparInstantiation = (Typar * TType) list
L
latkin 已提交
543

D
Don Syme 已提交
544
/// Represents an instantiation where type definition references replace other type definition references
L
latkin 已提交
545
type TyconRefRemap = TyconRefMap<TyconRef>
D
Don Syme 已提交
546 547

/// Represents an instantiation where value references replace other value references
L
latkin 已提交
548 549
type ValRemap = ValMap<ValRef>

D
Don Syme 已提交
550
/// Represents a combination of substitutions/instantiations where things replace other things during remapping
L
latkin 已提交
551 552
[<NoEquality; NoComparison>]
type Remap =
D
Don Syme 已提交
553
    { tpinst: TyparInstantiation
D
Don Syme 已提交
554
      valRemap: ValRemap
D
Don Syme 已提交
555
      tyconRefRemap: TyconRefRemap
D
Fix 631  
Don Syme 已提交
556
      removeTraitSolutions: bool }
L
latkin 已提交
557

D
Don Syme 已提交
558
    static member Empty: Remap
L
latkin 已提交
559

D
Don Syme 已提交
560
val addTyconRefRemap: TyconRef -> TyconRef -> Remap -> Remap
L
latkin 已提交
561

D
Don Syme 已提交
562
val addValRemap: Val -> Val -> Remap -> Remap
L
latkin 已提交
563

D
Don Syme 已提交
564
val mkTyparInst: Typars -> TTypes -> TyparInstantiation
D
Don Syme 已提交
565

D
Don Syme 已提交
566
val mkTyconRefInst: TyconRef -> TypeInst -> TyparInstantiation
D
Don Syme 已提交
567

D
Don Syme 已提交
568
val emptyTyparInst: TyparInstantiation
L
latkin 已提交
569

D
Don Syme 已提交
570
val instType: TyparInstantiation -> TType -> TType
D
Don Syme 已提交
571

D
Don Syme 已提交
572
val instTypes: TyparInstantiation -> TypeInst -> TypeInst
D
Don Syme 已提交
573

D
Don Syme 已提交
574
val instTyparConstraints: TyparInstantiation -> TyparConstraint list -> TyparConstraint list
D
Don Syme 已提交
575

D
Don Syme 已提交
576
val instTrait: TyparInstantiation -> TraitConstraintInfo -> TraitConstraintInfo
L
latkin 已提交
577

578
val generalTyconRefInst: TyconRef -> TypeInst
D
Don Syme 已提交
579

580
/// From typars to types
D
Don Syme 已提交
581
val generalizeTypars: Typars -> TypeInst
D
Don Syme 已提交
582

D
Don Syme 已提交
583
val generalizeTyconRef: TcGlobals -> TyconRef -> TTypes * TType
D
Don Syme 已提交
584

D
Don Syme 已提交
585
val generalizedTyconRef: TcGlobals -> TyconRef -> TType
D
Don Syme 已提交
586

D
Don Syme 已提交
587
val mkTyparToTyparRenaming: Typars -> Typars -> TyparInstantiation * TTypes
L
latkin 已提交
588 589 590

//-------------------------------------------------------------------------
// See through typar equations from inference and/or type abbreviation equations.
591
//-------------------------------------------------------------------------
L
latkin 已提交
592

D
Don Syme 已提交
593
val reduceTyconRefAbbrev: TyconRef -> TypeInst -> TType
D
Don Syme 已提交
594

D
Don Syme 已提交
595
val reduceTyconRefMeasureableOrProvided: TcGlobals -> TyconRef -> TypeInst -> TType
D
Don Syme 已提交
596

D
Don Syme 已提交
597
val reduceTyconRefAbbrevMeasureable: TyconRef -> Measure
L
latkin 已提交
598

599 600
/// set bool to 'true' to allow shortcutting of type parameter equation chains during stripping
val stripTyEqnsA: TcGlobals -> bool -> TType -> TType
D
Don Syme 已提交
601

D
Don Syme 已提交
602
val stripTyEqns: TcGlobals -> TType -> TType
D
Don Syme 已提交
603

D
Don Syme 已提交
604
val stripTyEqnsAndMeasureEqns: TcGlobals -> TType -> TType
L
latkin 已提交
605

D
Don Syme 已提交
606
val tryNormalizeMeasureInType: TcGlobals -> TType -> TType
L
latkin 已提交
607 608

/// See through F# exception abbreviations
D
Don Syme 已提交
609
val stripExnEqns: TyconRef -> Tycon
D
Don Syme 已提交
610

D
Don Syme 已提交
611
val recdFieldsOfExnDefRef: TyconRef -> RecdField list
D
Don Syme 已提交
612

D
Don Syme 已提交
613
val recdFieldTysOfExnDefRef: TyconRef -> TType list
L
latkin 已提交
614 615

//-------------------------------------------------------------------------
616
// Analyze types.  These all look through type abbreviations and
L
latkin 已提交
617
// inference equations, i.e. are "stripped"
618
//-------------------------------------------------------------------------
L
latkin 已提交
619

D
Don Syme 已提交
620
val destForallTy: TcGlobals -> TType -> Typars * TType
D
Don Syme 已提交
621

D
Don Syme 已提交
622
val destFunTy: TcGlobals -> TType -> TType * TType
D
Don Syme 已提交
623

D
Don Syme 已提交
624
val destAnyTupleTy: TcGlobals -> TType -> TupInfo * TTypes
D
Don Syme 已提交
625

D
Don Syme 已提交
626
val destRefTupleTy: TcGlobals -> TType -> TTypes
D
Don Syme 已提交
627

D
Don Syme 已提交
628
val destStructTupleTy: TcGlobals -> TType -> TTypes
D
Don Syme 已提交
629

D
Don Syme 已提交
630
val destTyparTy: TcGlobals -> TType -> Typar
D
Don Syme 已提交
631

D
Don Syme 已提交
632
val destAnyParTy: TcGlobals -> TType -> Typar
D
Don Syme 已提交
633

D
Don Syme 已提交
634
val destMeasureTy: TcGlobals -> TType -> Measure
D
Don Syme 已提交
635

D
Don Syme 已提交
636
val tryDestForallTy: TcGlobals -> TType -> Typars * TType
L
latkin 已提交
637

D
Don Syme 已提交
638
val isFunTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
639

D
Don Syme 已提交
640
val isForallTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
641

D
Don Syme 已提交
642
val isAnyTupleTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
643

D
Don Syme 已提交
644
val isRefTupleTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
645

D
Don Syme 已提交
646
val isStructTupleTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
647

D
Don Syme 已提交
648
val isStructAnonRecdTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
649

D
Don Syme 已提交
650
val isAnonRecdTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
651

D
Don Syme 已提交
652
val isUnionTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
653

D
Don Syme 已提交
654
val isReprHiddenTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
655

D
Don Syme 已提交
656
val isFSharpObjModelTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
657

D
Don Syme 已提交
658
val isRecdTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
659

D
Don Syme 已提交
660
val isFSharpStructOrEnumTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
661

D
Don Syme 已提交
662
val isFSharpEnumTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
663

D
Don Syme 已提交
664
val isTyparTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
665

D
Don Syme 已提交
666
val isAnyParTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
667

D
Don Syme 已提交
668
val tryAnyParTy: TcGlobals -> TType -> ValueOption<Typar>
D
Don Syme 已提交
669

D
Don Syme 已提交
670
val tryAnyParTyOption: TcGlobals -> TType -> Typar option
D
Don Syme 已提交
671

D
Don Syme 已提交
672
val isMeasureTy: TcGlobals -> TType -> bool
L
latkin 已提交
673

D
Don Syme 已提交
674
val mkAppTy: TyconRef -> TypeInst -> TType
L
latkin 已提交
675

D
Don Syme 已提交
676
val mkProvenUnionCaseTy: UnionCaseRef -> TypeInst -> TType
D
Don Syme 已提交
677

D
Don Syme 已提交
678
val isProvenUnionCaseTy: TType -> bool
L
latkin 已提交
679

D
Don Syme 已提交
680
val isAppTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
681

D
Don Syme 已提交
682
val tryAppTy: TcGlobals -> TType -> ValueOption<TyconRef * TypeInst>
D
Don Syme 已提交
683

D
Don Syme 已提交
684
val destAppTy: TcGlobals -> TType -> TyconRef * TypeInst
D
Don Syme 已提交
685

D
Don Syme 已提交
686
val tcrefOfAppTy: TcGlobals -> TType -> TyconRef
D
Don Syme 已提交
687

D
Don Syme 已提交
688
val tryTcrefOfAppTy: TcGlobals -> TType -> ValueOption<TyconRef>
D
Don Syme 已提交
689

D
Don Syme 已提交
690
val tryDestTyparTy: TcGlobals -> TType -> ValueOption<Typar>
D
Don Syme 已提交
691

692
val tryDestFunTy: TcGlobals -> TType -> ValueOption<TType * TType>
D
Don Syme 已提交
693

D
Don Syme 已提交
694
val tryDestAnonRecdTy: TcGlobals -> TType -> ValueOption<AnonRecdTypeInfo * TType list>
D
Don Syme 已提交
695

D
Don Syme 已提交
696
val argsOfAppTy: TcGlobals -> TType -> TypeInst
D
Don Syme 已提交
697

D
Don Syme 已提交
698
val mkInstForAppTy: TcGlobals -> TType -> TyparInstantiation
L
latkin 已提交
699 700

/// Try to get a TyconRef for a type without erasing type abbreviations
D
Don Syme 已提交
701
val tryNiceEntityRefOfTy: TType -> ValueOption<TyconRef>
L
latkin 已提交
702

D
Don Syme 已提交
703
val tryNiceEntityRefOfTyOption: TType -> TyconRef option
L
latkin 已提交
704

D
Don Syme 已提交
705
val domainOfFunTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
706

D
Don Syme 已提交
707
val rangeOfFunTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
708

D
Don Syme 已提交
709
val stripFunTy: TcGlobals -> TType -> TType list * TType
D
Don Syme 已提交
710

D
Don Syme 已提交
711
val stripFunTyN: TcGlobals -> int -> TType -> TType list * TType
L
latkin 已提交
712

D
Don Syme 已提交
713
val applyForallTy: TcGlobals -> TType -> TypeInst -> TType
L
latkin 已提交
714

D
Don Syme 已提交
715
val tryDestAnyTupleTy: TcGlobals -> TType -> TupInfo * TType list
D
Don Syme 已提交
716

D
Don Syme 已提交
717
val tryDestRefTupleTy: TcGlobals -> TType -> TType list
L
latkin 已提交
718 719

//-------------------------------------------------------------------------
720
// Compute actual types of union cases and fields given an instantiation
L
latkin 已提交
721
// of the generic type parameters of the enclosing type.
722
//-------------------------------------------------------------------------
L
latkin 已提交
723

D
Don Syme 已提交
724
val actualResultTyOfUnionCase: TypeInst -> UnionCaseRef -> TType
L
latkin 已提交
725

D
Don Syme 已提交
726
val actualTysOfUnionCaseFields: TyparInstantiation -> UnionCaseRef -> TType list
L
latkin 已提交
727

D
Don Syme 已提交
728
val actualTysOfInstanceRecdFields: TyparInstantiation -> TyconRef -> TType list
L
latkin 已提交
729

D
Don Syme 已提交
730
val actualTyOfRecdField: TyparInstantiation -> RecdField -> TType
D
Don Syme 已提交
731

D
Don Syme 已提交
732
val actualTyOfRecdFieldRef: RecdFieldRef -> TypeInst -> TType
D
Don Syme 已提交
733

D
Don Syme 已提交
734
val actualTyOfRecdFieldForTycon: Tycon -> TypeInst -> RecdField -> TType
L
latkin 已提交
735 736

//-------------------------------------------------------------------------
737
// Top types: guaranteed to be compiled to .NET methods, and must be able to
L
latkin 已提交
738 739
// have user-specified argument names (for stability w.r.t. reflection)
// and user-specified argument and return attributes.
740
//-------------------------------------------------------------------------
L
latkin 已提交
741

742
type UncurriedArgInfos = (TType * ArgReprInfo) list
D
Don Syme 已提交
743

L
latkin 已提交
744 745
type CurriedArgInfos = UncurriedArgInfos list

746 747
type TraitWitnessInfos = TraitWitnessInfo list

748
val destTopForallTy: TcGlobals -> ValReprInfo -> TType -> Typars * TType
D
Don Syme 已提交
749

D
Don Syme 已提交
750
val GetTopTauTypeInFSharpForm: TcGlobals -> ArgReprInfo list list -> TType -> range -> CurriedArgInfos * TType
D
Don Syme 已提交
751

752
val GetValReprTypeInFSharpForm:
753
    TcGlobals -> ValReprInfo -> TType -> range -> Typars * CurriedArgInfos * TType * ArgReprInfo
D
Don Syme 已提交
754

D
Don Syme 已提交
755
val IsCompiledAsStaticProperty: TcGlobals -> Val -> bool
D
Don Syme 已提交
756

D
Don Syme 已提交
757
val IsCompiledAsStaticPropertyWithField: TcGlobals -> Val -> bool
D
Don Syme 已提交
758

759
val GetValReprTypeInCompiledForm:
760 761 762 763 764 765
    TcGlobals ->
    ValReprInfo ->
    int ->
    TType ->
    range ->
        Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
D
Don Syme 已提交
766

D
Don Syme 已提交
767
val GetFSharpViewOfReturnType: TcGlobals -> TType option -> TType
L
latkin 已提交
768

D
Don Syme 已提交
769
val NormalizeDeclaredTyparsForEquiRecursiveInference: TcGlobals -> Typars -> Typars
L
latkin 已提交
770 771 772

//-------------------------------------------------------------------------
// Compute the return type after an application
773 774
//-------------------------------------------------------------------------

D
Don Syme 已提交
775
val applyTys: TcGlobals -> TType -> TType list * 'T list -> TType
L
latkin 已提交
776 777 778

//-------------------------------------------------------------------------
// Compute free variables in types
779 780
//-------------------------------------------------------------------------

D
Don Syme 已提交
781
val emptyFreeTypars: FreeTypars
D
Don Syme 已提交
782

D
Don Syme 已提交
783
val unionFreeTypars: FreeTypars -> FreeTypars -> FreeTypars
L
latkin 已提交
784

D
Don Syme 已提交
785
val emptyFreeTycons: FreeTycons
D
Don Syme 已提交
786

D
Don Syme 已提交
787
val unionFreeTycons: FreeTycons -> FreeTycons -> FreeTycons
L
latkin 已提交
788

D
Don Syme 已提交
789
val emptyFreeTyvars: FreeTyvars
D
Don Syme 已提交
790

D
Don Syme 已提交
791
val isEmptyFreeTyvars: FreeTyvars -> bool
D
Don Syme 已提交
792

D
Don Syme 已提交
793
val unionFreeTyvars: FreeTyvars -> FreeTyvars -> FreeTyvars
L
latkin 已提交
794

D
Don Syme 已提交
795
val emptyFreeLocals: FreeLocals
D
Don Syme 已提交
796

D
Don Syme 已提交
797
val unionFreeLocals: FreeLocals -> FreeLocals -> FreeLocals
L
latkin 已提交
798

799
type FreeVarOptions
L
latkin 已提交
800

D
Don Syme 已提交
801
val CollectLocalsNoCaching: FreeVarOptions
D
Don Syme 已提交
802

D
Don Syme 已提交
803
val CollectTyparsNoCaching: FreeVarOptions
D
Don Syme 已提交
804

D
Don Syme 已提交
805
val CollectTyparsAndLocalsNoCaching: FreeVarOptions
D
Don Syme 已提交
806

D
Don Syme 已提交
807
val CollectTyparsAndLocals: FreeVarOptions
D
Don Syme 已提交
808

D
Don Syme 已提交
809
val CollectLocals: FreeVarOptions
D
Don Syme 已提交
810

811 812 813 814
val CollectLocalsWithStackGuard: unit -> FreeVarOptions

val CollectTyparsAndLocalsWithStackGuard: unit -> FreeVarOptions

D
Don Syme 已提交
815
val CollectTypars: FreeVarOptions
D
Don Syme 已提交
816

D
Don Syme 已提交
817
val CollectAllNoCaching: FreeVarOptions
D
Don Syme 已提交
818

D
Don Syme 已提交
819
val CollectAll: FreeVarOptions
L
latkin 已提交
820

D
Don Syme 已提交
821
val accFreeInTypes: FreeVarOptions -> TType list -> FreeTyvars -> FreeTyvars
D
Don Syme 已提交
822

D
Don Syme 已提交
823
val accFreeInType: FreeVarOptions -> TType -> FreeTyvars -> FreeTyvars
D
Don Syme 已提交
824

D
Don Syme 已提交
825
val accFreeInTypars: FreeVarOptions -> Typars -> FreeTyvars -> FreeTyvars
L
latkin 已提交
826

D
Don Syme 已提交
827
val freeInType: FreeVarOptions -> TType -> FreeTyvars
D
Don Syme 已提交
828

D
Don Syme 已提交
829
val freeInTypes: FreeVarOptions -> TType list -> FreeTyvars
D
Don Syme 已提交
830

D
Don Syme 已提交
831
val freeInVal: FreeVarOptions -> Val -> FreeTyvars
L
latkin 已提交
832

833
// This one puts free variables in canonical left-to-right order.
D
Don Syme 已提交
834
val freeInTypeLeftToRight: TcGlobals -> bool -> TType -> Typars
D
Don Syme 已提交
835

D
Don Syme 已提交
836
val freeInTypesLeftToRight: TcGlobals -> bool -> TType list -> Typars
D
Don Syme 已提交
837

D
Don Syme 已提交
838
val freeInTypesLeftToRightSkippingConstraints: TcGlobals -> TType list -> Typars
L
latkin 已提交
839

D
Don Syme 已提交
840
val freeInModuleTy: ModuleOrNamespaceType -> FreeTyvars
L
latkin 已提交
841

D
Don Syme 已提交
842
val isDimensionless: TcGlobals -> TType -> bool
L
latkin 已提交
843

844 845 846 847
//---------------------------------------------------------------------------
// TType modifications and comparisons
//---------------------------------------------------------------------------

D
Don Syme 已提交
848
val stripMeasuresFromTy: TcGlobals -> TType -> TType
849

L
latkin 已提交
850 851
//-------------------------------------------------------------------------
// Equivalence of types (up to substitution of type variables in the left-hand type)
852
//-------------------------------------------------------------------------
L
latkin 已提交
853 854

[<NoEquality; NoComparison>]
855
type TypeEquivEnv =
D
Don Syme 已提交
856
    { EquivTypars: TyparMap<TType>
L
latkin 已提交
857 858
      EquivTycons: TyconRefRemap }

D
Don Syme 已提交
859
    static member Empty: TypeEquivEnv
D
Don Syme 已提交
860

D
Don Syme 已提交
861
    member BindEquivTypars: Typars -> Typars -> TypeEquivEnv
D
Don Syme 已提交
862

D
Don Syme 已提交
863
    static member FromTyparInst: TyparInstantiation -> TypeEquivEnv
D
Don Syme 已提交
864

D
Don Syme 已提交
865
    static member FromEquivTypars: Typars -> Typars -> TypeEquivEnv
L
latkin 已提交
866

D
Don Syme 已提交
867
val traitsAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool
D
Don Syme 已提交
868

D
Don Syme 已提交
869
val traitsAEquiv: TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool
D
Don Syme 已提交
870

D
Don Syme 已提交
871
val traitKeysAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TraitWitnessInfo -> TraitWitnessInfo -> bool
872

D
Don Syme 已提交
873
val traitKeysAEquiv: TcGlobals -> TypeEquivEnv -> TraitWitnessInfo -> TraitWitnessInfo -> bool
874

D
Don Syme 已提交
875
val typarConstraintsAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool
D
Don Syme 已提交
876

D
Don Syme 已提交
877
val typarConstraintsAEquiv: TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool
D
Don Syme 已提交
878

D
Don Syme 已提交
879
val typarsAEquiv: TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool
D
Don Syme 已提交
880

D
Don Syme 已提交
881
val typeAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType -> TType -> bool
D
Don Syme 已提交
882

D
Don Syme 已提交
883
val typeAEquiv: TcGlobals -> TypeEquivEnv -> TType -> TType -> bool
D
Don Syme 已提交
884

D
Don Syme 已提交
885
val returnTypesAEquivAux: Erasure -> TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool
D
Don Syme 已提交
886

D
Don Syme 已提交
887
val returnTypesAEquiv: TcGlobals -> TypeEquivEnv -> TType option -> TType option -> bool
D
Don Syme 已提交
888

D
Don Syme 已提交
889
val tcrefAEquiv: TcGlobals -> TypeEquivEnv -> TyconRef -> TyconRef -> bool
D
Don Syme 已提交
890

D
Don Syme 已提交
891
val valLinkageAEquiv: TcGlobals -> TypeEquivEnv -> Val -> Val -> bool
D
Don Syme 已提交
892

D
Don Syme 已提交
893
val anonInfoEquiv: AnonRecdTypeInfo -> AnonRecdTypeInfo -> bool
L
latkin 已提交
894 895 896 897 898 899

//-------------------------------------------------------------------------
// 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
D
Don Syme 已提交
900
val isErasedType: TcGlobals -> TType -> bool
L
latkin 已提交
901 902

// Return all components (units-of-measure, and types) of this type that would be erased
D
Don Syme 已提交
903
val getErasedTypes: TcGlobals -> TType -> TType list
L
latkin 已提交
904 905 906

//-------------------------------------------------------------------------
// Unit operations
907
//-------------------------------------------------------------------------
908

D
Don Syme 已提交
909
val MeasurePower: Measure -> int -> Measure
D
Don Syme 已提交
910

D
Don Syme 已提交
911
val ListMeasureVarOccsWithNonZeroExponents: Measure -> (Typar * Rational) list
D
Don Syme 已提交
912

D
Don Syme 已提交
913
val ListMeasureConOccsWithNonZeroExponents: TcGlobals -> bool -> Measure -> (TyconRef * Rational) list
D
Don Syme 已提交
914

D
Don Syme 已提交
915
val ProdMeasures: Measure list -> Measure
D
Don Syme 已提交
916

D
Don Syme 已提交
917
val MeasureVarExponent: Typar -> Measure -> Rational
D
Don Syme 已提交
918

D
Don Syme 已提交
919
val MeasureExprConExponent: TcGlobals -> bool -> TyconRef -> Measure -> Rational
D
Don Syme 已提交
920

D
Don Syme 已提交
921
val normalizeMeasure: TcGlobals -> Measure -> Measure
922

L
latkin 已提交
923
//-------------------------------------------------------------------------
924 925
// Members
//-------------------------------------------------------------------------
L
latkin 已提交
926

D
Don Syme 已提交
927
val GetTypeOfMemberInFSharpForm: TcGlobals -> ValRef -> Typars * CurriedArgInfos * TType * ArgReprInfo
D
Don Syme 已提交
928

929 930
val GetTypeOfMemberInMemberForm:
    TcGlobals -> ValRef -> Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
D
Don Syme 已提交
931

932 933
val GetTypeOfIntrinsicMemberInCompiledForm:
    TcGlobals -> ValRef -> Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
D
Don Syme 已提交
934

935 936 937 938 939 940 941 942
val GetMemberTypeInMemberForm:
    TcGlobals ->
    SynMemberFlags ->
    ValReprInfo ->
    int ->
    TType ->
    range ->
        Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
L
latkin 已提交
943 944

/// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst)
945
val PartitionValTyparsForApparentEnclosingType:
D
Don Syme 已提交
946
    TcGlobals -> Val -> (Typars * Typars * Typars * TyparInstantiation * TType list) option
D
Don Syme 已提交
947

L
latkin 已提交
948
/// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst)
D
Don Syme 已提交
949
val PartitionValTypars: TcGlobals -> Val -> (Typars * Typars * Typars * TyparInstantiation * TType list) option
D
Don Syme 已提交
950

L
latkin 已提交
951
/// Returns (parentTypars,memberParentTypars,memberMethodTypars,memberToParentInst,tinst)
D
Don Syme 已提交
952
val PartitionValRefTypars: TcGlobals -> ValRef -> (Typars * Typars * Typars * TyparInstantiation * TType list) option
L
latkin 已提交
953

954 955 956
/// Count the number of type parameters on the enclosing type
val CountEnclosingTyparsOfActualParentOfVal: Val -> int

D
Don Syme 已提交
957
val ReturnTypeOfPropertyVal: TcGlobals -> Val -> TType
D
Don Syme 已提交
958

959
val ArgInfosOfPropertyVal: TcGlobals -> Val -> UncurriedArgInfos
D
Don Syme 已提交
960

961
val ArgInfosOfMember: TcGlobals -> ValRef -> CurriedArgInfos
L
latkin 已提交
962

D
Don Syme 已提交
963
val GetMemberCallInfo: TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * bool * bool * bool * bool * bool
L
latkin 已提交
964 965 966

//-------------------------------------------------------------------------
// Printing
967 968
//-------------------------------------------------------------------------

L
latkin 已提交
969 970 971
type TyparConstraintsWithTypars = (Typar * TyparConstraint) list

module PrettyTypes =
D
Don Syme 已提交
972

D
Don Syme 已提交
973
    val NeedsPrettyTyparName: Typar -> bool
D
Don Syme 已提交
974

D
Don Syme 已提交
975
    val NewPrettyTypars: TyparInstantiation -> Typars -> string list -> Typars * TyparInstantiation
D
Don Syme 已提交
976

D
Don Syme 已提交
977
    val PrettyTyparNames: (Typar -> bool) -> string list -> Typars -> string list
D
Don Syme 已提交
978

D
Don Syme 已提交
979
    val PrettifyType: TcGlobals -> TType -> TType * TyparConstraintsWithTypars
D
Don Syme 已提交
980

981
    val PrettifyInstAndTyparsAndType:
D
Don Syme 已提交
982 983 984
        TcGlobals ->
        TyparInstantiation * Typars * TType ->
            (TyparInstantiation * Typars * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
985

D
Don Syme 已提交
986
    val PrettifyTypePair: TcGlobals -> TType * TType -> (TType * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
987

D
Don Syme 已提交
988
    val PrettifyTypes: TcGlobals -> TTypes -> TTypes * TyparConstraintsWithTypars
989

990 991 992
    /// 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.
993 994
    val PrettifyDiscriminantAndTypePairs:
        TcGlobals -> ('Discriminant * TType) list -> ('Discriminant * TType) list * TyparConstraintsWithTypars
D
Don Syme 已提交
995

D
Don Syme 已提交
996
    val PrettifyInst: TcGlobals -> TyparInstantiation -> TyparInstantiation * TyparConstraintsWithTypars
D
Don Syme 已提交
997

D
Don Syme 已提交
998 999
    val PrettifyInstAndType:
        TcGlobals -> TyparInstantiation * TType -> (TyparInstantiation * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1000

D
Don Syme 已提交
1001 1002
    val PrettifyInstAndTypes:
        TcGlobals -> TyparInstantiation * TTypes -> (TyparInstantiation * TTypes) * TyparConstraintsWithTypars
D
Don Syme 已提交
1003

1004
    val PrettifyInstAndSig:
D
Don Syme 已提交
1005 1006 1007
        TcGlobals ->
        TyparInstantiation * TTypes * TType ->
            (TyparInstantiation * TTypes * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1008

D
Don Syme 已提交
1009
    val PrettifyCurriedTypes: TcGlobals -> TType list list -> TType list list * TyparConstraintsWithTypars
D
Don Syme 已提交
1010

1011 1012
    val PrettifyCurriedSigTypes:
        TcGlobals -> TType list list * TType -> (TType list list * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1013

1014 1015
    val PrettifyInstAndUncurriedSig:
        TcGlobals ->
D
Don Syme 已提交
1016 1017
        TyparInstantiation * UncurriedArgInfos * TType ->
            (TyparInstantiation * UncurriedArgInfos * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1018

1019 1020
    val PrettifyInstAndCurriedSig:
        TcGlobals ->
D
Don Syme 已提交
1021 1022
        TyparInstantiation * TTypes * CurriedArgInfos * TType ->
            (TyparInstantiation * TTypes * CurriedArgInfos * TType) * TyparConstraintsWithTypars
L
latkin 已提交
1023

1024 1025 1026 1027 1028 1029 1030 1031 1032
/// Describes how generic type parameters in a type will be formatted during printing
type GenericParameterStyle =
    /// Use the IsPrefixDisplay member of the TyCon to determine the style
    | Implicit
    /// Force the prefix style: List<int>
    | Prefix
    /// Force the suffix style: int List
    | Suffix

L
latkin 已提交
1033
[<NoEquality; NoComparison>]
1034
type DisplayEnv =
F
Florian Verdonck 已提交
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
    {
        includeStaticParametersInTypeNames: bool
        openTopPathsSorted: Lazy<string list list>
        openTopPathsRaw: string list list
        shortTypeNames: bool
        suppressNestedTypes: bool
        maxMembers: int option
        showObsoleteMembers: bool
        showHiddenMembers: bool
        showTyparBinding: bool
        showInferenceTyparAnnotations: bool
        suppressInlineKeyword: bool
        suppressMutableKeyword: bool
        showMemberContainers: bool
        shortConstraints: bool
        useColonForReturnType: bool
        showAttributes: bool
        showOverrides: bool
        showStaticallyResolvedTyparAnnotations: bool
        abbreviateAdditionalConstraints: bool
        showTyparDefaultConstraints: bool
        /// If set, signatures will be rendered with XML documentation comments for members if they exist
        /// Defaults to false, expected use cases include things like signature file generation.
        showDocumentation: bool
        shrinkOverloads: bool
        printVerboseSignatures: bool
        escapeKeywordNames: bool
        g: TcGlobals
        contextAccessibility: Accessibility
        generatedValueLayout: Val -> Layout option
        genericParameterStyle: GenericParameterStyle
    }
D
Don Syme 已提交
1067

L
latkin 已提交
1068
    member SetOpenPaths: string list list -> DisplayEnv
D
Don Syme 已提交
1069

L
latkin 已提交
1070 1071
    static member Empty: TcGlobals -> DisplayEnv

D
Don Syme 已提交
1072
    member AddAccessibility: Accessibility -> DisplayEnv
D
Don Syme 已提交
1073

D
Don Syme 已提交
1074
    member AddOpenPath: string list -> DisplayEnv
D
Don Syme 已提交
1075

D
Don Syme 已提交
1076
    member AddOpenModuleOrNamespace: ModuleOrNamespaceRef -> DisplayEnv
L
latkin 已提交
1077

D
Don Syme 已提交
1078
    member UseGenericParameterStyle: GenericParameterStyle -> DisplayEnv
1079

D
Don Syme 已提交
1080 1081
    static member InitialForSigFileGeneration: TcGlobals -> DisplayEnv

D
Don Syme 已提交
1082
val tagEntityRefName: xref: EntityRef -> name: string -> TaggedText
L
latkin 已提交
1083 1084

/// Return the full text for an item as we want it displayed to the user as a fully qualified entity
D
Don Syme 已提交
1085
val fullDisplayTextOfModRef: ModuleOrNamespaceRef -> string
D
Don Syme 已提交
1086

D
Don Syme 已提交
1087
val fullDisplayTextOfParentOfModRef: ModuleOrNamespaceRef -> ValueOption<string>
D
Don Syme 已提交
1088

D
Don Syme 已提交
1089
val fullDisplayTextOfValRef: ValRef -> string
D
Don Syme 已提交
1090

D
Don Syme 已提交
1091
val fullDisplayTextOfValRefAsLayout: ValRef -> Layout
D
Don Syme 已提交
1092

D
Don Syme 已提交
1093
val fullDisplayTextOfTyconRef: TyconRef -> string
D
Don Syme 已提交
1094

D
Don Syme 已提交
1095
val fullDisplayTextOfTyconRefAsLayout: TyconRef -> Layout
D
Don Syme 已提交
1096

D
Don Syme 已提交
1097
val fullDisplayTextOfExnRef: TyconRef -> string
D
Don Syme 已提交
1098

D
Don Syme 已提交
1099
val fullDisplayTextOfExnRefAsLayout: TyconRef -> Layout
D
Don Syme 已提交
1100

D
Don Syme 已提交
1101
val fullDisplayTextOfUnionCaseRef: UnionCaseRef -> string
D
Don Syme 已提交
1102

D
Don Syme 已提交
1103
val fullDisplayTextOfRecdFieldRef: RecdFieldRef -> string
L
latkin 已提交
1104

D
Don Syme 已提交
1105
val ticksAndArgCountTextOfTyconRef: TyconRef -> string
L
latkin 已提交
1106 1107

/// A unique qualified name for each type definition, used to qualify the names of interface implementation methods
D
Don Syme 已提交
1108
val qualifiedMangledNameOfTyconRef: TyconRef -> string -> string
1109

D
Don Syme 已提交
1110
val qualifiedInterfaceImplementationName: TcGlobals -> TType -> string -> string
L
latkin 已提交
1111

D
Don Syme 已提交
1112
val trimPathByDisplayEnv: DisplayEnv -> string list -> string
L
latkin 已提交
1113

D
Don Syme 已提交
1114
val prefixOfStaticReq: TyparStaticReq -> string
D
Don Syme 已提交
1115

D
Don Syme 已提交
1116
val prefixOfInferenceTypar: Typar -> string
L
latkin 已提交
1117 1118

/// Utilities used in simplifying types for visual presentation
1119
module SimplifyTypes =
D
Don Syme 已提交
1120

L
latkin 已提交
1121
    type TypeSimplificationInfo =
D
Don Syme 已提交
1122
        { singletons: Typar Zset
1123
          inplaceConstraints: Zmap<Typar, TType>
D
Don Syme 已提交
1124
          postfixConstraints: TyparConstraintsWithTypars }
D
Don Syme 已提交
1125

D
Don Syme 已提交
1126
    val typeSimplificationInfo0: TypeSimplificationInfo
L
latkin 已提交
1127

D
Don Syme 已提交
1128
    val CollectInfo: bool -> TType list -> TyparConstraintsWithTypars -> TypeSimplificationInfo
L
latkin 已提交
1129

D
Don Syme 已提交
1130
val superOfTycon: TcGlobals -> Tycon -> TType
D
Don Syme 已提交
1131

D
Don Syme 已提交
1132
val abstractSlotValRefsOfTycons: Tycon list -> ValRef list
D
Don Syme 已提交
1133

D
Don Syme 已提交
1134
val abstractSlotValsOfTycons: Tycon list -> Val list
L
latkin 已提交
1135 1136 1137

//-------------------------------------------------------------------------
// Free variables in expressions etc.
1138
//-------------------------------------------------------------------------
L
latkin 已提交
1139

D
Don Syme 已提交
1140
val emptyFreeVars: FreeVars
D
Don Syme 已提交
1141

D
Don Syme 已提交
1142
val unionFreeVars: FreeVars -> FreeVars -> FreeVars
L
latkin 已提交
1143

D
Don Syme 已提交
1144
val accFreeInTargets: FreeVarOptions -> DecisionTreeTarget array -> FreeVars -> FreeVars
D
Don Syme 已提交
1145

D
Don Syme 已提交
1146
val accFreeInExprs: FreeVarOptions -> Exprs -> FreeVars -> FreeVars
D
Don Syme 已提交
1147

D
Don Syme 已提交
1148
val accFreeInSwitchCases: FreeVarOptions -> DecisionTreeCase list -> DecisionTree option -> FreeVars -> FreeVars
D
Don Syme 已提交
1149

D
Don Syme 已提交
1150
val accFreeInDecisionTree: FreeVarOptions -> DecisionTree -> FreeVars -> FreeVars
L
latkin 已提交
1151 1152

/// Get the free variables in a module definition.
D
Don Syme 已提交
1153
val freeInModuleOrNamespace: FreeVarOptions -> ModuleOrNamespaceContents -> FreeVars
L
latkin 已提交
1154 1155

/// Get the free variables in an expression.
D
Don Syme 已提交
1156
val freeInExpr: FreeVarOptions -> Expr -> FreeVars
L
latkin 已提交
1157 1158

/// Get the free variables in the right hand side of a binding.
D
Don Syme 已提交
1159
val freeInBindingRhs: FreeVarOptions -> Binding -> FreeVars
L
latkin 已提交
1160

D
Don Syme 已提交
1161
/// Check if a set of free type variables are all public
D
Don Syme 已提交
1162
val freeTyvarsAllPublic: FreeTyvars -> bool
L
latkin 已提交
1163

D
Don Syme 已提交
1164
/// Check if a set of free variables are all public
D
Don Syme 已提交
1165
val freeVarsAllPublic: FreeVars -> bool
L
latkin 已提交
1166

D
Don Syme 已提交
1167
/// Compute the type of an expression from the expression itself
1168
val tyOfExpr: TcGlobals -> Expr -> TType
L
latkin 已提交
1169

1170 1171
/// A flag to govern whether ValReprInfo inference should be type-directed or syntax-directed when
/// inferring from a lambda expression.
1172
[<RequireQualifiedAccess>]
1173 1174
type AllowTypeDirectedDetupling =
    | Yes
D
Don Syme 已提交
1175
    | No
1176

D
Don Syme 已提交
1177
/// Given a (curried) lambda expression, pull off its arguments
D
Don Syme 已提交
1178
val stripTopLambda: Expr * TType -> Typars * Val list list * Expr * TType
D
Don Syme 已提交
1179 1180

/// Given a lambda expression, extract the ValReprInfo for its arguments and other details
1181
val InferValReprInfoOfExpr:
1182
    TcGlobals -> AllowTypeDirectedDetupling -> TType -> Attribs list list -> Attribs -> Expr -> ValReprInfo
D
Don Syme 已提交
1183 1184

/// Given a lambda binding, extract the ValReprInfo for its arguments and other details
1185
val InferValReprInfoOfBinding: TcGlobals -> AllowTypeDirectedDetupling -> Val -> Expr -> ValReprInfo
L
latkin 已提交
1186

D
Don Syme 已提交
1187
/// Mutate a value to indicate it should be considered a local rather than a module-bound definition
1188
// REVIEW: this mutation should not be needed
1189
val ClearValReprInfo: Val -> Val
L
latkin 已提交
1190

D
Don Syme 已提交
1191
/// Indicate what should happen to value definitions when copying expressions
1192
type ValCopyFlag =
L
latkin 已提交
1193 1194
    | CloneAll
    | CloneAllAndMarkExprValsAsCompilerGenerated
D
Don Syme 已提交
1195

1196
    /// OnlyCloneExprVals is a nasty setting to reuse the cloning logic in a mode where all
D
Don Syme 已提交
1197
    /// Tycon and "module/member" Val objects keep their identity, but the Val objects for all Expr bindings
1198
    /// are cloned. This is used to 'fixup' the TAST created by tlr.fs
D
Don Syme 已提交
1199 1200 1201
    ///
    /// This is a fragile mode of use. It's not really clear why TLR needs to create a "bad" expression tree that
    /// reuses Val objects as multiple value bindings, and its been the cause of several subtle bugs.
L
latkin 已提交
1202 1203
    | OnlyCloneExprVals

D
Don Syme 已提交
1204
/// Remap a reference to a type definition using the given remapping substitution
D
Don Syme 已提交
1205
val remapTyconRef: TyconRefRemap -> TyconRef -> TyconRef
D
Don Syme 已提交
1206 1207

/// Remap a reference to a union case using the given remapping substitution
D
Don Syme 已提交
1208
val remapUnionCaseRef: TyconRefRemap -> UnionCaseRef -> UnionCaseRef
D
Don Syme 已提交
1209 1210

/// Remap a reference to a record field using the given remapping substitution
D
Don Syme 已提交
1211
val remapRecdFieldRef: TyconRefRemap -> RecdFieldRef -> RecdFieldRef
D
Don Syme 已提交
1212 1213

/// Remap a reference to a value using the given remapping substitution
D
Don Syme 已提交
1214
val remapValRef: Remap -> ValRef -> ValRef
D
Don Syme 已提交
1215 1216

/// Remap an expression using the given remapping substitution
D
Don Syme 已提交
1217
val remapExpr: TcGlobals -> ValCopyFlag -> Remap -> Expr -> Expr
D
Don Syme 已提交
1218 1219

/// Remap an attribute using the given remapping substitution
D
Don Syme 已提交
1220
val remapAttrib: TcGlobals -> Remap -> Attrib -> Attrib
D
Don Syme 已提交
1221 1222

/// Remap a (possible generic) type using the given remapping substitution
D
Don Syme 已提交
1223
val remapPossibleForallTy: TcGlobals -> Remap -> TType -> TType
D
Don Syme 已提交
1224 1225

/// Copy an entire module or namespace type using the given copying flags
D
Don Syme 已提交
1226
val copyModuleOrNamespaceType: TcGlobals -> ValCopyFlag -> ModuleOrNamespaceType -> ModuleOrNamespaceType
D
Don Syme 已提交
1227 1228

/// Copy an entire expression using the given copying flags
D
Don Syme 已提交
1229
val copyExpr: TcGlobals -> ValCopyFlag -> Expr -> Expr
D
Don Syme 已提交
1230 1231

/// Copy an entire implementation file using the given copying flags
D
Don Syme 已提交
1232
val copyImplFile: TcGlobals -> ValCopyFlag -> CheckedImplFile -> CheckedImplFile
D
Don Syme 已提交
1233 1234

/// Copy a method slot signature, including new generic type parameters if the slot signature represents a generic method
D
Don Syme 已提交
1235
val copySlotSig: SlotSig -> SlotSig
D
Don Syme 已提交
1236 1237

/// Instantiate the generic type parameters in a method slot signature, building a new one
D
Don Syme 已提交
1238
val instSlotSig: TyparInstantiation -> SlotSig -> SlotSig
L
latkin 已提交
1239

D
Don Syme 已提交
1240
/// Instantiate the generic type parameters in an expression, building a new one
D
Don Syme 已提交
1241
val instExpr: TcGlobals -> TyparInstantiation -> Expr -> Expr
L
latkin 已提交
1242

D
Don Syme 已提交
1243 1244
/// The remapping that corresponds to a module meeting its signature
/// and also report the set of tycons, tycon representations and values hidden in the process.
1245
type SignatureRepackageInfo =
F
Florian Verdonck 已提交
1246 1247 1248
    {
        /// The list of corresponding values
        RepackagedVals: (ValRef * ValRef) list
D
Don Syme 已提交
1249

F
Florian Verdonck 已提交
1250 1251 1252
        /// The list of corresponding modules, namespaces and type definitions
        RepackagedEntities: (TyconRef * TyconRef) list
    }
L
latkin 已提交
1253

D
Don Syme 已提交
1254
    /// The empty table
D
Don Syme 已提交
1255
    static member Empty: SignatureRepackageInfo
1256

D
Don Syme 已提交
1257
/// A set of tables summarizing the items hidden by a signature
1258
type SignatureHidingInfo =
D
Don Syme 已提交
1259
    { HiddenTycons: Zset<Tycon>
1260
      HiddenTyconReprs: Zset<Tycon>
D
Don Syme 已提交
1261 1262 1263 1264 1265
      HiddenVals: Zset<Val>
      HiddenRecdFields: Zset<RecdFieldRef>
      HiddenUnionCases: Zset<UnionCaseRef> }

    /// The empty table representing no hiding
D
Don Syme 已提交
1266
    static member Empty: SignatureHidingInfo
L
latkin 已提交
1267

D
Don Syme 已提交
1268
/// Compute the remapping information implied by a signature being inferred for a particular implementation
1269
val ComputeRemappingFromImplementationToSignature:
D
Don Syme 已提交
1270
    TcGlobals -> ModuleOrNamespaceContents -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo
D
Don Syme 已提交
1271 1272

/// Compute the remapping information implied by an explicit signature being given for an inferred signature
1273 1274
val ComputeRemappingFromInferredSignatureToExplicitSignature:
    TcGlobals -> ModuleOrNamespaceType -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo
D
Don Syme 已提交
1275 1276

/// Compute the hiding information that corresponds to the hiding applied at an assembly boundary
1277 1278 1279
val ComputeSignatureHidingInfoAtAssemblyBoundary: ModuleOrNamespaceType -> SignatureHidingInfo -> SignatureHidingInfo

/// Compute the hiding information that corresponds to the hiding applied at an assembly boundary
1280
val ComputeImplementationHidingInfoAtAssemblyBoundary:
D
Don Syme 已提交
1281
    ModuleOrNamespaceContents -> SignatureHidingInfo -> SignatureHidingInfo
D
Don Syme 已提交
1282

1283
val mkRepackageRemapping: SignatureRepackageInfo -> Remap
L
latkin 已提交
1284

D
Don Syme 已提交
1285
/// Wrap one module or namespace implementation in a 'namespace N' outer wrapper
D
Don Syme 已提交
1286
val wrapModuleOrNamespaceContentsInNamespace:
1287 1288 1289 1290 1291
    isModule: bool ->
    id: Ident ->
    cpath: CompilationPath ->
    mexpr: ModuleOrNamespaceContents ->
        ModuleOrNamespaceContents
D
Don Syme 已提交
1292 1293

/// Wrap one module or namespace definition in a 'namespace N' outer wrapper
1294 1295
val wrapModuleOrNamespaceTypeInNamespace:
    Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespaceType * ModuleOrNamespace
D
Don Syme 已提交
1296 1297

/// Wrap one module or namespace definition in a 'module M = ..' outer wrapper
D
Don Syme 已提交
1298
val wrapModuleOrNamespaceType: Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespace
L
latkin 已提交
1299

D
Don Syme 已提交
1300
/// Given a namespace, module or type definition, try to produce a reference to that entity.
D
Don Syme 已提交
1301
val tryRescopeEntity: CcuThunk -> Entity -> ValueOption<EntityRef>
D
Don Syme 已提交
1302 1303

/// Given a value definition, try to produce a reference to that value. Fails for local values.
D
Don Syme 已提交
1304
val tryRescopeVal: CcuThunk -> Remap -> Val -> ValueOption<ValRef>
L
latkin 已提交
1305

D
Don Syme 已提交
1306 1307 1308 1309
/// Make the substitution (remapping) table for viewing a module or namespace 'from the outside'
///
/// Given the top-most signatures constrains the public compilation units
/// of an assembly, compute a remapping that converts local references to non-local references.
1310
/// This remapping must be applied to all pickled expressions and types
D
Don Syme 已提交
1311
/// exported from the assembly.
D
Don Syme 已提交
1312
val MakeExportRemapping: CcuThunk -> ModuleOrNamespace -> Remap
D
Don Syme 已提交
1313 1314

/// Make a remapping table for viewing a module or namespace 'from the outside'
1315
val ApplyExportRemappingToEntity: TcGlobals -> Remap -> ModuleOrNamespace -> ModuleOrNamespace
L
latkin 已提交
1316

D
Don Syme 已提交
1317
/// Determine if a type definition is hidden by a signature
D
Don Syme 已提交
1318
val IsHiddenTycon: (Remap * SignatureHidingInfo) list -> Tycon -> bool
D
Don Syme 已提交
1319 1320

/// Determine if the representation of a type definition is hidden by a signature
D
Don Syme 已提交
1321
val IsHiddenTyconRepr: (Remap * SignatureHidingInfo) list -> Tycon -> bool
D
Don Syme 已提交
1322 1323

/// Determine if a member, function or value is hidden by a signature
D
Don Syme 已提交
1324
val IsHiddenVal: (Remap * SignatureHidingInfo) list -> Val -> bool
L
latkin 已提交
1325

D
Don Syme 已提交
1326
/// Determine if a record field is hidden by a signature
D
Don Syme 已提交
1327
val IsHiddenRecdField: (Remap * SignatureHidingInfo) list -> RecdFieldRef -> bool
L
latkin 已提交
1328

E
Eugene Auduchinok 已提交
1329
/// Adjust marks in expressions, replacing all marks by the given mark.
D
Don Syme 已提交
1330
/// Used when inlining.
D
Don Syme 已提交
1331
val remarkExpr: range -> Expr -> Expr
1332

D
Don Syme 已提交
1333
/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments
1334
val primMkApp: Expr * TType -> TypeInst -> Exprs -> range -> Expr
D
Don Syme 已提交
1335 1336 1337

/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments.
/// Reduce the application via let-bindings if the function value is a lambda expression.
D
Don Syme 已提交
1338
val mkApps: TcGlobals -> (Expr * TType) * TType list list * Exprs * range -> Expr
D
Don Syme 已提交
1339 1340 1341

/// Build the application of a generic construct to a set of type arguments.
/// Reduce the application via substitution if the function value is a typed lambda expression.
D
Don Syme 已提交
1342
val mkTyAppExpr: range -> Expr * TType -> TType list -> Expr
L
latkin 已提交
1343

D
Don Syme 已提交
1344
/// Build an expression to mutate a local
1345
///   localv <- e
D
Don Syme 已提交
1346
val mkValSet: range -> ValRef -> Expr -> Expr
D
Don Syme 已提交
1347 1348

/// Build an expression to mutate the contents of a local pointer
1349
///  *localv_ptr = e
D
Don Syme 已提交
1350
val mkAddrSet: range -> ValRef -> Expr -> Expr
D
Don Syme 已提交
1351 1352

/// Build an expression to dereference a local pointer
1353
/// *localv_ptr
D
Don Syme 已提交
1354
val mkAddrGet: range -> ValRef -> Expr
D
Don Syme 已提交
1355

1356 1357
/// Build an expression to take the address of a local
/// &localv
D
Don Syme 已提交
1358
val mkValAddr: range -> readonly: bool -> ValRef -> Expr
L
latkin 已提交
1359

E
Eugene Auduchinok 已提交
1360
/// Build an expression representing the read of an instance class or record field.
D
Don Syme 已提交
1361
/// First take the address of the record expression if it is a struct.
D
Don Syme 已提交
1362
val mkRecdFieldGet: TcGlobals -> Expr * RecdFieldRef * TypeInst * range -> Expr
L
latkin 已提交
1363

D
Don Syme 已提交
1364
///  Accumulate the targets actually used in a decision graph (for reporting warnings)
D
Don Syme 已提交
1365
val accTargetsOfDecisionTree: DecisionTree -> int list -> int list
L
latkin 已提交
1366

1367
/// Make a 'match' expression applying some peep-hole optimizations along the way, e.g to
D
Don Syme 已提交
1368
/// pre-decide the branch taken at compile-time.
1369 1370
val mkAndSimplifyMatch:
    DebugPointAtBinding -> range -> range -> TType -> DecisionTree -> DecisionTreeTarget list -> Expr
L
latkin 已提交
1371

D
Don Syme 已提交
1372
/// Make a 'match' expression without applying any peep-hole optimizations.
D
Don Syme 已提交
1373
val primMkMatch: DebugPointAtBinding * range * DecisionTree * DecisionTreeTarget array * range * TType -> Expr
L
latkin 已提交
1374

D
Don Syme 已提交
1375
///  Work out what things on the right-han-side of a 'let rec' recursive binding need to be fixed up
1376 1377 1378 1379 1380 1381 1382
val IterateRecursiveFixups:
    TcGlobals ->
    Val option ->
    (Val option -> Expr -> (Expr -> Expr) -> Expr -> unit) ->
    Expr * (Expr -> Expr) ->
        Expr ->
            unit
L
latkin 已提交
1383

D
Don Syme 已提交
1384
/// Given a lambda expression taking multiple variables, build a corresponding lambda taking a tuple
D
Don Syme 已提交
1385
val MultiLambdaToTupledLambda: TcGlobals -> Val list -> Expr -> Val * Expr
L
latkin 已提交
1386

1387
/// Given a lambda expression, adjust it to have be one or two lambda expressions (fun a -> (fun b -> ...))
1388
/// where the first has the given arguments.
D
Don Syme 已提交
1389
val AdjustArityOfLambdaBody: TcGlobals -> int -> Val list -> Expr -> Val list * Expr
L
latkin 已提交
1390

D
Don Syme 已提交
1391
/// Make an application expression, doing beta reduction by introducing let-bindings
1392
/// if the function expression is a construction of a lambda
D
Don Syme 已提交
1393
val MakeApplicationAndBetaReduce: TcGlobals -> Expr * TType * TypeInst list * Exprs * range -> Expr
L
latkin 已提交
1394

1395 1396
/// Make a delegate invoke expression for an F# delegate type, doing beta reduction by introducing let-bindings
/// if the delegate expression is a construction of a delegate.
1397 1398
val MakeFSharpDelegateInvokeAndTryBetaReduce:
    TcGlobals -> delInvokeRef: Expr * delExpr: Expr * delInvokeTy: TType * delInvokeArg: Expr * m: range -> Expr
1399

E
Eugene Auduchinok 已提交
1400
/// Combine two static-resolution requirements on a type parameter
D
Don Syme 已提交
1401
val JoinTyparStaticReq: TyparStaticReq -> TyparStaticReq -> TyparStaticReq
L
latkin 已提交
1402

D
Don Syme 已提交
1403
/// Layout for internal compiler debugging purposes
L
latkin 已提交
1404 1405
module DebugPrint =

1406 1407 1408 1409 1410 1411
    /// A global flag indicating whether debug output should include ValReprInfo
    val mutable layoutValReprInfo: bool

    /// A global flag indicating whether debug output should include stamps of Val and Entity
    val mutable layoutStamps: bool

D
Don Syme 已提交
1412
    /// A global flag indicating whether debug output should include ranges
1413 1414 1415 1416
    val mutable layoutRanges: bool

    /// A global flag indicating whether debug output should include type information
    val mutable layoutTypes: bool
D
Don Syme 已提交
1417 1418

    /// Convert a type to a string for debugging purposes
D
Don Syme 已提交
1419
    val showType: TType -> string
D
Don Syme 已提交
1420 1421

    /// Convert an expression to a string for debugging purposes
1422
    val showExpr: Expr -> string
L
latkin 已提交
1423

D
Don Syme 已提交
1424
    /// Debug layout for a reference to a value
D
Don Syme 已提交
1425
    val valRefL: ValRef -> Layout
D
Don Syme 已提交
1426 1427

    /// Debug layout for a reference to a union case
D
Don Syme 已提交
1428
    val unionCaseRefL: UnionCaseRef -> Layout
D
Don Syme 已提交
1429 1430

    /// Debug layout for an value definition at its binding site
1431
    val valAtBindL: Val -> Layout
D
Don Syme 已提交
1432 1433

    /// Debug layout for an integer
D
Don Syme 已提交
1434
    val intL: int -> Layout
D
Don Syme 已提交
1435 1436

    /// Debug layout for a value definition
D
Don Syme 已提交
1437
    val valL: Val -> Layout
D
Don Syme 已提交
1438 1439

    /// Debug layout for a type parameter definition
D
Don Syme 已提交
1440
    val typarDeclL: Typar -> Layout
D
Don Syme 已提交
1441 1442

    /// Debug layout for a trait constraint
D
Don Syme 已提交
1443
    val traitL: TraitConstraintInfo -> Layout
D
Don Syme 已提交
1444 1445

    /// Debug layout for a type parameter
D
Don Syme 已提交
1446
    val typarL: Typar -> Layout
D
Don Syme 已提交
1447 1448

    /// Debug layout for a set of type parameters
D
Don Syme 已提交
1449
    val typarsL: Typars -> Layout
D
Don Syme 已提交
1450 1451

    /// Debug layout for a type
D
Don Syme 已提交
1452
    val typeL: TType -> Layout
D
Don Syme 已提交
1453 1454

    /// Debug layout for a method slot signature
D
Don Syme 已提交
1455
    val slotSigL: SlotSig -> Layout
D
Don Syme 已提交
1456 1457

    /// Debug layout for a module or namespace definition
1458
    val entityL: ModuleOrNamespace -> Layout
D
Don Syme 已提交
1459 1460

    /// Debug layout for a binding of an expression to a value
1461
    val bindingL: Binding -> Layout
D
Don Syme 已提交
1462 1463

    /// Debug layout for an expression
1464
    val exprL: Expr -> Layout
D
Don Syme 已提交
1465 1466

    /// Debug layout for a type definition
1467
    val tyconL: Tycon -> Layout
D
Don Syme 已提交
1468 1469

    /// Debug layout for a decision tree
1470
    val decisionTreeL: DecisionTree -> Layout
D
Don Syme 已提交
1471 1472

    /// Debug layout for an implementation file
1473
    val implFileL: CheckedImplFile -> Layout
D
Don Syme 已提交
1474 1475

    /// Debug layout for a list of implementation files
1476
    val implFilesL: CheckedImplFile list -> Layout
L
latkin 已提交
1477

D
Don Syme 已提交
1478
    /// Debug layout for class and record fields
D
Don Syme 已提交
1479
    val recdFieldRefL: RecdFieldRef -> Layout
L
latkin 已提交
1480

D
Don Syme 已提交
1481
/// A set of function parameters (visitor) for folding over expressions
L
latkin 已提交
1482
type ExprFolder<'State> =
1483 1484 1485 1486 1487
    { exprIntercept: ('State -> Expr -> 'State) (* noInterceptF *)
        -> ('State -> Expr -> 'State)
        -> 'State
        -> Expr
        -> 'State (* recurseF *)
D
Don Syme 已提交
1488
      valBindingSiteIntercept: 'State -> bool * Val -> 'State
1489 1490
      nonRecBindingsIntercept: 'State -> Binding -> 'State
      recBindingsIntercept: 'State -> Bindings -> 'State
D
Don Syme 已提交
1491 1492
      dtreeIntercept: 'State -> DecisionTree -> 'State
      targetIntercept: ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option
1493
      tmethodIntercept: ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option }
D
Don Syme 已提交
1494 1495

/// The empty set of actions for folding over expressions
D
Don Syme 已提交
1496
val ExprFolder0: ExprFolder<'State>
D
Don Syme 已提交
1497 1498

/// Fold over all the expressions in an implementation file
D
Don Syme 已提交
1499
val FoldImplFile: ExprFolder<'State> -> ('State -> CheckedImplFile -> 'State)
D
Don Syme 已提交
1500 1501

/// Fold over all the expressions in an expression
1502
val FoldExpr: ExprFolder<'State> -> ('State -> Expr -> 'State)
L
latkin 已提交
1503 1504

#if DEBUG
D
Don Syme 已提交
1505
/// Extract some statistics from an expression
D
Don Syme 已提交
1506
val ExprStats: Expr -> string
L
latkin 已提交
1507 1508
#endif

D
Don Syme 已提交
1509
/// Build a nativeptr type
D
Don Syme 已提交
1510
val mkNativePtrTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1511 1512

/// Build a 'voidptr' type
D
Don Syme 已提交
1513
val mkVoidPtrTy: TcGlobals -> TType
D
Don Syme 已提交
1514 1515

/// Build a single-dimensional array type
D
Don Syme 已提交
1516
val mkArrayType: TcGlobals -> TType -> TType
D
Don Syme 已提交
1517

1518 1519 1520
/// Determine if a type is a value option type
val isValueOptionTy: TcGlobals -> TType -> bool

1521
/// Determine if a type is an option type
D
Don Syme 已提交
1522
val isOptionTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1523 1524

/// Take apart an option type
D
Don Syme 已提交
1525
val destOptionTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1526 1527

/// Try to take apart an option type
D
Don Syme 已提交
1528
val tryDestOptionTy: TcGlobals -> TType -> ValueOption<TType>
L
latkin 已提交
1529

1530 1531 1532
/// Try to take apart an option type
val destValueOptionTy: TcGlobals -> TType -> TType

1533
/// Determine is a type is a System.Nullable type
D
Don Syme 已提交
1534
val isNullableTy: TcGlobals -> TType -> bool
1535 1536 1537 1538 1539 1540 1541

/// Try to take apart a System.Nullable type
val tryDestNullableTy: TcGlobals -> TType -> ValueOption<TType>

/// Take apart a System.Nullable type
val destNullableTy: TcGlobals -> TType -> TType

D
Don Syme 已提交
1542
/// Determine if a type is a System.Linq.Expression type
D
Don Syme 已提交
1543
val isLinqExpressionTy: TcGlobals -> TType -> bool
L
latkin 已提交
1544

D
Don Syme 已提交
1545
/// Take apart a System.Linq.Expression type
D
Don Syme 已提交
1546
val destLinqExpressionTy: TcGlobals -> TType -> TType
L
latkin 已提交
1547

D
Don Syme 已提交
1548
/// Try to take apart a System.Linq.Expression type
D
Don Syme 已提交
1549
val tryDestLinqExpressionTy: TcGlobals -> TType -> TType option
L
latkin 已提交
1550

D
Don Syme 已提交
1551
/// Determine if a type is an IDelegateEvent type
D
Don Syme 已提交
1552
val isIDelegateEventType: TcGlobals -> TType -> bool
D
Don Syme 已提交
1553 1554

/// Take apart an IDelegateEvent type
1555
val destIDelegateEventType: TcGlobals -> TType -> TType
D
Don Syme 已提交
1556 1557

/// Build an IEvent type
D
Don Syme 已提交
1558
val mkIEventType: TcGlobals -> TType -> TType -> TType
D
Don Syme 已提交
1559 1560

/// Build an IObservable type
D
Don Syme 已提交
1561
val mkIObservableType: TcGlobals -> TType -> TType
L
latkin 已提交
1562

D
Don Syme 已提交
1563
/// Build an IObserver type
D
Don Syme 已提交
1564
val mkIObserverType: TcGlobals -> TType -> TType
L
latkin 已提交
1565

D
Don Syme 已提交
1566
/// Build an Lazy type
D
Don Syme 已提交
1567
val mkLazyTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1568 1569

/// Build an PrintFormat type
D
Don Syme 已提交
1570
val mkPrintfFormatTy: TcGlobals -> TType -> TType -> TType -> TType -> TType -> TType
L
latkin 已提交
1571 1572 1573

//-------------------------------------------------------------------------
// Classify types
1574
//-------------------------------------------------------------------------
L
latkin 已提交
1575

D
Don Syme 已提交
1576
/// Represents metadata extracted from a nominal type
1577 1578 1579
type TypeDefMetadata =
    | ILTypeMetadata of TILObjectReprData
    | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata
1580
#if !NO_TYPEPROVIDERS
1581
    | ProvidedTypeMetadata of TProvidedTypeInfo
L
latkin 已提交
1582 1583
#endif

D
Don Syme 已提交
1584
/// Extract metadata from a type definition
D
Don Syme 已提交
1585
val metadataOfTycon: Tycon -> TypeDefMetadata
D
Don Syme 已提交
1586 1587

/// Extract metadata from a type
D
Don Syme 已提交
1588
val metadataOfTy: TcGlobals -> TType -> TypeDefMetadata
L
latkin 已提交
1589

D
Don Syme 已提交
1590
/// Determine if a type is the System.String type
D
Don Syme 已提交
1591
val isStringTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1592 1593

/// Determine if a type is an F# list type
D
Don Syme 已提交
1594
val isListTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1595 1596

/// Determine if a type is a nominal .NET type
D
Don Syme 已提交
1597
val isILAppTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1598 1599

/// Determine if a type is any kind of array type
D
Don Syme 已提交
1600
val isArrayTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1601 1602

/// Determine if a type is a single-dimensional array type
D
Don Syme 已提交
1603
val isArray1DTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1604 1605

/// Get the element type of an array type
D
Don Syme 已提交
1606
val destArrayTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1607 1608

/// Get the element type of an F# list type
D
Don Syme 已提交
1609
val destListTy: TcGlobals -> TType -> TType
L
latkin 已提交
1610

D
Don Syme 已提交
1611
/// Build an array type of the given rank
D
Don Syme 已提交
1612
val mkArrayTy: TcGlobals -> int -> TType -> range -> TType
D
Don Syme 已提交
1613

1614
/// Check if a type definition is one of the artificial type definitions used for array types of different ranks
D
Don Syme 已提交
1615
val isArrayTyconRef: TcGlobals -> TyconRef -> bool
D
Don Syme 已提交
1616

E
Eugene Auduchinok 已提交
1617
/// Determine the rank of one of the artificial type definitions used for array types
D
Don Syme 已提交
1618
val rankOfArrayTyconRef: TcGlobals -> TyconRef -> int
L
latkin 已提交
1619

D
Don Syme 已提交
1620
/// Determine if a type is the F# unit type
D
Don Syme 已提交
1621
val isUnitTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1622 1623

/// Determine if a type is the System.Object type
D
Don Syme 已提交
1624
val isObjTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1625

1626
/// Determine if a type is the System.ValueType type
D
Don Syme 已提交
1627
val isValueTypeTy: TcGlobals -> TType -> bool
1628

D
Don Syme 已提交
1629
/// Determine if a type is the System.Void type
D
Don Syme 已提交
1630
val isVoidTy: TcGlobals -> TType -> bool
L
latkin 已提交
1631 1632

/// Get the element type of an array type
D
Don Syme 已提交
1633
val destArrayTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1634

L
latkin 已提交
1635
/// Get the rank of an array type
D
Don Syme 已提交
1636
val rankOfArrayTy: TcGlobals -> TType -> int
L
latkin 已提交
1637

D
Don Syme 已提交
1638
/// Determine if a reference to a type definition is an interface type
D
Don Syme 已提交
1639
val isInterfaceTyconRef: TyconRef -> bool
D
Don Syme 已提交
1640 1641

/// Determine if a type is a delegate type
D
Don Syme 已提交
1642
val isDelegateTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1643

1644
/// Determine if a type is a delegate type defined in F#
1645 1646
val isFSharpDelegateTy: TcGlobals -> TType -> bool

D
Don Syme 已提交
1647
/// Determine if a type is an interface type
D
Don Syme 已提交
1648
val isInterfaceTy: TcGlobals -> TType -> bool
L
latkin 已提交
1649

D
Don Syme 已提交
1650
/// Determine if a type is a FSharpRef type
D
Don Syme 已提交
1651
val isRefTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1652

1653
/// Determine if a type is a function (including generic). Not the same as isFunTy.
D
Don Syme 已提交
1654
val isForallFunctionTy: TcGlobals -> TType -> bool
1655

D
Don Syme 已提交
1656
/// Determine if a type is a sealed type
D
Don Syme 已提交
1657
val isSealedTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1658 1659

/// Determine if a type is a ComInterop type
D
Don Syme 已提交
1660
val isComInteropTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1661 1662

/// Determine the underlying type of an enum type (normally int32)
D
Don Syme 已提交
1663
val underlyingTypeOfEnumTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1664 1665

/// If the input type is an enum type, then convert to its underlying type, otherwise return the input type
D
Don Syme 已提交
1666
val normalizeEnumTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1667

0
0101 已提交
1668 1669 1670
/// Determine if TyconRef is to a struct type
val isStructTyconRef: TyconRef -> bool

D
Don Syme 已提交
1671
/// Determine if a type is a struct type
D
Don Syme 已提交
1672
val isStructTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1673

D
Don Syme 已提交
1674 1675
val isStructOrEnumTyconTy: TcGlobals -> TType -> bool

1676 1677 1678 1679
/// Determine if a type is a variable type with the ': struct' constraint.
///
/// Note, isStructTy does not include type parameters with the ': struct' constraint
/// This predicate is used to detect those type parameters.
D
Don Syme 已提交
1680
val isNonNullableStructTyparTy: TcGlobals -> TType -> bool
1681 1682 1683 1684 1685

/// Determine if a type is a variable type with the ': not struct' constraint.
///
/// Note, isRefTy does not include type parameters with the ': not struct' constraint
/// This predicate is used to detect those type parameters.
D
Don Syme 已提交
1686
val isReferenceTyparTy: TcGlobals -> TType -> bool
1687

D
Don Syme 已提交
1688
/// Determine if a type is an unmanaged type
D
Don Syme 已提交
1689
val isUnmanagedTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1690 1691

/// Determine if a type is a class type
D
Don Syme 已提交
1692
val isClassTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1693 1694

/// Determine if a type is an enum type
D
Don Syme 已提交
1695
val isEnumTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1696 1697

/// Determine if a type is a struct, record or union type
D
Don Syme 已提交
1698
val isStructRecordOrUnionTyconTy: TcGlobals -> TType -> bool
L
latkin 已提交
1699 1700 1701 1702

/// For "type Class as self", 'self' is fixed up after initialization. To support this,
/// it is converted behind the scenes to a ref. This function strips off the ref and
/// returns the underlying type.
D
Don Syme 已提交
1703
val StripSelfRefCell: TcGlobals * ValBaseOrThisInfo * TType -> TType
L
latkin 已提交
1704

D
Don Syme 已提交
1705
/// An active pattern to determine if a type is a nominal type, possibly instantiated
D
Don Syme 已提交
1706
val (|AppTy|_|): TcGlobals -> TType -> (TyconRef * TType list) option
D
Don Syme 已提交
1707 1708

/// An active pattern to match System.Nullable types
D
Don Syme 已提交
1709
val (|NullableTy|_|): TcGlobals -> TType -> TType option
D
Don Syme 已提交
1710 1711

/// An active pattern to transform System.Nullable types to their input, otherwise leave the input unchanged
1712
val (|StripNullableTy|): TcGlobals -> TType -> TType
D
Don Syme 已提交
1713 1714

/// Matches any byref type, yielding the target type
D
Don Syme 已提交
1715
val (|ByrefTy|_|): TcGlobals -> TType -> TType option
L
latkin 已提交
1716 1717 1718

//-------------------------------------------------------------------------
// Special semantic constraints
1719
//-------------------------------------------------------------------------
L
latkin 已提交
1720 1721

val IsUnionTypeWithNullAsTrueValue: TcGlobals -> Tycon -> bool
D
Don Syme 已提交
1722

D
Don Syme 已提交
1723
val TyconHasUseNullAsTrueValueAttribute: TcGlobals -> Tycon -> bool
D
Don Syme 已提交
1724

D
Don Syme 已提交
1725
val CanHaveUseNullAsTrueValueAttribute: TcGlobals -> Tycon -> bool
D
Don Syme 已提交
1726

D
Don Syme 已提交
1727
val MemberIsCompiledAsInstance: TcGlobals -> TyconRef -> bool -> ValMemberInfo -> Attribs -> bool
D
Don Syme 已提交
1728

D
Don Syme 已提交
1729
val ValSpecIsCompiledAsInstance: TcGlobals -> Val -> bool
D
Don Syme 已提交
1730

D
Don Syme 已提交
1731
val ValRefIsCompiledAsInstanceMember: TcGlobals -> ValRef -> bool
D
Don Syme 已提交
1732

D
Don Syme 已提交
1733
val ModuleNameIsMangled: TcGlobals -> Attribs -> bool
L
latkin 已提交
1734

D
Don Syme 已提交
1735
val CompileAsEvent: TcGlobals -> Attribs -> bool
L
latkin 已提交
1736

D
Don Syme 已提交
1737
val TypeNullIsExtraValue: TcGlobals -> range -> TType -> bool
D
Don Syme 已提交
1738

D
Don Syme 已提交
1739
val TypeNullIsTrueValue: TcGlobals -> TType -> bool
D
Don Syme 已提交
1740

D
Don Syme 已提交
1741
val TypeNullNotLiked: TcGlobals -> range -> TType -> bool
D
Don Syme 已提交
1742

D
Don Syme 已提交
1743
val TypeNullNever: TcGlobals -> TType -> bool
L
latkin 已提交
1744

D
Don Syme 已提交
1745
val TypeSatisfiesNullConstraint: TcGlobals -> range -> TType -> bool
D
Don Syme 已提交
1746

D
Don Syme 已提交
1747
val TypeHasDefaultValue: TcGlobals -> range -> TType -> bool
L
latkin 已提交
1748

D
Don Syme 已提交
1749
val isAbstractTycon: Tycon -> bool
L
latkin 已提交
1750

D
Don Syme 已提交
1751
val isUnionCaseRefDefinitelyMutable: UnionCaseRef -> bool
D
Don Syme 已提交
1752

D
Don Syme 已提交
1753
val isRecdOrUnionOrStructTyconRefDefinitelyMutable: TyconRef -> bool
D
Don Syme 已提交
1754

1755
val isExnDefinitelyMutable: TyconRef -> bool
D
Don Syme 已提交
1756

D
Don Syme 已提交
1757
val isUnionCaseFieldMutable: TcGlobals -> UnionCaseRef -> int -> bool
D
Don Syme 已提交
1758

D
Don Syme 已提交
1759
val isExnFieldMutable: TyconRef -> int -> bool
D
Don Syme 已提交
1760

1761
val isRecdOrStructTyconRefReadOnly: TcGlobals -> range -> TyconRef -> bool
D
Don Syme 已提交
1762

1763
val isRecdOrStructTyconRefAssumedImmutable: TcGlobals -> TyconRef -> bool
D
Don Syme 已提交
1764

1765
val isRecdOrStructTyReadOnly: TcGlobals -> range -> TType -> bool
L
latkin 已提交
1766

1767
val useGenuineField: Tycon -> RecdField -> bool
D
Don Syme 已提交
1768

D
Don Syme 已提交
1769
val ComputeFieldName: Tycon -> RecdField -> string
L
latkin 已提交
1770 1771 1772

//-------------------------------------------------------------------------
// Destruct slotsigs etc.
1773
//-------------------------------------------------------------------------
L
latkin 已提交
1774

D
Don Syme 已提交
1775
val slotSigHasVoidReturnTy: SlotSig -> bool
D
Don Syme 已提交
1776

D
Don Syme 已提交
1777
val actualReturnTyOfSlotSig: TypeInst -> TypeInst -> SlotSig -> TType option
L
latkin 已提交
1778

D
Don Syme 已提交
1779
val returnTyOfMethod: TcGlobals -> ObjExprMethod -> TType option
L
latkin 已提交
1780 1781 1782

//-------------------------------------------------------------------------
// Primitives associated with initialization graphs
1783
//-------------------------------------------------------------------------
L
latkin 已提交
1784

D
Don Syme 已提交
1785
val mkRefCell: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1786

D
Don Syme 已提交
1787
val mkRefCellGet: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1788

D
Don Syme 已提交
1789
val mkRefCellSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
1790

D
Don Syme 已提交
1791
val mkLazyDelayed: TcGlobals -> range -> TType -> Expr -> Expr
L
latkin 已提交
1792

D
Don Syme 已提交
1793
val mkLazyForce: TcGlobals -> range -> TType -> Expr -> Expr
L
latkin 已提交
1794

D
Don Syme 已提交
1795
val mkRefCellContentsRef: TcGlobals -> RecdFieldRef
D
Don Syme 已提交
1796

1797
/// Check if a type is an FSharpRef type
D
Don Syme 已提交
1798
val isRefCellTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1799

1800
/// Get the element type of an FSharpRef type
D
Don Syme 已提交
1801
val destRefCellTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1802

1803
/// Create the FSharpRef type for a given element type
D
Don Syme 已提交
1804
val mkRefCellTy: TcGlobals -> TType -> TType
L
latkin 已提交
1805

1806
/// Create the IEnumerable (seq) type for a given element type
D
Don Syme 已提交
1807
val mkSeqTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1808

1809
/// Create the IEnumerator type for a given element type
D
Don Syme 已提交
1810
val mkIEnumeratorTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1811

1812
/// Create the list type for a given element type
D
Don Syme 已提交
1813
val mkListTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1814

1815
/// Create the option type for a given element type
D
Don Syme 已提交
1816
val mkOptionTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1817

1818
/// Create the voption type for a given element type
1819
val mkValueOptionTy: TcGlobals -> TType -> TType
1820

1821 1822 1823 1824
/// Create the Nullable type for a given element type
val mkNullableTy: TcGlobals -> TType -> TType

/// Create the union case 'None' for an option type
D
Don Syme 已提交
1825
val mkNoneCase: TcGlobals -> UnionCaseRef
D
Don Syme 已提交
1826

1827 1828
/// Create the union case 'Some(expr)' for an option type
val mkSomeCase: TcGlobals -> UnionCaseRef
L
latkin 已提交
1829

1830 1831 1832 1833 1834 1835
/// Create the struct union case 'ValueSome(expr)' for a voption type
val mkValueSomeCase: TcGlobals -> UnionCaseRef

/// Create the struct union case 'Some' or 'ValueSome(expr)' for a voption type
val mkAnySomeCase: TcGlobals -> isStruct: bool -> UnionCaseRef

1836
/// Create the expression '[]' for a list type
D
Don Syme 已提交
1837
val mkNil: TcGlobals -> range -> TType -> Expr
D
Don Syme 已提交
1838

D
Don Syme 已提交
1839 1840
/// Create the expression 'headExpr:: tailExpr'
val mkCons: TcGlobals -> TType -> Expr -> Expr -> Expr
L
latkin 已提交
1841

1842
/// Create the expression 'Some(expr)'
D
Don Syme 已提交
1843
val mkSome: TcGlobals -> TType -> Expr -> range -> Expr
1844

1845
/// Create the expression 'None' for an option-type
1846 1847
val mkNone: TcGlobals -> TType -> range -> Expr

D
Don Syme 已提交
1848
val mkOptionToNullable: TcGlobals -> range -> TType -> Expr -> Expr
1849 1850 1851

val mkOptionDefaultValue: TcGlobals -> range -> TType -> Expr -> Expr -> Expr

L
latkin 已提交
1852 1853
//-------------------------------------------------------------------------
// Make a few more expressions
1854
//-------------------------------------------------------------------------
L
latkin 已提交
1855

1856
val mkSequential: range -> Expr -> Expr -> Expr
D
Don Syme 已提交
1857

1858
val mkThenDoSequential: range -> expr: Expr -> stmt: Expr -> Expr
1859 1860 1861 1862 1863 1864 1865 1866

/// This is used for tacking on code _before_ the expression. The SuppressStmt
/// setting is used for debug points, suppressing the debug points for the statement if possible.
val mkCompGenSequential: range -> stmt: Expr -> expr: Expr -> Expr

/// This is used for tacking on code _after_ the expression. The SuppressStmt
/// setting is used for debug points, suppressing the debug points for the statement if possible.
val mkCompGenThenDoSequential: range -> expr: Expr -> stmt: Expr -> Expr
D
Don Syme 已提交
1867

1868
val mkSequentials: TcGlobals -> range -> Exprs -> Expr
D
Don Syme 已提交
1869

D
Don Syme 已提交
1870
val mkRecordExpr: TcGlobals -> RecordConstructionInfo * TyconRef * TypeInst * RecdFieldRef list * Exprs * range -> Expr
D
Don Syme 已提交
1871

D
Don Syme 已提交
1872
val mkUnbox: TType -> Expr -> range -> Expr
D
Don Syme 已提交
1873

D
Don Syme 已提交
1874
val mkBox: TType -> Expr -> range -> Expr
D
Don Syme 已提交
1875

D
Don Syme 已提交
1876
val mkIsInst: TType -> Expr -> range -> Expr
D
Don Syme 已提交
1877

D
Don Syme 已提交
1878
val mkNull: range -> TType -> Expr
D
Don Syme 已提交
1879

D
Don Syme 已提交
1880
val mkNullTest: TcGlobals -> range -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1881

D
Don Syme 已提交
1882
val mkNonNullTest: TcGlobals -> range -> Expr -> Expr
D
Don Syme 已提交
1883

D
Don Syme 已提交
1884
val mkIsInstConditional: TcGlobals -> range -> TType -> Expr -> Val -> Expr -> Expr -> Expr
D
Don Syme 已提交
1885

D
Don Syme 已提交
1886
val mkThrow: range -> TType -> Expr -> Expr
D
Don Syme 已提交
1887

D
Don Syme 已提交
1888
val mkGetArg0: range -> TType -> Expr
L
latkin 已提交
1889

D
Don Syme 已提交
1890
val mkDefault: range * TType -> Expr
L
latkin 已提交
1891

D
Don Syme 已提交
1892
val isThrow: Expr -> bool
L
latkin 已提交
1893

D
Don Syme 已提交
1894
val mkString: TcGlobals -> range -> string -> Expr
D
Don Syme 已提交
1895

D
Don Syme 已提交
1896
val mkBool: TcGlobals -> range -> bool -> Expr
D
Don Syme 已提交
1897

D
Don Syme 已提交
1898
val mkByte: TcGlobals -> range -> byte -> Expr
D
Don Syme 已提交
1899

D
Don Syme 已提交
1900
val mkUInt16: TcGlobals -> range -> uint16 -> Expr
D
Don Syme 已提交
1901

D
Don Syme 已提交
1902
val mkTrue: TcGlobals -> range -> Expr
D
Don Syme 已提交
1903

D
Don Syme 已提交
1904
val mkFalse: TcGlobals -> range -> Expr
D
Don Syme 已提交
1905

D
Don Syme 已提交
1906
val mkUnit: TcGlobals -> range -> Expr
D
Don Syme 已提交
1907

D
Don Syme 已提交
1908
val mkInt32: TcGlobals -> range -> int32 -> Expr
D
Don Syme 已提交
1909

D
Don Syme 已提交
1910
val mkInt: TcGlobals -> range -> int -> Expr
D
Don Syme 已提交
1911

D
Don Syme 已提交
1912
val mkZero: TcGlobals -> range -> Expr
D
Don Syme 已提交
1913

D
Don Syme 已提交
1914
val mkOne: TcGlobals -> range -> Expr
D
Don Syme 已提交
1915

D
Don Syme 已提交
1916
val mkTwo: TcGlobals -> range -> Expr
D
Don Syme 已提交
1917

D
Don Syme 已提交
1918
val mkMinusOne: TcGlobals -> range -> Expr
D
Don Syme 已提交
1919

D
Don Syme 已提交
1920
val destInt32: Expr -> int32 option
L
latkin 已提交
1921 1922 1923

//-------------------------------------------------------------------------
// Primitives associated with quotations
1924 1925
//-------------------------------------------------------------------------

D
Don Syme 已提交
1926
val isQuotedExprTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
1927

D
Don Syme 已提交
1928
val destQuotedExprTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1929

D
Don Syme 已提交
1930
val mkQuotedExprTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
1931

D
Don Syme 已提交
1932
val mkRawQuotedExprTy: TcGlobals -> TType
1933 1934 1935

//-------------------------------------------------------------------------
// Primitives associated with IL code gen
1936
//-------------------------------------------------------------------------
1937

1938
val mspec_Type_GetTypeFromHandle: TcGlobals -> ILMethodSpec
D
Don Syme 已提交
1939

1940
val fspec_Missing_Value: TcGlobals -> ILFieldSpec
D
Don Syme 已提交
1941

1942
val mkInitializeArrayMethSpec: TcGlobals -> ILMethodSpec
D
Don Syme 已提交
1943

D
Don Syme 已提交
1944
val mkByteArrayTy: TcGlobals -> TType
D
Don Syme 已提交
1945

1946 1947
val mkInvalidCastExnNewobj: TcGlobals -> ILInstr

L
latkin 已提交
1948 1949
//-------------------------------------------------------------------------
// Construct calls to some intrinsic functions
1950
//-------------------------------------------------------------------------
L
latkin 已提交
1951

1952
val mkCallNewFormat: TcGlobals -> range -> TType -> TType -> TType -> TType -> TType -> formatStringExpr: Expr -> Expr
L
latkin 已提交
1953

D
Don Syme 已提交
1954
val mkCallUnbox: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1955

D
Don Syme 已提交
1956
val mkCallGetGenericComparer: TcGlobals -> range -> Expr
D
Don Syme 已提交
1957

D
Don Syme 已提交
1958
val mkCallGetGenericEREqualityComparer: TcGlobals -> range -> Expr
D
Don Syme 已提交
1959

D
Don Syme 已提交
1960
val mkCallGetGenericPEREqualityComparer: TcGlobals -> range -> Expr
L
latkin 已提交
1961

D
Don Syme 已提交
1962
val mkCallUnboxFast: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1963

D
Don Syme 已提交
1964
val canUseUnboxFast: TcGlobals -> range -> TType -> bool
L
latkin 已提交
1965

D
Don Syme 已提交
1966
val mkCallDispose: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1967

D
Don Syme 已提交
1968
val mkCallSeq: TcGlobals -> range -> TType -> Expr -> Expr
L
latkin 已提交
1969

D
Don Syme 已提交
1970
val mkCallTypeTest: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1971

D
Don Syme 已提交
1972
val canUseTypeTestFast: TcGlobals -> TType -> bool
L
latkin 已提交
1973

D
Don Syme 已提交
1974
val mkCallTypeOf: TcGlobals -> range -> TType -> Expr
D
Don Syme 已提交
1975

1976
val mkCallTypeDefOf: TcGlobals -> range -> TType -> Expr
L
latkin 已提交
1977

D
Don Syme 已提交
1978
val mkCallCreateInstance: TcGlobals -> range -> TType -> Expr
D
Don Syme 已提交
1979

D
Don Syme 已提交
1980
val mkCallCreateEvent: TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1981

D
Don Syme 已提交
1982
val mkCallArrayLength: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
1983

D
Don Syme 已提交
1984
val mkCallArrayGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
1985

1986
val mkCallArray2DGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1987

D
Don Syme 已提交
1988
val mkCallArray3DGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1989

D
Don Syme 已提交
1990
val mkCallArray4DGet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1991

D
Don Syme 已提交
1992
val mkCallArraySet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1993

D
Don Syme 已提交
1994
val mkCallArray2DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1995

D
Don Syme 已提交
1996
val mkCallArray3DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
1997

D
Don Syme 已提交
1998
val mkCallArray4DSet: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr
S
Steffen Forkmann 已提交
1999

D
Don Syme 已提交
2000
val mkCallHash: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2001

D
Don Syme 已提交
2002
val mkCallBox: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2003

D
Don Syme 已提交
2004
val mkCallIsNull: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2005

D
Don Syme 已提交
2006
val mkCallRaise: TcGlobals -> range -> TType -> Expr -> Expr
L
latkin 已提交
2007

D
Don Syme 已提交
2008
val mkCallGenericComparisonWithComparerOuter: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2009

D
Don Syme 已提交
2010
val mkCallGenericEqualityEROuter: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2011

D
Don Syme 已提交
2012
val mkCallGenericEqualityWithComparerOuter: TcGlobals -> range -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2013

D
Don Syme 已提交
2014
val mkCallGenericHashWithComparerOuter: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
L
latkin 已提交
2015

D
Don Syme 已提交
2016
val mkCallEqualsOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2017

D
Don Syme 已提交
2018
val mkCallNotEqualsOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2019

D
Don Syme 已提交
2020
val mkCallLessThanOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2021

D
Don Syme 已提交
2022
val mkCallLessThanOrEqualsOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2023

D
Don Syme 已提交
2024
val mkCallGreaterThanOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2025

D
Don Syme 已提交
2026
val mkCallGreaterThanOrEqualsOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
S
Steffen Forkmann 已提交
2027

D
Don Syme 已提交
2028
val mkCallAdditionOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2029

D
Don Syme 已提交
2030
val mkCallSubtractionOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2031

D
Don Syme 已提交
2032
val mkCallMultiplyOperator: TcGlobals -> range -> ty1: TType -> ty2: TType -> retTy: TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2033

D
Don Syme 已提交
2034
val mkCallDivisionOperator: TcGlobals -> range -> ty1: TType -> ty2: TType -> retTy: TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2035

D
Don Syme 已提交
2036
val mkCallModulusOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2037

D
Don Syme 已提交
2038
val mkCallDefaultOf: TcGlobals -> range -> TType -> Expr
2039

D
Don Syme 已提交
2040
val mkCallBitwiseAndOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2041

D
Don Syme 已提交
2042
val mkCallBitwiseOrOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2043

D
Don Syme 已提交
2044
val mkCallBitwiseXorOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2045

D
Don Syme 已提交
2046
val mkCallShiftLeftOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2047

D
Don Syme 已提交
2048
val mkCallShiftRightOperator: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
S
Steffen Forkmann 已提交
2049

D
Don Syme 已提交
2050
val mkCallUnaryNegOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2051

D
Don Syme 已提交
2052
val mkCallUnaryNotOperator: TcGlobals -> range -> TType -> Expr -> Expr
S
Steffen Forkmann 已提交
2053

D
Don Syme 已提交
2054
val mkCallAdditionChecked: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2055

D
Don Syme 已提交
2056
val mkCallSubtractionChecked: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2057

D
Don Syme 已提交
2058
val mkCallMultiplyChecked: TcGlobals -> range -> ty1: TType -> ty2: TType -> retTy: TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2059

D
Don Syme 已提交
2060
val mkCallUnaryNegChecked: TcGlobals -> range -> TType -> Expr -> Expr
S
Steffen Forkmann 已提交
2061

D
Don Syme 已提交
2062
val mkCallToByteChecked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2063

D
Don Syme 已提交
2064
val mkCallToSByteChecked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2065

D
Don Syme 已提交
2066
val mkCallToInt16Checked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2067

D
Don Syme 已提交
2068
val mkCallToUInt16Checked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2069

D
Don Syme 已提交
2070
val mkCallToIntChecked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2071

D
Don Syme 已提交
2072
val mkCallToInt32Checked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2073

D
Don Syme 已提交
2074
val mkCallToUInt32Checked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2075

D
Don Syme 已提交
2076
val mkCallToInt64Checked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2077

D
Don Syme 已提交
2078
val mkCallToUInt64Checked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2079

D
Don Syme 已提交
2080
val mkCallToIntPtrChecked: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2081

D
Don Syme 已提交
2082
val mkCallToUIntPtrChecked: TcGlobals -> range -> TType -> Expr -> Expr
S
Steffen Forkmann 已提交
2083

D
Don Syme 已提交
2084
val mkCallToByteOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2085

D
Don Syme 已提交
2086
val mkCallToSByteOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2087

D
Don Syme 已提交
2088
val mkCallToInt16Operator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2089

D
Don Syme 已提交
2090
val mkCallToUInt16Operator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2091

D
Don Syme 已提交
2092
val mkCallToIntOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2093

D
Don Syme 已提交
2094
val mkCallToInt32Operator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2095

D
Don Syme 已提交
2096
val mkCallToUInt32Operator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2097

D
Don Syme 已提交
2098
val mkCallToInt64Operator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2099

D
Don Syme 已提交
2100
val mkCallToUInt64Operator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2101

D
Don Syme 已提交
2102
val mkCallToSingleOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2103

D
Don Syme 已提交
2104
val mkCallToDoubleOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2105

D
Don Syme 已提交
2106
val mkCallToIntPtrOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2107

D
Don Syme 已提交
2108
val mkCallToUIntPtrOperator: TcGlobals -> range -> TType -> Expr -> Expr
S
Steffen Forkmann 已提交
2109

D
Don Syme 已提交
2110
val mkCallToCharOperator: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2111

D
Don Syme 已提交
2112
val mkCallToEnumOperator: TcGlobals -> range -> TType -> Expr -> Expr
S
Steffen Forkmann 已提交
2113

D
Don Syme 已提交
2114
val mkCallDeserializeQuotationFSharp20Plus: TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2115

D
Don Syme 已提交
2116
val mkCallDeserializeQuotationFSharp40Plus: TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2117

2118
val mkCallCastQuotation: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2119

D
Don Syme 已提交
2120
val mkCallLiftValueWithName: TcGlobals -> range -> TType -> string -> Expr -> Expr
D
Don Syme 已提交
2121

2122 2123
val mkCallLiftValue: TcGlobals -> range -> TType -> Expr -> Expr

D
Don Syme 已提交
2124
val mkCallLiftValueWithDefn: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2125

D
Don Syme 已提交
2126
val mkCallSeqCollect: TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2127

D
Don Syme 已提交
2128
val mkCallSeqUsing: TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2129

D
Don Syme 已提交
2130
val mkCallSeqDelay: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2131

D
Don Syme 已提交
2132
val mkCallSeqAppend: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2133

D
Don Syme 已提交
2134
val mkCallSeqFinally: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2135

D
Don Syme 已提交
2136
val mkCallSeqGenerated: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2137

D
Don Syme 已提交
2138
val mkCallSeqOfFunctions: TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2139

2140
val mkCallSeqToArray: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2141

2142
val mkCallSeqToList: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2143

D
Don Syme 已提交
2144
val mkCallSeqMap: TcGlobals -> range -> TType -> TType -> Expr -> Expr -> Expr
D
Don Syme 已提交
2145

D
Don Syme 已提交
2146
val mkCallSeqSingleton: TcGlobals -> range -> TType -> Expr -> Expr
D
Don Syme 已提交
2147

D
Don Syme 已提交
2148
val mkCallSeqEmpty: TcGlobals -> range -> TType -> Expr
D
Don Syme 已提交
2149

2150 2151 2152
/// Make a call to the 'isprintf' function for string interpolation
val mkCall_sprintf: g: TcGlobals -> m: range -> funcTy: TType -> fmtExpr: Expr -> fillExprs: Expr list -> Expr

D
Don Syme 已提交
2153
val mkILAsmCeq: TcGlobals -> range -> Expr -> Expr -> Expr
D
Don Syme 已提交
2154

D
Don Syme 已提交
2155
val mkILAsmClt: TcGlobals -> range -> Expr -> Expr -> Expr
L
latkin 已提交
2156

2157
val mkCallFailInit: TcGlobals -> range -> Expr
D
Don Syme 已提交
2158

2159
val mkCallFailStaticInit: TcGlobals -> range -> Expr
D
Don Syme 已提交
2160

2161
val mkCallCheckThis: TcGlobals -> range -> TType -> Expr -> Expr
L
latkin 已提交
2162

D
Don Syme 已提交
2163
val mkCase: DecisionTreeTest * DecisionTree -> DecisionTreeCase
L
latkin 已提交
2164

D
Don Syme 已提交
2165
val mkCallQuoteToLinqLambdaExpression: TcGlobals -> range -> TType -> Expr -> Expr
L
latkin 已提交
2166

D
Don Syme 已提交
2167
val mkCallGetQuerySourceAsEnumerable: TcGlobals -> range -> TType -> TType -> Expr -> Expr
D
Don Syme 已提交
2168

D
Don Syme 已提交
2169
val mkCallNewQuerySource: TcGlobals -> range -> TType -> TType -> Expr -> Expr
L
latkin 已提交
2170

D
Don Syme 已提交
2171
val mkArray: TType * Exprs * range -> Expr
2172

D
Don Syme 已提交
2173
val mkStaticCall_String_Concat2: TcGlobals -> range -> Expr -> Expr -> Expr
D
Don Syme 已提交
2174

D
Don Syme 已提交
2175
val mkStaticCall_String_Concat3: TcGlobals -> range -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2176

D
Don Syme 已提交
2177
val mkStaticCall_String_Concat4: TcGlobals -> range -> Expr -> Expr -> Expr -> Expr -> Expr
D
Don Syme 已提交
2178

D
Don Syme 已提交
2179
val mkStaticCall_String_Concat_Array: TcGlobals -> range -> Expr -> Expr
2180

2181
/// Use a witness in BuiltInWitnesses
D
Don Syme 已提交
2182
val tryMkCallBuiltInWitness: TcGlobals -> TraitConstraintInfo -> Expr list -> range -> Expr option
2183

2184 2185 2186
/// Use an operator as a witness
val tryMkCallCoreFunctionAsBuiltInWitness:
    TcGlobals -> IntrinsicValRef -> TType list -> Expr list -> range -> Expr option
2187

L
latkin 已提交
2188 2189 2190
//-------------------------------------------------------------------------
// operations primarily associated with the optimization to fix
// up loops to generate .NET code that does not include array bound checks
2191
//-------------------------------------------------------------------------
L
latkin 已提交
2192

D
Don Syme 已提交
2193
val mkDecr: TcGlobals -> range -> Expr -> Expr
D
Don Syme 已提交
2194

D
Don Syme 已提交
2195
val mkIncr: TcGlobals -> range -> Expr -> Expr
D
Don Syme 已提交
2196

D
Don Syme 已提交
2197
val mkLdlen: TcGlobals -> range -> Expr -> Expr
D
Don Syme 已提交
2198

D
Don Syme 已提交
2199
val mkLdelem: TcGlobals -> range -> TType -> Expr -> Expr -> Expr
L
latkin 已提交
2200 2201

//-------------------------------------------------------------------------
2202 2203
// Analyze attribute sets
//-------------------------------------------------------------------------
L
latkin 已提交
2204

2205
val TryDecodeILAttribute: ILTypeRef -> ILAttributes -> (ILAttribElem list * ILAttributeNamedArg list) option
D
Don Syme 已提交
2206

D
Don Syme 已提交
2207
val TryFindILAttribute: BuiltinAttribInfo -> ILAttributes -> bool
D
Don Syme 已提交
2208

D
Don Syme 已提交
2209
val TryFindILAttributeOpt: BuiltinAttribInfo option -> ILAttributes -> bool
D
Don Syme 已提交
2210

D
Don Syme 已提交
2211
val IsMatchingFSharpAttribute: TcGlobals -> BuiltinAttribInfo -> Attrib -> bool
D
Don Syme 已提交
2212

D
Don Syme 已提交
2213
val IsMatchingFSharpAttributeOpt: TcGlobals -> BuiltinAttribInfo option -> Attrib -> bool
D
Don Syme 已提交
2214

D
Don Syme 已提交
2215
val HasFSharpAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> bool
D
Don Syme 已提交
2216

D
Don Syme 已提交
2217
val HasFSharpAttributeOpt: TcGlobals -> BuiltinAttribInfo option -> Attribs -> bool
D
Don Syme 已提交
2218

D
Don Syme 已提交
2219
val TryFindFSharpAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> Attrib option
D
Don Syme 已提交
2220

D
Don Syme 已提交
2221
val TryFindFSharpAttributeOpt: TcGlobals -> BuiltinAttribInfo option -> Attribs -> Attrib option
D
Don Syme 已提交
2222

D
Don Syme 已提交
2223
val TryFindFSharpBoolAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option
D
Don Syme 已提交
2224

D
Don Syme 已提交
2225
val TryFindFSharpBoolAttributeAssumeFalse: TcGlobals -> BuiltinAttribInfo -> Attribs -> bool option
D
Don Syme 已提交
2226

D
Don Syme 已提交
2227
val TryFindFSharpStringAttribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> string option
D
Don Syme 已提交
2228

D
Don Syme 已提交
2229
val TryFindFSharpInt32Attribute: TcGlobals -> BuiltinAttribInfo -> Attribs -> int32 option
L
latkin 已提交
2230

D
Don Syme 已提交
2231 2232 2233
/// Try to find a specific attribute on a type definition, where the attribute accepts a string argument.
///
/// This is used to detect the 'DefaultMemberAttribute' and 'ConditionalAttribute' attributes (on type definitions)
D
Don Syme 已提交
2234
val TryFindTyconRefStringAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> string option
D
Don Syme 已提交
2235 2236

/// Try to find a specific attribute on a type definition, where the attribute accepts a bool argument.
D
Don Syme 已提交
2237
val TryFindTyconRefBoolAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> bool option
D
Don Syme 已提交
2238 2239

/// Try to find a specific attribute on a type definition
D
Don Syme 已提交
2240
val TyconRefHasAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> bool
D
Don Syme 已提交
2241

2242 2243 2244
/// Try to find an attribute with a specific full name on a type definition
val TyconRefHasAttributeByName: range -> string -> TyconRef -> bool

D
Don Syme 已提交
2245
/// Try to find the AttributeUsage attribute, looking for the value of the AllowMultiple named parameter
D
Don Syme 已提交
2246
val TryFindAttributeUsageAttribute: TcGlobals -> range -> TyconRef -> bool option
D
Don Syme 已提交
2247

2248
#if !NO_TYPEPROVIDERS
L
latkin 已提交
2249
/// returns Some(assemblyName) for success
2250
val TryDecodeTypeProviderAssemblyAttr: ILAttribute -> string MaybeNull option
L
latkin 已提交
2251
#endif
D
Don Syme 已提交
2252

D
Don Syme 已提交
2253
val IsSignatureDataVersionAttr: ILAttribute -> bool
D
Don Syme 已提交
2254

2255
val TryFindAutoOpenAttr: ILAttribute -> string option
D
Don Syme 已提交
2256

2257
val TryFindInternalsVisibleToAttr: ILAttribute -> string option
L
latkin 已提交
2258

2259
val IsMatchingSignatureDataVersionAttr: ILVersionInfo -> ILAttribute -> bool
L
latkin 已提交
2260

D
Don Syme 已提交
2261
val mkCompilationMappingAttr: TcGlobals -> int -> ILAttribute
2262

D
Don Syme 已提交
2263
val mkCompilationMappingAttrWithSeqNum: TcGlobals -> int -> int -> ILAttribute
D
Don Syme 已提交
2264

D
Don Syme 已提交
2265
val mkCompilationMappingAttrWithVariantNumAndSeqNum: TcGlobals -> int -> int -> int -> ILAttribute
D
Don Syme 已提交
2266

D
Don Syme 已提交
2267
val mkCompilationMappingAttrForQuotationResource: TcGlobals -> string * ILTypeRef list -> ILAttribute
D
Don Syme 已提交
2268

D
Don Syme 已提交
2269
val mkCompilationArgumentCountsAttr: TcGlobals -> int list -> ILAttribute
D
Don Syme 已提交
2270

D
Don Syme 已提交
2271
val mkCompilationSourceNameAttr: TcGlobals -> string -> ILAttribute
D
Don Syme 已提交
2272

D
Don Syme 已提交
2273
val mkSignatureDataVersionAttr: TcGlobals -> ILVersionInfo -> ILAttribute
D
Don Syme 已提交
2274

D
Don Syme 已提交
2275
val mkCompilerGeneratedAttr: TcGlobals -> int -> ILAttribute
L
latkin 已提交
2276 2277 2278

//-------------------------------------------------------------------------
// More common type construction
2279
//-------------------------------------------------------------------------
L
latkin 已提交
2280

D
Don Syme 已提交
2281
val isInByrefTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
2282

D
Don Syme 已提交
2283
val isOutByrefTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
2284

D
Don Syme 已提交
2285
val isByrefTy: TcGlobals -> TType -> bool
2286

D
Don Syme 已提交
2287
val isNativePtrTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
2288

D
Don Syme 已提交
2289
val destByrefTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
2290

D
Don Syme 已提交
2291
val destNativePtrTy: TcGlobals -> TType -> TType
L
latkin 已提交
2292

D
Don Syme 已提交
2293
val isByrefTyconRef: TcGlobals -> TyconRef -> bool
D
Don Syme 已提交
2294

D
Don Syme 已提交
2295
val isByrefLikeTyconRef: TcGlobals -> range -> TyconRef -> bool
D
Don Syme 已提交
2296

D
Don Syme 已提交
2297
val isSpanLikeTyconRef: TcGlobals -> range -> TyconRef -> bool
D
Don Syme 已提交
2298

D
Don Syme 已提交
2299
val isByrefLikeTy: TcGlobals -> range -> TType -> bool
L
latkin 已提交
2300

W
Will Smith 已提交
2301
/// Check if the type is a byref-like but not a byref.
D
Don Syme 已提交
2302
val isSpanLikeTy: TcGlobals -> range -> TType -> bool
L
latkin 已提交
2303

D
Don Syme 已提交
2304
val isSpanTy: TcGlobals -> range -> TType -> bool
2305

D
Don Syme 已提交
2306
val tryDestSpanTy: TcGlobals -> range -> TType -> (TyconRef * TType) option
2307

D
Don Syme 已提交
2308
val destSpanTy: TcGlobals -> range -> TType -> (TyconRef * TType)
2309

D
Don Syme 已提交
2310
val isReadOnlySpanTy: TcGlobals -> range -> TType -> bool
2311

D
Don Syme 已提交
2312
val tryDestReadOnlySpanTy: TcGlobals -> range -> TType -> (TyconRef * TType) option
2313

D
Don Syme 已提交
2314
val destReadOnlySpanTy: TcGlobals -> range -> TType -> (TyconRef * TType)
2315

L
latkin 已提交
2316 2317
//-------------------------------------------------------------------------
// Tuple constructors/destructors
2318
//-------------------------------------------------------------------------
L
latkin 已提交
2319

D
Don Syme 已提交
2320
val isRefTupleExpr: Expr -> bool
D
Don Syme 已提交
2321

D
Don Syme 已提交
2322
val tryDestRefTupleExpr: Expr -> Exprs
D
Don Syme 已提交
2323

D
Don Syme 已提交
2324
val mkAnyTupledTy: TcGlobals -> TupInfo -> TType list -> TType
D
Don Syme 已提交
2325

2326
val mkAnyTupled: TcGlobals -> range -> TupInfo -> Exprs -> TType list -> Expr
D
Don Syme 已提交
2327

2328
val mkRefTupled: TcGlobals -> range -> Exprs -> TType list -> Expr
D
Don Syme 已提交
2329

2330
val mkRefTupledNoTypes: TcGlobals -> range -> Exprs -> Expr
D
Don Syme 已提交
2331

D
Don Syme 已提交
2332
val mkRefTupledTy: TcGlobals -> TType list -> TType
D
Don Syme 已提交
2333

D
Don Syme 已提交
2334
val mkRefTupledVarsTy: TcGlobals -> Val list -> TType
L
latkin 已提交
2335

2336
val mkRefTupledVars: TcGlobals -> range -> Val list -> Expr
D
Don Syme 已提交
2337

D
Don Syme 已提交
2338
val mkMethodTy: TcGlobals -> TType list list -> TType -> TType
D
Don Syme 已提交
2339

D
Don Syme 已提交
2340
val mkAnyAnonRecdTy: TcGlobals -> AnonRecdTypeInfo -> TType list -> TType
D
Don Syme 已提交
2341

F
Florian Verdonck 已提交
2342
val mkAnonRecd: TcGlobals -> range -> AnonRecdTypeInfo -> Ident[] -> Exprs -> TType list -> Expr
L
latkin 已提交
2343

2344
val AdjustValForExpectedValReprInfo: TcGlobals -> range -> ValRef -> ValUseFlag -> ValReprInfo -> Expr * TType
D
Don Syme 已提交
2345

2346
val AdjustValToHaveValReprInfo: Val -> ParentRef -> ValReprInfo -> unit
D
Don Syme 已提交
2347

D
Don Syme 已提交
2348
val LinearizeTopMatch: TcGlobals -> ParentRef -> Expr -> Expr
D
Don Syme 已提交
2349

D
Don Syme 已提交
2350
val AdjustPossibleSubsumptionExpr: TcGlobals -> Expr -> Exprs -> (Expr * Exprs) option
D
Don Syme 已提交
2351

D
Don Syme 已提交
2352
val NormalizeAndAdjustPossibleSubsumptionExprs: TcGlobals -> Expr -> Expr
L
latkin 已提交
2353 2354 2355

//-------------------------------------------------------------------------
// XmlDoc signatures, used by both VS mode and XML-help emit
2356
//-------------------------------------------------------------------------
L
latkin 已提交
2357

D
Don Syme 已提交
2358
val buildAccessPath: CompilationPath option -> string
L
latkin 已提交
2359

D
Don Syme 已提交
2360
val XmlDocArgsEnc: TcGlobals -> Typars * Typars -> TType list -> string
D
Don Syme 已提交
2361

2362
val XmlDocSigOfVal: TcGlobals -> full: bool -> string -> Val -> string
D
Don Syme 已提交
2363

2364
val XmlDocSigOfUnionCase: path: string list -> string
D
Don Syme 已提交
2365

2366
val XmlDocSigOfField: path: string list -> string
D
Don Syme 已提交
2367

2368
val XmlDocSigOfProperty: path: string list -> string
D
Don Syme 已提交
2369

2370
val XmlDocSigOfTycon: path: string list -> string
D
Don Syme 已提交
2371

2372
val XmlDocSigOfSubModul: path: string list -> string
D
Don Syme 已提交
2373

2374
val XmlDocSigOfEntity: eref: EntityRef -> string
L
latkin 已提交
2375 2376 2377

//---------------------------------------------------------------------------
// Resolve static optimizations
2378
//-------------------------------------------------------------------------
D
Don Syme 已提交
2379

2380
type StaticOptimizationAnswer =
L
latkin 已提交
2381 2382 2383
    | Yes = 1y
    | No = -1y
    | Unknown = 0y
D
Don Syme 已提交
2384

D
Don Syme 已提交
2385
val DecideStaticOptimizations: TcGlobals -> StaticOptimization list -> haveWitnesses: bool -> StaticOptimizationAnswer
L
latkin 已提交
2386

D
Don Syme 已提交
2387
val mkStaticOptimizationExpr: TcGlobals -> StaticOptimization list * Expr * Expr * range -> Expr
L
latkin 已提交
2388

D
Don Syme 已提交
2389
/// Build for loops
2390
val mkFastForLoop: TcGlobals -> DebugPointAtFor * DebugPointAtInOrTo * range * Val * Expr * bool * Expr * Expr -> Expr
L
latkin 已提交
2391 2392 2393

//---------------------------------------------------------------------------
// Active pattern helpers
2394
//-------------------------------------------------------------------------
L
latkin 已提交
2395

2396
type ActivePatternElemRef with
D
Don Syme 已提交
2397

2398 2399 2400 2401 2402
    member LogicalName: string

    member DisplayNameCore: string

    member DisplayName: string
L
latkin 已提交
2403

D
Don Syme 已提交
2404
val TryGetActivePatternInfo: ValRef -> PrettyNaming.ActivePatternInfo option
D
Don Syme 已提交
2405

2406
val mkChoiceCaseRef: g: TcGlobals -> m: range -> n: int -> i: int -> UnionCaseRef
L
latkin 已提交
2407

2408
type PrettyNaming.ActivePatternInfo with
D
Don Syme 已提交
2409

2410 2411 2412 2413 2414
    /// Get the core of the display name for one of the cases of the active pattern, by index
    member DisplayNameCoreByIdx: idx: int -> string

    /// Get the display name for one of the cases of the active pattern, by index
    member DisplayNameByIdx: idx: int -> string
L
latkin 已提交
2415

2416
    /// Get the result type for the active pattern
2417
    member ResultType: g: TcGlobals -> range -> TType list -> bool -> TType
D
Don Syme 已提交
2418

2419
    /// Get the overall type for a function that implements the active pattern
D
Don Syme 已提交
2420
    member OverallType: g: TcGlobals -> m: range -> argTy: TType -> retTys: TType list -> isStruct: bool -> TType
L
latkin 已提交
2421

D
Don Syme 已提交
2422
val doesActivePatternHaveFreeTypars: TcGlobals -> ValRef -> bool
L
latkin 已提交
2423 2424 2425

//---------------------------------------------------------------------------
// Structural rewrites
2426
//-------------------------------------------------------------------------
L
latkin 已提交
2427 2428

[<NoEquality; NoComparison>]
2429
type ExprRewritingEnv =
D
Don Syme 已提交
2430 2431 2432
    { PreIntercept: ((Expr -> Expr) -> Expr -> Expr option) option
      PostTransform: Expr -> Expr option
      PreInterceptBinding: ((Expr -> Expr) -> Binding -> Binding option) option
2433 2434
      RewriteQuotations: bool
      StackGuard: StackGuard }
L
latkin 已提交
2435

2436 2437
val RewriteDecisionTree: ExprRewritingEnv -> DecisionTree -> DecisionTree

D
Don Syme 已提交
2438
val RewriteExpr: ExprRewritingEnv -> Expr -> Expr
D
Don Syme 已提交
2439

D
Don Syme 已提交
2440
val RewriteImplFile: ExprRewritingEnv -> CheckedImplFile -> CheckedImplFile
L
latkin 已提交
2441

E
Eugene Auduchinok 已提交
2442
val IsGenericValWithGenericConstraints: TcGlobals -> Val -> bool
L
latkin 已提交
2443

2444
type Entity with
D
Don Syme 已提交
2445

D
Don Syme 已提交
2446
    member HasInterface: TcGlobals -> TType -> bool
D
Don Syme 已提交
2447

D
Don Syme 已提交
2448
    member HasOverride: TcGlobals -> string -> TType list -> bool
D
Don Syme 已提交
2449

D
Don Syme 已提交
2450
    member HasMember: TcGlobals -> string -> TType list -> bool
L
latkin 已提交
2451

2452
type EntityRef with
D
Don Syme 已提交
2453

D
Don Syme 已提交
2454
    member HasInterface: TcGlobals -> TType -> bool
D
Don Syme 已提交
2455

D
Don Syme 已提交
2456
    member HasOverride: TcGlobals -> string -> TType list -> bool
D
Don Syme 已提交
2457

D
Don Syme 已提交
2458
    member HasMember: TcGlobals -> string -> TType list -> bool
L
latkin 已提交
2459

D
Don Syme 已提交
2460
val (|AttribBitwiseOrExpr|_|): TcGlobals -> Expr -> (Expr * Expr) option
D
Don Syme 已提交
2461

D
Don Syme 已提交
2462
val (|EnumExpr|_|): TcGlobals -> Expr -> Expr option
D
Don Syme 已提交
2463

D
Don Syme 已提交
2464
val (|TypeOfExpr|_|): TcGlobals -> Expr -> TType option
D
Don Syme 已提交
2465

D
Don Syme 已提交
2466
val (|TypeDefOfExpr|_|): TcGlobals -> Expr -> TType option
D
Don Syme 已提交
2467 2468 2469

val isNameOfValRef: TcGlobals -> ValRef -> bool

D
Don Syme 已提交
2470
val (|NameOfExpr|_|): TcGlobals -> Expr -> TType option
D
Don Syme 已提交
2471

D
Don Syme 已提交
2472
val (|SeqExpr|_|): TcGlobals -> Expr -> unit option
L
latkin 已提交
2473 2474

val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr
D
Don Syme 已提交
2475

D
Don Syme 已提交
2476
val EvaledAttribExprEquality: TcGlobals -> Expr -> Expr -> bool
D
Don Syme 已提交
2477

L
latkin 已提交
2478 2479
val IsSimpleSyntacticConstantExpr: TcGlobals -> Expr -> bool

2480 2481
val (|ConstToILFieldInit|_|): Const -> ILFieldInit option

2482
val (|ExtractAttribNamedArg|_|): string -> AttribNamedArg list -> AttribExpr option
D
Don Syme 已提交
2483

D
Don Syme 已提交
2484
val (|AttribInt32Arg|_|): AttribExpr -> int32 option
D
Don Syme 已提交
2485

D
Don Syme 已提交
2486
val (|AttribInt16Arg|_|): AttribExpr -> int16 option
D
Don Syme 已提交
2487

D
Don Syme 已提交
2488
val (|AttribBoolArg|_|): AttribExpr -> bool option
D
Don Syme 已提交
2489

D
Don Syme 已提交
2490
val (|AttribStringArg|_|): AttribExpr -> string option
L
latkin 已提交
2491

D
Don Syme 已提交
2492
val (|Int32Expr|_|): Expr -> int32 option
L
latkin 已提交
2493 2494 2495

/// Determines types that are potentially known to satisfy the 'comparable' constraint and returns
/// a set of residual types that must also satisfy the constraint
D
Don Syme 已提交
2496
val (|SpecialComparableHeadType|_|): TcGlobals -> TType -> TType list option
D
Don Syme 已提交
2497

D
Don Syme 已提交
2498
val (|SpecialEquatableHeadType|_|): TcGlobals -> TType -> TType list option
D
Don Syme 已提交
2499

D
Don Syme 已提交
2500
val (|SpecialNotEquatableHeadType|_|): TcGlobals -> TType -> unit option
L
latkin 已提交
2501

2502 2503 2504
type OptimizeForExpressionOptions =
    | OptimizeIntRangesOnly
    | OptimizeAllForExpressions
D
Don Syme 已提交
2505

2506
val DetectAndOptimizeForEachExpression: TcGlobals -> OptimizeForExpressionOptions -> Expr -> Expr
2507

D
Don Syme 已提交
2508
val TryEliminateDesugaredConstants: TcGlobals -> range -> Const -> Expr option
L
latkin 已提交
2509

D
Don Syme 已提交
2510
val MemberIsExplicitImpl: TcGlobals -> ValMemberInfo -> bool
D
Don Syme 已提交
2511

D
Don Syme 已提交
2512
val ValIsExplicitImpl: TcGlobals -> Val -> bool
D
Don Syme 已提交
2513

D
Don Syme 已提交
2514
val ValRefIsExplicitImpl: TcGlobals -> ValRef -> bool
L
latkin 已提交
2515

2516 2517
val (|LinearMatchExpr|_|):
    Expr -> (DebugPointAtBinding * range * DecisionTree * DecisionTreeTarget * Expr * range * TType) option
D
Don Syme 已提交
2518

2519 2520
val rebuildLinearMatchExpr:
    DebugPointAtBinding * range * DecisionTree * DecisionTreeTarget * Expr * range * TType -> Expr
L
latkin 已提交
2521

D
Don Syme 已提交
2522
val (|LinearOpExpr|_|): Expr -> (TOp * TypeInst * Expr list * Expr * range) option
2523

2524
val rebuildLinearOpExpr: TOp * TypeInst * Expr list * Expr * range -> Expr
2525

D
Don Syme 已提交
2526
val mkCoerceIfNeeded: TcGlobals -> tgtTy: TType -> srcTy: TType -> Expr -> Expr
L
latkin 已提交
2527

D
Don Syme 已提交
2528
val (|InnerExprPat|): Expr -> Expr
2529

D
Don Syme 已提交
2530
val allValsOfModDef: ModuleOrNamespaceContents -> seq<Val>
D
Don Syme 已提交
2531

2532
val BindUnitVars: TcGlobals -> Val list * ArgReprInfo list * Expr -> Val list * Expr
D
Don Syme 已提交
2533 2534 2535 2536 2537

val isThreadOrContextStatic: TcGlobals -> Attrib list -> bool

val mkUnitDelayLambda: TcGlobals -> range -> Expr -> Expr

2538 2539 2540 2541
val GenWitnessArgTys: TcGlobals -> TraitWitnessInfo -> TType list list

val GenWitnessTys: TcGlobals -> TraitWitnessInfos -> TType list

2542
val GenWitnessTy: TcGlobals -> TraitWitnessInfo -> TType
2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555

val GetTraitConstraintInfosOfTypars: TcGlobals -> Typars -> TraitConstraintInfo list

val GetTraitWitnessInfosOfTypars: TcGlobals -> numParentTypars: int -> typars: Typars -> TraitWitnessInfos

/// An immutable mappping from witnesses to some data.
///
/// Note: this uses an immutable HashMap/Dictionary with an IEqualityComparer that captures TcGlobals, see EmptyTraitWitnessInfoHashMap
type TraitWitnessInfoHashMap<'T> = ImmutableDictionary<TraitWitnessInfo, 'T>

/// Create an empty immutable mapping from witnesses to some data
val EmptyTraitWitnessInfoHashMap: TcGlobals -> TraitWitnessInfoHashMap<'T>

2556
/// Match expressions that are an application of a particular F# function value
D
Don Syme 已提交
2557
val (|ValApp|_|): TcGlobals -> ValRef -> Expr -> (TypeInst * Exprs * range) option
2558

2559
/// Match expressions that represent the creation of an instance of an F# delegate value
2560
val (|NewDelegateExpr|_|): TcGlobals -> Expr -> (Unique * Val list * Expr * range * (Expr -> Expr)) option
2561 2562

/// Match a .Invoke on a delegate
2563
val (|DelegateInvokeExpr|_|): TcGlobals -> Expr -> (Expr * TType * Expr * Expr * range) option
2564 2565

/// Match 'if __useResumableCode then ... else ...' expressions
2566
val (|IfUseResumableStateMachinesExpr|_|): TcGlobals -> Expr -> (Expr * Expr) option
2567

2568 2569
val CombineCcuContentFragments: range -> ModuleOrNamespaceType list -> ModuleOrNamespaceType

2570 2571 2572 2573
/// Recognise a 'match __resumableEntry() with ...' expression
val (|ResumableEntryMatchExpr|_|): g: TcGlobals -> Expr -> (Expr * Val * Expr * (Expr * Expr -> Expr)) option

/// Recognise a '__stateMachine' expression
2574 2575
val (|StructStateMachineExpr|_|):
    g: TcGlobals -> expr: Expr -> (TType * (Val * Expr) * (Val * Val * Expr) * (Val * Expr)) option
2576 2577 2578 2579

/// Recognise a sequential or binding construct in a resumable code
val (|SequentialResumableCode|_|): g: TcGlobals -> Expr -> (Expr * Expr * range * (Expr -> Expr -> Expr)) option

2580 2581 2582
/// Recognise a '__debugPoint' expression
val (|DebugPointExpr|_|): g: TcGlobals -> Expr -> string option

2583 2584 2585
/// Recognise a '__resumeAt' expression
val (|ResumeAtExpr|_|): g: TcGlobals -> Expr -> Expr option

2586 2587 2588
/// Recognise a while expression
val (|WhileExpr|_|): Expr -> (DebugPointAtWhile * SpecialWhileLoopMarker * Expr * Expr * range) option

2589
/// Recognise an integer for-loop expression
2590 2591
val (|IntegerForLoopExpr|_|):
    Expr -> (DebugPointAtFor * DebugPointAtInOrTo * ForLoopStyle * Expr * Expr * Val * Expr * range) option
2592

J
Jeff B 已提交
2593
/// Recognise a try-with expression
2594 2595
val (|TryWithExpr|_|):
    Expr -> (DebugPointAtTry * DebugPointAtWith * TType * Expr * Val * Expr * Val * Expr * range) option
2596 2597 2598 2599 2600

/// Recognise a try-finally expression
val (|TryFinallyExpr|_|): Expr -> (DebugPointAtTry * DebugPointAtFinally * TType * Expr * Expr * range) option

/// Add a label to use as the target for a goto
2601
val mkLabelled: range -> ILCodeLabel -> Expr -> Expr
2602

2603 2604 2605 2606 2607 2608
/// Any delegate type with ResumableCode attribute, or any function returning such a delegate type
val isResumableCodeTy: TcGlobals -> TType -> bool

/// The delegate type ResumableCode, or any function returning this a delegate type
val isReturnsResumableCodeTy: TcGlobals -> TType -> bool

2609 2610
/// Shared helper for binding attributes
val TryBindTyconRefAttribute:
2611 2612
    g: TcGlobals ->
    m: range ->
2613
    BuiltinAttribInfo ->
2614 2615 2616 2617 2618
    tcref: TyconRef ->
    f1: (ILAttribElem list * ILAttributeNamedArg list -> 'a option) ->
    f2: (Attrib -> 'a option) ->
    f3: (obj option list * (string * obj option) list -> 'a option) ->
        'a option
2619 2620

val (|ResumableCodeInvoke|_|):
2621
    g: TcGlobals -> expr: Expr -> (Expr * Expr * Expr list * range * (Expr * Expr list -> Expr)) option
2622

2623
val (|OpPipeRight|_|): g: TcGlobals -> expr: Expr -> (TType * Expr * Expr * range) option
2624

2625
val (|OpPipeRight2|_|): g: TcGlobals -> expr: Expr -> (TType * Expr * Expr * Expr * range) option
2626

2627
val (|OpPipeRight3|_|): g: TcGlobals -> expr: Expr -> (TType * Expr * Expr * Expr * Expr * range) option
2628

2629 2630 2631 2632
val mkDebugPoint: m: range -> expr: Expr -> Expr

/// Match an if...then...else expression or the result of "a && b" or "a || b"
val (|IfThenElseExpr|_|): expr: Expr -> (Expr * Expr * Expr) option
2633 2634

/// Determine if a value is a method implementing an interface dispatch slot using a private method impl
2635
val ComputeUseMethodImpl: g: TcGlobals -> v: Val -> bool
D
Don Syme 已提交
2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665

/// Detect the de-sugared form of a 'yield x' within a 'seq { ... }'
val (|SeqYield|_|): TcGlobals -> Expr -> (Expr * range) option

/// Detect the de-sugared form of a 'expr; expr' within a 'seq { ... }'
val (|SeqAppend|_|): TcGlobals -> Expr -> (Expr * Expr * range) option

/// Detect the de-sugared form of a 'while gd do expr' within a 'seq { ... }'
val (|SeqWhile|_|): TcGlobals -> Expr -> (Expr * Expr * DebugPointAtWhile * range) option

/// Detect the de-sugared form of a 'try .. finally .. ' within a 'seq { ... }'
val (|SeqTryFinally|_|): TcGlobals -> Expr -> (Expr * Expr * DebugPointAtTry * DebugPointAtFinally * range) option

/// Detect the de-sugared form of a 'use x = ..' within a 'seq { ... }'
val (|SeqUsing|_|): TcGlobals -> Expr -> (Expr * Val * Expr * TType * DebugPointAtBinding * range) option

/// Detect the de-sugared form of a 'for x in collection do ..' within a 'seq { ... }'
val (|SeqForEach|_|): TcGlobals -> Expr -> (Expr * Val * Expr * TType * range * range * DebugPointAtInOrTo) option

/// Detect the outer 'Seq.delay' added for a construct 'seq { ... }'
val (|SeqDelay|_|): TcGlobals -> Expr -> (Expr * TType) option

/// Detect a 'Seq.empty' implicit in the implied 'else' branch of an 'if .. then' in a seq { ... }
val (|SeqEmpty|_|): TcGlobals -> Expr -> range option

/// Detect a 'seq { ... }' expression
val (|Seq|_|): TcGlobals -> Expr -> (Expr * TType) option

/// Indicates if an F# type is the type associated with an F# exception declaration
val isFSharpExceptionTy: g: TcGlobals -> ty: TType -> bool