F# Compiler Guide


SynExpr Type

Represents a syntax tree for F# expressions

Union cases

Union case Description

AddressOf(isByref, expr, opRange, range)

Full Usage: AddressOf(isByref, expr, opRange, range)

Parameters:

F# syntax: &expr, &&expr

isByref : bool
expr : SynExpr
opRange : range
range : range

AnonRecd(isStruct, copyInfo, recordFields, range)

Full Usage: AnonRecd(isStruct, copyInfo, recordFields, range)

Parameters:

F# syntax: {| id1=e1; ...; idN=eN |} F# syntax: struct {| id1=e1; ...; idN=eN |}

isStruct : bool
copyInfo : (SynExpr * BlockSeparator) option
recordFields : (Ident * range option * SynExpr) list
range : range

App(flag, isInfix, funcExpr, argExpr, range)

Full Usage: App(flag, isInfix, funcExpr, argExpr, range)

Parameters:

F# syntax: f x flag: indicates if the application is syntactically atomic, e.g. f.[1] is atomic, but 'f x' is not isInfix is true for the first app of an infix operator, e.g. 1+2 becomes App(App(+, 1), 2), where the inner node is marked isInfix

flag : ExprAtomicFlag
isInfix : bool
funcExpr : SynExpr
argExpr : SynExpr
range : range

ArbitraryAfterError(debugStr, range)

Full Usage: ArbitraryAfterError(debugStr, range)

Parameters:
    debugStr : string
    range : range

Inserted for error recovery

debugStr : string
range : range

ArrayOrList(isArray, exprs, range)

Full Usage: ArrayOrList(isArray, exprs, range)

Parameters:

F# syntax: [ e1; ...; en ], [| e1; ...; en |]

isArray : bool
exprs : SynExpr list
range : range

ArrayOrListComputed(isArray, expr, range)

Full Usage: ArrayOrListComputed(isArray, expr, range)

Parameters:

F# syntax: [ expr ], [| expr |]

isArray : bool
expr : SynExpr
range : range

Assert(expr, range)

Full Usage: Assert(expr, range)

Parameters:

F# syntax: assert expr

expr : SynExpr
range : range

ComputationExpr(hasSeqBuilder, expr, range)

Full Usage: ComputationExpr(hasSeqBuilder, expr, range)

Parameters:

F# syntax: { expr }

hasSeqBuilder : bool
expr : SynExpr
range : range

Const(constant, range)

Full Usage: Const(constant, range)

Parameters:

F# syntax: 1, 1.3, () etc.

constant : SynConst
range : range

DebugPoint(debugPoint, isControlFlow, innerExpr)

Full Usage: DebugPoint(debugPoint, isControlFlow, innerExpr)

Parameters:

Debug points arising from computation expressions

debugPoint : DebugPointAtLeafExpr
isControlFlow : bool
innerExpr : SynExpr

DiscardAfterMissingQualificationAfterDot(expr, range)

Full Usage: DiscardAfterMissingQualificationAfterDot(expr, range)

Parameters:

Inserted for error recovery when there is "expr." and missing tokens or error recovery after the dot

expr : SynExpr
range : range

Do(expr, range)

Full Usage: Do(expr, range)

Parameters:

F# syntax: do expr

expr : SynExpr
range : range

DoBang(expr, range)

Full Usage: DoBang(expr, range)

Parameters:

F# syntax: do! expr Computation expressions only

expr : SynExpr
range : range

DotGet(expr, rangeOfDot, longDotId, range)

Full Usage: DotGet(expr, rangeOfDot, longDotId, range)

Parameters:

F# syntax: expr.ident.ident

expr : SynExpr
rangeOfDot : range
longDotId : SynLongIdent
range : range

DotIndexedGet(objectExpr, indexArgs, dotRange, range)

Full Usage: DotIndexedGet(objectExpr, indexArgs, dotRange, range)

Parameters:

F# syntax: expr.[expr, ..., expr]

objectExpr : SynExpr
indexArgs : SynExpr
dotRange : range
range : range

DotIndexedSet(objectExpr, indexArgs, valueExpr, leftOfSetRange, dotRange, range)

Full Usage: DotIndexedSet(objectExpr, indexArgs, valueExpr, leftOfSetRange, dotRange, range)

Parameters:

F# syntax: expr.[expr, ..., expr] <- expr

objectExpr : SynExpr
indexArgs : SynExpr
valueExpr : SynExpr
leftOfSetRange : range
dotRange : range
range : range

DotNamedIndexedPropertySet(targetExpr, longDotId, argExpr, rhsExpr, range)

