TypedTreeOps.fsi 101.3 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

D
Don Syme 已提交
799 800 801 802 803 804
/// Represents the options to activate when collecting free variables
[<Sealed>]
type FreeVarOptions =
    /// During backend code generation of state machines, register a template replacement for struct types.
    /// This may introduce new free variables related to the instantiation of the struct type.
    member WithTemplateReplacement: (TyconRef -> bool) * Typars -> FreeVarOptions
L
latkin 已提交
805

D
Don Syme 已提交
806
val CollectLocalsNoCaching: FreeVarOptions
D
Don Syme 已提交
807

D
Don Syme 已提交
808
val CollectTyparsNoCaching: FreeVarOptions
D
Don Syme 已提交
809

D
Don Syme 已提交
810
val CollectTyparsAndLocalsNoCaching: FreeVarOptions
D
Don Syme 已提交
811

D
Don Syme 已提交
812
val CollectTyparsAndLocals: FreeVarOptions
D
Don Syme 已提交
813

D
Don Syme 已提交
814
val CollectLocals: FreeVarOptions
D
Don Syme 已提交
815

816 817 818 819
val CollectLocalsWithStackGuard: unit -> FreeVarOptions

val CollectTyparsAndLocalsWithStackGuard: unit -> FreeVarOptions

D
Don Syme 已提交
820
val CollectTypars: FreeVarOptions
D
Don Syme 已提交
821

D
Don Syme 已提交
822
val CollectAllNoCaching: FreeVarOptions
D
Don Syme 已提交
823

D
Don Syme 已提交
824
val CollectAll: FreeVarOptions
L
latkin 已提交
825

D
Don Syme 已提交
826
val accFreeInTypes: FreeVarOptions -> TType list -> FreeTyvars -> FreeTyvars
D
Don Syme 已提交
827

D
Don Syme 已提交
828
val accFreeInType: FreeVarOptions -> TType -> FreeTyvars -> FreeTyvars
D
Don Syme 已提交
829

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

D
Don Syme 已提交
832
val freeInType: FreeVarOptions -> TType -> FreeTyvars
D
Don Syme 已提交
833

D
Don Syme 已提交
834
val freeInTypes: FreeVarOptions -> TType list -> FreeTyvars
D
Don Syme 已提交
835

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

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

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

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

D
Don Syme 已提交
845
val freeInModuleTy: ModuleOrNamespaceType -> FreeTyvars
L
latkin 已提交
846

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

849 850 851 852
//---------------------------------------------------------------------------
// TType modifications and comparisons
//---------------------------------------------------------------------------

D
Don Syme 已提交
853
val stripMeasuresFromTy: TcGlobals -> TType -> TType
854

L
latkin 已提交
855 856
//-------------------------------------------------------------------------
// Equivalence of types (up to substitution of type variables in the left-hand type)
857
//-------------------------------------------------------------------------
L
latkin 已提交
858 859

[<NoEquality; NoComparison>]
860
type TypeEquivEnv =
D
Don Syme 已提交
861
    { EquivTypars: TyparMap<TType>
L
latkin 已提交
862 863
      EquivTycons: TyconRefRemap }

D
Don Syme 已提交
864
    static member Empty: TypeEquivEnv
D
Don Syme 已提交
865

D
Don Syme 已提交
866
    member BindEquivTypars: Typars -> Typars -> TypeEquivEnv
D
Don Syme 已提交
867

D
Don Syme 已提交
868
    static member FromTyparInst: TyparInstantiation -> TypeEquivEnv
D
Don Syme 已提交
869

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

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

D
Don Syme 已提交
874
val traitsAEquiv: TcGlobals -> TypeEquivEnv -> TraitConstraintInfo -> TraitConstraintInfo -> bool
D
Don Syme 已提交
875

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

D
Don Syme 已提交
878
val traitKeysAEquiv: TcGlobals -> TypeEquivEnv -> TraitWitnessInfo -> TraitWitnessInfo -> bool
879

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

D
Don Syme 已提交
882
val typarConstraintsAEquiv: TcGlobals -> TypeEquivEnv -> TyparConstraint -> TyparConstraint -> bool
D
Don Syme 已提交
883

D
Don Syme 已提交
884
val typarsAEquiv: TcGlobals -> TypeEquivEnv -> Typars -> Typars -> bool
D
Don Syme 已提交
885

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

D
Don Syme 已提交
888
val typeAEquiv: TcGlobals -> TypeEquivEnv -> TType -> TType -> bool
D
Don Syme 已提交
889

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

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

