diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 965957dbc0c..13c18561c00 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -82,6 +82,8 @@ * Symbols: add ObsoleteDiagnosticInfo ([PR #19359](https://github.com/dotnet/fsharp/pull/19359)) * Add `#version;;` directive to F# Interactive to display version and environment information. ([Issue #13307](https://github.com/dotnet/fsharp/issues/13307), [PR #19332](https://github.com/dotnet/fsharp/pull/19332)) * Debug: rework for expressions stepping ([PR #19894](https://github.com/dotnet/fsharp/pull/19894)) +* Debug: rework conditional erasure, fix stepping over literals ([PR #19897](https://github.com/dotnet/fsharp/pull/19897)) +* Debug: fix if and match condition sequence points ([PR #19932](https://github.com/dotnet/fsharp/pull/19932)) ### Changed diff --git a/src/Compiler/Checking/CheckIncrementalClasses.fs b/src/Compiler/Checking/CheckIncrementalClasses.fs index 846aa5f9085..1d094bbf874 100644 --- a/src/Compiler/Checking/CheckIncrementalClasses.fs +++ b/src/Compiler/Checking/CheckIncrementalClasses.fs @@ -802,7 +802,7 @@ let MakeCtorForIncrClassConstructionPhase2C( // Extend the range of any immediate debug point to include the 'do' let doExpr = match doExpr with - | Expr.DebugPoint(_, innerExpr) -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, innerExpr) + | Expr.DebugPoint(_, innerExpr) -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), innerExpr) | e -> e let binder = (fun e -> mkSequential mFull doExpr e) let isPriorToSuperInit = false @@ -940,7 +940,7 @@ let MakeCtorForIncrClassConstructionPhase2C( // Add the debug point let inheritsExpr = if inheritsIsVisible then - Expr.DebugPoint(DebugPointAtLeafExpr.Yes inheritsExpr.Range, inheritsExpr) + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, inheritsExpr.Range), inheritsExpr) else inheritsExpr diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 3ab446a6687..b05df442d36 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -81,7 +81,7 @@ let inline arbKeySelectors m = // Flag that a debug point should get emitted prior to both the evaluation of 'rhsExpr' and the call to Using let inline addBindDebugPoint spBind e = match spBind with - | DebugPointAtBinding.Yes m -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, e) + | DebugPointAtBinding.Yes m -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), false, e) | _ -> e let inline mkSynDelay2 (e: SynExpr) = mkSynDelay (e.Range.MakeSynthetic()) e @@ -1345,7 +1345,7 @@ let rec TryTranslateComputationExpression let forCall = match spFor with - | DebugPointAtFor.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, false, forCall) + | DebugPointAtFor.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFor), false, forCall) | DebugPointAtFor.No -> forCall translatedCtxt forCall) @@ -1389,7 +1389,7 @@ let rec TryTranslateComputationExpression // 'while' is hit just before each time the guard is called let guardExpr = match spWhile with - | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) + | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mWhile), false, guardExpr) | DebugPointAtWhile.No -> guardExpr Some( @@ -1419,7 +1419,7 @@ let rec TryTranslateComputationExpression // 'while!' is hit just before each time the guard is called let guardExpr = match spWhile with - | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) + | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mWhile), false, guardExpr) | DebugPointAtWhile.No -> guardExpr let rewrittenWhileExpr = @@ -1557,7 +1557,7 @@ let rec TryTranslateComputationExpression // Put down a debug point for the 'finally' let unwindExpr2 = match spFinally with - | DebugPointAtFinally.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFinally, true, unwindExpr) + | DebugPointAtFinally.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFinally), true, unwindExpr) | DebugPointAtFinally.No -> unwindExpr if ceenv.isQuery then @@ -1571,7 +1571,7 @@ let rec TryTranslateComputationExpression let innerExpr = match spTry with - | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) + | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mTry), true, innerExpr) | _ -> innerExpr Some( @@ -2308,7 +2308,7 @@ let rec TryTranslateComputationExpression let innerExpr = match spTry with - | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) + | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mTry), true, innerExpr) | _ -> innerExpr let callExpr = @@ -2345,7 +2345,7 @@ let rec TryTranslateComputationExpression if IsControlFlowExpression synYieldExpr then yieldFromCall else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, false, yieldFromCall) + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), false, yieldFromCall) Some(translatedCtxt yieldFromCall) @@ -2374,7 +2374,7 @@ let rec TryTranslateComputationExpression if IsControlFlowExpression synReturnExpr then returnFromCall else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, false, returnFromCall) + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), false, returnFromCall) Some(translatedCtxt returnFromCall) @@ -2393,7 +2393,7 @@ let rec TryTranslateComputationExpression if IsControlFlowExpression synYieldOrReturnExpr then yieldOrReturnCall else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, false, yieldOrReturnCall) + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), false, yieldOrReturnCall) Some(translatedCtxt yieldOrReturnCall) @@ -2704,7 +2704,9 @@ and TranslateComputationExpressionBind and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp varSpace innerComp = match innerComp with | SynExpr.YieldOrReturn((false, _), returnExpr, m, _) -> - let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnExpr) + let returnExpr = + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), false, returnExpr) + Some(returnExpr, None) | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 4932830a352..e1322bf1db7 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -3103,7 +3103,7 @@ let BuildPossiblyConditionalMethodCall (cenv: cenv) env isMutable m isProp minfo if shouldEraseCall then // Methods marked with 'Conditional' must return 'unit' UnifyTypes cenv env m g.unit_ty (minfo.GetFSharpReturnType(cenv.amap, m, minst)) - mkUnit g m, g.unit_ty + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden = true, range = m), mkUnit g m), g.unit_ty else #if !NO_TYPEPROVIDERS match minfo with @@ -5903,6 +5903,7 @@ and TcNonControlFlowExpr (env: TcEnv) f = let res2 = match res with | IfThenElseExpr _ -> res + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden = true), _) -> res | _ -> mkDebugPoint res.Range res res2, tpenv else diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 46959e56b22..7f3c8e88315 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -3171,8 +3171,8 @@ and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr (sequel: sequel) = | LinearOpExpr _ | Expr.Match _ -> GenLinearExpr cenv cgbuf eenv expr sequel false id |> ignore - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) -> - if equals m range0 then + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden, m), innerExpr) -> + if isHidden then cgbuf.EmitStartOfHiddenCode() else CG.EmitDebugPoint cgbuf m @@ -3720,24 +3720,11 @@ and GenLinearExpr cenv cgbuf eenv expr sequel preSteps (contf: FakeUnit -> FakeU //assert(cgbuf.GetCurrentStack() = stackAfterJoin) // REVIEW: Since gen_dtree* now sets stack, stack should be stackAfterJoin at this point... CG.SetStack cgbuf stackAfterJoin - // If any values are left on the stack after the join then we're certainly going to do something with them - // For example, we may be about to execute a 'stloc' for - // - // let y2 = if System.DateTime.Now.Year < 2000 then 1 else 2 - // - // or a 'stelem' for - // - // arr.[0] <- if System.DateTime.Now.Year > 2000 then 1 else 2 - // - // In both cases, any instructions that come after this point will be falsely associated with the last branch of the control - // prior to the join point. This is base, e.g. see FSharp 1.0 bug 5155 - cgbuf.EmitStartOfHiddenCode() - GenSequel cenv eenv.cloc cgbuf sequelAfterJoin Fake)) - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) -> - if equals m range0 then + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden, m), innerExpr) -> + if isHidden then cgbuf.EmitStartOfHiddenCode() else CG.EmitDebugPoint cgbuf m @@ -7949,8 +7936,6 @@ and GenDecisionTreeSwitch let m = e.Range cgbuf.SetMarkToHereIfNecessary inplabOpt - cgbuf.EmitStartOfHiddenCode() - match cases with // optimize a test against a boolean value, i.e. the all-important if-then-else | TCase(DecisionTreeTest.Const(Const.Bool b), successTree) :: _ -> @@ -10641,10 +10626,21 @@ and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: Co let _, body = CodeGenMethod cenv cgbuf.mgbuf ([], eenv.staticInitializationName, eenv, 0, None, codeGenInitFunc, m) - if CheckCodeDoesSomething body.Code then + let codeDoesSomething = CheckCodeDoesSomething body.Code + + // Keep the init method if it carries a visible debug point, so steppable bindings like 'let i = ()' survive. + let hasVisibleDebugPoint = + not cenv.options.localOptimizationsEnabled + && body.Code.Instrs + |> Array.exists (function + | I_seqpoint sp -> sp.Line <> FeeFee cenv + | _ -> false) + + if codeDoesSomething || hasVisibleDebugPoint then // We are here because the module we just grabbed has an interesting static initializer let feefee, seqpt = - if body.Code.Instrs.Length > 0 then + // Without real init code, the .cctor's FeeFee marker would just add a stray hidden sequence point. + if codeDoesSomething && body.Code.Instrs.Length > 0 then match body.Code.Instrs[0] with | I_seqpoint sp as i -> [ FeeFeeInstr cenv sp.Document ], [ i ] | _ -> [], [] diff --git a/src/Compiler/Optimize/LowerComputedCollections.fs b/src/Compiler/Optimize/LowerComputedCollections.fs index 896540b0ae6..1dabf4fb142 100644 --- a/src/Compiler/Optimize/LowerComputedCollections.fs +++ b/src/Compiler/Optimize/LowerComputedCollections.fs @@ -114,7 +114,7 @@ let LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr = let cleanupE = BuildDisposableCleanup tcVal g infoReader m enumv // A debug point should get emitted prior to both the evaluation of 'inp' and the call to GetEnumerator - let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, e) + let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFor), e) let spInAsWhile = match spIn with DebugPointAtInOrTo.Yes m -> DebugPointAtWhile.Yes m | DebugPointAtInOrTo.No -> DebugPointAtWhile.No @@ -289,7 +289,7 @@ module List = match body with | Expr.Let(TBind(v, rhs, DebugPointAtBinding.Yes spBind), innerBody, m, flags) -> let bodyForAdd = Expr.Let(TBind(v, rhs, DebugPointAtBinding.NoneAtInvisible), innerBody, m, flags) - Expr.DebugPoint(DebugPointAtLeafExpr.Yes spBind, mkCallCollectorAdd tcVal g reader mBody collector bodyForAdd) + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, spBind), mkCallCollectorAdd tcVal g reader mBody collector bodyForAdd) | _ -> mkCallCollectorAdd tcVal g reader mIn collector body @@ -342,7 +342,7 @@ module List = match body with | Some (loopVal, body) -> mkInvisibleLet m loopVal loopVar - (Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mkCallCollectorAdd tcVal g reader mBody collector body)) + (Expr.DebugPoint (DebugPointAtLeafExpr.Yes(false, mFor), mkCallCollectorAdd tcVal g reader mBody collector body)) | None -> mkCallCollectorAdd tcVal g reader mBody collector loopVar) @@ -447,7 +447,7 @@ module Array = ) // Add a debug point at the `for`, before anything gets evaluated. - Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mapping) + Expr.DebugPoint (DebugPointAtLeafExpr.Yes(false, mFor), mapping) ) /// Whether to check for overflow when converting a value to a native int. @@ -508,7 +508,7 @@ module Array = match body with | Some (loopVal, body) -> - mkInvisibleLet mBody loopVal loopVar (Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mkStore body)) + mkInvisibleLet mBody loopVal loopVar (Expr.DebugPoint (DebugPointAtLeafExpr.Yes(false, mFor), mkStore body)) | None -> mkStore loopVar) diff --git a/src/Compiler/Optimize/LowerSequences.fs b/src/Compiler/Optimize/LowerSequences.fs index 3b7b4a51181..02c9f33373e 100644 --- a/src/Compiler/Optimize/LowerSequences.fs +++ b/src/Compiler/Optimize/LowerSequences.fs @@ -118,7 +118,7 @@ let ConvertSequenceExprToObject g amap overallExpr = let (TBind(v, e, sp)) = bind let addDebugPoint e = match sp with - | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e) + | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e) | _ -> e let vref = mkLocalValRef v { resBody with @@ -262,7 +262,7 @@ let ConvertSequenceExprToObject g amap overallExpr = // body ]] // A debug point should get emitted prior to both the evaluation of 'inp' and the call to GetEnumerator - let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, e) + let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFor), e) // The 'in' debug point is put back into the TypedTree at the right place for SeqWhile let mIn = match spIn with DebugPointAtInOrTo.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) | DebugPointAtInOrTo.No -> mIn @@ -293,11 +293,11 @@ let ConvertSequenceExprToObject g amap overallExpr = let asyncVars = unionFreeVars res1.asyncVars (freeInExpr CollectLocals compensation) let addTryDebugPoint e = match spTry with - | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e) + | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e) | _ -> e let addFinallyDebugPoint e = match spFinally with - | DebugPointAtFinally.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e) + | DebugPointAtFinally.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e) | _ -> e Some { phase2 = (fun (pcVar, _currv, _, pcMap as ctxt) -> let generate1, dispose1, checkDispose1 = res1.phase2 ctxt diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index cb9453d3177..a82d57d0789 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -76,7 +76,7 @@ let RepresentBindingAsStateVar g (bind: Binding) (resBody: StateMachineConversio let (TBind(v, e, sp)) = bind let addDebugPoint innerExpr = match sp with - | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) + | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), innerExpr) | _ -> innerExpr let vref = mkLocalValRef v { resBody with diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index a6fa90d1e3a..eee8052bd04 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -383,9 +383,6 @@ type OptimizationSettings = /// This optimization is off by default, given tiny overhead of including try/with. See https://github.com/dotnet/fsharp/pull/376 member _.EliminateTryWithAndTryFinally = false - /// Determines if we should eliminate first part of sequential expression if it has no effect - member x.EliminateSequential = x.LocalOptimizationsEnabled - /// Determines if we should determine branches in pattern matching based on known information, e.g. /// eliminate a "if true then .. else ... " member x.EliminateSwitch = x.LocalOptimizationsEnabled @@ -2874,12 +2871,8 @@ and OptimizeLinearExpr cenv env expr contf = OptimizeLinearExpr cenv env e2 (contf << (fun (e2R, e2info) -> if (flag = NormalSeq) && - // Drop bare (compiler-generated) units always; keep a debug-pointed unit in debug code so - // it stays steppable (a unit without one must go, else a dangling breakpoint - FSharp 1.0 bug 6034). - (cenv.settings.EliminateSequential || - (match e1R with - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes _, _) -> false - | _ -> match stripDebugPoints e1R with Expr.Const (Const.Unit, _, _) -> true | _ -> false)) && + (cenv.settings.LocalOptimizationsEnabled || + (match e1R with | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden, _), _) -> isHidden | _ -> false)) && not e1info.HasEffect then e2R, e2info else @@ -2942,9 +2935,11 @@ and OptimizeLinearExpr cenv env expr contf = OptimizeLinearExpr cenv env argLast (contf << (fun (argLastR, argLastInfo) -> OptimizeExprOpReductionsAfter cenv env (op, tyargs, argsHeadR @ [argLastR], argsHeadInfosR @ [argLastInfo], m))) - | Expr.DebugPoint (m, innerExpr) when not (IsDebugPipeRightExpr cenv innerExpr)-> + | Expr.DebugPoint (m, innerExpr) when not (IsDebugPipeRightExpr cenv innerExpr)-> OptimizeLinearExpr cenv env innerExpr (contf << (fun (innerExprR, einfo) -> - Expr.DebugPoint (m, innerExprR), einfo)) + match m with + | DebugPointAtLeafExpr.Yes(isHidden = true) when not einfo.HasEffect -> innerExprR, einfo + | _ -> Expr.DebugPoint (m, innerExprR), einfo)) | _ -> contf (OptimizeExpr cenv env expr) @@ -2966,7 +2961,7 @@ and OptimizeTryFinally cenv env (spTry, spFinally, e1, e2, m, ty) = if cenv.settings.EliminateTryWithAndTryFinally && not e1info.HasEffect then let e1R2 = match spTry with - | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e1R) + | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e1R) | DebugPointAtTry.No -> e1R Expr.Sequential (e1R2, e2R, ThenDoSeq, m), info else @@ -4220,7 +4215,14 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = if vref.ShouldInline && IsPartialExprVal einfo.Info then errorR(InternalError("the inline value '"+vref.LogicalName+"' was not inferred to have a known value", vref.Range)) - let env = BindInternalLocalVal cenv vref (mkValInfo einfo vref) env + let env = BindInternalLocalVal cenv vref (mkValInfo einfo vref) env + + // The hidden debug point on the r.h.s. is dropped above, so suppress the binding's debug point too. + let spBind = + match expr with + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden = true), _) when not einfo.HasEffect -> DebugPointAtBinding.NoneAtLet + | _ -> spBind + (TBind(vref, exprOptimized, spBind), einfo), env with RecoverableException exn -> errorRecovery exn vref.Range diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index 434974de754..119669f22d9 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -568,7 +568,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynInterpolatedStringPart.FillExpr(fillExpr, _) -> yield fillExpr ] - | SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, isControlFlow, innerExpr) -> + | SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(_, m), isControlFlow, innerExpr) -> yield! checkRange m yield! walkExpr isControlFlow innerExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 7c0030e4f3a..f35bb3297de 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -270,7 +270,7 @@ type DebugPointAtTry = | No [] -type DebugPointAtLeafExpr = Yes of range +type DebugPointAtLeafExpr = Yes of isHidden: bool * range: range [] type DebugPointAtWith = diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 2206d199c39..8b152ba2d69 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -258,7 +258,7 @@ type DebugPointAtTarget = /// Represents a debug point at a leaf expression (e.g. an application or constant). [] -type DebugPointAtLeafExpr = Yes of range +type DebugPointAtLeafExpr = Yes of isHidden: bool * range: range /// Represents whether a debug point should be suppressed for either the /// first or second part of a sequential execution, that is whether the diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index 733b269b588..dac2e23c10c 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -5274,7 +5274,7 @@ type Expr = | WitnessArg _ -> "WitnessArg(..)" | TyChoose _ -> "TyChoose(..)" | Link e -> "Link(" + e.Value.ToDebugString(depth) + ")" - | DebugPoint (DebugPointAtLeafExpr.Yes m, e) -> sprintf "DebugPoint(%s, " (m.ToString()) + e.ToDebugString(depth) + ")" + | DebugPoint (DebugPointAtLeafExpr.Yes(_, m), e) -> sprintf "DebugPoint(%s, " (m.ToString()) + e.ToDebugString(depth) + ")" /// Get the mark/range/position information from an expression member expr.Range = diff --git a/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs b/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs index a57c6e23804..d011c2d231f 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs @@ -2075,7 +2075,7 @@ module internal DebugPrint = | Expr.Link rX -> exprL rX.Value |> wrap - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, rX) -> + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(_, m), rX) -> aboveListL [ wordL (tagText "__debugPoint(") ^^ rangeL m ^^ wordL (tagText ")"); exprL rX ] |> wrap diff --git a/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs b/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs index 00761538123..1151c53fca5 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs @@ -512,7 +512,7 @@ module internal ExprConstruction = let valsOfBinds (binds: Bindings) = binds |> List.map (fun b -> b.Var) let mkDebugPoint m expr = - Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, expr) + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), expr) // Used to remove Expr.Link for inner expressions in pattern matches let (|InnerExprPat|) expr = stripExpr expr diff --git a/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs b/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs index de28bc34138..7401ed40b14 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs @@ -2873,7 +2873,7 @@ module internal ExprAnalysis = // Incorporate spBind as a note if present let res = match spBind with - | DebugPointAtBinding.Yes dp -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes dp, res) + | DebugPointAtBinding.Yes dp -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, dp), res) | _ -> res res diff --git a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs index a676cc3e6dd..83ff0d3baca 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs @@ -2230,7 +2230,7 @@ module internal TupleCompilation = (mkValSet mIn (mkLocalValRef nextVar) tailOrNullExpr) let bodyAndStep = - mkSequential mIn bodyExpr (Expr.DebugPoint(DebugPointAtLeafExpr.Yes range0, loopStep)) + mkSequential mIn bodyExpr (Expr.DebugPoint(DebugPointAtLeafExpr.Yes(true, mIn), loopStep)) let bodyExpr = mkLet spElem mFor elemVar headOrDefaultExpr bodyAndStep diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl index 0d32a2de1dd..7ab998bc870 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl @@ -517,6 +517,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property class assembly/C e2() { .get class assembly/C assembly::get_e2() @@ -526,6 +544,18 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + } .class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl index 5178c62e41d..ee6ecc8e060 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl @@ -517,6 +517,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property class assembly/C e2() { .get class assembly/C assembly::get_e2() @@ -526,8 +544,19 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { -} + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } +} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl index 87d3e2bfa45..98f8426f18b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl @@ -91,6 +91,24 @@ IL_0001: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property int32 x() { .get int32 assembly::get_x() @@ -100,8 +118,19 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { -} + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } +} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 42385696441..edc3c3437db 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -49,21 +49,43 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.EntryPointAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 - IL_0000: nop - IL_0001: nop - IL_0002: call int32 assembly::get_static_initializer() - IL_0007: ldc.i4.s 10 - IL_0009: bne.un.s IL_000f - - IL_000b: ldc.i4.0 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop IL_000c: nop - IL_000d: br.s IL_0011 + IL_000d: nop + IL_000e: call int32 assembly::get_static_initializer() + IL_0013: ldc.i4.s 10 + IL_0015: bne.un.s IL_001b + + IL_0017: ldc.i4.0 + IL_0018: nop + IL_0019: br.s IL_001d + + IL_001b: ldc.i4.1 + IL_001c: nop + IL_001d: tail. + IL_001f: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_0024: ret + } - IL_000f: ldc.i4.1 - IL_0010: nop - IL_0011: tail. - IL_0013: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_0018: ret + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret } .property int32 static_initializer() @@ -75,6 +97,18 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl new file mode 100644 index 00000000000..5ef583ab9b1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl @@ -0,0 +1,14 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl new file mode 100644 index 00000000000..3c7693a8b97 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl @@ -0,0 +1,15 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl new file mode 100644 index 00000000000..c906ed2a67f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl @@ -0,0 +1,21 @@ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (4,5-4,7) () + IL_0000: ldnull + IL_0001: stsfld Module::i@3 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl new file mode 100644 index 00000000000..7b8e1d01ed0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl @@ -0,0 +1,21 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (5,5-5,7) () + IL_0000: ldnull + IL_0001: stsfld Module::i@3 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl new file mode 100644 index 00000000000..418becdf336 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl @@ -0,0 +1,21 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (6,5-6,7) () + IL_0000: ldnull + IL_0001: stsfld Module::i@3 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl new file mode 100644 index 00000000000..8784f1fe3c3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl @@ -0,0 +1,10 @@ +module Module + +do + let i = System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + +Module::staticInitialization@ + (5,5-5,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl new file mode 100644 index 00000000000..39a42b809a6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl @@ -0,0 +1,17 @@ +module Module + +do + let i = () + let j = () + () +-------------------------------------------------------------------------------- + +Module::staticInitialization@ + (4,5-4,15) let i = () + IL_0000: nop + + (5,5-5,15) let j = () + IL_0001: nop + + (6,5-6,7) () + IL_0002: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl new file mode 100644 index 00000000000..89970bd86f7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl @@ -0,0 +1,13 @@ +module Module + +do + let i = () + () +-------------------------------------------------------------------------------- + +Module::staticInitialization@ + (4,5-4,15) let i = () + IL_0000: nop + + (5,5-5,7) () + IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl new file mode 100644 index 00000000000..5ef583ab9b1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl @@ -0,0 +1,14 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl new file mode 100644 index 00000000000..3c7693a8b97 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl @@ -0,0 +1,15 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl new file mode 100644 index 00000000000..c906ed2a67f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl @@ -0,0 +1,21 @@ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (4,5-4,7) () + IL_0000: ldnull + IL_0001: stsfld Module::i@3 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl new file mode 100644 index 00000000000..7b8e1d01ed0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl @@ -0,0 +1,21 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (5,5-5,7) () + IL_0000: ldnull + IL_0001: stsfld Module::i@3 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl new file mode 100644 index 00000000000..418becdf336 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl @@ -0,0 +1,21 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (6,5-6,7) () + IL_0000: ldnull + IL_0001: stsfld Module::i@3 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl new file mode 100644 index 00000000000..7def5b5213a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl @@ -0,0 +1,6 @@ +module Module + +let i = System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl new file mode 100644 index 00000000000..527031e40ea --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl @@ -0,0 +1,12 @@ +module Module + +let i = () +let j = () +-------------------------------------------------------------------------------- + +Module::staticInitialization@ + (3,1-3,11) let i = () + IL_0000: nop + + (4,1-4,11) let j = () + IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl new file mode 100644 index 00000000000..690723ece92 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl @@ -0,0 +1,8 @@ +module Module + +let i = () +-------------------------------------------------------------------------------- + +Module::staticInitialization@ + (3,1-3,11) let i = () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl index beb451d8511..c9f769e27f8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl @@ -1,26 +1,34 @@ +module Module + +let f (l: int[]) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_001c - (5,5-5,10) for i + (4,5-4,10) for i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_000a: ldloc.2 - IL_000b: call WriteLine + IL_000b: call Console::WriteLine - (7,9-7,40) System.Console.WriteLine(i + 1) + (6,9-6,40) System.Console.WriteLine(i + 1) IL_0010: ldloc.2 IL_0011: ldc.i4.1 IL_0012: add - IL_0013: call WriteLine + IL_0013: call Console::WriteLine IL_0018: ldloc.1 @@ -28,7 +36,7 @@ Module::f IL_001a: add IL_001b: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001c: ldloc.1 IL_001d: ldloc.0 IL_001e: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl index 022d36579ed..6a52a9513a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl @@ -1,20 +1,27 @@ +module Module + +let f (l: int[]) = + for i in l do + System.Console.WriteLine i +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_0014 - (5,5-5,10) for i + (4,5-4,10) for i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_000a: ldloc.2 - IL_000b: call WriteLine + IL_000b: call Console::WriteLine IL_0010: ldloc.1 @@ -22,7 +29,7 @@ Module::f IL_0012: add IL_0013: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0014: ldloc.1 IL_0015: ldloc.0 IL_0016: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl index a2dd006417a..8fcc590231f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl @@ -1,13 +1,24 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + [| + for Id i in l do + yield i + |] +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,5-10,7) [| for Id i in l do yield i |] + (6,5-9,7) [| for Id i in l do yield i |] IL_0000: nop - (8,9-8,12) for + (7,9-7,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -16,20 +27,20 @@ Module::f IL_000b: callvirt get_Current IL_0010: stloc.3 IL_0011: ldloc.3 - IL_0012: call |Id| + IL_0012: call Module::|Id| IL_0017: stloc.s 4 IL_0019: ldloc.s 4 IL_001b: stloc.s 5 - (9,13-9,20) yield i + (8,13-8,20) yield i IL_001d: ldloca.s 0 IL_001f: ldloc.s 5 IL_0021: call Add IL_0026: nop - (8,18-8,20) in + (7,18-7,20) in IL_0027: ldloc.1 - IL_0028: callvirt MoveNext + IL_0028: callvirt IEnumerator::MoveNext IL_002d: brtrue.s IL_000a IL_002f: ldnull IL_0030: stloc.2 @@ -37,14 +48,12 @@ Module::f IL_0033: ldloc.1 IL_0034: isinst IDisposable IL_0039: stloc.s 6 - - IL_003b: ldloc.s 6 IL_003d: brfalse.s IL_0047 IL_003f: ldloc.s 6 - IL_0041: callvirt Dispose + IL_0041: callvirt IDisposable::Dispose IL_0046: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl index 048c51b972b..d0b94cae31a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl @@ -1,8 +1,16 @@ +module Module + +let f (l: int list) = + [| + for n in l -> n + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-7,7) [| for n in l -> n |] + (4,5-6,7) [| for n in l -> n |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -13,15 +21,15 @@ Module::f IL_0011: ldloca.s 0 IL_0013: stloc.s 4 - (6,23-6,24) n + (5,23-5,24) n IL_0015: ldloc.s 4 IL_0017: ldloc.3 IL_0018: call Add IL_001d: nop - (6,15-6,17) in + (5,15-5,17) in IL_001e: ldloc.1 - IL_001f: callvirt MoveNext + IL_001f: callvirt IEnumerator::MoveNext IL_0024: brtrue.s IL_000a IL_0026: ldnull IL_0027: stloc.2 @@ -29,14 +37,12 @@ Module::f IL_002a: ldloc.1 IL_002b: isinst IDisposable IL_0030: stloc.s 5 - - IL_0032: ldloc.s 5 IL_0034: brfalse.s IL_003e IL_0036: ldloc.s 5 - IL_0038: callvirt Dispose + IL_0038: callvirt IDisposable::Dispose IL_003d: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl index 234b112f656..3aba9f3f29c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [| + for n in l do + yield n + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,7) [| for n in l do yield n |] + (4,5-7,7) [| for n in l do yield n |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -13,15 +22,15 @@ Module::f IL_0011: ldloca.s 0 IL_0013: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0015: ldloc.s 4 IL_0017: ldloc.3 IL_0018: call Add IL_001d: nop - (6,15-6,17) in + (5,15-5,17) in IL_001e: ldloc.1 - IL_001f: callvirt MoveNext + IL_001f: callvirt IEnumerator::MoveNext IL_0024: brtrue.s IL_000a IL_0026: ldnull IL_0027: stloc.2 @@ -29,14 +38,12 @@ Module::f IL_002a: ldloc.1 IL_002b: isinst IDisposable IL_0030: stloc.s 5 - - IL_0032: ldloc.s 5 IL_0034: brfalse.s IL_003e IL_0036: ldloc.s 5 - IL_0038: callvirt Dispose + IL_0038: callvirt IDisposable::Dispose IL_003d: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl index d9b3362ac39..709b28fc197 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [| + for i, i1 in l do + yield i + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,7) [| for i, i1 in l do yield i |] + (4,5-7,7) [| for i, i1 in l do yield i |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -17,15 +26,15 @@ Module::f IL_001a: call get_Item1 IL_001f: stloc.s 5 - (7,13-7,20) yield i + (6,13-6,20) yield i IL_0021: ldloca.s 0 IL_0023: ldloc.s 5 IL_0025: call Add IL_002a: nop - (6,19-6,21) in + (5,19-5,21) in IL_002b: ldloc.1 - IL_002c: callvirt MoveNext + IL_002c: callvirt IEnumerator::MoveNext IL_0031: brtrue.s IL_000a IL_0033: ldnull IL_0034: stloc.2 @@ -33,14 +42,12 @@ Module::f IL_0037: ldloc.1 IL_0038: isinst IDisposable IL_003d: stloc.s 6 - - IL_003f: ldloc.s 6 IL_0041: brfalse.s IL_004b IL_0043: ldloc.s 6 - IL_0045: callvirt Dispose + IL_0045: callvirt IDisposable::Dispose IL_004a: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl index 0e9884491ae..418bef6dacb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl @@ -1,13 +1,22 @@ +module Module + +let a = + [| + for n in 1..10 do + yield n + |] +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 - IL_0001: stsfld init@ - IL_0006: ldsfld init@ + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ IL_000b: pop IL_000c: ret Module::staticInitialization@ - (4,1-8,7) let a = [| for n in 1..10 do yield n |] + (3,1-7,7) let a = [| for n in 1..10 do yield n |] IL_0000: ldc.i4.s 10 IL_0002: conv.i8 IL_0003: conv.ovf.i.un @@ -22,14 +31,14 @@ Module::staticInitialization@ IL_0011: ldloc.2 IL_0012: stloc.3 - (6,9-6,12) for + (5,9-5,12) for IL_0013: ldloc.0 IL_0014: ldloc.1 IL_0015: conv.i IL_0016: stloc.s 4 IL_0018: stloc.s 5 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_001a: ldloc.s 5 IL_001c: ldloc.s 4 IL_001e: ldloc.3 @@ -44,11 +53,11 @@ Module::staticInitialization@ IL_0027: add IL_0028: stloc.1 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.1 IL_002a: ldc.i4.s 10 IL_002c: conv.i8 IL_002d: blt.un.s IL_0011 IL_002f: ldloc.0 - IL_0030: stsfld a@4 + IL_0030: stsfld Module::a@3 IL_0035: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl index 234b112f656..8a483c3b775 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: int list) = + [| + for n in l do + yield n + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,7) [| for n in l do yield n |] + (4,5-7,7) [| for n in l do yield n |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -13,15 +22,15 @@ Module::f IL_0011: ldloca.s 0 IL_0013: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0015: ldloc.s 4 IL_0017: ldloc.3 IL_0018: call Add IL_001d: nop - (6,15-6,17) in + (5,15-5,17) in IL_001e: ldloc.1 - IL_001f: callvirt MoveNext + IL_001f: callvirt IEnumerator::MoveNext IL_0024: brtrue.s IL_000a IL_0026: ldnull IL_0027: stloc.2 @@ -29,14 +38,12 @@ Module::f IL_002a: ldloc.1 IL_002b: isinst IDisposable IL_0030: stloc.s 5 - - IL_0032: ldloc.s 5 IL_0034: brfalse.s IL_003e IL_0036: ldloc.s 5 - IL_0038: callvirt Dispose + IL_0038: callvirt IDisposable::Dispose IL_003d: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl index 735b64ef291..759337a3017 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl @@ -1,28 +1,37 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int[]) = + for Id i in l do + () +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,17-7,18) l + (6,17-6,18) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_0019 - (7,5-7,13) for Id i + (6,5-6,13) for Id i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 IL_000a: ldloc.2 - IL_000b: call |Id| + IL_000b: call Module::|Id| IL_0010: stloc.3 IL_0011: ldloc.3 IL_0012: stloc.s 4 - (8,9-8,11) () + (7,9-7,11) () IL_0014: nop @@ -31,7 +40,7 @@ Module::f IL_0017: add IL_0018: stloc.1 - (7,14-7,16) in + (6,14-6,16) in IL_0019: ldloc.1 IL_001a: ldloc.0 IL_001b: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl index 117072dd130..f8618ea40c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl @@ -1,12 +1,19 @@ +module Module + +let f (l: (int * int)[]) = + for i1, i2 in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,19-5,20) l + (4,19-4,20) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_0022 - (5,5-5,15) for i1, i2 + (4,5-4,15) for i1, i2 IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem 0x1b000001 @@ -18,7 +25,7 @@ Module::f IL_0016: call get_Item1 IL_001b: stloc.s 4 - (6,9-6,11) () + (5,9-5,11) () IL_001d: nop @@ -27,7 +34,7 @@ Module::f IL_0020: add IL_0021: stloc.1 - (5,16-5,18) in + (4,16-4,18) in IL_0022: ldloc.1 IL_0023: ldloc.0 IL_0024: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl index ad1455f0b35..5b6e9dedcc1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl @@ -1,18 +1,25 @@ +module Module + +let f (l: int[]) = + for i in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_000f - (5,5-5,10) for i + (4,5-4,10) for i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_000a: nop @@ -21,7 +28,7 @@ Module::f IL_000d: add IL_000e: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_000f: ldloc.1 IL_0010: ldloc.0 IL_0011: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl new file mode 100644 index 00000000000..fc9ede4e5a9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl @@ -0,0 +1,32 @@ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::f + (4,14-4,15) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: call get_TailOrNull + IL_0008: stloc.1 + IL_0009: br.s IL_001b + + (4,5-4,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + + IL_0012: ldloc.1 + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: call get_TailOrNull + IL_001a: stloc.1 + + (4,11-4,13) in + IL_001b: ldloc.1 + IL_001c: brtrue.s IL_000b + IL_001e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl new file mode 100644 index 00000000000..4afdfd4e7c6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl @@ -0,0 +1,37 @@ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +-------------------------------------------------------------------------------- + +Module::f + (4,14-4,15) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: call get_TailOrNull + IL_0008: stloc.1 + IL_0009: br.s IL_0025 + + (4,5-4,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,9-6,36) System.Console.WriteLine "" + IL_0012: ldstr "" + IL_0017: call Console::WriteLine + + + IL_001c: ldloc.1 + IL_001d: stloc.0 + IL_001e: ldloc.0 + IL_001f: call get_TailOrNull + IL_0024: stloc.1 + + (4,11-4,13) in + IL_0025: ldloc.1 + IL_0026: brtrue.s IL_000b + IL_0028: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl new file mode 100644 index 00000000000..a3ca5cd7750 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl @@ -0,0 +1,37 @@ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::f + (4,14-4,15) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: call get_TailOrNull + IL_0008: stloc.1 + IL_0009: br.s IL_0025 + + (4,5-4,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (5,9-5,36) System.Console.WriteLine "" + IL_0012: ldstr "" + IL_0017: call Console::WriteLine + + + IL_001c: ldloc.1 + IL_001d: stloc.0 + IL_001e: ldloc.0 + IL_001f: call get_TailOrNull + IL_0024: stloc.1 + + (4,11-4,13) in + IL_0025: ldloc.1 + IL_0026: brtrue.s IL_000b + IL_0028: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl index 5eec9beaeb0..d6607455ef3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + let _ = () + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,15 +15,15 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001d - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,17-6,19) () + (5,17-5,19) () IL_0012: nop - (7,9-7,11) () + (6,9-6,11) () IL_0013: nop @@ -25,7 +33,7 @@ Module::f IL_0017: call get_TailOrNull IL_001c: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001d: ldloc.1 IL_001e: brtrue.s IL_000b IL_0020: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl index cabffb41911..0ea5fd169cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,20 +15,20 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0029 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 - IL_0013: call WriteLine + IL_0013: call Console::WriteLine - (7,9-7,40) System.Console.WriteLine(i + 1) + (6,9-6,40) System.Console.WriteLine(i + 1) IL_0018: ldloc.2 IL_0019: ldc.i4.1 IL_001a: add - IL_001b: call WriteLine + IL_001b: call Console::WriteLine IL_0020: ldloc.1 @@ -29,7 +37,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0029: ldloc.1 IL_002a: brtrue.s IL_000b IL_002c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl index 401652494b3..f6f184a7701 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + (()) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +14,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001c - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,10-6,12) () + (5,10-5,12) () IL_0012: nop @@ -22,7 +29,7 @@ Module::f IL_0016: call get_TailOrNull IL_001b: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001c: ldloc.1 IL_001d: brtrue.s IL_000b IL_001f: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl index c3c76afe5aa..315504bd6a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + () + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,15 +15,15 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001d - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_0012: nop - (7,9-7,11) () + (6,9-6,11) () IL_0013: nop @@ -25,7 +33,7 @@ Module::f IL_0017: call get_TailOrNull IL_001c: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001d: ldloc.1 IL_001e: brtrue.s IL_000b IL_0020: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl index 9dc76f432cc..713a03b68f9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine i +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,14 +14,14 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0021 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 - IL_0013: call WriteLine + IL_0013: call Console::WriteLine IL_0018: ldloc.1 @@ -23,7 +30,7 @@ Module::f IL_001b: call get_TailOrNull IL_0020: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0021: ldloc.1 IL_0022: brtrue.s IL_000b IL_0024: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl index 08615e86be6..3ae778d9a23 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl @@ -1,13 +1,24 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + [ + for Id i in l do + yield i + ] +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,5-10,6) [ for Id i in l do yield i ] + (6,5-9,6) [ for Id i in l do yield i ] IL_0000: nop - (8,9-8,12) for + (7,9-7,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -19,13 +30,13 @@ Module::f IL_0012: stloc.3 IL_0013: ldloca.s 0 IL_0015: ldloc.3 - IL_0016: call |Id| + IL_0016: call Module::|Id| IL_001b: stloc.s 4 IL_001d: ldloc.s 4 IL_001f: stloc.s 5 IL_0021: stloc.s 6 - (9,13-9,20) yield i + (8,13-8,20) yield i IL_0023: ldloc.s 6 IL_0025: ldloc.s 5 IL_0027: call Add @@ -36,7 +47,7 @@ Module::f IL_0030: call get_TailOrNull IL_0035: stloc.2 - (8,18-8,20) in + (7,18-7,20) in IL_0036: ldloc.2 IL_0037: brtrue.s IL_000c IL_0039: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl index 108c8700c6f..b63ad05c8dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl @@ -1,8 +1,16 @@ +module Module + +let f (l: int list) = + [ + for n in l -> n + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-7,6) [ for n in l -> n ] + (4,5-6,6) [ for n in l -> n ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -15,7 +23,7 @@ Module::f IL_0013: ldloca.s 0 IL_0015: stloc.s 4 - (6,23-6,24) n + (5,23-5,24) n IL_0017: ldloc.s 4 IL_0019: ldloc.3 IL_001a: call Add @@ -26,7 +34,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.2 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.2 IL_002a: brtrue.s IL_000c IL_002c: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl index 3a82bf3d6bf..e89ee794a8c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [ + for n in l do + yield n + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) [ for n in l do yield n ] + (4,5-7,6) [ for n in l do yield n ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -15,7 +24,7 @@ Module::f IL_0013: ldloca.s 0 IL_0015: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0017: ldloc.s 4 IL_0019: ldloc.3 IL_001a: call Add @@ -26,7 +35,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.2 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.2 IL_002a: brtrue.s IL_000c IL_002c: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl index d308682b1cc..52d43e9b92e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [ + for i, i1 in l do + yield i + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) [ for i, i1 in l do yield i ] + (4,5-7,6) [ for i, i1 in l do yield i ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -21,7 +30,7 @@ Module::f IL_0023: stloc.s 5 IL_0025: stloc.s 6 - (7,13-7,20) yield i + (6,13-6,20) yield i IL_0027: ldloc.s 6 IL_0029: ldloc.s 5 IL_002b: call Add @@ -32,7 +41,7 @@ Module::f IL_0034: call get_TailOrNull IL_0039: stloc.2 - (6,19-6,21) in + (5,19-5,21) in IL_003a: ldloc.2 IL_003b: brtrue.s IL_000c IL_003d: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl index 5e0accf23b8..0a7de799786 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl @@ -1,13 +1,22 @@ +module Module + +let a = + [ + for n in 1..10 do + yield n + ] +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 - IL_0001: stsfld init@ - IL_0006: ldsfld init@ + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ IL_000b: pop IL_000c: ret Module::staticInitialization@ - (4,1-8,6) let a = [ for n in 1..10 do yield n ] + (3,1-7,6) let a = [ for n in 1..10 do yield n ] IL_0000: ldc.i4.0 IL_0001: conv.i8 IL_0002: stloc.1 @@ -17,11 +26,11 @@ Module::staticInitialization@ IL_0007: ldloc.2 IL_0008: stloc.3 - (6,9-6,12) for + (5,9-5,12) for IL_0009: ldloca.s 0 IL_000b: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_000d: ldloc.s 4 IL_000f: ldloc.3 IL_0010: call Add @@ -36,12 +45,12 @@ Module::staticInitialization@ IL_001d: add IL_001e: stloc.1 - (6,15-6,17) in + (5,15-5,17) in IL_001f: ldloc.1 IL_0020: ldc.i4.s 10 IL_0022: conv.i8 IL_0023: blt.un.s IL_0007 IL_0025: ldloca.s 0 IL_0027: call Close - IL_002c: stsfld a@4 + IL_002c: stsfld Module::a@3 IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl index 3a82bf3d6bf..c4071f0681a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: int list) = + [ + for n in l do + yield n + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) [ for n in l do yield n ] + (4,5-7,6) [ for n in l do yield n ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -15,7 +24,7 @@ Module::f IL_0013: ldloca.s 0 IL_0015: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0017: ldloc.s 4 IL_0019: ldloc.3 IL_001a: call Add @@ -26,7 +35,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.2 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.2 IL_002a: brtrue.s IL_000c IL_002c: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl index 04c4ef9351d..de47c9cd161 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl @@ -1,10 +1,19 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + for Id i in l do + () +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,17-7,18) l + (6,17-6,18) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -12,17 +21,17 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0026 - (7,5-7,13) for Id i + (6,5-6,13) for Id i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 IL_0012: ldloc.2 - IL_0013: call |Id| + IL_0013: call Module::|Id| IL_0018: stloc.3 IL_0019: ldloc.3 IL_001a: stloc.s 4 - (8,9-8,11) () + (7,9-7,11) () IL_001c: nop @@ -32,7 +41,7 @@ Module::f IL_0020: call get_TailOrNull IL_0025: stloc.1 - (7,14-7,16) in + (6,14-6,16) in IL_0026: ldloc.1 IL_0027: brtrue.s IL_000b IL_0029: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl index afdc8ca112c..b00aa0c54a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: (int * int) list) = + for i1, i2 in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,19-5,20) l + (4,19-4,20) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,7 +14,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_002b - (5,5-5,15) for i1, i2 + (4,5-4,15) for i1, i2 IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 @@ -18,7 +25,7 @@ Module::f IL_001a: call get_Item1 IL_001f: stloc.s 4 - (6,9-6,11) () + (5,9-5,11) () IL_0021: nop @@ -28,7 +35,7 @@ Module::f IL_0025: call get_TailOrNull IL_002a: stloc.1 - (5,16-5,18) in + (4,16-4,18) in IL_002b: ldloc.1 IL_002c: brtrue.s IL_000b IL_002e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl index e0cc6be0c47..c1a29adad2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +14,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001c - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_0012: nop @@ -22,7 +29,7 @@ Module::f IL_0016: call get_TailOrNull IL_001b: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001c: ldloc.1 IL_001d: brtrue.s IL_000b IL_001f: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl index 0e16ad2c8e2..6f166fc0371 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int seq) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,37 +15,35 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0020 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 - IL_0013: call WriteLine + IL_0013: call Console::WriteLine - (7,9-7,40) System.Console.WriteLine(i + 1) + (6,9-6,40) System.Console.WriteLine(i + 1) IL_0018: ldloc.2 IL_0019: ldc.i4.1 IL_001a: add - IL_001b: call WriteLine + IL_001b: call Console::WriteLine - (5,11-5,13) in + (4,11-4,13) in IL_0020: ldloc.1 - IL_0021: callvirt MoveNext + IL_0021: callvirt IEnumerator::MoveNext IL_0026: brtrue.s IL_000b IL_0028: leave.s IL_003c IL_002a: ldloc.1 IL_002b: isinst IDisposable IL_0030: stloc.3 - - IL_0031: ldloc.3 IL_0032: brfalse.s IL_003b IL_0034: ldloc.3 - IL_0035: callvirt Dispose + IL_0035: callvirt IDisposable::Dispose IL_003a: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl index b6d13c7e7ab..758c3f1533e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int seq) = + for i in l do + System.Console.WriteLine i +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,31 +14,29 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0018 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 - IL_0013: call WriteLine + IL_0013: call Console::WriteLine - (5,11-5,13) in + (4,11-4,13) in IL_0018: ldloc.1 - IL_0019: callvirt MoveNext + IL_0019: callvirt IEnumerator::MoveNext IL_001e: brtrue.s IL_000b IL_0020: leave.s IL_0034 IL_0022: ldloc.1 IL_0023: isinst IDisposable IL_0028: stloc.3 - - IL_0029: ldloc.3 IL_002a: brfalse.s IL_0033 IL_002c: ldloc.3 - IL_002d: callvirt Dispose + IL_002d: callvirt IDisposable::Dispose IL_0032: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl index a1d4ee342ca..bd0897c4258 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl @@ -1,21 +1,32 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + seq { + for Id i in l do + yield i + } +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,5-10,6) seq { for Id i in l do yield i } + (6,5-9,6) seq { for Id i in l do yield i } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 IL_0003: ldc.i4.0 - IL_0004: newobj .ctor + IL_0004: newobj f@7::.ctor IL_0009: ret -f@8::GenerateNext +f@7::GenerateNext IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@7::pc IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch (3 targets) @@ -23,78 +34,77 @@ f@8::GenerateNext IL_001b: nop - IL_001c: br.s IL_0073 + IL_001c: br.s IL_0071 IL_001e: nop - IL_001f: br.s IL_0066 + IL_001f: br.s IL_0064 IL_0021: nop - IL_0022: br.s IL_0094 + IL_0022: br.s IL_0092 IL_0024: nop - IL_0025: br.s IL_0027 - - (8,9-8,12) for - IL_0027: ldarg.0 - IL_0028: ldarg.0 - IL_0029: ldfld l - IL_002e: callvirt GetEnumerator - IL_0033: stfld enum - IL_0038: ldarg.0 - IL_0039: ldc.i4.1 - IL_003a: stfld pc - IL_003f: br.s IL_0066 - IL_0041: ldarg.0 - IL_0042: ldfld enum - IL_0047: callvirt get_Current - IL_004c: stloc.0 - IL_004d: ldloc.0 - IL_004e: call |Id| - IL_0053: stloc.1 - IL_0054: ldloc.1 - IL_0055: stloc.2 - - (9,13-9,20) yield i - IL_0056: ldarg.0 - IL_0057: ldc.i4.2 - IL_0058: stfld pc - IL_005d: ldarg.0 - IL_005e: ldloc.2 - IL_005f: stfld current - IL_0064: ldc.i4.1 - IL_0065: ret - - (8,18-8,20) in - IL_0066: ldarg.0 - IL_0067: ldfld enum - IL_006c: callvirt MoveNext - IL_0071: brtrue.s IL_0041 - IL_0073: ldarg.0 - IL_0074: ldc.i4.3 - IL_0075: stfld pc - IL_007a: ldarg.0 - IL_007b: ldfld enum - IL_0080: call Dispose - IL_0085: nop - IL_0086: ldarg.0 - IL_0087: ldnull - IL_0088: stfld enum - IL_008d: ldarg.0 - IL_008e: ldc.i4.3 - IL_008f: stfld pc - IL_0094: ldarg.0 - IL_0095: ldc.i4.0 - IL_0096: stfld current - IL_009b: ldc.i4.0 - IL_009c: ret - -f@8::Close + + (7,9-7,12) for + IL_0025: ldarg.0 + IL_0026: ldarg.0 + IL_0027: ldfld f@7::l + IL_002c: callvirt GetEnumerator + IL_0031: stfld f@7::enum + IL_0036: ldarg.0 + IL_0037: ldc.i4.1 + IL_0038: stfld f@7::pc + IL_003d: br.s IL_0064 + IL_003f: ldarg.0 + IL_0040: ldfld f@7::enum + IL_0045: callvirt get_Current + IL_004a: stloc.0 + IL_004b: ldloc.0 + IL_004c: call Module::|Id| + IL_0051: stloc.1 + IL_0052: ldloc.1 + IL_0053: stloc.2 + + (8,13-8,20) yield i + IL_0054: ldarg.0 + IL_0055: ldc.i4.2 + IL_0056: stfld f@7::pc + IL_005b: ldarg.0 + IL_005c: ldloc.2 + IL_005d: stfld f@7::current + IL_0062: ldc.i4.1 + IL_0063: ret + + (7,18-7,20) in + IL_0064: ldarg.0 + IL_0065: ldfld f@7::enum + IL_006a: callvirt IEnumerator::MoveNext + IL_006f: brtrue.s IL_003f + IL_0071: ldarg.0 + IL_0072: ldc.i4.3 + IL_0073: stfld f@7::pc + IL_0078: ldarg.0 + IL_0079: ldfld f@7::enum + IL_007e: call IntrinsicFunctions::Dispose + IL_0083: nop + IL_0084: ldarg.0 + IL_0085: ldnull + IL_0086: stfld f@7::enum + IL_008b: ldarg.0 + IL_008c: ldc.i4.3 + IL_008d: stfld f@7::pc + IL_0092: ldarg.0 + IL_0093: ldc.i4.0 + IL_0094: stfld f@7::current + IL_0099: ldc.i4.0 + IL_009a: ret + +f@7::Close IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@7::pc IL_0006: ldc.i4.3 IL_0007: sub IL_0008: switch (1 targets) @@ -102,110 +112,100 @@ f@8::Close IL_0013: nop - IL_0014: br.s IL_0078 + IL_0014: br.s IL_0076 IL_0016: nop - - IL_0017: ldarg.0 - IL_0018: ldfld pc + IL_0018: ldfld f@7::pc IL_001d: switch (4 targets) IL_0032: br.s IL_0040 IL_0034: nop - IL_0035: br.s IL_0058 + IL_0035: br.s IL_0056 IL_0037: nop - IL_0038: br.s IL_0044 + IL_0038: br.s IL_0042 IL_003a: nop - IL_003b: br.s IL_0043 + IL_003b: br.s IL_0041 IL_003d: nop - IL_003e: br.s IL_0058 + IL_003e: br.s IL_0056 IL_0040: nop - IL_0041: br.s IL_0043 - IL_0043: nop - IL_0044: ldarg.0 - IL_0045: ldc.i4.3 - IL_0046: stfld pc - IL_004b: ldarg.0 - IL_004c: ldfld enum - IL_0051: call Dispose - IL_0056: nop + IL_0041: nop + IL_0042: ldarg.0 + IL_0043: ldc.i4.3 + IL_0044: stfld f@7::pc + IL_0049: ldarg.0 + IL_004a: ldfld f@7::enum + IL_004f: call IntrinsicFunctions::Dispose + IL_0054: nop - IL_0057: nop - IL_0058: ldarg.0 - IL_0059: ldc.i4.3 - IL_005a: stfld pc - IL_005f: ldarg.0 - IL_0060: ldc.i4.0 - IL_0061: stfld current - IL_0066: leave.s IL_0072 - IL_0068: castclass Exception - IL_006d: stloc.1 - IL_006e: ldloc.1 - IL_006f: stloc.0 - IL_0070: leave.s IL_0072 - - - IL_0072: nop - IL_0073: br IL_0000 - - - IL_0078: ldloc.0 - IL_0079: brfalse.s IL_007d + IL_0055: nop + IL_0056: ldarg.0 + IL_0057: ldc.i4.3 + IL_0058: stfld f@7::pc + IL_005d: ldarg.0 + IL_005e: ldc.i4.0 + IL_005f: stfld f@7::current + IL_0064: leave.s IL_0070 + IL_0066: castclass Exception + IL_006b: stloc.1 + IL_006c: ldloc.1 + IL_006d: stloc.0 + IL_006e: leave.s IL_0070 - IL_007b: ldloc.0 - IL_007c: throw + IL_0070: nop + IL_0071: br IL_0000 + IL_0076: ldloc.0 + IL_0077: brfalse.s IL_007b - IL_007d: ret + IL_0079: ldloc.0 + IL_007a: throw + IL_007b: ret -f@8::get_CheckClose +f@7::get_CheckClose IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@7::pc IL_0006: switch (4 targets) IL_001b: br.s IL_0029 IL_001d: nop - IL_001e: br.s IL_0030 + IL_001e: br.s IL_002e IL_0020: nop - IL_0021: br.s IL_002e + IL_0021: br.s IL_002c IL_0023: nop - IL_0024: br.s IL_002c + IL_0024: br.s IL_002a IL_0026: nop - IL_0027: br.s IL_0030 + IL_0027: br.s IL_002e IL_0029: nop - IL_002a: br.s IL_002c - - + IL_002a: ldc.i4.1 + IL_002b: ret IL_002c: ldc.i4.1 IL_002d: ret - IL_002e: ldc.i4.1 + IL_002e: ldc.i4.0 IL_002f: ret - IL_0030: ldc.i4.0 - IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl index c22c1947a13..095775bd513 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl @@ -1,16 +1,24 @@ +module Module + +let f (l: int list) = + seq { + for n in l -> n + } +-------------------------------------------------------------------------------- + Module::f - (5,5-7,6) seq { for n in l -> n } + (4,5-6,6) seq { for n in l -> n } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 IL_0003: ldc.i4.0 - IL_0004: newobj .ctor + IL_0004: newobj f@5::.ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch (3 targets) @@ -18,75 +26,74 @@ f@6::GenerateNext IL_001b: nop - IL_001c: br.s IL_006c + IL_001c: br.s IL_006a IL_001e: nop - IL_001f: br.s IL_005f + IL_001f: br.s IL_005d IL_0021: nop - IL_0022: br.s IL_008d + IL_0022: br.s IL_008b IL_0024: nop - IL_0025: br.s IL_0027 - - (6,9-6,12) for - IL_0027: ldarg.0 - IL_0028: ldarg.0 - IL_0029: ldfld l - IL_002e: callvirt GetEnumerator - IL_0033: stfld enum - IL_0038: ldarg.0 - IL_0039: ldc.i4.1 - IL_003a: stfld pc - IL_003f: br.s IL_005f - IL_0041: ldarg.0 - IL_0042: ldfld enum - IL_0047: callvirt get_Current - IL_004c: stloc.0 - IL_004d: ldarg.0 - IL_004e: ldc.i4.2 - IL_004f: stfld pc - IL_0054: ldarg.0 - IL_0055: stloc.1 - - (6,23-6,24) n - IL_0056: ldloc.1 - IL_0057: ldloc.0 - IL_0058: stfld current - IL_005d: ldc.i4.1 - IL_005e: ret - - (6,15-6,17) in - IL_005f: ldarg.0 - IL_0060: ldfld enum - IL_0065: callvirt MoveNext - IL_006a: brtrue.s IL_0041 - IL_006c: ldarg.0 - IL_006d: ldc.i4.3 - IL_006e: stfld pc - IL_0073: ldarg.0 - IL_0074: ldfld enum - IL_0079: call Dispose - IL_007e: nop - IL_007f: ldarg.0 - IL_0080: ldnull - IL_0081: stfld enum - IL_0086: ldarg.0 - IL_0087: ldc.i4.3 - IL_0088: stfld pc - IL_008d: ldarg.0 - IL_008e: ldc.i4.0 - IL_008f: stfld current - IL_0094: ldc.i4.0 - IL_0095: ret - -f@6::Close + + (5,9-5,12) for + IL_0025: ldarg.0 + IL_0026: ldarg.0 + IL_0027: ldfld f@5::l + IL_002c: callvirt GetEnumerator + IL_0031: stfld f@5::enum + IL_0036: ldarg.0 + IL_0037: ldc.i4.1 + IL_0038: stfld f@5::pc + IL_003d: br.s IL_005d + IL_003f: ldarg.0 + IL_0040: ldfld f@5::enum + IL_0045: callvirt get_Current + IL_004a: stloc.0 + IL_004b: ldarg.0 + IL_004c: ldc.i4.2 + IL_004d: stfld f@5::pc + IL_0052: ldarg.0 + IL_0053: stloc.1 + + (5,23-5,24) n + IL_0054: ldloc.1 + IL_0055: ldloc.0 + IL_0056: stfld f@5::current + IL_005b: ldc.i4.1 + IL_005c: ret + + (5,15-5,17) in + IL_005d: ldarg.0 + IL_005e: ldfld f@5::enum + IL_0063: callvirt IEnumerator::MoveNext + IL_0068: brtrue.s IL_003f + IL_006a: ldarg.0 + IL_006b: ldc.i4.3 + IL_006c: stfld f@5::pc + IL_0071: ldarg.0 + IL_0072: ldfld f@5::enum + IL_0077: call IntrinsicFunctions::Dispose + IL_007c: nop + IL_007d: ldarg.0 + IL_007e: ldnull + IL_007f: stfld f@5::enum + IL_0084: ldarg.0 + IL_0085: ldc.i4.3 + IL_0086: stfld f@5::pc + IL_008b: ldarg.0 + IL_008c: ldc.i4.0 + IL_008d: stfld f@5::current + IL_0092: ldc.i4.0 + IL_0093: ret + +f@5::Close IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.3 IL_0007: sub IL_0008: switch (1 targets) @@ -94,110 +101,100 @@ f@6::Close IL_0013: nop - IL_0014: br.s IL_0078 + IL_0014: br.s IL_0076 IL_0016: nop - - IL_0017: ldarg.0 - IL_0018: ldfld pc + IL_0018: ldfld f@5::pc IL_001d: switch (4 targets) IL_0032: br.s IL_0040 IL_0034: nop - IL_0035: br.s IL_0058 + IL_0035: br.s IL_0056 IL_0037: nop - IL_0038: br.s IL_0044 + IL_0038: br.s IL_0042 IL_003a: nop - IL_003b: br.s IL_0043 + IL_003b: br.s IL_0041 IL_003d: nop - IL_003e: br.s IL_0058 + IL_003e: br.s IL_0056 IL_0040: nop - IL_0041: br.s IL_0043 - IL_0043: nop - IL_0044: ldarg.0 - IL_0045: ldc.i4.3 - IL_0046: stfld pc - IL_004b: ldarg.0 - IL_004c: ldfld enum - IL_0051: call Dispose - IL_0056: nop + IL_0041: nop + IL_0042: ldarg.0 + IL_0043: ldc.i4.3 + IL_0044: stfld f@5::pc + IL_0049: ldarg.0 + IL_004a: ldfld f@5::enum + IL_004f: call IntrinsicFunctions::Dispose + IL_0054: nop - IL_0057: nop - IL_0058: ldarg.0 - IL_0059: ldc.i4.3 - IL_005a: stfld pc - IL_005f: ldarg.0 - IL_0060: ldc.i4.0 - IL_0061: stfld current - IL_0066: leave.s IL_0072 - IL_0068: castclass Exception - IL_006d: stloc.1 - IL_006e: ldloc.1 - IL_006f: stloc.0 - IL_0070: leave.s IL_0072 + IL_0055: nop + IL_0056: ldarg.0 + IL_0057: ldc.i4.3 + IL_0058: stfld f@5::pc + IL_005d: ldarg.0 + IL_005e: ldc.i4.0 + IL_005f: stfld f@5::current + IL_0064: leave.s IL_0070 + IL_0066: castclass Exception + IL_006b: stloc.1 + IL_006c: ldloc.1 + IL_006d: stloc.0 + IL_006e: leave.s IL_0070 - IL_0072: nop - IL_0073: br IL_0000 + IL_0070: nop + IL_0071: br IL_0000 + IL_0076: ldloc.0 + IL_0077: brfalse.s IL_007b - IL_0078: ldloc.0 - IL_0079: brfalse.s IL_007d + IL_0079: ldloc.0 + IL_007a: throw - IL_007b: ldloc.0 - IL_007c: throw + IL_007b: ret - - IL_007d: ret - - - -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: switch (4 targets) IL_001b: br.s IL_0029 IL_001d: nop - IL_001e: br.s IL_0030 + IL_001e: br.s IL_002e IL_0020: nop - IL_0021: br.s IL_002e + IL_0021: br.s IL_002c IL_0023: nop - IL_0024: br.s IL_002c + IL_0024: br.s IL_002a IL_0026: nop - IL_0027: br.s IL_0030 + IL_0027: br.s IL_002e IL_0029: nop - IL_002a: br.s IL_002c - - + IL_002a: ldc.i4.1 + IL_002b: ret IL_002c: ldc.i4.1 IL_002d: ret - IL_002e: ldc.i4.1 + IL_002e: ldc.i4.0 IL_002f: ret - IL_0030: ldc.i4.0 - IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl index c87c15661e4..9ff027a7378 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl @@ -1,16 +1,25 @@ +module Module + +let f (l: (int * int) list) = + seq { + for n in l do + yield n + } +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) seq { for n in l do yield n } + (4,5-7,6) seq { for n in l do yield n } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 IL_0003: ldnull - IL_0004: newobj .ctor + IL_0004: newobj f@5::.ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch (3 targets) @@ -18,75 +27,74 @@ f@6::GenerateNext IL_001b: nop - IL_001c: br.s IL_006c + IL_001c: br.s IL_006a IL_001e: nop - IL_001f: br.s IL_005f + IL_001f: br.s IL_005d IL_0021: nop - IL_0022: br.s IL_008d + IL_0022: br.s IL_008b IL_0024: nop - IL_0025: br.s IL_0027 - - (6,9-6,12) for - IL_0027: ldarg.0 - IL_0028: ldarg.0 - IL_0029: ldfld l - IL_002e: callvirt GetEnumerator - IL_0033: stfld enum - IL_0038: ldarg.0 - IL_0039: ldc.i4.1 - IL_003a: stfld pc - IL_003f: br.s IL_005f - IL_0041: ldarg.0 - IL_0042: ldfld enum - IL_0047: callvirt get_Current - IL_004c: stloc.0 - IL_004d: ldarg.0 - IL_004e: ldc.i4.2 - IL_004f: stfld pc - IL_0054: ldarg.0 - IL_0055: stloc.1 - - (7,13-7,20) yield n - IL_0056: ldloc.1 - IL_0057: ldloc.0 - IL_0058: stfld current - IL_005d: ldc.i4.1 - IL_005e: ret - - (6,15-6,17) in - IL_005f: ldarg.0 - IL_0060: ldfld enum - IL_0065: callvirt MoveNext - IL_006a: brtrue.s IL_0041 - IL_006c: ldarg.0 - IL_006d: ldc.i4.3 - IL_006e: stfld pc - IL_0073: ldarg.0 - IL_0074: ldfld enum - IL_0079: call Dispose - IL_007e: nop - IL_007f: ldarg.0 - IL_0080: ldnull - IL_0081: stfld enum - IL_0086: ldarg.0 - IL_0087: ldc.i4.3 - IL_0088: stfld pc - IL_008d: ldarg.0 - IL_008e: ldnull - IL_008f: stfld current - IL_0094: ldc.i4.0 - IL_0095: ret - -f@6::Close + + (5,9-5,12) for + IL_0025: ldarg.0 + IL_0026: ldarg.0 + IL_0027: ldfld f@5::l + IL_002c: callvirt GetEnumerator + IL_0031: stfld f@5::enum + IL_0036: ldarg.0 + IL_0037: ldc.i4.1 + IL_0038: stfld f@5::pc + IL_003d: br.s IL_005d + IL_003f: ldarg.0 + IL_0040: ldfld f@5::enum + IL_0045: callvirt get_Current + IL_004a: stloc.0 + IL_004b: ldarg.0 + IL_004c: ldc.i4.2 + IL_004d: stfld f@5::pc + IL_0052: ldarg.0 + IL_0053: stloc.1 + + (6,13-6,20) yield n + IL_0054: ldloc.1 + IL_0055: ldloc.0 + IL_0056: stfld f@5::current + IL_005b: ldc.i4.1 + IL_005c: ret + + (5,15-5,17) in + IL_005d: ldarg.0 + IL_005e: ldfld f@5::enum + IL_0063: callvirt IEnumerator::MoveNext + IL_0068: brtrue.s IL_003f + IL_006a: ldarg.0 + IL_006b: ldc.i4.3 + IL_006c: stfld f@5::pc + IL_0071: ldarg.0 + IL_0072: ldfld f@5::enum + IL_0077: call IntrinsicFunctions::Dispose + IL_007c: nop + IL_007d: ldarg.0 + IL_007e: ldnull + IL_007f: stfld f@5::enum + IL_0084: ldarg.0 + IL_0085: ldc.i4.3 + IL_0086: stfld f@5::pc + IL_008b: ldarg.0 + IL_008c: ldnull + IL_008d: stfld f@5::current + IL_0092: ldc.i4.0 + IL_0093: ret + +f@5::Close IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.3 IL_0007: sub IL_0008: switch (1 targets) @@ -94,110 +102,100 @@ f@6::Close IL_0013: nop - IL_0014: br.s IL_0078 + IL_0014: br.s IL_0076 IL_0016: nop - - IL_0017: ldarg.0 - IL_0018: ldfld pc + IL_0018: ldfld f@5::pc IL_001d: switch (4 targets) IL_0032: br.s IL_0040 IL_0034: nop - IL_0035: br.s IL_0058 + IL_0035: br.s IL_0056 IL_0037: nop - IL_0038: br.s IL_0044 + IL_0038: br.s IL_0042 IL_003a: nop - IL_003b: br.s IL_0043 + IL_003b: br.s IL_0041 IL_003d: nop - IL_003e: br.s IL_0058 + IL_003e: br.s IL_0056 IL_0040: nop - IL_0041: br.s IL_0043 - IL_0043: nop - IL_0044: ldarg.0 - IL_0045: ldc.i4.3 - IL_0046: stfld pc - IL_004b: ldarg.0 - IL_004c: ldfld enum - IL_0051: call Dispose - IL_0056: nop + IL_0041: nop + IL_0042: ldarg.0 + IL_0043: ldc.i4.3 + IL_0044: stfld f@5::pc + IL_0049: ldarg.0 + IL_004a: ldfld f@5::enum + IL_004f: call IntrinsicFunctions::Dispose + IL_0054: nop - IL_0057: nop - IL_0058: ldarg.0 - IL_0059: ldc.i4.3 - IL_005a: stfld pc - IL_005f: ldarg.0 - IL_0060: ldnull - IL_0061: stfld current - IL_0066: leave.s IL_0072 - IL_0068: castclass Exception - IL_006d: stloc.1 - IL_006e: ldloc.1 - IL_006f: stloc.0 - IL_0070: leave.s IL_0072 + IL_0055: nop + IL_0056: ldarg.0 + IL_0057: ldc.i4.3 + IL_0058: stfld f@5::pc + IL_005d: ldarg.0 + IL_005e: ldnull + IL_005f: stfld f@5::current + IL_0064: leave.s IL_0070 + IL_0066: castclass Exception + IL_006b: stloc.1 + IL_006c: ldloc.1 + IL_006d: stloc.0 + IL_006e: leave.s IL_0070 - IL_0072: nop - IL_0073: br IL_0000 + IL_0070: nop + IL_0071: br IL_0000 + IL_0076: ldloc.0 + IL_0077: brfalse.s IL_007b - IL_0078: ldloc.0 - IL_0079: brfalse.s IL_007d + IL_0079: ldloc.0 + IL_007a: throw - IL_007b: ldloc.0 - IL_007c: throw + IL_007b: ret - - IL_007d: ret - - - -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: switch (4 targets) IL_001b: br.s IL_0029 IL_001d: nop - IL_001e: br.s IL_0030 + IL_001e: br.s IL_002e IL_0020: nop - IL_0021: br.s IL_002e + IL_0021: br.s IL_002c IL_0023: nop - IL_0024: br.s IL_002c + IL_0024: br.s IL_002a IL_0026: nop - IL_0027: br.s IL_0030 + IL_0027: br.s IL_002e IL_0029: nop - IL_002a: br.s IL_002c - - + IL_002a: ldc.i4.1 + IL_002b: ret IL_002c: ldc.i4.1 IL_002d: ret - IL_002e: ldc.i4.1 + IL_002e: ldc.i4.0 IL_002f: ret - IL_0030: ldc.i4.0 - IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl index 563e2b0a3f0..1ccd9ab00d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl @@ -1,16 +1,25 @@ +module Module + +let f (l: (int * int) list) = + seq { + for i, i1 in l do + yield i + } +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) seq { for i, i1 in l do yield i } + (4,5-7,6) seq { for i, i1 in l do yield i } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 IL_0003: ldc.i4.0 - IL_0004: newobj .ctor + IL_0004: newobj f@5::.ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch (3 targets) @@ -18,79 +27,78 @@ f@6::GenerateNext IL_001b: nop - IL_001c: br.s IL_0078 + IL_001c: br.s IL_0076 IL_001e: nop - IL_001f: br.s IL_006b + IL_001f: br.s IL_0069 IL_0021: nop - IL_0022: br.s IL_0099 + IL_0022: br.s IL_0097 IL_0024: nop - IL_0025: br.s IL_0027 - - (6,9-6,12) for - IL_0027: ldarg.0 - IL_0028: ldarg.0 - IL_0029: ldfld l - IL_002e: callvirt GetEnumerator - IL_0033: stfld enum - IL_0038: ldarg.0 - IL_0039: ldc.i4.1 - IL_003a: stfld pc - IL_003f: br.s IL_006b - IL_0041: ldarg.0 - IL_0042: ldfld enum - IL_0047: callvirt get_Current - IL_004c: stloc.0 - IL_004d: ldloc.0 - IL_004e: call get_Item2 - IL_0053: stloc.1 - IL_0054: ldloc.0 - IL_0055: call get_Item1 - IL_005a: stloc.2 - - (7,13-7,20) yield i - IL_005b: ldarg.0 - IL_005c: ldc.i4.2 - IL_005d: stfld pc - IL_0062: ldarg.0 - IL_0063: ldloc.2 - IL_0064: stfld current - IL_0069: ldc.i4.1 - IL_006a: ret - - (6,19-6,21) in - IL_006b: ldarg.0 - IL_006c: ldfld enum - IL_0071: callvirt MoveNext - IL_0076: brtrue.s IL_0041 - IL_0078: ldarg.0 - IL_0079: ldc.i4.3 - IL_007a: stfld pc - IL_007f: ldarg.0 - IL_0080: ldfld enum - IL_0085: call Dispose - IL_008a: nop - IL_008b: ldarg.0 - IL_008c: ldnull - IL_008d: stfld enum - IL_0092: ldarg.0 - IL_0093: ldc.i4.3 - IL_0094: stfld pc - IL_0099: ldarg.0 - IL_009a: ldc.i4.0 - IL_009b: stfld current - IL_00a0: ldc.i4.0 - IL_00a1: ret - -f@6::Close + + (5,9-5,12) for + IL_0025: ldarg.0 + IL_0026: ldarg.0 + IL_0027: ldfld f@5::l + IL_002c: callvirt GetEnumerator + IL_0031: stfld f@5::enum + IL_0036: ldarg.0 + IL_0037: ldc.i4.1 + IL_0038: stfld f@5::pc + IL_003d: br.s IL_0069 + IL_003f: ldarg.0 + IL_0040: ldfld f@5::enum + IL_0045: callvirt get_Current + IL_004a: stloc.0 + IL_004b: ldloc.0 + IL_004c: call get_Item2 + IL_0051: stloc.1 + IL_0052: ldloc.0 + IL_0053: call get_Item1 + IL_0058: stloc.2 + + (6,13-6,20) yield i + IL_0059: ldarg.0 + IL_005a: ldc.i4.2 + IL_005b: stfld f@5::pc + IL_0060: ldarg.0 + IL_0061: ldloc.2 + IL_0062: stfld f@5::current + IL_0067: ldc.i4.1 + IL_0068: ret + + (5,19-5,21) in + IL_0069: ldarg.0 + IL_006a: ldfld f@5::enum + IL_006f: callvirt IEnumerator::MoveNext + IL_0074: brtrue.s IL_003f + IL_0076: ldarg.0 + IL_0077: ldc.i4.3 + IL_0078: stfld f@5::pc + IL_007d: ldarg.0 + IL_007e: ldfld f@5::enum + IL_0083: call IntrinsicFunctions::Dispose + IL_0088: nop + IL_0089: ldarg.0 + IL_008a: ldnull + IL_008b: stfld f@5::enum + IL_0090: ldarg.0 + IL_0091: ldc.i4.3 + IL_0092: stfld f@5::pc + IL_0097: ldarg.0 + IL_0098: ldc.i4.0 + IL_0099: stfld f@5::current + IL_009e: ldc.i4.0 + IL_009f: ret + +f@5::Close IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.3 IL_0007: sub IL_0008: switch (1 targets) @@ -98,110 +106,100 @@ f@6::Close IL_0013: nop - IL_0014: br.s IL_0078 + IL_0014: br.s IL_0076 IL_0016: nop - - IL_0017: ldarg.0 - IL_0018: ldfld pc + IL_0018: ldfld f@5::pc IL_001d: switch (4 targets) IL_0032: br.s IL_0040 IL_0034: nop - IL_0035: br.s IL_0058 + IL_0035: br.s IL_0056 IL_0037: nop - IL_0038: br.s IL_0044 + IL_0038: br.s IL_0042 IL_003a: nop - IL_003b: br.s IL_0043 + IL_003b: br.s IL_0041 IL_003d: nop - IL_003e: br.s IL_0058 + IL_003e: br.s IL_0056 IL_0040: nop - IL_0041: br.s IL_0043 - IL_0043: nop - IL_0044: ldarg.0 - IL_0045: ldc.i4.3 - IL_0046: stfld pc - IL_004b: ldarg.0 - IL_004c: ldfld enum - IL_0051: call Dispose - IL_0056: nop + IL_0041: nop + IL_0042: ldarg.0 + IL_0043: ldc.i4.3 + IL_0044: stfld f@5::pc + IL_0049: ldarg.0 + IL_004a: ldfld f@5::enum + IL_004f: call IntrinsicFunctions::Dispose + IL_0054: nop - IL_0057: nop - IL_0058: ldarg.0 - IL_0059: ldc.i4.3 - IL_005a: stfld pc - IL_005f: ldarg.0 - IL_0060: ldc.i4.0 - IL_0061: stfld current - IL_0066: leave.s IL_0072 - IL_0068: castclass Exception - IL_006d: stloc.1 - IL_006e: ldloc.1 - IL_006f: stloc.0 - IL_0070: leave.s IL_0072 + IL_0055: nop + IL_0056: ldarg.0 + IL_0057: ldc.i4.3 + IL_0058: stfld f@5::pc + IL_005d: ldarg.0 + IL_005e: ldc.i4.0 + IL_005f: stfld f@5::current + IL_0064: leave.s IL_0070 + IL_0066: castclass Exception + IL_006b: stloc.1 + IL_006c: ldloc.1 + IL_006d: stloc.0 + IL_006e: leave.s IL_0070 - IL_0072: nop - IL_0073: br IL_0000 + IL_0070: nop + IL_0071: br IL_0000 + IL_0076: ldloc.0 + IL_0077: brfalse.s IL_007b - IL_0078: ldloc.0 - IL_0079: brfalse.s IL_007d + IL_0079: ldloc.0 + IL_007a: throw - IL_007b: ldloc.0 - IL_007c: throw + IL_007b: ret - - IL_007d: ret - - - -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: switch (4 targets) IL_001b: br.s IL_0029 IL_001d: nop - IL_001e: br.s IL_0030 + IL_001e: br.s IL_002e IL_0020: nop - IL_0021: br.s IL_002e + IL_0021: br.s IL_002c IL_0023: nop - IL_0024: br.s IL_002c + IL_0024: br.s IL_002a IL_0026: nop - IL_0027: br.s IL_0030 + IL_0027: br.s IL_002e IL_0029: nop - IL_002a: br.s IL_002c - - + IL_002a: ldc.i4.1 + IL_002b: ret IL_002c: ldc.i4.1 IL_002d: ret - IL_002e: ldc.i4.1 + IL_002e: ldc.i4.0 IL_002f: ret - IL_0030: ldc.i4.0 - IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl index 6e703a4a985..d05797f5edb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl @@ -1,24 +1,33 @@ +module Module + +let a = + seq { + for n in 1..10 do + yield n + } +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 - IL_0001: stsfld init@ - IL_0006: ldsfld init@ + IL_0001: stsfld $Module::init@ + IL_0006: ldsfld $Module::init@ IL_000b: pop IL_000c: ret Module::staticInitialization@ - (5,5-8,6) seq { for n in 1..10 do yield n } + (4,5-7,6) seq { for n in 1..10 do yield n } IL_0000: ldnull IL_0001: ldc.i4.0 IL_0002: ldc.i4.0 - IL_0003: newobj .ctor - IL_0008: stsfld a@4 + IL_0003: newobj a@5::.ctor + IL_0008: stsfld Module::a@3 IL_000d: ret -a@6::GenerateNext +a@5::GenerateNext IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld a@5::pc IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch (3 targets) @@ -26,77 +35,76 @@ a@6::GenerateNext IL_001b: nop - IL_001c: br.s IL_006f + IL_001c: br.s IL_006d IL_001e: nop - IL_001f: br.s IL_0062 + IL_001f: br.s IL_0060 IL_0021: nop - IL_0022: br.s IL_0090 + IL_0022: br.s IL_008e IL_0024: nop - IL_0025: br.s IL_0027 - - (6,9-6,12) for - IL_0027: ldarg.0 - IL_0028: ldc.i4.1 - IL_0029: ldc.i4.1 - IL_002a: ldc.i4.s 10 - IL_002c: call RangeInt32 - IL_0031: callvirt GetEnumerator - IL_0036: stfld enum - IL_003b: ldarg.0 - IL_003c: ldc.i4.1 - IL_003d: stfld pc - IL_0042: br.s IL_0062 - IL_0044: ldarg.0 - IL_0045: ldfld enum - IL_004a: callvirt get_Current - IL_004f: stloc.0 - IL_0050: ldarg.0 - IL_0051: ldc.i4.2 - IL_0052: stfld pc - IL_0057: ldarg.0 - IL_0058: stloc.1 - - (7,13-7,20) yield n - IL_0059: ldloc.1 - IL_005a: ldloc.0 - IL_005b: stfld current - IL_0060: ldc.i4.1 - IL_0061: ret - - (6,15-6,17) in - IL_0062: ldarg.0 - IL_0063: ldfld enum - IL_0068: callvirt MoveNext - IL_006d: brtrue.s IL_0044 - IL_006f: ldarg.0 - IL_0070: ldc.i4.3 - IL_0071: stfld pc - IL_0076: ldarg.0 - IL_0077: ldfld enum - IL_007c: call Dispose - IL_0081: nop - IL_0082: ldarg.0 - IL_0083: ldnull - IL_0084: stfld enum - IL_0089: ldarg.0 - IL_008a: ldc.i4.3 - IL_008b: stfld pc - IL_0090: ldarg.0 - IL_0091: ldc.i4.0 - IL_0092: stfld current - IL_0097: ldc.i4.0 - IL_0098: ret - -a@6::Close + + (5,9-5,12) for + IL_0025: ldarg.0 + IL_0026: ldc.i4.1 + IL_0027: ldc.i4.1 + IL_0028: ldc.i4.s 10 + IL_002a: call OperatorIntrinsics::RangeInt32 + IL_002f: callvirt GetEnumerator + IL_0034: stfld a@5::enum + IL_0039: ldarg.0 + IL_003a: ldc.i4.1 + IL_003b: stfld a@5::pc + IL_0040: br.s IL_0060 + IL_0042: ldarg.0 + IL_0043: ldfld a@5::enum + IL_0048: callvirt get_Current + IL_004d: stloc.0 + IL_004e: ldarg.0 + IL_004f: ldc.i4.2 + IL_0050: stfld a@5::pc + IL_0055: ldarg.0 + IL_0056: stloc.1 + + (6,13-6,20) yield n + IL_0057: ldloc.1 + IL_0058: ldloc.0 + IL_0059: stfld a@5::current + IL_005e: ldc.i4.1 + IL_005f: ret + + (5,15-5,17) in + IL_0060: ldarg.0 + IL_0061: ldfld a@5::enum + IL_0066: callvirt IEnumerator::MoveNext + IL_006b: brtrue.s IL_0042 + IL_006d: ldarg.0 + IL_006e: ldc.i4.3 + IL_006f: stfld a@5::pc + IL_0074: ldarg.0 + IL_0075: ldfld a@5::enum + IL_007a: call IntrinsicFunctions::Dispose + IL_007f: nop + IL_0080: ldarg.0 + IL_0081: ldnull + IL_0082: stfld a@5::enum + IL_0087: ldarg.0 + IL_0088: ldc.i4.3 + IL_0089: stfld a@5::pc + IL_008e: ldarg.0 + IL_008f: ldc.i4.0 + IL_0090: stfld a@5::current + IL_0095: ldc.i4.0 + IL_0096: ret + +a@5::Close IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld a@5::pc IL_0006: ldc.i4.3 IL_0007: sub IL_0008: switch (1 targets) @@ -104,110 +112,100 @@ a@6::Close IL_0013: nop - IL_0014: br.s IL_0078 + IL_0014: br.s IL_0076 IL_0016: nop - - IL_0017: ldarg.0 - IL_0018: ldfld pc + IL_0018: ldfld a@5::pc IL_001d: switch (4 targets) IL_0032: br.s IL_0040 IL_0034: nop - IL_0035: br.s IL_0058 + IL_0035: br.s IL_0056 IL_0037: nop - IL_0038: br.s IL_0044 + IL_0038: br.s IL_0042 IL_003a: nop - IL_003b: br.s IL_0043 + IL_003b: br.s IL_0041 IL_003d: nop - IL_003e: br.s IL_0058 + IL_003e: br.s IL_0056 IL_0040: nop - IL_0041: br.s IL_0043 - IL_0043: nop - IL_0044: ldarg.0 - IL_0045: ldc.i4.3 - IL_0046: stfld pc - IL_004b: ldarg.0 - IL_004c: ldfld enum - IL_0051: call Dispose - IL_0056: nop + IL_0041: nop + IL_0042: ldarg.0 + IL_0043: ldc.i4.3 + IL_0044: stfld a@5::pc + IL_0049: ldarg.0 + IL_004a: ldfld a@5::enum + IL_004f: call IntrinsicFunctions::Dispose + IL_0054: nop - IL_0057: nop - IL_0058: ldarg.0 - IL_0059: ldc.i4.3 - IL_005a: stfld pc - IL_005f: ldarg.0 - IL_0060: ldc.i4.0 - IL_0061: stfld current - IL_0066: leave.s IL_0072 - IL_0068: castclass Exception - IL_006d: stloc.1 - IL_006e: ldloc.1 - IL_006f: stloc.0 - IL_0070: leave.s IL_0072 + IL_0055: nop + IL_0056: ldarg.0 + IL_0057: ldc.i4.3 + IL_0058: stfld a@5::pc + IL_005d: ldarg.0 + IL_005e: ldc.i4.0 + IL_005f: stfld a@5::current + IL_0064: leave.s IL_0070 + IL_0066: castclass Exception + IL_006b: stloc.1 + IL_006c: ldloc.1 + IL_006d: stloc.0 + IL_006e: leave.s IL_0070 - IL_0072: nop - IL_0073: br IL_0000 + IL_0070: nop + IL_0071: br IL_0000 + IL_0076: ldloc.0 + IL_0077: brfalse.s IL_007b - IL_0078: ldloc.0 - IL_0079: brfalse.s IL_007d + IL_0079: ldloc.0 + IL_007a: throw - IL_007b: ldloc.0 - IL_007c: throw + IL_007b: ret - - IL_007d: ret - - - -a@6::get_CheckClose +a@5::get_CheckClose IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld a@5::pc IL_0006: switch (4 targets) IL_001b: br.s IL_0029 IL_001d: nop - IL_001e: br.s IL_0030 + IL_001e: br.s IL_002e IL_0020: nop - IL_0021: br.s IL_002e + IL_0021: br.s IL_002c IL_0023: nop - IL_0024: br.s IL_002c + IL_0024: br.s IL_002a IL_0026: nop - IL_0027: br.s IL_0030 + IL_0027: br.s IL_002e IL_0029: nop - IL_002a: br.s IL_002c - - + IL_002a: ldc.i4.1 + IL_002b: ret IL_002c: ldc.i4.1 IL_002d: ret - IL_002e: ldc.i4.1 + IL_002e: ldc.i4.0 IL_002f: ret - IL_0030: ldc.i4.0 - IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl index 93ea36c1411..47d036281ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl @@ -1,16 +1,25 @@ +module Module + +let f (l: int list) = + seq { + for n in l do + yield n + } +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) seq { for n in l do yield n } + (4,5-7,6) seq { for n in l do yield n } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 IL_0003: ldc.i4.0 - IL_0004: newobj .ctor + IL_0004: newobj f@5::.ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.1 IL_0007: sub IL_0008: switch (3 targets) @@ -18,75 +27,74 @@ f@6::GenerateNext IL_001b: nop - IL_001c: br.s IL_006c + IL_001c: br.s IL_006a IL_001e: nop - IL_001f: br.s IL_005f + IL_001f: br.s IL_005d IL_0021: nop - IL_0022: br.s IL_008d + IL_0022: br.s IL_008b IL_0024: nop - IL_0025: br.s IL_0027 - - (6,9-6,12) for - IL_0027: ldarg.0 - IL_0028: ldarg.0 - IL_0029: ldfld l - IL_002e: callvirt GetEnumerator - IL_0033: stfld enum - IL_0038: ldarg.0 - IL_0039: ldc.i4.1 - IL_003a: stfld pc - IL_003f: br.s IL_005f - IL_0041: ldarg.0 - IL_0042: ldfld enum - IL_0047: callvirt get_Current - IL_004c: stloc.0 - IL_004d: ldarg.0 - IL_004e: ldc.i4.2 - IL_004f: stfld pc - IL_0054: ldarg.0 - IL_0055: stloc.1 - - (7,13-7,20) yield n - IL_0056: ldloc.1 - IL_0057: ldloc.0 - IL_0058: stfld current - IL_005d: ldc.i4.1 - IL_005e: ret - - (6,15-6,17) in - IL_005f: ldarg.0 - IL_0060: ldfld enum - IL_0065: callvirt MoveNext - IL_006a: brtrue.s IL_0041 - IL_006c: ldarg.0 - IL_006d: ldc.i4.3 - IL_006e: stfld pc - IL_0073: ldarg.0 - IL_0074: ldfld enum - IL_0079: call Dispose - IL_007e: nop - IL_007f: ldarg.0 - IL_0080: ldnull - IL_0081: stfld enum - IL_0086: ldarg.0 - IL_0087: ldc.i4.3 - IL_0088: stfld pc - IL_008d: ldarg.0 - IL_008e: ldc.i4.0 - IL_008f: stfld current - IL_0094: ldc.i4.0 - IL_0095: ret - -f@6::Close + + (5,9-5,12) for + IL_0025: ldarg.0 + IL_0026: ldarg.0 + IL_0027: ldfld f@5::l + IL_002c: callvirt GetEnumerator + IL_0031: stfld f@5::enum + IL_0036: ldarg.0 + IL_0037: ldc.i4.1 + IL_0038: stfld f@5::pc + IL_003d: br.s IL_005d + IL_003f: ldarg.0 + IL_0040: ldfld f@5::enum + IL_0045: callvirt get_Current + IL_004a: stloc.0 + IL_004b: ldarg.0 + IL_004c: ldc.i4.2 + IL_004d: stfld f@5::pc + IL_0052: ldarg.0 + IL_0053: stloc.1 + + (6,13-6,20) yield n + IL_0054: ldloc.1 + IL_0055: ldloc.0 + IL_0056: stfld f@5::current + IL_005b: ldc.i4.1 + IL_005c: ret + + (5,15-5,17) in + IL_005d: ldarg.0 + IL_005e: ldfld f@5::enum + IL_0063: callvirt IEnumerator::MoveNext + IL_0068: brtrue.s IL_003f + IL_006a: ldarg.0 + IL_006b: ldc.i4.3 + IL_006c: stfld f@5::pc + IL_0071: ldarg.0 + IL_0072: ldfld f@5::enum + IL_0077: call IntrinsicFunctions::Dispose + IL_007c: nop + IL_007d: ldarg.0 + IL_007e: ldnull + IL_007f: stfld f@5::enum + IL_0084: ldarg.0 + IL_0085: ldc.i4.3 + IL_0086: stfld f@5::pc + IL_008b: ldarg.0 + IL_008c: ldc.i4.0 + IL_008d: stfld f@5::current + IL_0092: ldc.i4.0 + IL_0093: ret + +f@5::Close IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: ldc.i4.3 IL_0007: sub IL_0008: switch (1 targets) @@ -94,110 +102,100 @@ f@6::Close IL_0013: nop - IL_0014: br.s IL_0078 + IL_0014: br.s IL_0076 IL_0016: nop - - IL_0017: ldarg.0 - IL_0018: ldfld pc + IL_0018: ldfld f@5::pc IL_001d: switch (4 targets) IL_0032: br.s IL_0040 IL_0034: nop - IL_0035: br.s IL_0058 + IL_0035: br.s IL_0056 IL_0037: nop - IL_0038: br.s IL_0044 + IL_0038: br.s IL_0042 IL_003a: nop - IL_003b: br.s IL_0043 + IL_003b: br.s IL_0041 IL_003d: nop - IL_003e: br.s IL_0058 + IL_003e: br.s IL_0056 IL_0040: nop - IL_0041: br.s IL_0043 - IL_0043: nop - IL_0044: ldarg.0 - IL_0045: ldc.i4.3 - IL_0046: stfld pc - IL_004b: ldarg.0 - IL_004c: ldfld enum - IL_0051: call Dispose - IL_0056: nop + IL_0041: nop + IL_0042: ldarg.0 + IL_0043: ldc.i4.3 + IL_0044: stfld f@5::pc + IL_0049: ldarg.0 + IL_004a: ldfld f@5::enum + IL_004f: call IntrinsicFunctions::Dispose + IL_0054: nop - IL_0057: nop - IL_0058: ldarg.0 - IL_0059: ldc.i4.3 - IL_005a: stfld pc - IL_005f: ldarg.0 - IL_0060: ldc.i4.0 - IL_0061: stfld current - IL_0066: leave.s IL_0072 - IL_0068: castclass Exception - IL_006d: stloc.1 - IL_006e: ldloc.1 - IL_006f: stloc.0 - IL_0070: leave.s IL_0072 + IL_0055: nop + IL_0056: ldarg.0 + IL_0057: ldc.i4.3 + IL_0058: stfld f@5::pc + IL_005d: ldarg.0 + IL_005e: ldc.i4.0 + IL_005f: stfld f@5::current + IL_0064: leave.s IL_0070 + IL_0066: castclass Exception + IL_006b: stloc.1 + IL_006c: ldloc.1 + IL_006d: stloc.0 + IL_006e: leave.s IL_0070 - IL_0072: nop - IL_0073: br IL_0000 + IL_0070: nop + IL_0071: br IL_0000 + IL_0076: ldloc.0 + IL_0077: brfalse.s IL_007b - IL_0078: ldloc.0 - IL_0079: brfalse.s IL_007d + IL_0079: ldloc.0 + IL_007a: throw - IL_007b: ldloc.0 - IL_007c: throw + IL_007b: ret - - IL_007d: ret - - - -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 - IL_0001: ldfld pc + IL_0001: ldfld f@5::pc IL_0006: switch (4 targets) IL_001b: br.s IL_0029 IL_001d: nop - IL_001e: br.s IL_0030 + IL_001e: br.s IL_002e IL_0020: nop - IL_0021: br.s IL_002e + IL_0021: br.s IL_002c IL_0023: nop - IL_0024: br.s IL_002c + IL_0024: br.s IL_002a IL_0026: nop - IL_0027: br.s IL_0030 + IL_0027: br.s IL_002e IL_0029: nop - IL_002a: br.s IL_002c - - + IL_002a: ldc.i4.1 + IL_002b: ret IL_002c: ldc.i4.1 IL_002d: ret - IL_002e: ldc.i4.1 + IL_002e: ldc.i4.0 IL_002f: ret - IL_0030: ldc.i4.0 - IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl index b367716fac3..15fe24cd037 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl @@ -1,10 +1,19 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int seq) = + for Id i in l do + () +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,17-7,18) l + (6,17-6,18) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -12,35 +21,33 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001d - (7,5-7,13) for Id i + (6,5-6,13) for Id i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 IL_0012: ldloc.2 - IL_0013: call |Id| + IL_0013: call Module::|Id| IL_0018: stloc.3 IL_0019: ldloc.3 IL_001a: stloc.s 4 - (8,9-8,11) () + (7,9-7,11) () IL_001c: nop - (7,14-7,16) in + (6,14-6,16) in IL_001d: ldloc.1 - IL_001e: callvirt MoveNext + IL_001e: callvirt IEnumerator::MoveNext IL_0023: brtrue.s IL_000b IL_0025: leave.s IL_003c IL_0027: ldloc.1 IL_0028: isinst IDisposable IL_002d: stloc.s 5 - - IL_002f: ldloc.s 5 IL_0031: brfalse.s IL_003b IL_0033: ldloc.s 5 - IL_0035: callvirt Dispose + IL_0035: callvirt IDisposable::Dispose IL_003a: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl index 1d789aafae2..b78317cd877 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: (int * int) seq) = + for i1, i2 in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,19-5,20) l + (4,19-4,20) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,7 +14,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0022 - (5,5-5,15) for i1, i2 + (4,5-4,15) for i1, i2 IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 @@ -18,25 +25,23 @@ Module::f IL_001a: call get_Item1 IL_001f: stloc.s 4 - (6,9-6,11) () + (5,9-5,11) () IL_0021: nop - (5,16-5,18) in + (4,16-4,18) in IL_0022: ldloc.1 - IL_0023: callvirt MoveNext + IL_0023: callvirt IEnumerator::MoveNext IL_0028: brtrue.s IL_000b IL_002a: leave.s IL_0041 IL_002c: ldloc.1 IL_002d: isinst IDisposable IL_0032: stloc.s 5 - - IL_0034: ldloc.s 5 IL_0036: brfalse.s IL_0040 IL_0038: ldloc.s 5 - IL_003a: callvirt Dispose + IL_003a: callvirt IDisposable::Dispose IL_003f: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl index cf20ed793cc..24a8b83484b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int seq) = + for i in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,30 +14,28 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0013 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_0012: nop - (5,11-5,13) in + (4,11-4,13) in IL_0013: ldloc.1 - IL_0014: callvirt MoveNext + IL_0014: callvirt IEnumerator::MoveNext IL_0019: brtrue.s IL_000b IL_001b: leave.s IL_002f IL_001d: ldloc.1 IL_001e: isinst IDisposable IL_0023: stloc.3 - - IL_0024: ldloc.3 IL_0025: brfalse.s IL_002e IL_0027: ldloc.3 - IL_0028: callvirt Dispose + IL_0028: callvirt IDisposable::Dispose IL_002d: endfinally diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl index 571e8a5476a..b72e7d2e352 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl @@ -1,11 +1,18 @@ +module Module + +let f (l: string) = + for c in l do + System.Console.WriteLine c +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.2 IL_0004: ldloc.0 - IL_0005: callvirt get_Length + IL_0005: callvirt String::get_Length IL_000a: ldc.i4.1 IL_000b: sub IL_000c: stloc.1 @@ -13,15 +20,15 @@ Module::f IL_000e: ldloc.2 IL_000f: blt.s IL_0029 - (5,5-5,10) for c + (4,5-4,10) for c IL_0011: ldloc.0 IL_0012: ldloc.2 - IL_0013: callvirt get_Chars + IL_0013: callvirt String::get_Chars IL_0018: stloc.3 - (6,9-6,35) System.Console.WriteLine c + (5,9-5,35) System.Console.WriteLine c IL_0019: ldloc.3 - IL_001a: call WriteLine + IL_001a: call Console::WriteLine IL_001f: ldloc.2 @@ -29,7 +36,7 @@ Module::f IL_0021: add IL_0022: stloc.2 - (5,11-5,13) in + (4,11-4,13) in IL_0023: ldloc.2 IL_0024: ldloc.1 IL_0025: ldc.i4.1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl new file mode 100644 index 00000000000..6b8bd6c7183 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl @@ -0,0 +1,8 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl new file mode 100644 index 00000000000..29f72e56448 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl @@ -0,0 +1,9 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl new file mode 100644 index 00000000000..bdfbdb06041 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl @@ -0,0 +1,11 @@ +module Module + +let f () = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl new file mode 100644 index 00000000000..3b406721679 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl @@ -0,0 +1,11 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::f + (5,5-5,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl new file mode 100644 index 00000000000..43b4c570085 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl @@ -0,0 +1,11 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + +Module::f + (6,5-6,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl new file mode 100644 index 00000000000..47b52e134d2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl @@ -0,0 +1,7 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl new file mode 100644 index 00000000000..ff31e008474 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl @@ -0,0 +1,12 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +-------------------------------------------------------------------------------- + +Module::f + (5,5-5,32) System.Console.WriteLine "" + IL_0000: ldstr "" + IL_0005: call Console::WriteLine + IL_000a: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl new file mode 100644 index 00000000000..befe1c7a50b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl @@ -0,0 +1,12 @@ +module Module + +let f () = + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,32) System.Console.WriteLine "" + IL_0000: ldstr "" + IL_0005: call Console::WriteLine + IL_000a: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl index 7d3acc1e66a..e433d98d6dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl @@ -1,8 +1,15 @@ +module Module + +let f () = + let i = 1 + 1 +-------------------------------------------------------------------------------- + Module::f - (5,5-5,14) let i = 1 + (4,5-4,14) let i = 1 IL_0000: ldc.i4.1 IL_0001: stloc.0 - (6,5-6,6) 1 + (5,5-5,6) 1 IL_0002: ldc.i4.1 IL_0003: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl index 61f9775be11..2e679cf0419 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl @@ -1,6 +1,13 @@ +module Module + +let f () = + () + () +-------------------------------------------------------------------------------- + Module::f - (5,5-5,7) () + (4,5-4,7) () IL_0000: nop - (6,5-6,7) () + (5,5-5,7) () IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl index f3a13298d7a..aeebdef981e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl @@ -1,3 +1,9 @@ +module Module + +let f () = + () +-------------------------------------------------------------------------------- + Module::f - (5,5-5,7) () + (4,5-4,7) () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 01.bsl new file mode 100644 index 00000000000..3299f49b2b1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 01.bsl @@ -0,0 +1,30 @@ +module Module + +let f (x: int) = + x + x + +let g () = + if f 5 = 10 then 0 else 1 +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (7,5-7,21) if f 5 = 10 then + IL_0000: ldc.i4.5 + IL_0001: call Module::f + IL_0006: ldc.i4.s 10 + IL_0008: bne.un.s IL_000c + + (7,22-7,23) 0 + IL_000a: ldc.i4.0 + IL_000b: ret + + (7,29-7,30) 1 + IL_000c: ldc.i4.1 + IL_000d: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 02 - Bind.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 02 - Bind.bsl new file mode 100644 index 00000000000..7b89f7554b2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 02 - Bind.bsl @@ -0,0 +1,43 @@ +module Module + +let f (x: int) = + x + x + +let g () = + let y = if f 5 = 10 then 0 else 1 + y + y +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (7,13-7,29) if f 5 = 10 then + IL_0000: ldc.i4.5 + IL_0001: call Module::f + IL_0006: ldc.i4.s 10 + IL_0008: bne.un.s IL_000e + + (7,30-7,31) 0 + IL_000a: ldc.i4.0 + + + IL_000b: nop + IL_000c: br.s IL_0010 + + (7,37-7,38) 1 + IL_000e: ldc.i4.1 + + + IL_000f: nop + IL_0010: stloc.0 + + (8,5-8,10) y + y + IL_0011: ldloc.0 + IL_0012: ldloc.0 + IL_0013: add + IL_0014: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 03 - Set.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 03 - Set.bsl new file mode 100644 index 00000000000..43931c53990 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 03 - Set.bsl @@ -0,0 +1,57 @@ +module Module + +let f (x: int) = + x + x + +let g (arr: int[]) = + arr[0] <- if f 5 = 10 then 0 else 1 +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (7,5-7,11) arr[0] + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: stloc.0 + IL_0003: stloc.1 + + (7,15-7,31) if f 5 = 10 then + IL_0004: ldloc.1 + IL_0005: ldloc.0 + IL_0006: ldc.i4.5 + IL_0007: call Module::f + IL_000c: ldc.i4.s 10 + IL_000e: bne.un.s IL_0018 + + + IL_0010: stloc.2 + IL_0011: stloc.3 + + (7,32-7,33) 0 + IL_0012: ldloc.3 + IL_0013: ldloc.2 + IL_0014: ldc.i4.0 + + + IL_0015: nop + IL_0016: br.s IL_0022 + + + IL_0018: stloc.s 4 + IL_001a: stloc.s 5 + + (7,39-7,40) 1 + IL_001c: ldloc.s 5 + IL_001e: ldloc.s 4 + IL_0020: ldc.i4.1 + + + IL_0021: nop + IL_0022: stelem.i4 + IL_0023: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 04.bsl new file mode 100644 index 00000000000..8862de0a3ec --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 04.bsl @@ -0,0 +1,42 @@ +module Module + +let f (x: int) = + x + x + +let g () = + (if f 5 = 10 then 0 else 1) + f 1 +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (7,5-7,38) (if f 5 = 10 then 0 else 1) + f 1 + IL_0000: nop + + (7,6-7,22) if f 5 = 10 then + IL_0001: ldc.i4.5 + IL_0002: call Module::f + IL_0007: ldc.i4.s 10 + IL_0009: bne.un.s IL_000f + + (7,23-7,24) 0 + IL_000b: ldc.i4.0 + + + IL_000c: nop + IL_000d: br.s IL_0011 + + (7,30-7,31) 1 + IL_000f: ldc.i4.1 + + + IL_0010: nop + IL_0011: ldc.i4.1 + IL_0012: call Module::f + IL_0017: add + IL_0018: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 05.bsl new file mode 100644 index 00000000000..0277661152e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/If/If 05.bsl @@ -0,0 +1,49 @@ +module Module + +let f (x: int) = + x + x + +let g () = + let mutable x = 0 + if f 5 = 10 then x <- 1 else x <- 2 + x + x +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (7,5-7,22) let mutable x = 0 + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + + (8,5-8,21) if f 5 = 10 then + IL_0002: ldc.i4.5 + IL_0003: call Module::f + IL_0008: ldc.i4.s 10 + IL_000a: bne.un.s IL_0011 + + (8,22-8,28) x <- 1 + IL_000c: ldc.i4.1 + IL_000d: stloc.0 + + + IL_000e: nop + IL_000f: br.s IL_0014 + + (8,34-8,40) x <- 2 + IL_0011: ldc.i4.2 + IL_0012: stloc.0 + + + IL_0013: nop + + (9,5-9,10) x + x + IL_0014: ldloc.0 + IL_0015: ldloc.0 + IL_0016: add + IL_0017: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Match/Match 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Match/Match 01.bsl new file mode 100644 index 00000000000..b3790fbe8d2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Match/Match 01.bsl @@ -0,0 +1,34 @@ +module Module + +let f (x: int) = + x + x + +let g () = + match f 5 with + | 10 -> 0 + | _ -> 1 +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (7,5-7,19) match f 5 with + IL_0000: ldc.i4.5 + IL_0001: call Module::f + IL_0006: ldc.i4.s 10 + IL_0008: sub + IL_0009: switch (1 targets) + IL_0012: br.s IL_0016 + + (8,13-8,14) 0 + IL_0014: ldc.i4.0 + IL_0015: ret + + (9,12-9,13) 1 + IL_0016: ldc.i4.1 + IL_0017: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Match/Match 02 - Bind.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Match/Match 02 - Bind.bsl new file mode 100644 index 00000000000..893bfe7961c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Match/Match 02 - Bind.bsl @@ -0,0 +1,48 @@ +module Module + +let f (x: int) = + x + x + +let g () = + let i = + match f 5 with + | 10 -> 0 + | _ -> 1 + i + 1 +-------------------------------------------------------------------------------- + +Module::f + (4,5-4,10) x + x + IL_0000: ldarg.0 + IL_0001: ldarg.0 + IL_0002: add + IL_0003: ret + +Module::g + (8,9-8,23) match f 5 with + IL_0000: ldc.i4.5 + IL_0001: call Module::f + IL_0006: ldc.i4.s 10 + IL_0008: sub + IL_0009: switch (1 targets) + IL_0012: br.s IL_0018 + + (9,17-9,18) 0 + IL_0014: ldc.i4.0 + + + IL_0015: nop + IL_0016: br.s IL_001a + + (10,16-10,17) 1 + IL_0018: ldc.i4.1 + + + IL_0019: nop + IL_001a: stloc.0 + + (11,5-11,10) i + 1 + IL_001b: ldloc.0 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs index 3d373e0921f..f1319f5e5ff 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs @@ -9,7 +9,8 @@ open FSharp.Test.Compiler [] type private Baseline = - static member verify(source, [] name: string) = + static member verify(source: string, [] name: string) = + let source = source.Trim() let moduleName = StackTrace().GetFrame(1).GetMethod().DeclaringType.Name FSharp source |> asLibrary @@ -50,6 +51,89 @@ let f () = () """ + [] + let ``Body - ErasedCall 01`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 02`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 03`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 04`` () = + Baseline.verify """ +module Module + +let f () = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 05`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 06`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +""" + + [] + let ``Body - ErasedThenKeptCall 01`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +""" + + [] + let ``Body - KeptThenErasedCall 01`` () = + Baseline.verify """ +module Module + +let f () = + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +""" + module ForEach = [] let ``List - Simple 01`` () = @@ -82,6 +166,38 @@ let f (l: int list) = System.Console.WriteLine(i + 1) """ + [] + let ``List - Body - ErasedCall 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" +""" + + [] + let ``List - Body - ErasedThenKeptCall 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +""" + + [] + let ``List - Body - KeptThenErasedCall 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +""" + [] let ``List - Body - ParenUnit 01`` () = Baseline.verify """ @@ -470,3 +586,263 @@ let f (l: string) = for c in l do System.Console.WriteLine c """ + +module If = + [] + let ``If 01`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g () = + if f 5 = 10 then 0 else 1 +""" + + [] + let ``If 02 - Bind`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g () = + let y = if f 5 = 10 then 0 else 1 + y + y +""" + + [] + let ``If 03 - Set`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g (arr: int[]) = + arr[0] <- if f 5 = 10 then 0 else 1 +""" + + [] + let ``If 04`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g () = + (if f 5 = 10 then 0 else 1) + f 1 +""" + + [] + let ``If 05`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g () = + let mutable x = 0 + if f 5 = 10 then x <- 1 else x <- 2 + x + x +""" + +module Match = + [] + let ``Match 01`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g () = + match f 5 with + | 10 -> 0 + | _ -> 1 +""" + + [] + let ``Match 02 - Bind`` () = + Baseline.verify """ +module Module + +let f (x: int) = + x + x + +let g () = + let i = + match f 5 with + | 10 -> 0 + | _ -> 1 + i + 1 +""" + +module Binding = + [] + let ``Module - Unit 01`` () = + Baseline.verify """ +module Module + +let i = () +""" + + [] + let ``Module - SequentialUnits 01`` () = + Baseline.verify """ +module Module + +let i = () +let j = () +""" + + [] + let ``Module - ErasedCall 01`` () = + Baseline.verify """ +module Module + +let i = System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 02`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 03`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 04`` () = + Baseline.verify """ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 05`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 06`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +""" + + [] + let ``Local - Unit 01`` () = + Baseline.verify """ +module Module + +do + let i = () + () +""" + + [] + let ``Local - SequentialUnits 01`` () = + Baseline.verify """ +module Module + +do + let i = () + let j = () + () +""" + + [] + let ``Local - ErasedCall 01`` () = + Baseline.verify """ +module Module + +do + let i = System.Diagnostics.Debug.Write "" + () +""" + + [] + let ``Local - Erased call 02`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 03`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 04`` () = + Baseline.verify """ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 05`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 06`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +""" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl index 0d7172dfc0a..31aa835e6dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl @@ -1455,6 +1455,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string ABC/ABC::get_greeting() @@ -1483,6 +1501,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string ABC::get_greeting() @@ -1492,12 +1529,17 @@ .class private abstract auto ansi sealed ''.$ABC extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl index 4f12c1595c8..d464c830e32 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl @@ -1455,6 +1455,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string ABC/ABC::get_greeting() @@ -1483,6 +1501,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string ABC::get_greeting() @@ -1492,12 +1529,17 @@ .class private abstract auto ansi sealed ''.$ABC extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl index 407197b1184..b9733cee415 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl @@ -2153,6 +2153,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string XYZ.ABC/ABC::get_greeting() @@ -2181,6 +2199,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void XYZ.ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string XYZ.ABC::get_greeting() @@ -2190,12 +2227,17 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void XYZ.ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl index ef41cabbfcb..68b3d9701f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl @@ -2153,6 +2153,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string XYZ.ABC/ABC::get_greeting() @@ -2181,6 +2199,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void XYZ.ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string XYZ.ABC::get_greeting() @@ -2190,12 +2227,17 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void XYZ.ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl index e038bd5a127..6e8437bbab3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl @@ -51,8 +51,7 @@ IL_0011: ldc.i4.0 IL_0012: nop IL_0013: stloc.0 - IL_0014: nop - IL_0015: ret + IL_0014: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl new file mode 100644 index 00000000000..59b47aeff0b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl @@ -0,0 +1,77 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOn.il.bsl similarity index 99% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOn.il.bsl index d13107b7a6f..a55b6493f84 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOn.il.bsl @@ -52,4 +52,3 @@ - diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl index 93f733ef373..eae525a3866 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl @@ -6132,9 +6132,11 @@ FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(FSharp.Compiler.Synt FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(FSharp.Compiler.Syntax.DebugPointAtLeafExpr, System.Collections.IEqualityComparer) FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(System.Object) FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(System.Object, System.Collections.IEqualityComparer) -FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Syntax.DebugPointAtLeafExpr NewYes(FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range Item -FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range get_Item() +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean get_isHidden() +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean isHidden +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Syntax.DebugPointAtLeafExpr NewYes(Boolean, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Int32 GetHashCode() FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Int32 GetHashCode(System.Collections.IEqualityComparer) FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Int32 Tag diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 86f760a3bee..8a0b08717cb 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -58,6 +58,7 @@ $ code --diff {outFile} {expectedFile} if FileSystem.FileExistsShim outFile then FileSystem.FileDeleteShim outFile | Some diff -> + Directory.CreateDirectory(Path.GetDirectoryName expectedFile) |> ignore if shouldUpdateBaselines then if FileSystem.FileExistsShim outFile then FileSystem.FileDeleteShim outFile @@ -1762,13 +1763,29 @@ $ code --diff {outFile} {expectedFile} | :? OpCode as op -> yield (int op.Value &&& 0xffff), op | _ -> () ] + let private declaringTypeName (mdReader: MetadataReader) (handle: EntityHandle) = + if handle.IsNil then "" + else + let row = MetadataTokens.GetRowNumber handle + match handle.Kind with + | HandleKind.TypeDefinition -> mdReader.GetString (mdReader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle row)).Name + | HandleKind.TypeReference -> mdReader.GetString (mdReader.GetTypeReference(MetadataTokens.TypeReferenceHandle row)).Name + | _ -> "" + let rec private tokenName (mdReader: MetadataReader) (token: int) = let handle = MetadataTokens.EntityHandle token let row = MetadataTokens.GetRowNumber handle + let qualify ty nm = if ty = "" then nm else ty + "::" + nm match handle.Kind with - | HandleKind.MethodDefinition -> mdReader.GetString (mdReader.GetMethodDefinition(MetadataTokens.MethodDefinitionHandle row)).Name - | HandleKind.MemberReference -> mdReader.GetString (mdReader.GetMemberReference(MetadataTokens.MemberReferenceHandle row)).Name - | HandleKind.FieldDefinition -> mdReader.GetString (mdReader.GetFieldDefinition(MetadataTokens.FieldDefinitionHandle row)).Name + | HandleKind.MethodDefinition -> + let md = mdReader.GetMethodDefinition(MetadataTokens.MethodDefinitionHandle row) + qualify (declaringTypeName mdReader (TypeDefinitionHandle.op_Implicit (md.GetDeclaringType()))) (mdReader.GetString md.Name) + | HandleKind.MemberReference -> + let mr = mdReader.GetMemberReference(MetadataTokens.MemberReferenceHandle row) + qualify (declaringTypeName mdReader mr.Parent) (mdReader.GetString mr.Name) + | HandleKind.FieldDefinition -> + let fd = mdReader.GetFieldDefinition(MetadataTokens.FieldDefinitionHandle row) + qualify (declaringTypeName mdReader (TypeDefinitionHandle.op_Implicit (fd.GetDeclaringType()))) (mdReader.GetString fd.Name) | HandleKind.TypeReference -> mdReader.GetString (mdReader.GetTypeReference(MetadataTokens.TypeReferenceHandle row)).Name | HandleKind.TypeDefinition -> mdReader.GetString (mdReader.GetTypeDefinition(MetadataTokens.TypeDefinitionHandle row)).Name | HandleKind.MethodSpecification -> tokenName mdReader (MetadataTokens.GetToken (mdReader.GetMethodSpecification(MetadataTokens.MethodSpecificationHandle row)).Method) @@ -1802,7 +1819,8 @@ $ code --diff {outFile} {expectedFile} yield offset, op.Name + text ] let private formatSequencePoints (source: string) (assemblyPath: string) (pdbReader: MetadataReader) = - let lines = source.Replace("\r\n", "\n").Replace("\r", "\n").Split('\n') + let normalizedSource = source.Replace("\r\n", "\n").Replace("\r", "\n") + let lines = normalizedSource.Split('\n') let textOf (sp: SequencePoint) = let sb = StringBuilder() @@ -1840,7 +1858,8 @@ $ code --diff {outFile} {expectedFile} if offset >= sp.Offset && offset < nextOffset then sb.AppendLine(sprintf " IL_%04x: %s" offset text) |> ignore sb.AppendLine() |> ignore) - sb.ToString().Trim() + "\n" + + normalizedSource.Trim() + "\n" + String.replicate 80 "-" + "\n\n" + sb.ToString().Trim() + "\n" let verifySequencePointsBaseline (source: string) (baselineFilePath: string) (result: CompilationResult) : CompilationResult = match result with