Full Usage: DotNamedIndexedPropertySet(targetExpr, longDotId, argExpr, rhsExpr, range)

Parameters:

F# syntax: expr.Items (e1) <- e2, rarely used named-property-setter notation, e.g. (stringExpr).Chars(3) <- 'a'

targetExpr : SynExpr
longDotId : SynLongIdent
argExpr : SynExpr
rhsExpr : SynExpr
range : range

DotSet(targetExpr, longDotId, rhsExpr, range)

Full Usage: DotSet(targetExpr, longDotId, rhsExpr, range)

Parameters:

F# syntax: expr.ident...ident <- expr

targetExpr : SynExpr
longDotId : SynLongIdent
rhsExpr : SynExpr
range : range

Downcast(expr, targetType, range)

Full Usage: Downcast(expr, targetType, range)

Parameters:

F# syntax: expr :?> type

expr : SynExpr
targetType : SynType
range : range

Dynamic(funcExpr, qmark, argExpr, range)

Full Usage: Dynamic(funcExpr, qmark, argExpr, range)

Parameters:

F# syntax: f?x

funcExpr : SynExpr
qmark : range
argExpr : SynExpr
range : range

Fixed(expr, range)

Full Usage: Fixed(expr, range)

Parameters:

'use x = fixed expr'

expr : SynExpr
range : range

For(forDebugPoint, toDebugPoint, ident, equalsRange, identBody, direction, toBody, doBody, range)

Full Usage: For(forDebugPoint, toDebugPoint, ident, equalsRange, identBody, direction, toBody, doBody, range)

Parameters:

F# syntax: 'for i = ... to ... do ...'

forDebugPoint : DebugPointAtFor
toDebugPoint : DebugPointAtInOrTo
ident : Ident
equalsRange : range option
identBody : SynExpr
direction : bool
toBody : SynExpr
doBody : SynExpr
range : range

ForEach(forDebugPoint, inDebugPoint, seqExprOnly, isFromSource, pat, enumExpr, bodyExpr, range)

Full Usage: ForEach(forDebugPoint, inDebugPoint, seqExprOnly, isFromSource, pat, enumExpr, bodyExpr, range)

Parameters:

F# syntax: 'for ... in ... do ...'

forDebugPoint : DebugPointAtFor
inDebugPoint : DebugPointAtInOrTo
seqExprOnly : SeqExprOnly
isFromSource : bool
pat : SynPat
enumExpr : SynExpr
bodyExpr : SynExpr
range : range

FromParseError(expr, range)

Full Usage: FromParseError(expr, range)

Parameters:

Inserted for error recovery

expr : SynExpr
range : range

Ident ident

Full Usage: Ident ident

Parameters:

F# syntax: ident Optimized representation for SynExpr.LongIdent (false, [id], id.idRange)

ident : Ident

IfThenElse(ifExpr, thenExpr, elseExpr, spIfToThen, isFromErrorRecovery, range, trivia)

Full Usage: IfThenElse(ifExpr, thenExpr, elseExpr, spIfToThen, isFromErrorRecovery, range, trivia)

Parameters:

F# syntax: if expr then expr F# syntax: if expr then expr else expr

ifExpr : SynExpr
thenExpr : SynExpr
elseExpr : SynExpr option
spIfToThen : DebugPointAtBinding
isFromErrorRecovery : bool
range : range
trivia : SynExprIfThenElseTrivia

ImplicitZero range

Full Usage: ImplicitZero range

Parameters:

Used in parser error recovery and internally during type checking for translating computation expressions.

range : range

IndexFromEnd(expr, range)

Full Usage: IndexFromEnd(expr, range)

Parameters:

F# syntax: ^expr

expr : SynExpr
range : range

IndexRange(expr1, opm, expr2, range1, range2, range)

Full Usage: IndexRange(expr1, opm, expr2, range1, range2, range)

Parameters:

F# syntax: expr.. F# syntax: ..expr F# syntax: expr..expr F# syntax: * A two-element range indexer argument a..b, a.., ..b. Also used to represent a range in a list, array or sequence expression.

expr1 : SynExpr option
opm : range
expr2 : SynExpr option
range1 : range
range2 : range
range : range

InferredDowncast(expr, range)

Full Usage: InferredDowncast(expr, range)

Parameters:

F# syntax: downcast expr

expr : SynExpr
range : range

InferredUpcast(expr, range)

Full Usage: InferredUpcast(expr, range)

Parameters:

F# syntax: upcast expr

expr : SynExpr
range : range

InterpolatedString(contents, synStringKind, range)

Full Usage: InterpolatedString(contents, synStringKind, range)

Parameters:

F# syntax: interpolated string, e.g. "abc{x}" or "abc{x,3}" or "abc{x:N4}" Note the string ranges include the quotes, verbatim markers, dollar sign and braces

contents : SynInterpolatedStringPart list
synStringKind : SynStringKind
range : range

JoinIn(lhsExpr, lhsRange, rhsExpr, range)

Full Usage: JoinIn(lhsExpr, lhsRange, rhsExpr, range)

Parameters:

F# syntax: ... in ... Computation expressions only, based on JOIN_IN token from lex filter

lhsExpr : SynExpr
lhsRange : range
rhsExpr : SynExpr
range : range

Lambda(fromMethod, inLambdaSeq, args, body, parsedData, range, trivia)

Full Usage: Lambda(fromMethod, inLambdaSeq, args, body, parsedData, range, trivia)

Parameters:

First bool indicates if lambda originates from a method. Patterns here are always "simple" Second bool indicates if this is a "later" part of an iterated sequence of lambdas parsedData keeps original parsed patterns and expression, prior to transforming to "simple" patterns and iterated lambdas F# syntax: fun pat -> expr

fromMethod : bool
inLambdaSeq : bool
args : SynSimplePats
body : SynExpr
parsedData : (SynPat list * SynExpr) option
range : range
trivia : SynExprLambdaTrivia

Lazy(expr, range)

Full Usage: Lazy(expr, range)

Parameters:

F# syntax: lazy expr

expr : SynExpr
range : range

LetOrUse(isRecursive, isUse, bindings, body, range, trivia)

Full Usage: LetOrUse(isRecursive, isUse, bindings, body, range, trivia)

Parameters:

F# syntax: let pat = expr in expr F# syntax: let f pat1 .. patN = expr in expr F# syntax: let rec f pat1 .. patN = expr in expr F# syntax: use pat = expr in expr

isRecursive : bool
isUse : bool
bindings : SynBinding list
body : SynExpr
range : range
trivia : SynExprLetOrUseTrivia

LetOrUseBang(bindDebugPoint, isUse, isFromSource, pat, rhs, andBangs, body, range, trivia)

Full Usage: LetOrUseBang(bindDebugPoint, isUse, isFromSource, pat, rhs, andBangs, body, range, trivia)

Parameters:

F# syntax: let! pat = expr in expr F# syntax: use! pat = expr in expr F# syntax: let! pat = expr and! ... and! ... and! pat = expr in expr Computation expressions only

bindDebugPoint : DebugPointAtBinding
isUse : bool
isFromSource : bool
pat : SynPat
rhs : SynExpr
andBangs : SynExprAndBang list
body : SynExpr
range : range
trivia : SynExprLetOrUseBangTrivia

LibraryOnlyILAssembly(ilCode, typeArgs, args, retTy, range)

Full Usage: LibraryOnlyILAssembly(ilCode, typeArgs, args, retTy, range)

Parameters:

Only used in FSharp.Core

ilCode : obj
typeArgs : SynType list
args : SynExpr list
retTy : SynType list
range : range

LibraryOnlyStaticOptimization(constraints, expr, optimizedExpr, range)

Full Usage: LibraryOnlyStaticOptimization(constraints, expr, optimizedExpr, range)

Parameters:

Only used in FSharp.Core

constraints : SynStaticOptimizationConstraint list
expr : SynExpr
optimizedExpr : SynExpr
range : range

LibraryOnlyUnionCaseFieldGet(expr, longId, fieldNum, range)

Full Usage: LibraryOnlyUnionCaseFieldGet(expr, longId, fieldNum, range)

Parameters:

Only used in FSharp.Core

expr : SynExpr
longId : LongIdent
fieldNum : int
range : range

LibraryOnlyUnionCaseFieldSet(expr, longId, fieldNum, rhsExpr, range)

Full Usage: LibraryOnlyUnionCaseFieldSet(expr, longId, fieldNum, rhsExpr, range)

Parameters:

Only used in FSharp.Core

expr : SynExpr
longId : LongIdent
fieldNum : int
rhsExpr : SynExpr
range : range

LongIdent(isOptional, longDotId, altNameRefCell, range)

Full Usage: LongIdent(isOptional, longDotId, altNameRefCell, range)

Parameters:

F# syntax: ident.ident...ident isOptional: true if preceded by a '?' for an optional named parameter altNameRefCell: Normally 'None' except for some compiler-generated variables in desugaring pattern matching. See SynSimplePat.Id

isOptional : bool
longDotId : SynLongIdent
altNameRefCell : SynSimplePatAlternativeIdInfo ref option
range : range

LongIdentSet(longDotId, expr, range)

Full Usage: LongIdentSet(longDotId, expr, range)