D
Don Syme 已提交
894
val tcrefAEquiv: TcGlobals -> TypeEquivEnv -> TyconRef -> TyconRef -> bool
D
Don Syme 已提交
895

D
Don Syme 已提交
896
val valLinkageAEquiv: TcGlobals -> TypeEquivEnv -> Val -> Val -> bool
D
Don Syme 已提交
897

D
Don Syme 已提交
898
val anonInfoEquiv: AnonRecdTypeInfo -> AnonRecdTypeInfo -> bool
L
latkin 已提交
899 900 901 902 903 904

//-------------------------------------------------------------------------
// 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 已提交
905
val isErasedType: TcGlobals -> TType -> bool
L
latkin 已提交
906 907

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

//-------------------------------------------------------------------------
// Unit operations
912
//-------------------------------------------------------------------------
913

D
Don Syme 已提交
914
val MeasurePower: Measure -> int -> Measure
D
Don Syme 已提交
915

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

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

D
Don Syme 已提交
920
val ProdMeasures: Measure list -> Measure
D
Don Syme 已提交
921

D
Don Syme 已提交
922
val MeasureVarExponent: Typar -> Measure -> Rational
D
Don Syme 已提交
923

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

D
Don Syme 已提交
926
val normalizeMeasure: TcGlobals -> Measure -> Measure
927

L
latkin 已提交
928
//-------------------------------------------------------------------------
929 930
// Members
//-------------------------------------------------------------------------
L
latkin 已提交
931

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

934 935
val GetTypeOfMemberInMemberForm:
    TcGlobals -> ValRef -> Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
D
Don Syme 已提交
936

937 938
val GetTypeOfIntrinsicMemberInCompiledForm:
    TcGlobals -> ValRef -> Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
D
Don Syme 已提交
939

940 941 942 943 944 945 946 947
val GetMemberTypeInMemberForm:
    TcGlobals ->
    SynMemberFlags ->
    ValReprInfo ->
    int ->
    TType ->
    range ->
        Typars * TraitWitnessInfos * CurriedArgInfos * TType option * ArgReprInfo
L
latkin 已提交
948 949

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

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

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

959 960 961
/// Count the number of type parameters on the enclosing type
val CountEnclosingTyparsOfActualParentOfVal: Val -> int

D
Don Syme 已提交
962
val ReturnTypeOfPropertyVal: TcGlobals -> Val -> TType
D
Don Syme 已提交
963

964
val ArgInfosOfPropertyVal: TcGlobals -> Val -> UncurriedArgInfos
D
Don Syme 已提交
965

966
val ArgInfosOfMember: TcGlobals -> ValRef -> CurriedArgInfos
L
latkin 已提交
967

D
Don Syme 已提交
968
val GetMemberCallInfo: TcGlobals -> ValRef * ValUseFlag -> int * bool * bool * bool * bool * bool * bool * bool
L
latkin 已提交
969 970 971

//-------------------------------------------------------------------------
// Printing
972 973
//-------------------------------------------------------------------------

L
latkin 已提交
974 975 976
type TyparConstraintsWithTypars = (Typar * TyparConstraint) list

module PrettyTypes =
D
Don Syme 已提交
977

D
Don Syme 已提交
978
    val NeedsPrettyTyparName: Typar -> bool
D
Don Syme 已提交
979

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

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

D
Don Syme 已提交
984
    val PrettifyType: TcGlobals -> TType -> TType * TyparConstraintsWithTypars
D
Don Syme 已提交
985

986
    val PrettifyInstAndTyparsAndType:
D
Don Syme 已提交
987 988 989
        TcGlobals ->
        TyparInstantiation * Typars * TType ->
            (TyparInstantiation * Typars * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
990

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

D
Don Syme 已提交
993
    val PrettifyTypes: TcGlobals -> TTypes -> TTypes * TyparConstraintsWithTypars
994

995 996 997
    /// 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.
998 999
    val PrettifyDiscriminantAndTypePairs:
        TcGlobals -> ('Discriminant * TType) list -> ('Discriminant * TType) list * TyparConstraintsWithTypars
D
Don Syme 已提交
1000

D
Don Syme 已提交
1001
    val PrettifyInst: TcGlobals -> TyparInstantiation -> TyparInstantiation * TyparConstraintsWithTypars
D
Don Syme 已提交
1002

D
Don Syme 已提交
1003 1004
    val PrettifyInstAndType:
        TcGlobals -> TyparInstantiation * TType -> (TyparInstantiation * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1005

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

1009
    val PrettifyInstAndSig:
D
Don Syme 已提交
1010 1011 1012
        TcGlobals ->
        TyparInstantiation * TTypes * TType ->
            (TyparInstantiation * TTypes * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1013

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

1016 1017
    val PrettifyCurriedSigTypes:
        TcGlobals -> TType list list * TType -> (TType list list * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1018

1019 1020
    val PrettifyInstAndUncurriedSig:
        TcGlobals ->
D
Don Syme 已提交
1021 1022
        TyparInstantiation * UncurriedArgInfos * TType ->
            (TyparInstantiation * UncurriedArgInfos * TType) * TyparConstraintsWithTypars
D
Don Syme 已提交
1023

1024 1025
    val PrettifyInstAndCurriedSig:
        TcGlobals ->
D
Don Syme 已提交
1026 1027
        TyparInstantiation * TTypes * CurriedArgInfos * TType ->
            (TyparInstantiation * TTypes * CurriedArgInfos * TType) * TyparConstraintsWithTypars
L
latkin 已提交
1028

1029 1030 1031 1032 1033 1034 1035 1036 1037
/// 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 已提交
1038
[<NoEquality; NoComparison>]
1039
type DisplayEnv =
F
Florian Verdonck 已提交
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 1067 1068 1069 1070 1071
    {
        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 已提交
1072

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

L
latkin 已提交
1075 1076
    static member Empty: TcGlobals -> DisplayEnv

D
Don Syme 已提交
1077
    member AddAccessibility: Accessibility -> DisplayEnv
D
Don Syme 已提交
1078

D
Don Syme 已提交
1079
    member AddOpenPath: string list -> DisplayEnv
D
Don Syme 已提交
1080

D
Don Syme 已提交
1081
    member AddOpenModuleOrNamespace: ModuleOrNamespaceRef -> DisplayEnv
L
latkin 已提交
1082

D
Don Syme 已提交
1083
    member UseGenericParameterStyle: GenericParameterStyle -> DisplayEnv
1084

D
Don Syme 已提交
1085 1086
    static member InitialForSigFileGeneration: TcGlobals -> DisplayEnv

D
Don Syme 已提交
1087
val tagEntityRefName: xref: EntityRef -> name: string -> TaggedText
L
latkin 已提交
1088 1089

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

D
Don Syme 已提交
1092
val fullDisplayTextOfParentOfModRef: ModuleOrNamespaceRef -> ValueOption<string>
D
Don Syme 已提交
1093

D
Don Syme 已提交
1094
val fullDisplayTextOfValRef: ValRef -> string
D
Don Syme 已提交
1095

D
Don Syme 已提交
1096
val fullDisplayTextOfValRefAsLayout: ValRef -> Layout
D
Don Syme 已提交
1097

D
Don Syme 已提交
1098
val fullDisplayTextOfTyconRef: TyconRef -> string
D
Don Syme 已提交
1099

D
Don Syme 已提交
1100
val fullDisplayTextOfTyconRefAsLayout: TyconRef -> Layout
D
Don Syme 已提交
1101

D
Don Syme 已提交
1102
val fullDisplayTextOfExnRef: TyconRef -> string
D
Don Syme 已提交
1103

D
Don Syme 已提交
1104
val fullDisplayTextOfExnRefAsLayout: TyconRef -> Layout
D
Don Syme 已提交
1105

D
Don Syme 已提交
1106
val fullDisplayTextOfUnionCaseRef: UnionCaseRef -> string
D
Don Syme 已提交
1107

D
Don Syme 已提交
1108
val fullDisplayTextOfRecdFieldRef: RecdFieldRef -> string
L
latkin 已提交
1109

D
Don Syme 已提交
1110
val ticksAndArgCountTextOfTyconRef: TyconRef -> string
L
latkin 已提交
1111 1112

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

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

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

D
Don Syme 已提交
1119
val prefixOfStaticReq: TyparStaticReq -> string
D
Don Syme 已提交
1120

D
Don Syme 已提交
1121
val prefixOfInferenceTypar: Typar -> string
L
latkin 已提交
1122 1123

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

L
latkin 已提交
1126
    type TypeSimplificationInfo =
D
Don Syme 已提交
1127
        { singletons: Typar Zset
1128
          inplaceConstraints: Zmap<Typar, TType>
D
Don Syme 已提交
1129
          postfixConstraints: TyparConstraintsWithTypars }
D
Don Syme 已提交
1130

D
Don Syme 已提交
1131
    val typeSimplificationInfo0: TypeSimplificationInfo
L
latkin 已提交
1132

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

D
Don Syme 已提交
1135
val superOfTycon: TcGlobals -> Tycon -> TType
D
Don Syme 已提交
1136

D
Don Syme 已提交
1137
val abstractSlotValRefsOfTycons: Tycon list -> ValRef list
D
Don Syme 已提交
1138

D
Don Syme 已提交
1139
val abstractSlotValsOfTycons: Tycon list -> Val list
L
latkin 已提交
1140 1141 1142

//-------------------------------------------------------------------------
// Free variables in expressions etc.
1143
//-------------------------------------------------------------------------
L
latkin 已提交
1144

D
Don Syme 已提交
1145
val emptyFreeVars: FreeVars
D
Don Syme 已提交
1146

D
Don Syme 已提交
1147
val unionFreeVars: FreeVars -> FreeVars -> FreeVars
L
latkin 已提交
1148

D
Don Syme 已提交
1149
val accFreeInTargets: FreeVarOptions -> DecisionTreeTarget array -> FreeVars -> FreeVars
D
Don Syme 已提交
1150

D
Don Syme 已提交
1151
val accFreeInExprs: FreeVarOptions -> Exprs -> FreeVars -> FreeVars
D
Don Syme 已提交
1152

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

D
Don Syme 已提交
1155
val accFreeInDecisionTree: FreeVarOptions -> DecisionTree -> FreeVars -> FreeVars
L
latkin 已提交
1156 1157

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

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

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

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

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

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

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

D
Don Syme 已提交
1182
/// Given a (curried) lambda expression, pull off its arguments
D
Don Syme 已提交
1183
val stripTopLambda: Expr * TType -> Typars * Val list list * Expr * TType
D
Don Syme 已提交
1184 1185

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

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

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

D
Don Syme 已提交
1196
/// Indicate what should happen to value definitions when copying expressions
1197
type ValCopyFlag =
L
latkin 已提交
1198 1199
    | CloneAll
    | CloneAllAndMarkExprValsAsCompilerGenerated
D
Don Syme 已提交
1200

1201
    /// OnlyCloneExprVals is a nasty setting to reuse the cloning logic in a mode where all
D
Don Syme 已提交
1202
    /// Tycon and "module/member" Val objects keep their identity, but the Val objects for all Expr bindings
1203
    /// are cloned. This is used to 'fixup' the TAST created by tlr.fs
D
Don Syme 已提交
1204 1205 1206
    ///
    /// 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 已提交
1207 1208
    | OnlyCloneExprVals

D
Don Syme 已提交
1209
/// Remap a reference to a type definition using the given remapping substitution
D
Don Syme 已提交
1210
val remapTyconRef: TyconRefRemap -> TyconRef -> TyconRef
D
Don Syme 已提交
1211 1212

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

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

/// Remap a reference to a value using the given remapping substitution
D
Don Syme 已提交
1219
val remapValRef: Remap -> ValRef -> ValRef
D
Don Syme 已提交
1220 1221

/// Remap an expression using the given remapping substitution
D
Don Syme 已提交
1222
val remapExpr: TcGlobals -> ValCopyFlag -> Remap -> Expr -> Expr
D
Don Syme 已提交
1223 1224

/// Remap an attribute using the given remapping substitution
D
Don Syme 已提交
1225
val remapAttrib: TcGlobals -> Remap -> Attrib -> Attrib
D
Don Syme 已提交
1226 1227

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

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

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

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

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

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

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

D
Don Syme 已提交
1248 1249
/// 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.
1250
type SignatureRepackageInfo =
F
Florian Verdonck 已提交
1251 1252 1253
    {
        /// The list of corresponding values
        RepackagedVals: (ValRef * ValRef) list
D
Don Syme 已提交
1254

F
Florian Verdonck 已提交
1255 1256 1257
        /// The list of corresponding modules, namespaces and type definitions
        RepackagedEntities: (TyconRef * TyconRef) list
    }
L
latkin 已提交
1258

D
Don Syme 已提交
1259
    /// The empty table
D
Don Syme 已提交
1260
    static member Empty: SignatureRepackageInfo
1261

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

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

D
Don Syme 已提交
1273
/// Compute the remapping information implied by a signature being inferred for a particular implementation
1274
val ComputeRemappingFromImplementationToSignature:
D
Don Syme 已提交
1275
    TcGlobals -> ModuleOrNamespaceContents -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo
D
Don Syme 已提交
1276 1277

/// Compute the remapping information implied by an explicit signature being given for an inferred signature
1278 1279
val ComputeRemappingFromInferredSignatureToExplicitSignature:
    TcGlobals -> ModuleOrNamespaceType -> ModuleOrNamespaceType -> SignatureRepackageInfo * SignatureHidingInfo
D
Don Syme 已提交
1280 1281

/// Compute the hiding information that corresponds to the hiding applied at an assembly boundary
1282 1283 1284
val ComputeSignatureHidingInfoAtAssemblyBoundary: ModuleOrNamespaceType -> SignatureHidingInfo -> SignatureHidingInfo

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

1288
val mkRepackageRemapping: SignatureRepackageInfo -> Remap
L
latkin 已提交
1289

D
Don Syme 已提交
1290
/// Wrap one module or namespace implementation in a 'namespace N' outer wrapper
D
Don Syme 已提交
1291
val wrapModuleOrNamespaceContentsInNamespace:
1292 1293 1294 1295 1296
    isModule: bool ->
    id: Ident ->
    cpath: CompilationPath ->
    mexpr: ModuleOrNamespaceContents ->
        ModuleOrNamespaceContents
D
Don Syme 已提交
1297 1298

/// Wrap one module or namespace definition in a 'namespace N' outer wrapper
1299 1300
val wrapModuleOrNamespaceTypeInNamespace:
    Ident -> CompilationPath -> ModuleOrNamespaceType -> ModuleOrNamespaceType * ModuleOrNamespace
D
Don Syme 已提交
1301 1302

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

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

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

D
Don Syme 已提交
1311 1312 1313 1314
/// 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.
1315
/// This remapping must be applied to all pickled expressions and types
D
Don Syme 已提交
1316
/// exported from the assembly.
D
Don Syme 已提交
1317
val MakeExportRemapping: CcuThunk -> ModuleOrNamespace -> Remap
D
Don Syme 已提交
1318 1319

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

D
Don Syme 已提交
1322
/// Determine if a type definition is hidden by a signature
D
Don Syme 已提交
1323
val IsHiddenTycon: (Remap * SignatureHidingInfo) list -> Tycon -> bool
D
Don Syme 已提交
1324 1325

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

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

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

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

D
Don Syme 已提交
1338
/// Build the application of a (possibly generic, possibly curried) function value to a set of type and expression arguments
1339
val primMkApp: Expr * TType -> TypeInst -> Exprs -> range -> Expr
D
Don Syme 已提交
1340 1341 1342

/// 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 已提交
1343
val mkApps: TcGlobals -> (Expr * TType) * TType list list * Exprs * range -> Expr
D
Don Syme 已提交
1344 1345 1346

/// 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 已提交
1347
val mkTyAppExpr: range -> Expr * TType -> TType list -> Expr
L
latkin 已提交
1348

D
Don Syme 已提交
1349
/// Build an expression to mutate a local
1350
///   localv <- e
D
Don Syme 已提交
1351
val mkValSet: range -> ValRef -> Expr -> Expr
D
Don Syme 已提交
1352 1353

/// Build an expression to mutate the contents of a local pointer
1354
///  *localv_ptr = e
D
Don Syme 已提交
1355
val mkAddrSet: range -> ValRef -> Expr -> Expr
D
Don Syme 已提交
1356 1357

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

1361 1362
/// Build an expression to take the address of a local
/// &localv
D
Don Syme 已提交
1363
val mkValAddr: range -> readonly: bool -> ValRef -> Expr
L
latkin 已提交
1364

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

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

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

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

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

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

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

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

1400 1401
/// 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.
1402 1403
val MakeFSharpDelegateInvokeAndTryBetaReduce:
    TcGlobals -> delInvokeRef: Expr * delExpr: Expr * delInvokeTy: TType * delInvokeArg: Expr * m: range -> Expr
1404

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

D
Don Syme 已提交
1408
/// Layout for internal compiler debugging purposes
L
latkin 已提交
1409 1410
module DebugPrint =

1411 1412 1413 1414 1415 1416
    /// 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 已提交
1417
    /// A global flag indicating whether debug output should include ranges
1418 1419 1420 1421
    val mutable layoutRanges: bool

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

    /// Convert a type to a string for debugging purposes
D
Don Syme 已提交
1424
    val showType: TType -> string
D
Don Syme 已提交
1425 1426

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

D
Don Syme 已提交
1429
    /// Debug layout for a reference to a value
D
Don Syme 已提交
1430
    val valRefL: ValRef -> Layout
D
Don Syme 已提交
1431 1432

    /// Debug layout for a reference to a union case
D
Don Syme 已提交
1433
    val unionCaseRefL: UnionCaseRef -> Layout
D
Don Syme 已提交
1434 1435

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

    /// Debug layout for an integer
D
Don Syme 已提交
1439
    val intL: int -> Layout
D
Don Syme 已提交
1440 1441

    /// Debug layout for a value definition
D
Don Syme 已提交
1442
    val valL: Val -> Layout
D
Don Syme 已提交
1443 1444

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

    /// Debug layout for a trait constraint
D
Don Syme 已提交
1448
    val traitL: TraitConstraintInfo -> Layout
D
Don Syme 已提交
1449 1450

    /// Debug layout for a type parameter
D
Don Syme 已提交
1451
    val typarL: Typar -> Layout
D
Don Syme 已提交
1452 1453

    /// Debug layout for a set of type parameters
D
Don Syme 已提交
1454
    val typarsL: Typars -> Layout
D
Don Syme 已提交
1455 1456

    /// Debug layout for a type
D
Don Syme 已提交
1457
    val typeL: TType -> Layout
D
Don Syme 已提交
1458 1459

    /// Debug layout for a method slot signature
D
Don Syme 已提交
1460
    val slotSigL: SlotSig -> Layout
D
Don Syme 已提交
1461 1462

    /// Debug layout for a module or namespace definition
1463
    val entityL: ModuleOrNamespace -> Layout
D
Don Syme 已提交
1464 1465

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

    /// Debug layout for an expression
1469
    val exprL: Expr -> Layout
D
Don Syme 已提交
1470 1471

    /// Debug layout for a type definition
1472
    val tyconL: Tycon -> Layout
D
Don Syme 已提交
1473 1474

    /// Debug layout for a decision tree
1475
    val decisionTreeL: DecisionTree -> Layout
D
Don Syme 已提交
1476 1477

    /// Debug layout for an implementation file
1478
    val implFileL: CheckedImplFile -> Layout
D
Don Syme 已提交
1479 1480

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

D
Don Syme 已提交
1483
    /// Debug layout for class and record fields
D
Don Syme 已提交
1484
    val recdFieldRefL: RecdFieldRef -> Layout
L
latkin 已提交
1485

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/// 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 已提交
1543
/// Determine if a type is a System.Linq.Expression type
D
Don Syme 已提交
1544
val isLinqExpressionTy: TcGlobals -> TType -> bool
L
latkin 已提交
1545

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1677 1678 1679 1680
/// 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 已提交
1681
val isNonNullableStructTyparTy: TcGlobals -> TType -> bool
1682 1683 1684 1685 1686

/// 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 已提交
1687
val isReferenceTyparTy: TcGlobals -> TType -> bool
1688

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

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

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

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

/// 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 已提交
1704
val StripSelfRefCell: TcGlobals * ValBaseOrThisInfo * TType -> TType
L
latkin 已提交
1705

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1822 1823 1824 1825
/// 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 已提交
1826
val mkNoneCase: TcGlobals -> UnionCaseRef
D
Don Syme 已提交
1827

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

1831 1832 1833 1834 1835 1836
/// 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

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

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

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

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

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

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

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

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

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

/// 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 已提交
1868

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

//-------------------------------------------------------------------------
// Primitives associated with quotations
1925 1926
//-------------------------------------------------------------------------

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

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

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

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

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

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

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

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

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

1947 1948
val mkInvalidCastExnNewobj: TcGlobals -> ILInstr

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2149 2150 2151
/// 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 已提交
2152
val mkILAsmCeq: TcGlobals -> range -> Expr -> Expr -> Expr
D
Don Syme 已提交
2153

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

D
Don Syme 已提交
2230 2231 2232
/// 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 已提交
2233
val TryFindTyconRefStringAttribute: TcGlobals -> range -> BuiltinAttribInfo -> TyconRef -> string option
D
Don Syme 已提交
2234 2235

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

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

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

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

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

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

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

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

2258
val IsMatchingSignatureDataVersionAttr: ILVersionInfo -> ILAttribute -> bool
L
latkin 已提交
2259

D
Don Syme 已提交
2260
val mkCompilationMappingAttr: TcGlobals -> int -> ILAttribute
2261

D
Don Syme 已提交
2262
val mkCompilationMappingAttrWithSeqNum: TcGlobals -> int -> int -> ILAttribute
D
Don Syme 已提交
2263

D
Don Syme 已提交
2264
val mkCompilationMappingAttrWithVariantNumAndSeqNum: TcGlobals -> int -> int -> int -> ILAttribute
D
Don Syme 已提交
2265

D
Don Syme 已提交
2266
val mkCompilationMappingAttrForQuotationResource: TcGlobals -> string * ILTypeRef list -> ILAttribute
D
Don Syme 已提交
2267

D
Don Syme 已提交
2268
val mkCompilationArgumentCountsAttr: TcGlobals -> int list -> ILAttribute
D
Don Syme 已提交
2269

D
Don Syme 已提交
2270
val mkCompilationSourceNameAttr: TcGlobals -> string -> ILAttribute
D
Don Syme 已提交
2271

D
Don Syme 已提交
2272
val mkSignatureDataVersionAttr: TcGlobals -> ILVersionInfo -> ILAttribute
D
Don Syme 已提交
2273

D
Don Syme 已提交
2274
val mkCompilerGeneratedAttr: TcGlobals -> int -> ILAttribute
L
latkin 已提交
2275 2276 2277

//-------------------------------------------------------------------------
// More common type construction
2278
//-------------------------------------------------------------------------
L
latkin 已提交
2279

D
Don Syme 已提交
2280
val isInByrefTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
2281

D
Don Syme 已提交
2282
val isOutByrefTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
2283

D
Don Syme 已提交
2284
val isByrefTy: TcGlobals -> TType -> bool
2285

D
Don Syme 已提交
2286
val isNativePtrTy: TcGlobals -> TType -> bool
D
Don Syme 已提交
2287

D
Don Syme 已提交
2288
val destByrefTy: TcGlobals -> TType -> TType
D
Don Syme 已提交
2289

D
Don Syme 已提交
2290
val destNativePtrTy: TcGlobals -> TType -> TType
L
latkin 已提交
2291

D
Don Syme 已提交
2292
val isByrefTyconRef: TcGlobals -> TyconRef -> bool
D
Don Syme 已提交
2293

D
Don Syme 已提交
2294
val isByrefLikeTyconRef: TcGlobals -> range -> TyconRef -> bool
D
Don Syme 已提交
2295

D
Don Syme 已提交
2296
val isSpanLikeTyconRef: TcGlobals -> range -> TyconRef -> bool
D
Don Syme 已提交
2297

D
Don Syme 已提交
2298
val isByrefLikeTy: TcGlobals -> range -> TType -> bool
L
latkin 已提交
2299

W
Will Smith 已提交
2300
/// Check if the type is a byref-like but not a byref.
D
Don Syme 已提交
2301
val isSpanLikeTy: TcGlobals -> range -> TType -> bool
L
latkin 已提交
2302

D
Don Syme 已提交
2303
val isSpanTy: TcGlobals -> range -> TType -> bool
2304

D
Don Syme 已提交
2305
val tryDestSpanTy: TcGlobals -> range -> TType -> (TyconRef * TType) option
2306

D
Don Syme 已提交
2307
val destSpanTy: TcGlobals -> range -> TType -> (TyconRef * TType)
2308

D
Don Syme 已提交
2309
val isReadOnlySpanTy: TcGlobals -> range -> TType -> bool
2310

D
Don Syme 已提交
2311
val tryDestReadOnlySpanTy: TcGlobals -> range -> TType -> (TyconRef * TType) option
2312

D
Don Syme 已提交
2313
val destReadOnlySpanTy: TcGlobals -> range -> TType -> (TyconRef * TType)
2314

L
latkin 已提交
2315 2316
//-------------------------------------------------------------------------
// Tuple constructors/destructors
2317
//-------------------------------------------------------------------------
L
latkin 已提交
2318

D
Don Syme 已提交
2319
val isRefTupleExpr: Expr -> bool
D
Don Syme 已提交
2320

D
Don Syme 已提交
2321
val tryDestRefTupleExpr: Expr -> Exprs
D
Don Syme 已提交
2322

D
Don Syme 已提交
2323
val mkAnyTupledTy: TcGlobals -> TupInfo -> TType list -> TType
D
Don Syme 已提交
2324

2325
val mkAnyTupled: TcGlobals -> range -> TupInfo -> Exprs -> TType list -> Expr
D
Don Syme 已提交
2326

2327
val mkRefTupled: TcGlobals -> range -> Exprs -> TType list -> Expr
D
Don Syme 已提交
2328

2329
val mkRefTupledNoTypes: TcGlobals -> range -> Exprs -> Expr
D
Don Syme 已提交
2330

D
Don Syme 已提交
2331
val mkRefTupledTy: TcGlobals -> TType list -> TType
D
Don Syme 已提交
2332

D
Don Syme 已提交
2333
val mkRefTupledVarsTy: TcGlobals -> Val list -> TType
L
latkin 已提交
2334

2335
val mkRefTupledVars: TcGlobals -> range -> Val list -> Expr
D
Don Syme 已提交
2336

D
Don Syme 已提交
2337
val mkMethodTy: TcGlobals -> TType list list -> TType -> TType
D
Don Syme 已提交
2338

D
Don Syme 已提交
2339
val mkAnyAnonRecdTy: TcGlobals -> AnonRecdTypeInfo -> TType list -> TType
D
Don Syme 已提交
2340

F
Florian Verdonck 已提交
2341
val mkAnonRecd: TcGlobals -> range -> AnonRecdTypeInfo -> Ident[] -> Exprs -> TType list -> Expr
L
latkin 已提交
2342

2343
val AdjustValForExpectedValReprInfo: TcGlobals -> range -> ValRef -> ValUseFlag -> ValReprInfo -> Expr * TType
D
Don Syme 已提交
2344

2345
val AdjustValToHaveValReprInfo: Val -> ParentRef -> ValReprInfo -> unit
D
Don Syme 已提交
2346

D
Don Syme 已提交
2347
val LinearizeTopMatch: TcGlobals -> ParentRef -> Expr -> Expr
D
Don Syme 已提交
2348

D
Don Syme 已提交
2349
val AdjustPossibleSubsumptionExpr: TcGlobals -> Expr -> Exprs -> (Expr * Exprs) option
D
Don Syme 已提交
2350

D
Don Syme 已提交
2351
val NormalizeAndAdjustPossibleSubsumptionExprs: TcGlobals -> Expr -> Expr
L
latkin 已提交
2352 2353 2354

//-------------------------------------------------------------------------
// XmlDoc signatures, used by both VS mode and XML-help emit
2355
//-------------------------------------------------------------------------
L
latkin 已提交
2356

D
Don Syme 已提交
2357
val buildAccessPath: CompilationPath option -> string
L
latkin 已提交
2358

D
Don Syme 已提交
2359
val XmlDocArgsEnc: TcGlobals -> Typars * Typars -> TType list -> string
D
Don Syme 已提交
2360

2361
val XmlDocSigOfVal: TcGlobals -> full: bool -> string -> Val -> string
D
Don Syme 已提交
2362

2363
val XmlDocSigOfUnionCase: path: string list -> string
D
Don Syme 已提交
2364

2365
val XmlDocSigOfField: path: string list -> string
D
Don Syme 已提交
2366

2367
val XmlDocSigOfProperty: path: string list -> string
D
Don Syme 已提交
2368

2369
val XmlDocSigOfTycon: path: string list -> string
D
Don Syme 已提交
2370

2371
val XmlDocSigOfSubModul: path: string list -> string
D
Don Syme 已提交
2372

2373
val XmlDocSigOfEntity: eref: EntityRef -> string
L
latkin 已提交
2374 2375 2376

//---------------------------------------------------------------------------
// Resolve static optimizations
2377
//-------------------------------------------------------------------------
D
Don Syme 已提交
2378

2379
type StaticOptimizationAnswer =
L
latkin 已提交
2380 2381 2382
    | Yes = 1y
    | No = -1y
    | Unknown = 0y
D
Don Syme 已提交
2383

2384 2385
val DecideStaticOptimizations:
    TcGlobals -> StaticOptimization list -> canDecideTyparEqn: 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
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683

type TraitConstraintInfo with

    /// Get the argument types recorded in the member constraint suitable for building a TypedTree call.
    member GetCompiledArgumentTypes: unit -> TType list

    /// Get the argument types when the trait is used as a first-class value "^T.TraitName" which can then be applied
    member GetLogicalArgumentTypes: g: TcGlobals -> TType list

    member GetObjectType: unit -> TType option

    member GetReturnType: g: TcGlobals -> TType

    /// Get the name of the trait for textual call.
    member MemberDisplayNameCore: string

    /// Get the key associated with the member constraint.
    member GetWitnessInfo: unit -> TraitWitnessInfo
2684 2685 2686 2687 2688 2689

/// Matches a ModuleOrNamespaceContents that is empty from a signature printing point of view.
/// Signatures printed via the typed tree in NicePrint don't print TMDefOpens or TMDefDo.
/// This will match anything that does not have any types or bindings.
val (|EmptyModuleOrNamespaces|_|):
    moduleOrNamespaceContents: ModuleOrNamespaceContents -> (ModuleOrNamespace list) option