Parameters:

F# syntax: ident.ident...ident <- expr

longDotId : SynLongIdent
expr : SynExpr
range : range

Match(matchDebugPoint, expr, clauses, range, trivia)

Full Usage: Match(matchDebugPoint, expr, clauses, range, trivia)

Parameters:

F# syntax: match expr with pat1 -> expr | ... | patN -> exprN

matchDebugPoint : DebugPointAtBinding
expr : SynExpr
clauses : SynMatchClause list
range : range
trivia : SynExprMatchTrivia

MatchBang(matchDebugPoint, expr, clauses, range, trivia)

Full Usage: MatchBang(matchDebugPoint, expr, clauses, range, trivia)

Parameters:

F# syntax: match! expr with pat1 -> expr | ... | patN -> exprN

matchDebugPoint : DebugPointAtBinding
expr : SynExpr
clauses : SynMatchClause list
range : range
trivia : SynExprMatchBangTrivia

MatchLambda(isExnMatch, keywordRange, matchClauses, matchDebugPoint, range)

Full Usage: MatchLambda(isExnMatch, keywordRange, matchClauses, matchDebugPoint, range)

Parameters:

F# syntax: function pat1 -> expr | ... | patN -> exprN

isExnMatch : bool
keywordRange : range
matchClauses : SynMatchClause list
matchDebugPoint : DebugPointAtBinding
range : range

NamedIndexedPropertySet(longDotId, expr1, expr2, range)

Full Usage: NamedIndexedPropertySet(longDotId, expr1, expr2, range)

Parameters:

F# syntax: Type.Items(e1) <- e2, rarely used named-property-setter notation, e.g. Foo.Bar.Chars(3) <- 'a'

longDotId : SynLongIdent
expr1 : SynExpr
expr2 : SynExpr
range : range

New(isProtected, targetType, expr, range)

Full Usage: New(isProtected, targetType, expr, range)

Parameters:

F# syntax: new C(...) The flag is true if known to be 'family' ('protected') scope

isProtected : bool
targetType : SynType
expr : SynExpr
range : range

Null range

Full Usage: Null range

Parameters:

F# syntax: null

range : range

ObjExpr(objType, argOptions, withKeyword, bindings, members, extraImpls, newExprRange, range)

Full Usage: ObjExpr(objType, argOptions, withKeyword, bindings, members, extraImpls, newExprRange, range)

Parameters:

F# syntax: { new ... with ... }

objType : SynType
argOptions : (SynExpr * Ident option) option
withKeyword : range option
bindings : SynBinding list
members : SynMemberDefns
extraImpls : SynInterfaceImpl list
newExprRange : range
range : range

Paren(expr, leftParenRange, rightParenRange, range)

Full Usage: Paren(expr, leftParenRange, rightParenRange, range)

Parameters:

F# syntax: (expr) Parenthesized expressions. Kept in AST to distinguish A.M((x, y)) from A.M(x, y), among other things.

expr : SynExpr
leftParenRange : range
rightParenRange : range option
range : range

Quote(operator, isRaw, quotedExpr, isFromQueryExpression, range)

Full Usage: Quote(operator, isRaw, quotedExpr, isFromQueryExpression, range)

Parameters:
    operator : SynExpr
    isRaw : bool
    quotedExpr : SynExpr
    isFromQueryExpression : bool
    range : range

F# syntax: <@ expr @>, <@@ expr @@> Quote(operator, isRaw, quotedSynExpr, isFromQueryExpression, m)

operator : SynExpr
isRaw : bool
quotedExpr : SynExpr
isFromQueryExpression : bool
range : range

Record(baseInfo, copyInfo, recordFields, range)

Full Usage: Record(baseInfo, copyInfo, recordFields, range)

Parameters:

F# syntax: { f1=e1; ...; fn=en } inherit includes location of separator (for tooling) copyOpt contains range of the following WITH part (for tooling) every field includes range of separator after the field (for tooling)

baseInfo : (SynType * SynExpr * range * BlockSeparator option * range) option
copyInfo : (SynExpr * BlockSeparator) option
recordFields : SynExprRecordField list
range : range

Sequential(debugPoint, isTrueSeq, expr1, expr2, range)

Full Usage: Sequential(debugPoint, isTrueSeq, expr1, expr2, range)

Parameters:

F# syntax: expr; expr isTrueSeq: false indicates "let v = a in b; v"

debugPoint : DebugPointAtSequential
isTrueSeq : bool
expr1 : SynExpr
expr2 : SynExpr
range : range

SequentialOrImplicitYield(debugPoint, expr1, expr2, ifNotStmt, range)

Full Usage: SequentialOrImplicitYield(debugPoint, expr1, expr2, ifNotStmt, range)

Parameters:

Used internally during type checking for translating computation expressions.

debugPoint : DebugPointAtSequential
expr1 : SynExpr
expr2 : SynExpr
ifNotStmt : SynExpr
range : range

Set(targetExpr, rhsExpr, range)

Full Usage: Set(targetExpr, rhsExpr, range)

Parameters:

F# syntax: expr <- expr

targetExpr : SynExpr
rhsExpr : SynExpr
range : range

TraitCall(supportTys, traitSig, argExpr, range)

Full Usage: TraitCall(supportTys, traitSig, argExpr, range)

Parameters:

F# syntax: ((typar1 or ... or typarN): (member-dig) expr)

supportTys : SynTypar list
traitSig : SynMemberSig
argExpr : SynExpr
range : range

TryFinally(tryExpr, finallyExpr, range, tryDebugPoint, finallyDebugPoint, trivia)

Full Usage: TryFinally(tryExpr, finallyExpr, range, tryDebugPoint, finallyDebugPoint, trivia)

Parameters:

F# syntax: try expr finally expr

tryExpr : SynExpr
finallyExpr : SynExpr
range : range
tryDebugPoint : DebugPointAtTry
finallyDebugPoint : DebugPointAtFinally
trivia : SynExprTryFinallyTrivia

TryWith(tryExpr, withCases, range, tryDebugPoint, withDebugPoint, trivia)

Full Usage: TryWith(tryExpr, withCases, range, tryDebugPoint, withDebugPoint, trivia)

Parameters:

F# syntax: try expr with pat -> expr

tryExpr : SynExpr
withCases : SynMatchClause list
range : range
tryDebugPoint : DebugPointAtTry
withDebugPoint : DebugPointAtWith
trivia : SynExprTryWithTrivia

Tuple(isStruct, exprs, commaRanges, range)

Full Usage: Tuple(isStruct, exprs, commaRanges, range)

Parameters:

F# syntax: e1, ..., eN

isStruct : bool
exprs : SynExpr list
commaRanges : range list
range : range

TypeApp(expr, lessRange, typeArgs, commaRanges, greaterRange, typeArgsRange, range)

Full Usage: TypeApp(expr, lessRange, typeArgs, commaRanges, greaterRange, typeArgsRange, range)

Parameters:

F# syntax: expr

expr : SynExpr
lessRange : range
typeArgs : SynType list
commaRanges : range list
greaterRange : range option
typeArgsRange : range
range : range

TypeTest(expr, targetType, range)

Full Usage: TypeTest(expr, targetType, range)

Parameters:

F# syntax: expr :? type

expr : SynExpr
targetType : SynType
range : range

Typed(expr, targetType, range)

Full Usage: Typed(expr, targetType, range)

Parameters:

F# syntax: expr: type

expr : SynExpr
targetType : SynType
range : range

Upcast(expr, targetType, range)

Full Usage: Upcast(expr, targetType, range)

Parameters:

F# syntax: expr :> type

expr : SynExpr
targetType : SynType
range : range

While(whileDebugPoint, whileExpr, doExpr, range)

Full Usage: While(whileDebugPoint, whileExpr, doExpr, range)

Parameters:

F# syntax: 'while ... do ...'

whileDebugPoint : DebugPointAtWhile
whileExpr : SynExpr
doExpr : SynExpr
range : range

YieldOrReturn(flags, expr, range)

Full Usage: YieldOrReturn(flags, expr, range)

Parameters:

F# syntax: yield expr F# syntax: return expr Computation expressions only

flags : bool * bool
expr : SynExpr
range : range

YieldOrReturnFrom(flags, expr, range)

Full Usage: YieldOrReturnFrom(flags, expr, range)

Parameters:

F# syntax: yield! expr F# syntax: return! expr Computation expressions only

flags : bool * bool
expr : SynExpr
range : range

Instance members

Instance member Description

this.IsArbExprAndThusAlreadyReportedError

Full Usage: this.IsArbExprAndThusAlreadyReportedError

Returns: bool

Indicates if this expression arises from error recovery

Returns: bool

this.Range

Full Usage: this.Range

Returns: range

Gets the syntax range of this construct

Returns: range

this.RangeOfFirstPortion

Full Usage: this.RangeOfFirstPortion

Returns: range

Attempt to get the range of the first token or initial portion only - this is ad-hoc, just a cheap way to improve a certain 'query custom operation' error range

Returns: range

this.RangeWithoutAnyExtraDot

Full Usage: this.RangeWithoutAnyExtraDot

Returns: range
Returns: range