From 6cfb404e880dd5136653c33f16ca4a2138c5e8ef Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 4 Jun 2026 17:12:04 +0200 Subject: [PATCH 1/3] Sequence points: rework `for` stepping Step a for-each loop in source order: stop on the enumerable, then the element binding (covering `for `), then the body; "getting the next element" is hidden. Add a sequence-point baseline test helper. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Checking/Expressions/CheckExpressions.fs | 18 +- .../Expressions/CheckSequenceExpressions.fs | 4 +- src/Compiler/CodeGen/IlxGen.fs | 13 +- .../Optimize/LowerComputedCollections.fs | 23 +- src/Compiler/Optimize/Optimizer.fs | 13 +- .../TypedTree/TypedTreeOps.Transforms.fs | 34 +- src/Compiler/pars.fsy | 2 +- .../Debugger/CEDebugPoints.fs | 2 +- .../Debugger/ForArrowDebugPoints.fs | 2 +- .../ForNInRangeArrays.fs.il.bsl | 430 ++++++++-------- .../ForNInRangeLists.fs.il.bsl | 262 +++++----- .../GeneratedIterators/GenIter01.fs.il.bsl | 6 +- .../GeneratedIterators/GenIter02.fs.il.bsl | 6 +- .../GeneratedIterators/GenIter03.fs.il.bsl | 6 +- ...nIter04.fs.RealInternalSignatureOff.il.bsl | 6 +- ...enIter04.fs.RealInternalSignatureOn.il.bsl | 6 +- .../NoBoxingOnDispose01.fs.il.netcore.bsl | 35 +- ...fs.RealInternalSignatureOff.il.netcore.bsl | 6 +- ....fs.RealInternalSignatureOn.il.netcore.bsl | 6 +- .../Array - Body - MultipleStatements 01.bsl | 37 ++ .../Array - Body - SingleStatement 01.bsl | 31 ++ ...ay - Comprehensions - ActivePattern 01.bsl | 58 +++ .../Array - Comprehensions - Arrow 01.bsl | 50 ++ .../Array - Comprehensions - Tuple 01.bsl | 50 ++ .../Array - Comprehensions - Tuple 02.bsl | 54 ++ .../Array - Comprehensions - Value 01.bsl | 54 ++ .../Array - Comprehensions - Value 02.bsl | 50 ++ .../Array - Pattern - ActivePattern 01.bsl | 40 ++ .../ForEach/Array - Pattern - Tuple 01.bsl | 36 ++ .../ForEach/Array - Simple 01.bsl | 30 ++ .../ForEach/List - Body - LetUnit 01.bsl | 31 ++ .../List - Body - MultipleStatements 01.bsl | 35 ++ .../ForEach/List - Body - ParenUnit 01.bsl | 28 ++ .../List - Body - SequentialUnits 01.bsl | 31 ++ .../List - Body - SingleStatement 01.bsl | 29 ++ ...st - Comprehensions - ActivePattern 01.bsl | 44 ++ .../List - Comprehensions - Arrow 01.bsl | 34 ++ .../List - Comprehensions - Tuple 01.bsl | 34 ++ .../List - Comprehensions - Tuple 02.bsl | 40 ++ .../List - Comprehensions - Value 01.bsl | 47 ++ .../List - Comprehensions - Value 02.bsl | 34 ++ .../List - Pattern - ActivePattern 01.bsl | 38 ++ .../ForEach/List - Pattern - Tuple 01.bsl | 34 ++ .../ForEach/List - Simple 01.bsl | 28 ++ .../Seq - Body - MultipleStatements 01.bsl | 47 ++ .../Seq - Body - SingleStatement 01.bsl | 41 ++ ...eq - Comprehensions - ActivePattern 01.bsl | 211 ++++++++ .../Seq - Comprehensions - Arrow 01.bsl | 203 ++++++++ .../Seq - Comprehensions - Tuple 01.bsl | 203 ++++++++ .../Seq - Comprehensions - Tuple 02.bsl | 207 ++++++++ .../Seq - Comprehensions - Value 01.bsl | 213 ++++++++ .../Seq - Comprehensions - Value 02.bsl | 203 ++++++++ .../Seq - Pattern - ActivePattern 01.bsl | 50 ++ .../ForEach/Seq - Pattern - Tuple 01.bsl | 46 ++ .../ForEach/Seq - Simple 01.bsl | 40 ++ .../String - Body - SingleStatement 01.bsl | 38 ++ .../Function/Body - LetThenValue 01.bsl | 8 + .../Function/Body - SequentialUnits 01.bsl | 6 + .../Function/Body - Unit 01.bsl | 3 + .../SequencePoints/SequencePointsTests.fs | 472 ++++++++++++++++++ .../SteppingMatch/SteppingMatch08.fs.il.bsl | 4 +- .../FSharp.Compiler.ComponentTests.fsproj | 1 + tests/FSharp.Test.Utilities/Compiler.fs | 134 ++++- .../Expression/List - Comprehension 01.fs.bsl | 2 +- .../Expression/List - Comprehension 02.fs.bsl | 2 +- 65 files changed, 3537 insertions(+), 454 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index f6e0a61663f..4932830a352 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -8270,8 +8270,8 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s let mEnumExpr = synEnumExpr.Range let mFor = match spFor with DebugPointAtFor.Yes mStart -> mStart | DebugPointAtFor.No -> mEnumExpr let mIn = match spIn with DebugPointAtInOrTo.Yes mStart -> mStart | DebugPointAtInOrTo.No -> mBodyExpr - let spEnumExpr = DebugPointAtBinding.Yes mEnumExpr - let spForBind = match spFor with DebugPointAtFor.Yes m -> DebugPointAtBinding.Yes m | DebugPointAtFor.No -> DebugPointAtBinding.NoneAtSticky + let spEnumExpr = match spFor with DebugPointAtFor.Yes _ -> DebugPointAtBinding.Yes mEnumExpr | DebugPointAtFor.No -> DebugPointAtBinding.NoneAtSticky + let spForBind = match spFor with DebugPointAtFor.Yes _ -> DebugPointAtBinding.Yes(unionRanges mFor mPat) | DebugPointAtFor.No -> DebugPointAtBinding.NoneAtInvisible let spInAsWhile = match spIn with DebugPointAtInOrTo.Yes m -> DebugPointAtWhile.Yes m | DebugPointAtInOrTo.No -> DebugPointAtWhile.No // Check the expression being enumerated @@ -8295,10 +8295,10 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s let elemTy = destArrayTy g enumExprTy // Evaluate the array index lookup - let bodyExprFixup elemVar bodyExpr = mkInvisibleLet mIn elemVar (mkLdelem g mIn elemTy arrExpr idxExpr) bodyExpr + let bodyExprFixup elemVar bodyExpr = mkLet spForBind mFor elemVar (mkLdelem g mIn elemTy arrExpr idxExpr) bodyExpr // Evaluate the array expression once and put it in arrVar - let overallExprFixup overallExpr = mkLet spForBind mFor arrVar enumExpr overallExpr + let overallExprFixup overallExpr = mkLet spEnumExpr mEnumExpr arrVar enumExpr overallExpr // Ask for a loop over integers for the given range (elemTy, bodyExprFixup, overallExprFixup, Choice2Of3 (idxVar, mkZero g mFor, mkDecr g mFor (mkLdlen g mFor arrExpr))) @@ -8316,12 +8316,12 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s // Evaluate the span index lookup let bodyExprFixup elemVar bodyExpr = let elemAddrVar, _ = mkCompGenLocal mIn "addr" elemAddrTy - let e = mkInvisibleLet mIn elemVar (mkAddrGet mIn (mkLocalValRef elemAddrVar)) bodyExpr + let e = mkLet spForBind mFor elemVar (mkAddrGet mIn (mkLocalValRef elemAddrVar)) bodyExpr let getItemCallExpr, _ = BuildMethodCall tcVal g cenv.amap PossiblyMutates mWholeExpr true getItemMethInfo ValUseFlag.NormalValUse [] [ spanExpr ] [ idxExpr ] None mkInvisibleLet mIn elemAddrVar getItemCallExpr e // Evaluate the span expression once and put it in spanVar - let overallExprFixup overallExpr = mkLet spForBind mFor spanVar enumExpr overallExpr + let overallExprFixup overallExpr = mkLet spEnumExpr mEnumExpr spanVar enumExpr overallExpr let getLengthCallExpr, _ = BuildMethodCall tcVal g cenv.amap PossiblyMutates mWholeExpr true getLengthMethInfo ValUseFlag.NormalValUse [] [ spanExpr ] [] None @@ -8410,13 +8410,13 @@ and TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, synPat, s | Choice3Of3(enumerableVar, enumeratorVar, _, getEnumExpr, _, guardExpr, currentExpr) -> // This compiled for must be matched EXACTLY by CompiledForEachExpr - mkLet spForBind mFor enumerableVar enumExpr - (mkLet spEnumExpr mFor enumeratorVar getEnumExpr + mkLet spEnumExpr mEnumExpr enumerableVar enumExpr + (mkInvisibleLet mFor enumeratorVar getEnumExpr (mkTryFinally g (mkWhile g (spInAsWhile, WhileLoopForCompiledForEachExprMarker, guardExpr, - mkInvisibleLet mIn elemVar currentExpr bodyExpr, + mkLet spForBind mIn elemVar currentExpr bodyExpr, mFor), BuildDisposableCleanup cenv env mWholeExpr enumeratorVar, mFor, g.unit_ty, DebugPointAtTry.No, DebugPointAtFinally.No))) diff --git a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs index 86bf635d58a..a43b234fd90 100644 --- a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs @@ -387,7 +387,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT Some(resultExpr, tpenv) - | SynExpr.YieldOrReturn(flags = (isYield, _); expr = synYieldExpr; trivia = { YieldOrReturnKeyword = m }) -> + | SynExpr.YieldOrReturn(flags = (isYield, _); expr = synYieldExpr; range = m) -> let env = { env with eIsControlFlow = false } let genResultTy = NewInferenceType g @@ -404,7 +404,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT if IsControlFlowExpression synYieldExpr then resultExpr else - mkDebugPoint synYieldExpr.Range resultExpr + mkDebugPoint m resultExpr Some(resultExpr, tpenv) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 46b0726fc61..46959e56b22 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -3172,7 +3172,11 @@ and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr (sequel: sequel) = | Expr.Match _ -> GenLinearExpr cenv cgbuf eenv expr sequel false id |> ignore | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) -> - CG.EmitDebugPoint cgbuf m + if equals m range0 then + cgbuf.EmitStartOfHiddenCode() + else + CG.EmitDebugPoint cgbuf m + GenExpr cenv cgbuf eenv innerExpr sequel | Expr.Const(c, m, ty) -> GenConstant cenv cgbuf eenv (c, m, ty) sequel @@ -3733,7 +3737,11 @@ and GenLinearExpr cenv cgbuf eenv expr sequel preSteps (contf: FakeUnit -> FakeU Fake)) | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) -> - CG.EmitDebugPoint cgbuf m + if equals m range0 then + cgbuf.EmitStartOfHiddenCode() + else + CG.EmitDebugPoint cgbuf m + GenLinearExpr cenv cgbuf eenv innerExpr sequel true contf | LinearOpExpr(TOp.UnionCase c, tyargs, argsFront, argLast, m) -> @@ -5280,6 +5288,7 @@ and GenIntegerForLoop cenv cgbuf eenv (spFor, spTo, v, e1, dir, e2, loopBody, m) GenExpr cenv cgbuf eenvinner loopBody discard // v++ or v-- + cgbuf.EmitStartOfHiddenCode() GenGetLocalVal cenv cgbuf eenvinner e2.Range v None CG.EmitInstr cgbuf (pop 0) (Push [ g.ilg.typ_Int32 ]) (mkLdcInt32 1) diff --git a/src/Compiler/Optimize/LowerComputedCollections.fs b/src/Compiler/Optimize/LowerComputedCollections.fs index fa162fae7ca..896540b0ae6 100644 --- a/src/Compiler/Optimize/LowerComputedCollections.fs +++ b/src/Compiler/Optimize/LowerComputedCollections.fs @@ -339,12 +339,12 @@ module List = let loop = mkLoop (fun _idxVar loopVar -> - let body = - body - |> Option.map (fun (loopVal, body) -> mkInvisibleLet m loopVal loopVar body) - |> Option.defaultValue loopVar - - mkCallCollectorAdd tcVal g reader mBody collector body) + match body with + | Some (loopVal, body) -> + mkInvisibleLet m loopVal loopVar + (Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mkCallCollectorAdd tcVal g reader mBody collector body)) + | None -> + mkCallCollectorAdd tcVal g reader mBody collector loopVar) let close = mkCallCollectorClose tcVal g reader mBody collector mkSequential m loop close @@ -504,12 +504,13 @@ module Array = mkCompGenLetIn mFor "array" arrayTy (mkNewArray count) (fun (_, array) -> let loop = mkLoop (fun idxVar loopVar -> - let body = - body - |> Option.map (fun (loopVal, body) -> mkInvisibleLet mBody loopVal loopVar body) - |> Option.defaultValue loopVar + let mkStore elem = mkAsmExpr ([stelem], [], [array; convToNativeInt NoCheckOvf idxVar; elem], [], mBody) - mkAsmExpr ([stelem], [], [array; convToNativeInt NoCheckOvf idxVar; body], [], mBody)) + match body with + | Some (loopVal, body) -> + mkInvisibleLet mBody loopVal loopVar (Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mkStore body)) + | None -> + mkStore loopVar) mkSequential m loop array) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 3cbb574598c..a6fa90d1e3a 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -2873,11 +2873,14 @@ and OptimizeLinearExpr cenv env expr contf = let e1R, e1info = OptimizeExpr cenv env e1 OptimizeLinearExpr cenv env e2 (contf << (fun (e2R, e2info) -> - if (flag = NormalSeq) && - // Always eliminate '(); expr' sequences, even in debug code, to ensure that - // conditional method calls don't leave a dangling breakpoint (see FSharp 1.0 bug 6034) - (cenv.settings.EliminateSequential || (match stripDebugPoints e1R with Expr.Const (Const.Unit, _, _) -> true | _ -> false)) && - not e1info.HasEffect then + 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)) && + not e1info.HasEffect then e2R, e2info else Expr.Sequential (e1R, e2R, flag, m), diff --git a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs index d9503800020..a676cc3e6dd 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs @@ -1254,7 +1254,7 @@ module internal TupleCompilation = Let(enumeratorVar, GetEnumeratorCall enumerableVar2, _enumeratorBind, - TryFinally(WhileLoopForCompiledForEachExpr(spInWhile, _, (Let(elemVar, _, _, bodyExpr) as elemLet), _), _))) when + TryFinally(WhileLoopForCompiledForEachExpr(spInWhile, _, (Let(elemVar, _, spElem, bodyExpr) as elemLet), _), _))) when // Apply correctness conditions to ensure this really is a compiled for-each expression. valRefEq g (mkLocalValRef enumerableVar) enumerableVar2 && enumerableVar.IsCompilerGenerated @@ -1271,7 +1271,7 @@ module internal TupleCompilation = let mIn = elemLet.Range let mFor = - match spFor with + match spElem with | DebugPointAtBinding.Yes mFor -> mFor | _ -> enumerableExpr.Range @@ -1287,7 +1287,7 @@ module internal TupleCompilation = let enumerableTy = tyOfExpr g enumerableExpr - ValueSome(enumerableTy, enumerableExpr, elemVar, bodyExpr, (mBody, spFor, spIn, mFor, mIn, spInWhile, mWholeExpr)) + ValueSome(enumerableTy, enumerableExpr, elemVar, bodyExpr, (mBody, spFor, spElem, spIn, mFor, mIn, spInWhile, mWholeExpr)) | _ -> ValueNone [] @@ -2147,7 +2147,7 @@ module internal TupleCompilation = match option, expr with | _, CompiledInt32RangeForEachExpr g (startExpr, (1 | -1 as step), finishExpr, elemVar, bodyExpr, ranges) -> - let _mBody, spFor, spIn, _mFor, _mIn, _spInWhile, mWholeExpr = ranges + let _mBody, spFor, _spElem, spIn, _mFor, _mIn, _spInWhile, mWholeExpr = ranges let spFor = match spFor with @@ -2164,13 +2164,13 @@ module internal TupleCompilation = ValueNone) with | ValueSome(rangeTy, (start, step, finish)) -> - let mBody, _spFor, _spIn, mFor, mIn, spInWhile, _mWhole = ranges + let mBody, _spFor, _spElem, _spIn, mFor, mIn, spInWhile, _mWhole = ranges mkOptimizedRangeLoop g (mBody, mFor, mIn, spInWhile) (rangeTy, enumerableExpr) (start, step, finish) (fun _count mkLoop -> mkLoop (fun _idxVar loopVar -> mkInvisibleLet elemVar.Range elemVar loopVar bodyExpr)) | ValueNone -> - let mBody, spFor, spIn, mFor, mIn, spInWhile, mWholeExpr = ranges + let mBody, spFor, spElem, spIn, mFor, mIn, spInWhile, mWholeExpr = ranges if isStringTy g enumerableTy then // type is string, optimize for expression as: @@ -2189,7 +2189,7 @@ module internal TupleCompilation = let finishExpr = mkDecr g mFor lengthExpr // for compat reasons, loop item over string is sometimes object, not char let loopItemExpr = mkCoerceIfNeeded g elemVar.Type g.char_ty charExpr - let bodyExpr = mkInvisibleLet mIn elemVar loopItemExpr bodyExpr + let bodyExpr = mkLet spElem mFor elemVar loopItemExpr bodyExpr let forExpr = mkFastForLoop g (DebugPointAtFor.No, spIn, mWholeExpr, idxVar, startExpr, true, finishExpr, bodyExpr) @@ -2223,18 +2223,16 @@ module internal TupleCompilation = let tailOrNullExpr = mkUnionCaseFieldGetUnprovenViaExprAddr (currentExpr, g.cons_ucref, [ elemTy ], IndexTail, mIn) - let bodyExpr = - mkInvisibleLet + let loopStep = + mkSequential mIn - elemVar - headOrDefaultExpr - (mkSequential - mIn - bodyExpr - (mkSequential - mIn - (mkValSet mIn (mkLocalValRef currentVar) nextExpr) - (mkValSet mIn (mkLocalValRef nextVar) tailOrNullExpr))) + (mkValSet mIn (mkLocalValRef currentVar) nextExpr) + (mkValSet mIn (mkLocalValRef nextVar) tailOrNullExpr) + + let bodyAndStep = + mkSequential mIn bodyExpr (Expr.DebugPoint(DebugPointAtLeafExpr.Yes range0, loopStep)) + + let bodyExpr = mkLet spElem mFor elemVar headOrDefaultExpr bodyAndStep let expr = // let mutable current = enumerableExpr diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index bfeb413d3ca..01120123a36 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -5708,7 +5708,7 @@ arrowThenExprR: { let mArrow = rhs parseState 1 let expr = $2 mArrow let trivia: SynExprYieldOrReturnTrivia = { YieldOrReturnKeyword = mArrow } - SynExpr.YieldOrReturn((true, false), expr, (unionRanges mArrow expr.Range), trivia) } + SynExpr.YieldOrReturn((true, false), expr, expr.Range, trivia) } forLoopBinder: | parenPattern IN declExpr diff --git a/tests/FSharp.Compiler.ComponentTests/Debugger/CEDebugPoints.fs b/tests/FSharp.Compiler.ComponentTests/Debugger/CEDebugPoints.fs index 7c11ae49e20..a444c0dfc80 100644 --- a/tests/FSharp.Compiler.ComponentTests/Debugger/CEDebugPoints.fs +++ b/tests/FSharp.Compiler.ComponentTests/Debugger/CEDebugPoints.fs @@ -30,7 +30,7 @@ let a = seq { yield 42 } - """ "GenerateNext" [ (Line 6, Col 15, Line 6, Col 17) ] + """ "GenerateNext" [ (Line 6, Col 9, Line 6, Col 17) ] [] let ``ReturnFrom in async CE - debug point covers full expression`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Debugger/ForArrowDebugPoints.fs b/tests/FSharp.Compiler.ComponentTests/Debugger/ForArrowDebugPoints.fs index 08eabb2e9eb..455d974c6fa 100644 --- a/tests/FSharp.Compiler.ComponentTests/Debugger/ForArrowDebugPoints.fs +++ b/tests/FSharp.Compiler.ComponentTests/Debugger/ForArrowDebugPoints.fs @@ -56,7 +56,7 @@ let squares = [ (Line 4, Col 1, Line 7, Col 6) (Line 5, Col 5, Line 5, Col 8) (Line 5, Col 11, Line 5, Col 13) - (Line 6, Col 15, Line 6, Col 20) + (Line 6, Col 9, Line 6, Col 20) (Line 16707566, Col 0, Line 16707566, Col 0) ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl index f89e175d24e..89c764be9d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeArrays.fs.il.bsl @@ -407,11 +407,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0039 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -472,11 +472,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0049 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -607,11 +607,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0029 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -658,11 +658,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0029 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -711,11 +711,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0031 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -768,11 +768,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0031 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -827,11 +827,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0039 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -894,11 +894,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0049 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_5 IL_0018: stloc.s V_6 IL_001a: ldloc.s V_6 @@ -971,11 +971,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0049 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -1119,11 +1119,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0029 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -1178,11 +1178,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0029 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -1229,11 +1229,11 @@ IL_000d: stloc.2 IL_000e: br.s IL_0028 - IL_0010: ldloc.0 - IL_0011: ldloc.1 - IL_0012: conv.i - IL_0013: ldloc.2 - IL_0014: stloc.3 + IL_0010: ldloc.2 + IL_0011: stloc.3 + IL_0012: ldloc.0 + IL_0013: ldloc.1 + IL_0014: conv.i IL_0015: stloc.s V_4 IL_0017: stloc.s V_5 IL_0019: ldloc.s V_5 @@ -1296,11 +1296,11 @@ IL_000f: stloc.2 IL_0010: br.s IL_002a - IL_0012: ldloc.0 - IL_0013: ldloc.1 - IL_0014: conv.i - IL_0015: ldloc.2 - IL_0016: stloc.3 + IL_0012: ldloc.2 + IL_0013: stloc.3 + IL_0014: ldloc.0 + IL_0015: ldloc.1 + IL_0016: conv.i IL_0017: stloc.s V_4 IL_0019: stloc.s V_5 IL_001b: ldloc.s V_5 @@ -1347,11 +1347,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_002a - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -1426,11 +1426,11 @@ IL_002c: stloc.s V_4 IL_002e: br.s IL_004d - IL_0030: ldloc.2 - IL_0031: ldloc.3 - IL_0032: conv.i - IL_0033: ldloc.s V_4 - IL_0035: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: stloc.s V_5 + IL_0034: ldloc.2 + IL_0035: ldloc.3 + IL_0036: conv.i IL_0037: stloc.s V_6 IL_0039: stloc.s V_7 IL_003b: ldloc.s V_7 @@ -1504,11 +1504,11 @@ IL_002a: stloc.s V_4 IL_002c: br.s IL_004b - IL_002e: ldloc.2 - IL_002f: ldloc.3 - IL_0030: conv.i - IL_0031: ldloc.s V_4 - IL_0033: stloc.s V_5 + IL_002e: ldloc.s V_4 + IL_0030: stloc.s V_5 + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i IL_0035: stloc.s V_6 IL_0037: stloc.s V_7 IL_0039: ldloc.s V_7 @@ -1584,11 +1584,11 @@ IL_002a: stloc.s V_4 IL_002c: br.s IL_004b - IL_002e: ldloc.2 - IL_002f: ldloc.3 - IL_0030: conv.i - IL_0031: ldloc.s V_4 - IL_0033: stloc.s V_5 + IL_002e: ldloc.s V_4 + IL_0030: stloc.s V_5 + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i IL_0035: stloc.s V_6 IL_0037: stloc.s V_7 IL_0039: ldloc.s V_7 @@ -1662,11 +1662,11 @@ IL_002c: stloc.s V_4 IL_002e: br.s IL_004d - IL_0030: ldloc.2 - IL_0031: ldloc.3 - IL_0032: conv.i - IL_0033: ldloc.s V_4 - IL_0035: stloc.s V_5 + IL_0030: ldloc.s V_4 + IL_0032: stloc.s V_5 + IL_0034: ldloc.2 + IL_0035: ldloc.3 + IL_0036: conv.i IL_0037: stloc.s V_6 IL_0039: stloc.s V_7 IL_003b: ldloc.s V_7 @@ -1786,11 +1786,11 @@ IL_005f: stloc.s V_4 IL_0061: br.s IL_0080 - IL_0063: ldloc.2 - IL_0064: ldloc.3 - IL_0065: conv.i - IL_0066: ldloc.s V_4 - IL_0068: stloc.s V_5 + IL_0063: ldloc.s V_4 + IL_0065: stloc.s V_5 + IL_0067: ldloc.2 + IL_0068: ldloc.3 + IL_0069: conv.i IL_006a: stloc.s V_6 IL_006c: stloc.s V_7 IL_006e: ldloc.s V_7 @@ -1864,11 +1864,11 @@ IL_002a: stloc.s V_4 IL_002c: br.s IL_004b - IL_002e: ldloc.2 - IL_002f: ldloc.3 - IL_0030: conv.i - IL_0031: ldloc.s V_4 - IL_0033: stloc.s V_5 + IL_002e: ldloc.s V_4 + IL_0030: stloc.s V_5 + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i IL_0035: stloc.s V_6 IL_0037: stloc.s V_7 IL_0039: ldloc.s V_7 @@ -1990,11 +1990,11 @@ IL_005f: stloc.s V_4 IL_0061: br.s IL_0080 - IL_0063: ldloc.2 - IL_0064: ldloc.3 - IL_0065: conv.i - IL_0066: ldloc.s V_4 - IL_0068: stloc.s V_5 + IL_0063: ldloc.s V_4 + IL_0065: stloc.s V_5 + IL_0067: ldloc.2 + IL_0068: ldloc.3 + IL_0069: conv.i IL_006a: stloc.s V_6 IL_006c: stloc.s V_7 IL_006e: ldloc.s V_7 @@ -2070,11 +2070,11 @@ IL_002a: stloc.s V_4 IL_002c: br.s IL_004b - IL_002e: ldloc.2 - IL_002f: ldloc.3 - IL_0030: conv.i - IL_0031: ldloc.s V_4 - IL_0033: stloc.s V_5 + IL_002e: ldloc.s V_4 + IL_0030: stloc.s V_5 + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i IL_0035: stloc.s V_6 IL_0037: stloc.s V_7 IL_0039: ldloc.s V_7 @@ -2196,11 +2196,11 @@ IL_005a: stloc.s V_4 IL_005c: br.s IL_007b - IL_005e: ldloc.2 - IL_005f: ldloc.3 - IL_0060: conv.i - IL_0061: ldloc.s V_4 - IL_0063: stloc.s V_5 + IL_005e: ldloc.s V_4 + IL_0060: stloc.s V_5 + IL_0062: ldloc.2 + IL_0063: ldloc.3 + IL_0064: conv.i IL_0065: stloc.s V_6 IL_0067: stloc.s V_7 IL_0069: ldloc.s V_7 @@ -2324,11 +2324,11 @@ IL_005a: stloc.s V_4 IL_005c: br.s IL_007b - IL_005e: ldloc.2 - IL_005f: ldloc.3 - IL_0060: conv.i - IL_0061: ldloc.s V_4 - IL_0063: stloc.s V_5 + IL_005e: ldloc.s V_4 + IL_0060: stloc.s V_5 + IL_0062: ldloc.2 + IL_0063: ldloc.3 + IL_0064: conv.i IL_0065: stloc.s V_6 IL_0067: stloc.s V_7 IL_0069: ldloc.s V_7 @@ -2406,11 +2406,11 @@ IL_0034: stloc.s V_5 IL_0036: br.s IL_0058 - IL_0038: ldloc.3 - IL_0039: ldloc.s V_4 - IL_003b: conv.i - IL_003c: ldloc.s V_5 - IL_003e: stloc.s V_6 + IL_0038: ldloc.s V_5 + IL_003a: stloc.s V_6 + IL_003c: ldloc.3 + IL_003d: ldloc.s V_4 + IL_003f: conv.i IL_0040: stloc.s V_7 IL_0042: stloc.s V_8 IL_0044: ldloc.s V_8 @@ -2488,11 +2488,11 @@ IL_0032: stloc.s V_5 IL_0034: br.s IL_0056 - IL_0036: ldloc.3 - IL_0037: ldloc.s V_4 - IL_0039: conv.i - IL_003a: ldloc.s V_5 - IL_003c: stloc.s V_6 + IL_0036: ldloc.s V_5 + IL_0038: stloc.s V_6 + IL_003a: ldloc.3 + IL_003b: ldloc.s V_4 + IL_003d: conv.i IL_003e: stloc.s V_7 IL_0040: stloc.s V_8 IL_0042: ldloc.s V_8 @@ -2577,11 +2577,11 @@ IL_003b: stloc.s V_6 IL_003d: br.s IL_0060 - IL_003f: ldloc.s V_4 - IL_0041: ldloc.s V_5 - IL_0043: conv.i - IL_0044: ldloc.s V_6 - IL_0046: stloc.s V_7 + IL_003f: ldloc.s V_6 + IL_0041: stloc.s V_7 + IL_0043: ldloc.s V_4 + IL_0045: ldloc.s V_5 + IL_0047: conv.i IL_0048: stloc.s V_8 IL_004a: stloc.s V_9 IL_004c: ldloc.s V_9 @@ -2659,11 +2659,11 @@ IL_0034: stloc.s V_5 IL_0036: br.s IL_0058 - IL_0038: ldloc.3 - IL_0039: ldloc.s V_4 - IL_003b: conv.i - IL_003c: ldloc.s V_5 - IL_003e: stloc.s V_6 + IL_0038: ldloc.s V_5 + IL_003a: stloc.s V_6 + IL_003c: ldloc.3 + IL_003d: ldloc.s V_4 + IL_003f: conv.i IL_0040: stloc.s V_7 IL_0042: stloc.s V_8 IL_0044: ldloc.s V_8 @@ -2787,11 +2787,11 @@ IL_0067: stloc.s V_5 IL_0069: br.s IL_008b - IL_006b: ldloc.3 - IL_006c: ldloc.s V_4 - IL_006e: conv.i - IL_006f: ldloc.s V_5 - IL_0071: stloc.s V_6 + IL_006b: ldloc.s V_5 + IL_006d: stloc.s V_6 + IL_006f: ldloc.3 + IL_0070: ldloc.s V_4 + IL_0072: conv.i IL_0073: stloc.s V_7 IL_0075: stloc.s V_8 IL_0077: ldloc.s V_8 @@ -2869,11 +2869,11 @@ IL_0032: stloc.s V_5 IL_0034: br.s IL_0056 - IL_0036: ldloc.3 - IL_0037: ldloc.s V_4 - IL_0039: conv.i - IL_003a: ldloc.s V_5 - IL_003c: stloc.s V_6 + IL_0036: ldloc.s V_5 + IL_0038: stloc.s V_6 + IL_003a: ldloc.3 + IL_003b: ldloc.s V_4 + IL_003d: conv.i IL_003e: stloc.s V_7 IL_0040: stloc.s V_8 IL_0042: ldloc.s V_8 @@ -3011,11 +3011,11 @@ IL_0076: stloc.s V_7 IL_0078: br.s IL_009b - IL_007a: ldloc.s V_5 - IL_007c: ldloc.s V_6 - IL_007e: conv.i - IL_007f: ldloc.s V_7 - IL_0081: stloc.s V_8 + IL_007a: ldloc.s V_7 + IL_007c: stloc.s V_8 + IL_007e: ldloc.s V_5 + IL_0080: ldloc.s V_6 + IL_0082: conv.i IL_0083: stloc.s V_9 IL_0085: stloc.s V_10 IL_0087: ldloc.s V_10 @@ -3140,11 +3140,11 @@ IL_005a: stloc.s V_4 IL_005c: br.s IL_0087 - IL_005e: ldloc.2 - IL_005f: ldloc.3 - IL_0060: conv.i - IL_0061: ldloc.s V_4 - IL_0063: stloc.s V_5 + IL_005e: ldloc.s V_4 + IL_0060: stloc.s V_5 + IL_0062: ldloc.2 + IL_0063: ldloc.3 + IL_0064: conv.i IL_0065: stloc.s V_6 IL_0067: stloc.s V_7 IL_0069: ldloc.s V_7 @@ -3273,11 +3273,11 @@ IL_005a: stloc.s V_4 IL_005c: br.s IL_0087 - IL_005e: ldloc.2 - IL_005f: ldloc.3 - IL_0060: conv.i - IL_0061: ldloc.s V_4 - IL_0063: stloc.s V_5 + IL_005e: ldloc.s V_4 + IL_0060: stloc.s V_5 + IL_0062: ldloc.2 + IL_0063: ldloc.3 + IL_0064: conv.i IL_0065: stloc.s V_6 IL_0067: stloc.s V_7 IL_0069: ldloc.s V_7 @@ -3407,11 +3407,11 @@ IL_005a: stloc.s V_4 IL_005c: br.s IL_0086 - IL_005e: ldloc.2 - IL_005f: ldloc.3 - IL_0060: conv.i - IL_0061: ldloc.s V_4 - IL_0063: stloc.s V_5 + IL_005e: ldloc.s V_4 + IL_0060: stloc.s V_5 + IL_0062: ldloc.2 + IL_0063: ldloc.3 + IL_0064: conv.i IL_0065: stloc.s V_6 IL_0067: stloc.s V_7 IL_0069: ldloc.s V_7 @@ -3476,11 +3476,11 @@ IL_001e: stloc.s V_4 IL_0020: br.s IL_0043 - IL_0022: ldloc.2 - IL_0023: ldloc.3 - IL_0024: conv.i - IL_0025: ldloc.s V_4 - IL_0027: stloc.s V_5 + IL_0022: ldloc.s V_4 + IL_0024: stloc.s V_5 + IL_0026: ldloc.2 + IL_0027: ldloc.3 + IL_0028: conv.i IL_0029: stloc.s V_6 IL_002b: stloc.s V_7 IL_002d: ldloc.s V_7 @@ -3543,11 +3543,11 @@ IL_001e: stloc.3 IL_001f: br.s IL_003d - IL_0021: ldloc.1 - IL_0022: ldloc.2 - IL_0023: conv.i - IL_0024: ldloc.3 - IL_0025: stloc.s V_4 + IL_0021: ldloc.3 + IL_0022: stloc.s V_4 + IL_0024: ldloc.1 + IL_0025: ldloc.2 + IL_0026: conv.i IL_0027: stloc.s V_5 IL_0029: stloc.s V_6 IL_002b: ldloc.s V_6 @@ -3607,11 +3607,11 @@ IL_001e: stloc.2 IL_001f: br.s IL_0039 - IL_0021: ldloc.0 - IL_0022: ldloc.1 - IL_0023: conv.i - IL_0024: ldloc.2 - IL_0025: stloc.3 + IL_0021: ldloc.2 + IL_0022: stloc.3 + IL_0023: ldloc.0 + IL_0024: ldloc.1 + IL_0025: conv.i IL_0026: stloc.s V_4 IL_0028: stloc.s V_5 IL_002a: ldloc.s V_5 @@ -3670,11 +3670,11 @@ IL_001e: stloc.3 IL_001f: br.s IL_003d - IL_0021: ldloc.1 - IL_0022: ldloc.2 - IL_0023: conv.i - IL_0024: ldloc.3 - IL_0025: stloc.s V_4 + IL_0021: ldloc.3 + IL_0022: stloc.s V_4 + IL_0024: ldloc.1 + IL_0025: ldloc.2 + IL_0026: conv.i IL_0027: stloc.s V_5 IL_0029: stloc.s V_6 IL_002b: ldloc.s V_6 @@ -3756,11 +3756,11 @@ IL_002a: stloc.s V_4 IL_002c: br.s IL_005d - IL_002e: ldloc.2 - IL_002f: ldloc.3 - IL_0030: conv.i - IL_0031: ldloc.s V_4 - IL_0033: stloc.s V_5 + IL_002e: ldloc.s V_4 + IL_0030: stloc.s V_5 + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i IL_0035: stloc.s V_6 IL_0037: stloc.s V_7 IL_0039: ldloc.s V_7 @@ -3870,11 +3870,11 @@ IL_0042: stloc.s V_6 IL_0044: br.s IL_0081 - IL_0046: ldloc.3 - IL_0047: ldloc.s V_5 - IL_0049: conv.i - IL_004a: ldloc.s V_6 - IL_004c: stloc.s V_7 + IL_0046: ldloc.s V_6 + IL_0048: stloc.s V_7 + IL_004a: ldloc.3 + IL_004b: ldloc.s V_5 + IL_004d: conv.i IL_004e: stloc.s V_8 IL_0050: stloc.s V_9 IL_0052: ldloc.s V_9 @@ -3931,11 +3931,11 @@ IL_009f: stloc.s V_6 IL_00a1: br.s IL_00d6 - IL_00a3: ldloc.3 - IL_00a4: ldloc.s V_10 - IL_00a6: conv.i - IL_00a7: ldloc.s V_6 - IL_00a9: stloc.s V_7 + IL_00a3: ldloc.s V_6 + IL_00a5: stloc.s V_7 + IL_00a7: ldloc.3 + IL_00a8: ldloc.s V_10 + IL_00aa: conv.i IL_00ab: stloc.s V_11 IL_00ad: stloc.s V_12 IL_00af: ldloc.s V_12 @@ -4047,11 +4047,11 @@ IL_0042: stloc.s V_6 IL_0044: br.s IL_0081 - IL_0046: ldloc.3 - IL_0047: ldloc.s V_5 - IL_0049: conv.i - IL_004a: ldloc.s V_6 - IL_004c: stloc.s V_7 + IL_0046: ldloc.s V_6 + IL_0048: stloc.s V_7 + IL_004a: ldloc.3 + IL_004b: ldloc.s V_5 + IL_004d: conv.i IL_004e: stloc.s V_8 IL_0050: stloc.s V_9 IL_0052: ldloc.s V_9 @@ -4108,11 +4108,11 @@ IL_009f: stloc.s V_7 IL_00a1: br.s IL_00d6 - IL_00a3: ldloc.3 - IL_00a4: ldloc.s V_6 - IL_00a6: conv.i - IL_00a7: ldloc.s V_7 - IL_00a9: stloc.s V_10 + IL_00a3: ldloc.s V_7 + IL_00a5: stloc.s V_10 + IL_00a7: ldloc.3 + IL_00a8: ldloc.s V_6 + IL_00aa: conv.i IL_00ab: stloc.s V_11 IL_00ad: stloc.s V_12 IL_00af: ldloc.s V_12 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl index 842035cf524..4f629775f5f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForNInRangeLists.fs.il.bsl @@ -400,9 +400,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_002b - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldarg.0 @@ -461,11 +461,11 @@ IL_000e: stloc.2 IL_000f: br.s IL_0049 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: conv.i - IL_0014: ldloc.2 - IL_0015: stloc.3 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.0 + IL_0014: ldloc.1 + IL_0015: conv.i IL_0016: stloc.s V_4 IL_0018: stloc.s V_5 IL_001a: ldloc.s V_5 @@ -590,9 +590,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_001f - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 @@ -633,9 +633,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_001f - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 @@ -677,9 +677,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0023 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: stloc.s V_5 @@ -723,9 +723,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0023 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: stloc.s V_5 @@ -770,9 +770,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0027 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: stloc.s V_5 @@ -822,9 +822,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0037 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_5 IL_000d: ldloc.s V_5 IL_000f: ldloc.3 @@ -884,9 +884,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0037 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldarg.0 @@ -1019,9 +1019,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_001f - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 @@ -1070,9 +1070,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_001f - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 @@ -1113,9 +1113,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_001f - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 @@ -1172,9 +1172,9 @@ IL_0005: stloc.2 IL_0006: br.s IL_0020 - IL_0008: ldloca.s V_0 - IL_000a: ldloc.2 - IL_000b: stloc.3 + IL_0008: ldloc.2 + IL_0009: stloc.3 + IL_000a: ldloca.s V_0 IL_000c: stloc.s V_4 IL_000e: ldloc.s V_4 IL_0010: ldloc.3 @@ -1215,9 +1215,9 @@ IL_0005: stloc.2 IL_0006: br.s IL_0021 - IL_0008: ldloca.s V_0 - IL_000a: ldloc.2 - IL_000b: stloc.3 + IL_0008: ldloc.2 + IL_0009: stloc.3 + IL_000a: ldloca.s V_0 IL_000c: stloc.s V_4 IL_000e: ldloc.s V_4 IL_0010: ldloc.3 @@ -1278,9 +1278,9 @@ IL_0019: stloc.3 IL_001a: br.s IL_0036 - IL_001c: ldloca.s V_1 - IL_001e: ldloc.3 - IL_001f: stloc.s V_4 + IL_001c: ldloc.3 + IL_001d: stloc.s V_4 + IL_001f: ldloca.s V_1 IL_0021: stloc.s V_5 IL_0023: ldloc.s V_5 IL_0025: ldloc.s V_4 @@ -1340,9 +1340,9 @@ IL_0017: stloc.3 IL_0018: br.s IL_0034 - IL_001a: ldloca.s V_1 - IL_001c: ldloc.3 - IL_001d: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: stloc.s V_4 + IL_001d: ldloca.s V_1 IL_001f: stloc.s V_5 IL_0021: ldloc.s V_5 IL_0023: ldloc.s V_4 @@ -1403,9 +1403,9 @@ IL_0017: stloc.3 IL_0018: br.s IL_0034 - IL_001a: ldloca.s V_1 - IL_001c: ldloc.3 - IL_001d: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: stloc.s V_4 + IL_001d: ldloca.s V_1 IL_001f: stloc.s V_5 IL_0021: ldloc.s V_5 IL_0023: ldloc.s V_4 @@ -1465,9 +1465,9 @@ IL_0019: stloc.3 IL_001a: br.s IL_0036 - IL_001c: ldloca.s V_1 - IL_001e: ldloc.3 - IL_001f: stloc.s V_4 + IL_001c: ldloc.3 + IL_001d: stloc.s V_4 + IL_001f: ldloca.s V_1 IL_0021: stloc.s V_5 IL_0023: ldloc.s V_5 IL_0025: ldloc.s V_4 @@ -1573,9 +1573,9 @@ IL_004c: stloc.3 IL_004d: br.s IL_0069 - IL_004f: ldloca.s V_1 - IL_0051: ldloc.3 - IL_0052: stloc.s V_4 + IL_004f: ldloc.3 + IL_0050: stloc.s V_4 + IL_0052: ldloca.s V_1 IL_0054: stloc.s V_5 IL_0056: ldloc.s V_5 IL_0058: ldloc.s V_4 @@ -1635,9 +1635,9 @@ IL_0017: stloc.3 IL_0018: br.s IL_0034 - IL_001a: ldloca.s V_1 - IL_001c: ldloc.3 - IL_001d: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: stloc.s V_4 + IL_001d: ldloca.s V_1 IL_001f: stloc.s V_5 IL_0021: ldloc.s V_5 IL_0023: ldloc.s V_4 @@ -1744,9 +1744,9 @@ IL_004c: stloc.3 IL_004d: br.s IL_0069 - IL_004f: ldloca.s V_1 - IL_0051: ldloc.3 - IL_0052: stloc.s V_4 + IL_004f: ldloc.3 + IL_0050: stloc.s V_4 + IL_0052: ldloca.s V_1 IL_0054: stloc.s V_5 IL_0056: ldloc.s V_5 IL_0058: ldloc.s V_4 @@ -1807,9 +1807,9 @@ IL_0017: stloc.3 IL_0018: br.s IL_0034 - IL_001a: ldloca.s V_1 - IL_001c: ldloc.3 - IL_001d: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: stloc.s V_4 + IL_001d: ldloca.s V_1 IL_001f: stloc.s V_5 IL_0021: ldloc.s V_5 IL_0023: ldloc.s V_4 @@ -1916,9 +1916,9 @@ IL_0047: stloc.3 IL_0048: br.s IL_0064 - IL_004a: ldloca.s V_1 - IL_004c: ldloc.3 - IL_004d: stloc.s V_4 + IL_004a: ldloc.3 + IL_004b: stloc.s V_4 + IL_004d: ldloca.s V_1 IL_004f: stloc.s V_5 IL_0051: ldloc.s V_5 IL_0053: ldloc.s V_4 @@ -2029,9 +2029,9 @@ IL_0047: stloc.3 IL_0048: br.s IL_0064 - IL_004a: ldloca.s V_1 - IL_004c: ldloc.3 - IL_004d: stloc.s V_4 + IL_004a: ldloc.3 + IL_004b: stloc.s V_4 + IL_004d: ldloca.s V_1 IL_004f: stloc.s V_5 IL_0051: ldloc.s V_5 IL_0053: ldloc.s V_4 @@ -2095,9 +2095,9 @@ IL_0020: stloc.s V_4 IL_0022: br.s IL_0041 - IL_0024: ldloca.s V_2 - IL_0026: ldloc.s V_4 - IL_0028: stloc.s V_5 + IL_0024: ldloc.s V_4 + IL_0026: stloc.s V_5 + IL_0028: ldloca.s V_2 IL_002a: stloc.s V_6 IL_002c: ldloc.s V_6 IL_002e: ldloc.s V_5 @@ -2161,9 +2161,9 @@ IL_001e: stloc.s V_4 IL_0020: br.s IL_003f - IL_0022: ldloca.s V_2 - IL_0024: ldloc.s V_4 - IL_0026: stloc.s V_5 + IL_0022: ldloc.s V_4 + IL_0024: stloc.s V_5 + IL_0026: ldloca.s V_2 IL_0028: stloc.s V_6 IL_002a: ldloc.s V_6 IL_002c: ldloc.s V_5 @@ -2233,9 +2233,9 @@ IL_0027: stloc.s V_5 IL_0029: br.s IL_004a - IL_002b: ldloca.s V_3 - IL_002d: ldloc.s V_5 - IL_002f: stloc.s V_6 + IL_002b: ldloc.s V_5 + IL_002d: stloc.s V_6 + IL_002f: ldloca.s V_3 IL_0031: stloc.s V_7 IL_0033: ldloc.s V_7 IL_0035: ldloc.s V_6 @@ -2299,9 +2299,9 @@ IL_0020: stloc.s V_4 IL_0022: br.s IL_0041 - IL_0024: ldloca.s V_2 - IL_0026: ldloc.s V_4 - IL_0028: stloc.s V_5 + IL_0024: ldloc.s V_4 + IL_0026: stloc.s V_5 + IL_0028: ldloca.s V_2 IL_002a: stloc.s V_6 IL_002c: ldloc.s V_6 IL_002e: ldloc.s V_5 @@ -2411,9 +2411,9 @@ IL_0053: stloc.s V_4 IL_0055: br.s IL_0074 - IL_0057: ldloca.s V_2 - IL_0059: ldloc.s V_4 - IL_005b: stloc.s V_5 + IL_0057: ldloc.s V_4 + IL_0059: stloc.s V_5 + IL_005b: ldloca.s V_2 IL_005d: stloc.s V_6 IL_005f: ldloc.s V_6 IL_0061: ldloc.s V_5 @@ -2477,9 +2477,9 @@ IL_001e: stloc.s V_4 IL_0020: br.s IL_003f - IL_0022: ldloca.s V_2 - IL_0024: ldloc.s V_4 - IL_0026: stloc.s V_5 + IL_0022: ldloc.s V_4 + IL_0024: stloc.s V_5 + IL_0026: ldloca.s V_2 IL_0028: stloc.s V_6 IL_002a: ldloc.s V_6 IL_002c: ldloc.s V_5 @@ -2604,9 +2604,9 @@ IL_005f: stloc.s V_6 IL_0061: br.s IL_0082 - IL_0063: ldloca.s V_4 - IL_0065: ldloc.s V_6 - IL_0067: stloc.s V_7 + IL_0063: ldloc.s V_6 + IL_0065: stloc.s V_7 + IL_0067: ldloca.s V_4 IL_0069: stloc.s V_8 IL_006b: ldloc.s V_8 IL_006d: ldloc.s V_7 @@ -2717,9 +2717,9 @@ IL_0047: stloc.3 IL_0048: br.s IL_006c - IL_004a: ldloca.s V_1 - IL_004c: ldloc.3 - IL_004d: stloc.s V_4 + IL_004a: ldloc.3 + IL_004b: stloc.s V_4 + IL_004d: ldloca.s V_1 IL_004f: stloc.s V_5 IL_0051: ldloc.s V_5 IL_0053: ldloc.s V_4 @@ -2834,9 +2834,9 @@ IL_0047: stloc.3 IL_0048: br.s IL_006c - IL_004a: ldloca.s V_1 - IL_004c: ldloc.3 - IL_004d: stloc.s V_4 + IL_004a: ldloc.3 + IL_004b: stloc.s V_4 + IL_004d: ldloca.s V_1 IL_004f: stloc.s V_5 IL_0051: ldloc.s V_5 IL_0053: ldloc.s V_4 @@ -2952,9 +2952,9 @@ IL_0047: stloc.3 IL_0048: br.s IL_006b - IL_004a: ldloca.s V_1 - IL_004c: ldloc.3 - IL_004d: stloc.s V_4 + IL_004a: ldloc.3 + IL_004b: stloc.s V_4 + IL_004d: ldloca.s V_1 IL_004f: stloc.s V_5 IL_0051: ldloc.s V_5 IL_0053: stloc.s V_6 @@ -3010,9 +3010,9 @@ IL_0015: stloc.s V_4 IL_0017: br.s IL_003a - IL_0019: ldloca.s V_2 - IL_001b: ldloc.s V_4 - IL_001d: stloc.s V_5 + IL_0019: ldloc.s V_4 + IL_001b: stloc.s V_5 + IL_001d: ldloca.s V_2 IL_001f: stloc.s V_6 IL_0021: ldloc.s V_6 IL_0023: ldloc.s V_5 @@ -3068,9 +3068,9 @@ IL_0015: stloc.3 IL_0016: br.s IL_0034 - IL_0018: ldloca.s V_1 - IL_001a: ldloc.3 - IL_001b: stloc.s V_4 + IL_0018: ldloc.3 + IL_0019: stloc.s V_4 + IL_001b: ldloca.s V_1 IL_001d: stloc.s V_5 IL_001f: ldloc.s V_5 IL_0021: ldloc.s V_4 @@ -3123,9 +3123,9 @@ IL_0015: stloc.2 IL_0016: br.s IL_0030 - IL_0018: ldloca.s V_0 - IL_001a: ldloc.2 - IL_001b: stloc.3 + IL_0018: ldloc.2 + IL_0019: stloc.3 + IL_001a: ldloca.s V_0 IL_001c: stloc.s V_4 IL_001e: ldloc.s V_4 IL_0020: ldloc.3 @@ -3177,9 +3177,9 @@ IL_0015: stloc.3 IL_0016: br.s IL_0034 - IL_0018: ldloca.s V_1 - IL_001a: ldloc.3 - IL_001b: stloc.s V_4 + IL_0018: ldloc.3 + IL_0019: stloc.s V_4 + IL_001b: ldloca.s V_1 IL_001d: stloc.s V_5 IL_001f: ldloc.s V_5 IL_0021: ldloc.s V_4 @@ -3247,9 +3247,9 @@ IL_0017: stloc.3 IL_0018: br.s IL_0042 - IL_001a: ldloca.s V_1 - IL_001c: ldloc.3 - IL_001d: stloc.s V_4 + IL_001a: ldloc.3 + IL_001b: stloc.s V_4 + IL_001d: ldloca.s V_1 IL_001f: stloc.s V_5 IL_0021: ldloc.s V_5 IL_0023: ldsfld class assembly/f33@47 assembly/f33@47::@_instance @@ -3329,9 +3329,9 @@ IL_001f: stloc.s V_5 IL_0021: br.s IL_0058 - IL_0023: ldloca.s V_2 - IL_0025: ldloc.s V_5 - IL_0027: stloc.s V_6 + IL_0023: ldloc.s V_5 + IL_0025: stloc.s V_6 + IL_0027: ldloca.s V_2 IL_0029: stloc.s V_7 IL_002b: ldloc.s V_7 IL_002d: ldsfld class assembly/f34@48 assembly/f34@48::@_instance @@ -3387,9 +3387,9 @@ IL_0075: stloc.s V_5 IL_0077: br.s IL_00a7 - IL_0079: ldloca.s V_2 - IL_007b: ldloc.s V_5 - IL_007d: stloc.s V_6 + IL_0079: ldloc.s V_5 + IL_007b: stloc.s V_6 + IL_007d: ldloca.s V_2 IL_007f: stloc.s V_9 IL_0081: ldloc.s V_9 IL_0083: ldsfld class assembly/'f34@48-2' assembly/'f34@48-2'::@_instance @@ -3471,9 +3471,9 @@ IL_001f: stloc.s V_5 IL_0021: br.s IL_0058 - IL_0023: ldloca.s V_2 - IL_0025: ldloc.s V_5 - IL_0027: stloc.s V_6 + IL_0023: ldloc.s V_5 + IL_0025: stloc.s V_6 + IL_0027: ldloca.s V_2 IL_0029: stloc.s V_7 IL_002b: ldloc.s V_7 IL_002d: ldsfld class assembly/f35@49 assembly/f35@49::@_instance @@ -3529,9 +3529,9 @@ IL_0075: stloc.s V_6 IL_0077: br.s IL_00a7 - IL_0079: ldloca.s V_2 - IL_007b: ldloc.s V_6 - IL_007d: stloc.s V_8 + IL_0079: ldloc.s V_6 + IL_007b: stloc.s V_8 + IL_007d: ldloca.s V_2 IL_007f: stloc.s V_9 IL_0081: ldloc.s V_9 IL_0083: ldsfld class assembly/'f35@49-2' assembly/'f35@49-2'::@_instance diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl index de7d051766d..a3bb0385a6d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter01.fs.il.bsl @@ -49,9 +49,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0021 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl index ea4cf922b2a..b460d793280 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter02.fs.il.bsl @@ -50,9 +50,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0035 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldstr "hello" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl index e90b8cc491f..beeb8301a51 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter03.fs.il.bsl @@ -49,9 +49,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0021 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOff.il.bsl index bd94ed1bd69..498cd175ff4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOff.il.bsl @@ -76,9 +76,9 @@ IL_0004: stloc.3 IL_0005: br.s IL_0024 - IL_0007: ldloca.s V_1 - IL_0009: ldloc.3 - IL_000a: stloc.s V_4 + IL_0007: ldloc.3 + IL_0008: stloc.s V_4 + IL_000a: ldloca.s V_1 IL_000c: stloc.s V_5 IL_000e: ldloc.s V_5 IL_0010: ldloc.s V_4 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOn.il.bsl index 572d9c93770..927c1956b20 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GeneratedIterators/GenIter04.fs.RealInternalSignatureOn.il.bsl @@ -70,9 +70,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0021 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldloc.3 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl index 59e2f445fe0..0d5ece49577 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.netcore.bsl @@ -39,33 +39,32 @@ .maxstack 3 .locals init (valuetype [runtime]System.Collections.Generic.List`1/Enumerator V_0, !!T V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: callvirt instance valuetype [runtime]System.Collections.Generic.List`1/Enumerator class [runtime]System.Collections.Generic.List`1::GetEnumerator() - IL_0007: stloc.0 + IL_0000: ldarg.0 + IL_0001: callvirt instance valuetype [runtime]System.Collections.Generic.List`1/Enumerator class [runtime]System.Collections.Generic.List`1::GetEnumerator() + IL_0006: stloc.0 .try { - IL_0008: br.s IL_0013 + IL_0007: br.s IL_0012 - IL_000a: ldloca.s V_0 - IL_000c: call instance !0 valuetype [runtime]System.Collections.Generic.List`1/Enumerator::get_Current() - IL_0011: stloc.1 - IL_0012: nop - IL_0013: ldloca.s V_0 - IL_0015: call instance bool valuetype [runtime]System.Collections.Generic.List`1/Enumerator::MoveNext() - IL_001a: brtrue.s IL_000a + IL_0009: ldloca.s V_0 + IL_000b: call instance !0 valuetype [runtime]System.Collections.Generic.List`1/Enumerator::get_Current() + IL_0010: stloc.1 + IL_0011: nop + IL_0012: ldloca.s V_0 + IL_0014: call instance bool valuetype [runtime]System.Collections.Generic.List`1/Enumerator::MoveNext() + IL_0019: brtrue.s IL_0009 - IL_001c: leave.s IL_002c + IL_001b: leave.s IL_002b } finally { - IL_001e: ldloca.s V_0 - IL_0020: constrained. valuetype [runtime]System.Collections.Generic.List`1/Enumerator - IL_0026: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_002b: endfinally + IL_001d: ldloca.s V_0 + IL_001f: constrained. valuetype [runtime]System.Collections.Generic.List`1/Enumerator + IL_0025: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_002a: endfinally } - IL_002c: ret + IL_002b: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.bsl index 57926705228..0456f3caab1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.bsl @@ -687,9 +687,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0033 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldstr "hello" diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.bsl index 0048320b577..36d7b5fc66a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.bsl @@ -689,9 +689,9 @@ IL_0004: stloc.2 IL_0005: br.s IL_0033 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldstr "hello" 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 new file mode 100644 index 00000000000..beb451d8511 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl @@ -0,0 +1,37 @@ +Module::f + (5,14-5,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 + IL_0006: ldloc.0 + IL_0007: ldloc.1 + IL_0008: ldelem.i4 + IL_0009: stloc.2 + + (6,9-6,35) System.Console.WriteLine i + IL_000a: ldloc.2 + IL_000b: call WriteLine + + (7,9-7,40) System.Console.WriteLine(i + 1) + IL_0010: ldloc.2 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: call WriteLine + + + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: stloc.1 + + (5,11-5,13) in + IL_001c: ldloc.1 + IL_001d: ldloc.0 + IL_001e: ldlen + IL_001f: conv.i4 + IL_0020: blt.s IL_0006 + IL_0022: ret 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 new file mode 100644 index 00000000000..022d36579ed --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl @@ -0,0 +1,31 @@ +Module::f + (5,14-5,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 + IL_0006: ldloc.0 + IL_0007: ldloc.1 + IL_0008: ldelem.i4 + IL_0009: stloc.2 + + (6,9-6,35) System.Console.WriteLine i + IL_000a: ldloc.2 + IL_000b: call WriteLine + + + IL_0010: ldloc.1 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.1 + + (5,11-5,13) in + IL_0014: ldloc.1 + IL_0015: ldloc.0 + IL_0016: ldlen + IL_0017: conv.i4 + IL_0018: blt.s IL_0006 + IL_001a: ret 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 new file mode 100644 index 00000000000..a2dd006417a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl @@ -0,0 +1,58 @@ +Module::|Id| + (4,23-4,24) x + IL_0000: ldarg.0 + IL_0001: ret + +Module::f + (7,5-10,7) [| for Id i in l do yield i |] + IL_0000: nop + + (8,9-8,12) for + IL_0001: ldarg.0 + IL_0002: callvirt GetEnumerator + IL_0007: stloc.1 + IL_0008: br.s IL_0027 + IL_000a: ldloc.1 + IL_000b: callvirt get_Current + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: call |Id| + IL_0017: stloc.s 4 + IL_0019: ldloc.s 4 + IL_001b: stloc.s 5 + + (9,13-9,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 + IL_0027: ldloc.1 + IL_0028: callvirt MoveNext + IL_002d: brtrue.s IL_000a + IL_002f: ldnull + IL_0030: stloc.2 + IL_0031: leave.s IL_0048 + 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_0046: endfinally + + + IL_0047: endfinally + + + IL_0048: ldloc.2 + IL_0049: pop + IL_004a: ldloca.s 0 + IL_004c: call Close + IL_0051: ret 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 new file mode 100644 index 00000000000..048c51b972b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl @@ -0,0 +1,50 @@ +Module::f + (5,5-7,7) [| for n in l -> n |] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: callvirt GetEnumerator + IL_0007: stloc.1 + IL_0008: br.s IL_001e + IL_000a: ldloc.1 + IL_000b: callvirt get_Current + IL_0010: stloc.3 + IL_0011: ldloca.s 0 + IL_0013: stloc.s 4 + + (6,23-6,24) n + IL_0015: ldloc.s 4 + IL_0017: ldloc.3 + IL_0018: call Add + IL_001d: nop + + (6,15-6,17) in + IL_001e: ldloc.1 + IL_001f: callvirt MoveNext + IL_0024: brtrue.s IL_000a + IL_0026: ldnull + IL_0027: stloc.2 + IL_0028: leave.s IL_003f + 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_003d: endfinally + + + IL_003e: endfinally + + + IL_003f: ldloc.2 + IL_0040: pop + IL_0041: ldloca.s 0 + IL_0043: call Close + IL_0048: ret 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 new file mode 100644 index 00000000000..234b112f656 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl @@ -0,0 +1,50 @@ +Module::f + (5,5-8,7) [| for n in l do yield n |] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: callvirt GetEnumerator + IL_0007: stloc.1 + IL_0008: br.s IL_001e + IL_000a: ldloc.1 + IL_000b: callvirt get_Current + IL_0010: stloc.3 + IL_0011: ldloca.s 0 + IL_0013: stloc.s 4 + + (7,13-7,20) yield n + IL_0015: ldloc.s 4 + IL_0017: ldloc.3 + IL_0018: call Add + IL_001d: nop + + (6,15-6,17) in + IL_001e: ldloc.1 + IL_001f: callvirt MoveNext + IL_0024: brtrue.s IL_000a + IL_0026: ldnull + IL_0027: stloc.2 + IL_0028: leave.s IL_003f + 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_003d: endfinally + + + IL_003e: endfinally + + + IL_003f: ldloc.2 + IL_0040: pop + IL_0041: ldloca.s 0 + IL_0043: call Close + IL_0048: ret 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 new file mode 100644 index 00000000000..d9b3362ac39 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl @@ -0,0 +1,54 @@ +Module::f + (5,5-8,7) [| for i, i1 in l do yield i |] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: callvirt GetEnumerator + IL_0007: stloc.1 + IL_0008: br.s IL_002b + IL_000a: ldloc.1 + IL_000b: callvirt get_Current + IL_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: call get_Item2 + IL_0017: stloc.s 4 + IL_0019: ldloc.3 + IL_001a: call get_Item1 + IL_001f: stloc.s 5 + + (7,13-7,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 + IL_002b: ldloc.1 + IL_002c: callvirt MoveNext + IL_0031: brtrue.s IL_000a + IL_0033: ldnull + IL_0034: stloc.2 + IL_0035: leave.s IL_004c + 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_004a: endfinally + + + IL_004b: endfinally + + + IL_004c: ldloc.2 + IL_004d: pop + IL_004e: ldloca.s 0 + IL_0050: call Close + IL_0055: ret 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 new file mode 100644 index 00000000000..0e9884491ae --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl @@ -0,0 +1,54 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (4,1-8,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 + IL_0004: newarr Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_0029 + IL_0011: ldloc.2 + IL_0012: stloc.3 + + (6,9-6,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 + IL_001a: ldloc.s 5 + IL_001c: ldloc.s 4 + IL_001e: ldloc.3 + IL_001f: stelem.i4 + IL_0020: ldloc.2 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: conv.i8 + IL_0027: add + IL_0028: stloc.1 + + (6,15-6,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_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 new file mode 100644 index 00000000000..234b112f656 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl @@ -0,0 +1,50 @@ +Module::f + (5,5-8,7) [| for n in l do yield n |] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: callvirt GetEnumerator + IL_0007: stloc.1 + IL_0008: br.s IL_001e + IL_000a: ldloc.1 + IL_000b: callvirt get_Current + IL_0010: stloc.3 + IL_0011: ldloca.s 0 + IL_0013: stloc.s 4 + + (7,13-7,20) yield n + IL_0015: ldloc.s 4 + IL_0017: ldloc.3 + IL_0018: call Add + IL_001d: nop + + (6,15-6,17) in + IL_001e: ldloc.1 + IL_001f: callvirt MoveNext + IL_0024: brtrue.s IL_000a + IL_0026: ldnull + IL_0027: stloc.2 + IL_0028: leave.s IL_003f + 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_003d: endfinally + + + IL_003e: endfinally + + + IL_003f: ldloc.2 + IL_0040: pop + IL_0041: ldloca.s 0 + IL_0043: call Close + IL_0048: ret 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 new file mode 100644 index 00000000000..735b64ef291 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl @@ -0,0 +1,40 @@ +Module::|Id| + (4,23-4,24) x + IL_0000: ldarg.0 + IL_0001: ret + +Module::f + (7,17-7,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 + 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_0010: stloc.3 + IL_0011: ldloc.3 + IL_0012: stloc.s 4 + + (8,9-8,11) () + IL_0014: nop + + + IL_0015: ldloc.1 + IL_0016: ldc.i4.1 + IL_0017: add + IL_0018: stloc.1 + + (7,14-7,16) in + IL_0019: ldloc.1 + IL_001a: ldloc.0 + IL_001b: ldlen + IL_001c: conv.i4 + IL_001d: blt.s IL_0006 + IL_001f: ret 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 new file mode 100644 index 00000000000..117072dd130 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl @@ -0,0 +1,36 @@ +Module::f + (5,19-5,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 + IL_0006: ldloc.0 + IL_0007: ldloc.1 + IL_0008: ldelem 0x1b000001 + IL_000d: stloc.2 + IL_000e: ldloc.2 + IL_000f: call get_Item2 + IL_0014: stloc.3 + IL_0015: ldloc.2 + IL_0016: call get_Item1 + IL_001b: stloc.s 4 + + (6,9-6,11) () + IL_001d: nop + + + IL_001e: ldloc.1 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.1 + + (5,16-5,18) in + IL_0022: ldloc.1 + IL_0023: ldloc.0 + IL_0024: ldlen + IL_0025: conv.i4 + IL_0026: blt.s IL_0006 + IL_0028: ret 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 new file mode 100644 index 00000000000..ad1455f0b35 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl @@ -0,0 +1,30 @@ +Module::f + (5,14-5,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 + IL_0006: ldloc.0 + IL_0007: ldloc.1 + IL_0008: ldelem.i4 + IL_0009: stloc.2 + + (6,9-6,11) () + IL_000a: nop + + + IL_000b: ldloc.1 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: stloc.1 + + (5,11-5,13) in + IL_000f: ldloc.1 + IL_0010: ldloc.0 + IL_0011: ldlen + IL_0012: conv.i4 + IL_0013: blt.s IL_0006 + IL_0015: 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 new file mode 100644 index 00000000000..5eec9beaeb0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl @@ -0,0 +1,31 @@ +Module::f + (5,14-5,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_001d + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,17-6,19) () + IL_0012: nop + + (7,9-7,11) () + IL_0013: nop + + + IL_0014: ldloc.1 + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: call get_TailOrNull + IL_001c: stloc.1 + + (5,11-5,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 new file mode 100644 index 00000000000..cabffb41911 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl @@ -0,0 +1,35 @@ +Module::f + (5,14-5,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_0029 + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,9-6,35) System.Console.WriteLine i + IL_0012: ldloc.2 + IL_0013: call WriteLine + + (7,9-7,40) System.Console.WriteLine(i + 1) + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: call WriteLine + + + IL_0020: ldloc.1 + IL_0021: stloc.0 + IL_0022: ldloc.0 + IL_0023: call get_TailOrNull + IL_0028: stloc.1 + + (5,11-5,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 new file mode 100644 index 00000000000..401652494b3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl @@ -0,0 +1,28 @@ +Module::f + (5,14-5,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_001c + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,10-6,12) () + IL_0012: nop + + + IL_0013: ldloc.1 + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: call get_TailOrNull + IL_001b: stloc.1 + + (5,11-5,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 new file mode 100644 index 00000000000..c3c76afe5aa --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl @@ -0,0 +1,31 @@ +Module::f + (5,14-5,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_001d + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,9-6,11) () + IL_0012: nop + + (7,9-7,11) () + IL_0013: nop + + + IL_0014: ldloc.1 + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: call get_TailOrNull + IL_001c: stloc.1 + + (5,11-5,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 new file mode 100644 index 00000000000..9dc76f432cc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl @@ -0,0 +1,29 @@ +Module::f + (5,14-5,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_0021 + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,9-6,35) System.Console.WriteLine i + IL_0012: ldloc.2 + IL_0013: call WriteLine + + + IL_0018: ldloc.1 + IL_0019: stloc.0 + IL_001a: ldloc.0 + IL_001b: call get_TailOrNull + IL_0020: stloc.1 + + (5,11-5,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 new file mode 100644 index 00000000000..08615e86be6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl @@ -0,0 +1,44 @@ +Module::|Id| + (4,23-4,24) x + IL_0000: ldarg.0 + IL_0001: ret + +Module::f + (7,5-10,6) [ for Id i in l do yield i ] + IL_0000: nop + + (8,9-8,12) for + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call get_TailOrNull + IL_0009: stloc.2 + IL_000a: br.s IL_0036 + IL_000c: ldloc.1 + IL_000d: call get_HeadOrDefault + IL_0012: stloc.3 + IL_0013: ldloca.s 0 + IL_0015: ldloc.3 + IL_0016: call |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 + IL_0023: ldloc.s 6 + IL_0025: ldloc.s 5 + IL_0027: call Add + IL_002c: nop + IL_002d: ldloc.2 + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: call get_TailOrNull + IL_0035: stloc.2 + + (8,18-8,20) in + IL_0036: ldloc.2 + IL_0037: brtrue.s IL_000c + IL_0039: ldloca.s 0 + IL_003b: call Close + IL_0040: ret 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 new file mode 100644 index 00000000000..108c8700c6f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl @@ -0,0 +1,34 @@ +Module::f + (5,5-7,6) [ for n in l -> n ] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call get_TailOrNull + IL_0009: stloc.2 + IL_000a: br.s IL_0029 + IL_000c: ldloc.1 + IL_000d: call get_HeadOrDefault + IL_0012: stloc.3 + IL_0013: ldloca.s 0 + IL_0015: stloc.s 4 + + (6,23-6,24) n + IL_0017: ldloc.s 4 + IL_0019: ldloc.3 + IL_001a: call Add + IL_001f: nop + IL_0020: ldloc.2 + IL_0021: stloc.1 + IL_0022: ldloc.1 + IL_0023: call get_TailOrNull + IL_0028: stloc.2 + + (6,15-6,17) in + IL_0029: ldloc.2 + IL_002a: brtrue.s IL_000c + IL_002c: ldloca.s 0 + IL_002e: call Close + IL_0033: ret 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 new file mode 100644 index 00000000000..3a82bf3d6bf --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl @@ -0,0 +1,34 @@ +Module::f + (5,5-8,6) [ for n in l do yield n ] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call get_TailOrNull + IL_0009: stloc.2 + IL_000a: br.s IL_0029 + IL_000c: ldloc.1 + IL_000d: call get_HeadOrDefault + IL_0012: stloc.3 + IL_0013: ldloca.s 0 + IL_0015: stloc.s 4 + + (7,13-7,20) yield n + IL_0017: ldloc.s 4 + IL_0019: ldloc.3 + IL_001a: call Add + IL_001f: nop + IL_0020: ldloc.2 + IL_0021: stloc.1 + IL_0022: ldloc.1 + IL_0023: call get_TailOrNull + IL_0028: stloc.2 + + (6,15-6,17) in + IL_0029: ldloc.2 + IL_002a: brtrue.s IL_000c + IL_002c: ldloca.s 0 + IL_002e: call Close + IL_0033: ret 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 new file mode 100644 index 00000000000..d308682b1cc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl @@ -0,0 +1,40 @@ +Module::f + (5,5-8,6) [ for i, i1 in l do yield i ] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call get_TailOrNull + IL_0009: stloc.2 + IL_000a: br.s IL_003a + IL_000c: ldloc.1 + IL_000d: call get_HeadOrDefault + IL_0012: stloc.3 + IL_0013: ldloca.s 0 + IL_0015: ldloc.3 + IL_0016: call get_Item2 + IL_001b: stloc.s 4 + IL_001d: ldloc.3 + IL_001e: call get_Item1 + IL_0023: stloc.s 5 + IL_0025: stloc.s 6 + + (7,13-7,20) yield i + IL_0027: ldloc.s 6 + IL_0029: ldloc.s 5 + IL_002b: call Add + IL_0030: nop + IL_0031: ldloc.2 + IL_0032: stloc.1 + IL_0033: ldloc.1 + IL_0034: call get_TailOrNull + IL_0039: stloc.2 + + (6,19-6,21) in + IL_003a: ldloc.2 + IL_003b: brtrue.s IL_000c + IL_003d: ldloca.s 0 + IL_003f: call Close + IL_0044: ret 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 new file mode 100644 index 00000000000..5e0accf23b8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl @@ -0,0 +1,47 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (4,1-8,6) let a = [ for n in 1..10 do yield n ] + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_001f + IL_0007: ldloc.2 + IL_0008: stloc.3 + + (6,9-6,12) for + IL_0009: ldloca.s 0 + IL_000b: stloc.s 4 + + (7,13-7,20) yield n + IL_000d: ldloc.s 4 + IL_000f: ldloc.3 + IL_0010: call Add + IL_0015: nop + IL_0016: ldloc.2 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.2 + IL_001a: ldloc.1 + IL_001b: ldc.i4.1 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.1 + + (6,15-6,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_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 new file mode 100644 index 00000000000..3a82bf3d6bf --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl @@ -0,0 +1,34 @@ +Module::f + (5,5-8,6) [ for n in l do yield n ] + IL_0000: nop + + (6,9-6,12) for + IL_0001: ldarg.0 + IL_0002: stloc.1 + IL_0003: ldloc.1 + IL_0004: call get_TailOrNull + IL_0009: stloc.2 + IL_000a: br.s IL_0029 + IL_000c: ldloc.1 + IL_000d: call get_HeadOrDefault + IL_0012: stloc.3 + IL_0013: ldloca.s 0 + IL_0015: stloc.s 4 + + (7,13-7,20) yield n + IL_0017: ldloc.s 4 + IL_0019: ldloc.3 + IL_001a: call Add + IL_001f: nop + IL_0020: ldloc.2 + IL_0021: stloc.1 + IL_0022: ldloc.1 + IL_0023: call get_TailOrNull + IL_0028: stloc.2 + + (6,15-6,17) in + IL_0029: ldloc.2 + IL_002a: brtrue.s IL_000c + IL_002c: ldloca.s 0 + IL_002e: call Close + IL_0033: ret 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 new file mode 100644 index 00000000000..04c4ef9351d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl @@ -0,0 +1,38 @@ +Module::|Id| + (4,23-4,24) x + IL_0000: ldarg.0 + IL_0001: ret + +Module::f + (7,17-7,18) 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_0026 + + (7,5-7,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_0018: stloc.3 + IL_0019: ldloc.3 + IL_001a: stloc.s 4 + + (8,9-8,11) () + IL_001c: nop + + + IL_001d: ldloc.1 + IL_001e: stloc.0 + IL_001f: ldloc.0 + IL_0020: call get_TailOrNull + IL_0025: stloc.1 + + (7,14-7,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 new file mode 100644 index 00000000000..afdc8ca112c --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl @@ -0,0 +1,34 @@ +Module::f + (5,19-5,20) 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_002b + + (5,5-5,15) for i1, i2 + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + IL_0012: ldloc.2 + IL_0013: call get_Item2 + IL_0018: stloc.3 + IL_0019: ldloc.2 + IL_001a: call get_Item1 + IL_001f: stloc.s 4 + + (6,9-6,11) () + IL_0021: nop + + + IL_0022: ldloc.1 + IL_0023: stloc.0 + IL_0024: ldloc.0 + IL_0025: call get_TailOrNull + IL_002a: stloc.1 + + (5,16-5,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 new file mode 100644 index 00000000000..e0cc6be0c47 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl @@ -0,0 +1,28 @@ +Module::f + (5,14-5,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_001c + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,9-6,11) () + IL_0012: nop + + + IL_0013: ldloc.1 + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: call get_TailOrNull + IL_001b: stloc.1 + + (5,11-5,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 new file mode 100644 index 00000000000..0e16ad2c8e2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl @@ -0,0 +1,47 @@ +Module::f + (5,14-5,15) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: callvirt GetEnumerator + IL_0008: stloc.1 + IL_0009: br.s IL_0020 + + (5,5-5,10) for i + IL_000b: ldloc.1 + IL_000c: callvirt get_Current + IL_0011: stloc.2 + + (6,9-6,35) System.Console.WriteLine i + IL_0012: ldloc.2 + IL_0013: call WriteLine + + (7,9-7,40) System.Console.WriteLine(i + 1) + IL_0018: ldloc.2 + IL_0019: ldc.i4.1 + IL_001a: add + IL_001b: call WriteLine + + (5,11-5,13) in + IL_0020: ldloc.1 + IL_0021: callvirt 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_003a: endfinally + + + IL_003b: endfinally + + + IL_003c: ret 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 new file mode 100644 index 00000000000..b6d13c7e7ab --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl @@ -0,0 +1,41 @@ +Module::f + (5,14-5,15) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: callvirt GetEnumerator + IL_0008: stloc.1 + IL_0009: br.s IL_0018 + + (5,5-5,10) for i + IL_000b: ldloc.1 + IL_000c: callvirt get_Current + IL_0011: stloc.2 + + (6,9-6,35) System.Console.WriteLine i + IL_0012: ldloc.2 + IL_0013: call WriteLine + + (5,11-5,13) in + IL_0018: ldloc.1 + IL_0019: callvirt 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_0032: endfinally + + + IL_0033: endfinally + + + IL_0034: ret 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 new file mode 100644 index 00000000000..a1d4ee342ca --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl @@ -0,0 +1,211 @@ +Module::|Id| + (4,23-4,24) x + IL_0000: ldarg.0 + IL_0001: ret + +Module::f + (7,5-10,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_0009: ret + +f@8::GenerateNext + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: switch (3 targets) + IL_0019: br.s IL_0024 + + + IL_001b: nop + IL_001c: br.s IL_0073 + + + IL_001e: nop + IL_001f: br.s IL_0066 + + + IL_0021: nop + IL_0022: br.s IL_0094 + + + 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 + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.3 + IL_0007: sub + IL_0008: switch (1 targets) + IL_0011: br.s IL_0016 + + + IL_0013: nop + IL_0014: br.s IL_0078 + + + IL_0016: nop + + + IL_0017: ldarg.0 + IL_0018: ldfld pc + IL_001d: switch (4 targets) + IL_0032: br.s IL_0040 + + + IL_0034: nop + IL_0035: br.s IL_0058 + + + IL_0037: nop + IL_0038: br.s IL_0044 + + + IL_003a: nop + IL_003b: br.s IL_0043 + + + IL_003d: nop + IL_003e: br.s IL_0058 + + + 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_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_007b: ldloc.0 + IL_007c: throw + + + IL_007d: ret + + + +f@8::get_CheckClose + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: switch (4 targets) + IL_001b: br.s IL_0029 + + + IL_001d: nop + IL_001e: br.s IL_0030 + + + IL_0020: nop + IL_0021: br.s IL_002e + + + IL_0023: nop + IL_0024: br.s IL_002c + + + IL_0026: nop + IL_0027: br.s IL_0030 + + + IL_0029: nop + IL_002a: br.s IL_002c + + + IL_002c: ldc.i4.1 + IL_002d: ret + IL_002e: ldc.i4.1 + 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 new file mode 100644 index 00000000000..c22c1947a13 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl @@ -0,0 +1,203 @@ +Module::f + (5,5-7,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_0009: ret + +f@6::GenerateNext + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: switch (3 targets) + IL_0019: br.s IL_0024 + + + IL_001b: nop + IL_001c: br.s IL_006c + + + IL_001e: nop + IL_001f: br.s IL_005f + + + IL_0021: nop + IL_0022: br.s IL_008d + + + 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 + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.3 + IL_0007: sub + IL_0008: switch (1 targets) + IL_0011: br.s IL_0016 + + + IL_0013: nop + IL_0014: br.s IL_0078 + + + IL_0016: nop + + + IL_0017: ldarg.0 + IL_0018: ldfld pc + IL_001d: switch (4 targets) + IL_0032: br.s IL_0040 + + + IL_0034: nop + IL_0035: br.s IL_0058 + + + IL_0037: nop + IL_0038: br.s IL_0044 + + + IL_003a: nop + IL_003b: br.s IL_0043 + + + IL_003d: nop + IL_003e: br.s IL_0058 + + + 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_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_007b: ldloc.0 + IL_007c: throw + + + IL_007d: ret + + + +f@6::get_CheckClose + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: switch (4 targets) + IL_001b: br.s IL_0029 + + + IL_001d: nop + IL_001e: br.s IL_0030 + + + IL_0020: nop + IL_0021: br.s IL_002e + + + IL_0023: nop + IL_0024: br.s IL_002c + + + IL_0026: nop + IL_0027: br.s IL_0030 + + + IL_0029: nop + IL_002a: br.s IL_002c + + + IL_002c: ldc.i4.1 + IL_002d: ret + IL_002e: ldc.i4.1 + 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 new file mode 100644 index 00000000000..c87c15661e4 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl @@ -0,0 +1,203 @@ +Module::f + (5,5-8,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_0009: ret + +f@6::GenerateNext + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: switch (3 targets) + IL_0019: br.s IL_0024 + + + IL_001b: nop + IL_001c: br.s IL_006c + + + IL_001e: nop + IL_001f: br.s IL_005f + + + IL_0021: nop + IL_0022: br.s IL_008d + + + 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 + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.3 + IL_0007: sub + IL_0008: switch (1 targets) + IL_0011: br.s IL_0016 + + + IL_0013: nop + IL_0014: br.s IL_0078 + + + IL_0016: nop + + + IL_0017: ldarg.0 + IL_0018: ldfld pc + IL_001d: switch (4 targets) + IL_0032: br.s IL_0040 + + + IL_0034: nop + IL_0035: br.s IL_0058 + + + IL_0037: nop + IL_0038: br.s IL_0044 + + + IL_003a: nop + IL_003b: br.s IL_0043 + + + IL_003d: nop + IL_003e: br.s IL_0058 + + + 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_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_0072: nop + IL_0073: br IL_0000 + + + IL_0078: ldloc.0 + IL_0079: brfalse.s IL_007d + + + IL_007b: ldloc.0 + IL_007c: throw + + + IL_007d: ret + + + +f@6::get_CheckClose + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: switch (4 targets) + IL_001b: br.s IL_0029 + + + IL_001d: nop + IL_001e: br.s IL_0030 + + + IL_0020: nop + IL_0021: br.s IL_002e + + + IL_0023: nop + IL_0024: br.s IL_002c + + + IL_0026: nop + IL_0027: br.s IL_0030 + + + IL_0029: nop + IL_002a: br.s IL_002c + + + IL_002c: ldc.i4.1 + IL_002d: ret + IL_002e: ldc.i4.1 + 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 new file mode 100644 index 00000000000..563e2b0a3f0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl @@ -0,0 +1,207 @@ +Module::f + (5,5-8,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_0009: ret + +f@6::GenerateNext + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: switch (3 targets) + IL_0019: br.s IL_0024 + + + IL_001b: nop + IL_001c: br.s IL_0078 + + + IL_001e: nop + IL_001f: br.s IL_006b + + + IL_0021: nop + IL_0022: br.s IL_0099 + + + 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 + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.3 + IL_0007: sub + IL_0008: switch (1 targets) + IL_0011: br.s IL_0016 + + + IL_0013: nop + IL_0014: br.s IL_0078 + + + IL_0016: nop + + + IL_0017: ldarg.0 + IL_0018: ldfld pc + IL_001d: switch (4 targets) + IL_0032: br.s IL_0040 + + + IL_0034: nop + IL_0035: br.s IL_0058 + + + IL_0037: nop + IL_0038: br.s IL_0044 + + + IL_003a: nop + IL_003b: br.s IL_0043 + + + IL_003d: nop + IL_003e: br.s IL_0058 + + + 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_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_007b: ldloc.0 + IL_007c: throw + + + IL_007d: ret + + + +f@6::get_CheckClose + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: switch (4 targets) + IL_001b: br.s IL_0029 + + + IL_001d: nop + IL_001e: br.s IL_0030 + + + IL_0020: nop + IL_0021: br.s IL_002e + + + IL_0023: nop + IL_0024: br.s IL_002c + + + IL_0026: nop + IL_0027: br.s IL_0030 + + + IL_0029: nop + IL_002a: br.s IL_002c + + + IL_002c: ldc.i4.1 + IL_002d: ret + IL_002e: ldc.i4.1 + 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 new file mode 100644 index 00000000000..6e703a4a985 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl @@ -0,0 +1,213 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (5,5-8,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_000d: ret + +a@6::GenerateNext + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: switch (3 targets) + IL_0019: br.s IL_0024 + + + IL_001b: nop + IL_001c: br.s IL_006f + + + IL_001e: nop + IL_001f: br.s IL_0062 + + + IL_0021: nop + IL_0022: br.s IL_0090 + + + 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 + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.3 + IL_0007: sub + IL_0008: switch (1 targets) + IL_0011: br.s IL_0016 + + + IL_0013: nop + IL_0014: br.s IL_0078 + + + IL_0016: nop + + + IL_0017: ldarg.0 + IL_0018: ldfld pc + IL_001d: switch (4 targets) + IL_0032: br.s IL_0040 + + + IL_0034: nop + IL_0035: br.s IL_0058 + + + IL_0037: nop + IL_0038: br.s IL_0044 + + + IL_003a: nop + IL_003b: br.s IL_0043 + + + IL_003d: nop + IL_003e: br.s IL_0058 + + + 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_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_007b: ldloc.0 + IL_007c: throw + + + IL_007d: ret + + + +a@6::get_CheckClose + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: switch (4 targets) + IL_001b: br.s IL_0029 + + + IL_001d: nop + IL_001e: br.s IL_0030 + + + IL_0020: nop + IL_0021: br.s IL_002e + + + IL_0023: nop + IL_0024: br.s IL_002c + + + IL_0026: nop + IL_0027: br.s IL_0030 + + + IL_0029: nop + IL_002a: br.s IL_002c + + + IL_002c: ldc.i4.1 + IL_002d: ret + IL_002e: ldc.i4.1 + 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 new file mode 100644 index 00000000000..93ea36c1411 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl @@ -0,0 +1,203 @@ +Module::f + (5,5-8,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_0009: ret + +f@6::GenerateNext + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: switch (3 targets) + IL_0019: br.s IL_0024 + + + IL_001b: nop + IL_001c: br.s IL_006c + + + IL_001e: nop + IL_001f: br.s IL_005f + + + IL_0021: nop + IL_0022: br.s IL_008d + + + 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 + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: ldc.i4.3 + IL_0007: sub + IL_0008: switch (1 targets) + IL_0011: br.s IL_0016 + + + IL_0013: nop + IL_0014: br.s IL_0078 + + + IL_0016: nop + + + IL_0017: ldarg.0 + IL_0018: ldfld pc + IL_001d: switch (4 targets) + IL_0032: br.s IL_0040 + + + IL_0034: nop + IL_0035: br.s IL_0058 + + + IL_0037: nop + IL_0038: br.s IL_0044 + + + IL_003a: nop + IL_003b: br.s IL_0043 + + + IL_003d: nop + IL_003e: br.s IL_0058 + + + 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_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_007b: ldloc.0 + IL_007c: throw + + + IL_007d: ret + + + +f@6::get_CheckClose + + IL_0000: ldarg.0 + IL_0001: ldfld pc + IL_0006: switch (4 targets) + IL_001b: br.s IL_0029 + + + IL_001d: nop + IL_001e: br.s IL_0030 + + + IL_0020: nop + IL_0021: br.s IL_002e + + + IL_0023: nop + IL_0024: br.s IL_002c + + + IL_0026: nop + IL_0027: br.s IL_0030 + + + IL_0029: nop + IL_002a: br.s IL_002c + + + IL_002c: ldc.i4.1 + IL_002d: ret + IL_002e: ldc.i4.1 + 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 new file mode 100644 index 00000000000..b367716fac3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl @@ -0,0 +1,50 @@ +Module::|Id| + (4,23-4,24) x + IL_0000: ldarg.0 + IL_0001: ret + +Module::f + (7,17-7,18) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: callvirt GetEnumerator + IL_0008: stloc.1 + IL_0009: br.s IL_001d + + (7,5-7,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_0018: stloc.3 + IL_0019: ldloc.3 + IL_001a: stloc.s 4 + + (8,9-8,11) () + IL_001c: nop + + (7,14-7,16) in + IL_001d: ldloc.1 + IL_001e: callvirt 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_003a: endfinally + + + IL_003b: endfinally + + + IL_003c: ret 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 new file mode 100644 index 00000000000..1d789aafae2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl @@ -0,0 +1,46 @@ +Module::f + (5,19-5,20) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: callvirt GetEnumerator + IL_0008: stloc.1 + IL_0009: br.s IL_0022 + + (5,5-5,15) for i1, i2 + IL_000b: ldloc.1 + IL_000c: callvirt get_Current + IL_0011: stloc.2 + IL_0012: ldloc.2 + IL_0013: call get_Item2 + IL_0018: stloc.3 + IL_0019: ldloc.2 + IL_001a: call get_Item1 + IL_001f: stloc.s 4 + + (6,9-6,11) () + IL_0021: nop + + (5,16-5,18) in + IL_0022: ldloc.1 + IL_0023: callvirt 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_003f: endfinally + + + IL_0040: endfinally + + + IL_0041: ret 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 new file mode 100644 index 00000000000..cf20ed793cc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl @@ -0,0 +1,40 @@ +Module::f + (5,14-5,15) l + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: callvirt GetEnumerator + IL_0008: stloc.1 + IL_0009: br.s IL_0013 + + (5,5-5,10) for i + IL_000b: ldloc.1 + IL_000c: callvirt get_Current + IL_0011: stloc.2 + + (6,9-6,11) () + IL_0012: nop + + (5,11-5,13) in + IL_0013: ldloc.1 + IL_0014: callvirt 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_002d: endfinally + + + IL_002e: endfinally + + + IL_002f: ret 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 new file mode 100644 index 00000000000..571e8a5476a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl @@ -0,0 +1,38 @@ +Module::f + (5,14-5,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_000a: ldc.i4.1 + IL_000b: sub + IL_000c: stloc.1 + IL_000d: ldloc.1 + IL_000e: ldloc.2 + IL_000f: blt.s IL_0029 + + (5,5-5,10) for c + IL_0011: ldloc.0 + IL_0012: ldloc.2 + IL_0013: callvirt get_Chars + IL_0018: stloc.3 + + (6,9-6,35) System.Console.WriteLine c + IL_0019: ldloc.3 + IL_001a: call WriteLine + + + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + + (5,11-5,13) in + IL_0023: ldloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: bne.un.s IL_0011 + IL_0029: 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 new file mode 100644 index 00000000000..7d3acc1e66a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl @@ -0,0 +1,8 @@ +Module::f + (5,5-5,14) let i = 1 + IL_0000: ldc.i4.1 + IL_0001: stloc.0 + + (6,5-6,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 new file mode 100644 index 00000000000..61f9775be11 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl @@ -0,0 +1,6 @@ +Module::f + (5,5-5,7) () + IL_0000: nop + + (6,5-6,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 new file mode 100644 index 00000000000..f3a13298d7a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl @@ -0,0 +1,3 @@ +Module::f + (5,5-5,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs new file mode 100644 index 00000000000..3d373e0921f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs @@ -0,0 +1,472 @@ +module EmittedIL.SequencePointsTests + +open System.Diagnostics +open System.IO +open System.Runtime.CompilerServices +open System.Runtime.InteropServices +open Xunit +open FSharp.Test.Compiler + +[] +type private Baseline = + static member verify(source, [] name: string) = + let moduleName = StackTrace().GetFrame(1).GetMethod().DeclaringType.Name + FSharp source + |> asLibrary + |> withPortablePdb + |> withNoOptimize + |> compile + |> shouldSucceed + |> verifySequencePointsBaseline source (Path.Combine(__SOURCE_DIRECTORY__, moduleName, name + ".bsl")) + |> ignore + +module Function = + [] + let ``Body - Unit 01`` () = + Baseline.verify """ +module Module + +let f () = + () +""" + + [] + let ``Body - LetThenValue 01`` () = + Baseline.verify """ +module Module + +let f () = + let i = 1 + 1 +""" + + [] + let ``Body - SequentialUnits 01`` () = + Baseline.verify """ +module Module + +let f () = + () + () +""" + +module ForEach = + [] + let ``List - Simple 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + () +""" + + [] + let ``List - Body - SingleStatement 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine i +""" + + [] + let ``List - Body - MultipleStatements 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +""" + + [] + let ``List - Body - ParenUnit 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + (()) +""" + + [] + let ``List - Body - SequentialUnits 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + () + () +""" + + [] + let ``List - Body - LetUnit 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + let _ = () + () +""" + + [] + let ``List - Pattern - Tuple 01`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + for i1, i2 in l do + () +""" + + [] + let ``List - Pattern - ActivePattern 01`` () = + Baseline.verify """ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + for Id i in l do + () +""" + + [] + let ``List - Comprehensions - Value 01`` () = + Baseline.verify """ +module Module + +let a = + [ + for n in 1..10 do + yield n + ] +""" + + [] + let ``List - Comprehensions - Value 02`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + [ + for n in l do + yield n + ] +""" + + [] + let ``List - Comprehensions - Tuple 01`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + [ + for n in l do + yield n + ] +""" + + [] + let ``List - Comprehensions - Tuple 02`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + [ + for i, i1 in l do + yield i + ] +""" + + [] + let ``List - Comprehensions - Arrow 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + [ + for n in l -> n + ] +""" + + [] + let ``List - Comprehensions - ActivePattern 01`` () = + Baseline.verify """ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + [ + for Id i in l do + yield i + ] +""" + + [] + let ``Array - Simple 01`` () = + Baseline.verify """ +module Module + +let f (l: int[]) = + for i in l do + () +""" + + [] + let ``Array - Body - SingleStatement 01`` () = + Baseline.verify """ +module Module + +let f (l: int[]) = + for i in l do + System.Console.WriteLine i +""" + + [] + let ``Array - Body - MultipleStatements 01`` () = + Baseline.verify """ +module Module + +let f (l: int[]) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +""" + + [] + let ``Array - Pattern - Tuple 01`` () = + Baseline.verify """ +module Module + +let f (l: (int * int)[]) = + for i1, i2 in l do + () +""" + + [] + let ``Array - Pattern - ActivePattern 01`` () = + Baseline.verify """ +module Module + +let (|Id|) (x: int) = x + +let f (l: int[]) = + for Id i in l do + () +""" + + [] + let ``Array - Comprehensions - Value 01`` () = + Baseline.verify """ +module Module + +let a = + [| + for n in 1..10 do + yield n + |] +""" + + [] + let ``Array - Comprehensions - Value 02`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + [| + for n in l do + yield n + |] +""" + + [] + let ``Array - Comprehensions - Tuple 01`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + [| + for n in l do + yield n + |] +""" + + [] + let ``Array - Comprehensions - Tuple 02`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + [| + for i, i1 in l do + yield i + |] +""" + + [] + let ``Array - Comprehensions - Arrow 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + [| + for n in l -> n + |] +""" + + [] + let ``Array - Comprehensions - ActivePattern 01`` () = + Baseline.verify """ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + [| + for Id i in l do + yield i + |] +""" + + [] + let ``Seq - Simple 01`` () = + Baseline.verify """ +module Module + +let f (l: int seq) = + for i in l do + () +""" + + [] + let ``Seq - Body - SingleStatement 01`` () = + Baseline.verify """ +module Module + +let f (l: int seq) = + for i in l do + System.Console.WriteLine i +""" + + [] + let ``Seq - Body - MultipleStatements 01`` () = + Baseline.verify """ +module Module + +let f (l: int seq) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +""" + + [] + let ``Seq - Pattern - Tuple 01`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) seq) = + for i1, i2 in l do + () +""" + + [] + let ``Seq - Pattern - ActivePattern 01`` () = + Baseline.verify """ +module Module + +let (|Id|) (x: int) = x + +let f (l: int seq) = + for Id i in l do + () +""" + + [] + let ``Seq - Comprehensions - Value 01`` () = + Baseline.verify """ +module Module + +let a = + seq { + for n in 1..10 do + yield n + } +""" + + [] + let ``Seq - Comprehensions - Value 02`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + seq { + for n in l do + yield n + } +""" + + [] + let ``Seq - Comprehensions - Tuple 01`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + seq { + for n in l do + yield n + } +""" + + [] + let ``Seq - Comprehensions - Tuple 02`` () = + Baseline.verify """ +module Module + +let f (l: (int * int) list) = + seq { + for i, i1 in l do + yield i + } +""" + + [] + let ``Seq - Comprehensions - Arrow 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + seq { + for n in l -> n + } +""" + + [] + let ``Seq - Comprehensions - ActivePattern 01`` () = + Baseline.verify """ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + seq { + for Id i in l do + yield i + } +""" + + [] + let ``String - Body - SingleStatement 01`` () = + Baseline.verify """ +module Module + +let f (l: string) = + for c in l do + System.Console.WriteLine c +""" 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 4dde7ff829b..e038bd5a127 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl @@ -51,7 +51,8 @@ IL_0011: ldc.i4.0 IL_0012: nop IL_0013: stloc.0 - IL_0014: ret + IL_0014: nop + IL_0015: ret } } @@ -73,4 +74,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 3550b60c13e..954c02b8aca 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -226,6 +226,7 @@ + diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index d5ae4a34a27..86f760a3bee 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -17,7 +17,9 @@ open System.IO open System.Text open System.Text.RegularExpressions open System.Reflection +open System.Reflection.Emit open System.Reflection.Metadata +open System.Reflection.Metadata.Ecma335 open System.Reflection.PortableExecutable open FSharp.Test.CompilerAssertHelpers @@ -1535,27 +1537,29 @@ $ code --diff {outFile} {expectedFile} if expectedScope <> imports then failwith $"Expected imports are different from PDB.\nExpected:\n%A{expectedScope}\nActual:%A{imports}" + let private getMethodDebugInfos (assemblyReader: MetadataReader) (pdbReader: MetadataReader) = + [ for typeDefHandle in assemblyReader.TypeDefinitions do + let td = assemblyReader.GetTypeDefinition typeDefHandle + let typeName = assemblyReader.GetString td.Name + for methodHandle in td.GetMethods() do + let md = assemblyReader.GetMethodDefinition methodHandle + let methodName = assemblyReader.GetString md.Name + let rowNumber = System.Reflection.Metadata.Ecma335.MetadataTokens.GetRowNumber methodHandle + let debugInfoHandle = System.Reflection.Metadata.Ecma335.MetadataTokens.MethodDebugInformationHandle rowNumber + let debugInfo = pdbReader.GetMethodDebugInformation debugInfoHandle + yield typeName, methodName, methodHandle, debugInfo ] + let private getMethodSequencePoints (assemblyPath: string) (pdbReader: MetadataReader) (methodName: string) = use peStream = File.OpenRead(assemblyPath) use peReader = new PEReader(peStream) - let assemblyReader = peReader.GetMetadataReader() - - let methodHandles = - [ for typeDef in assemblyReader.TypeDefinitions do - let td = assemblyReader.GetTypeDefinition(typeDef) - for methodHandle in td.GetMethods() do - let md = assemblyReader.GetMethodDefinition(methodHandle) - let name = assemblyReader.GetString(md.Name) - if name = methodName then - yield methodHandle ] + let methods = + getMethodDebugInfos (peReader.GetMetadataReader()) pdbReader + |> List.filter (fun (_, name, _, _) -> name = methodName) - if methodHandles.IsEmpty then + if methods.IsEmpty then failwith (sprintf "Method '%s' not found in assembly '%s'" methodName assemblyPath) - [ for methodHandle in methodHandles do - let rowNumber = System.Reflection.Metadata.Ecma335.MetadataTokens.GetRowNumber(methodHandle) - let debugInfoHandle = System.Reflection.Metadata.Ecma335.MetadataTokens.MethodDebugInformationHandle(rowNumber) - let debugInfo = pdbReader.GetMethodDebugInformation(debugInfoHandle) + [ for _, _, _, debugInfo in methods do yield! debugInfo.GetSequencePoints() |> Seq.filter (fun sp -> not sp.IsHidden) @@ -1750,6 +1754,106 @@ $ code --diff {outFile} {expectedFile} verifyNoDebuggerHiddenOnMethodWithLine (optOutputPath |> Option.defaultValue "") reader line | _ -> failwith $"Unknown verification option: {option.ToString()}" + module private Il = + // Keyed by the encoded opcode value: one-byte ops as 0x00-0xFF, two-byte (0xFE-prefixed) as 0xFExx. + let private opsByValue = + dict [ for f in typeof.GetFields(BindingFlags.Public ||| BindingFlags.Static) do + match f.GetValue null with + | :? OpCode as op -> yield (int op.Value &&& 0xffff), op + | _ -> () ] + + let rec private tokenName (mdReader: MetadataReader) (token: int) = + let handle = MetadataTokens.EntityHandle token + let row = MetadataTokens.GetRowNumber handle + 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.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) + | _ -> sprintf "0x%08x" token + + let decodeMethodIL (mdReader: MetadataReader) (bytes: byte[]) = + [ let mutable pos = 0 + while pos < bytes.Length do + let offset = pos + let b0 = int bytes.[pos] + pos <- pos + 1 + let key = if b0 = 0xFE then (let b1 = int bytes.[pos] in pos <- pos + 1; 0xFE00 ||| b1) else b0 + let op = opsByValue.[key] + let operand = pos + let next size = pos <- operand + size + let text = + match op.OperandType with + | OperandType.InlineNone -> next 0; "" + | OperandType.ShortInlineBrTarget -> next 1; sprintf " IL_%04x" (operand + 1 + int (sbyte bytes.[operand])) + | OperandType.InlineBrTarget -> next 4; sprintf " IL_%04x" (operand + 4 + BitConverter.ToInt32(bytes, operand)) + | OperandType.ShortInlineI -> next 1; sprintf " %d" (sbyte bytes.[operand]) + | OperandType.InlineI -> next 4; sprintf " %d" (BitConverter.ToInt32(bytes, operand)) + | OperandType.InlineI8 -> next 8; sprintf " %d" (BitConverter.ToInt64(bytes, operand)) + | OperandType.ShortInlineR -> next 4; sprintf " %f" (BitConverter.ToSingle(bytes, operand)) + | OperandType.InlineR -> next 8; sprintf " %f" (BitConverter.ToDouble(bytes, operand)) + | OperandType.ShortInlineVar -> next 1; sprintf " %d" (int bytes.[operand]) + | OperandType.InlineVar -> next 2; sprintf " %d" (int (BitConverter.ToUInt16(bytes, operand))) + | OperandType.InlineString -> next 4; sprintf " \"%s\"" (mdReader.GetUserString(MetadataTokens.UserStringHandle(BitConverter.ToInt32(bytes, operand)))) + | OperandType.InlineSwitch -> next (4 + 4 * BitConverter.ToInt32(bytes, operand)); sprintf " (%d targets)" (BitConverter.ToInt32(bytes, operand)) + | _ -> next 4; " " + tokenName mdReader (BitConverter.ToInt32(bytes, operand)) + 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 textOf (sp: SequencePoint) = + let sb = StringBuilder() + for lineNo in sp.StartLine .. sp.EndLine do + if lineNo >= 1 && lineNo <= lines.Length then + let line = lines.[lineNo - 1] + let startCol = if lineNo = sp.StartLine then sp.StartColumn - 1 else 0 + let endCol = if lineNo = sp.EndLine then sp.EndColumn - 1 else line.Length + let startCol = max 0 (min startCol line.Length) + let endCol = max startCol (min endCol line.Length) + sb.Append(line.Substring(startCol, endCol - startCol)).Append(' ') |> ignore + Regex.Replace(sb.ToString().Trim(), @"\s+", " ") + + use peStream = File.OpenRead assemblyPath + use peReader = new PEReader(peStream) + let mdReader = peReader.GetMetadataReader() + + let sb = StringBuilder() + for typeName, methodName, methodHandle, debugInfo in getMethodDebugInfos mdReader pdbReader do + let points = debugInfo.GetSequencePoints() |> Seq.sortBy (fun sp -> sp.Offset) |> Seq.toList + if not points.IsEmpty then + let md = mdReader.GetMethodDefinition methodHandle + let instructions = + if md.RelativeVirtualAddress = 0 then [] + else Il.decodeMethodIL mdReader ((peReader.GetMethodBody md.RelativeVirtualAddress).GetILBytes()) + + sb.AppendLine($"{typeName}::{methodName}") |> ignore + points |> List.iteri (fun i sp -> + let nextOffset = if i + 1 < points.Length then points.[i + 1].Offset else Int32.MaxValue + if sp.IsHidden then + sb.AppendLine(" ") |> ignore + else + sb.AppendLine(sprintf " (%d,%d-%d,%d) %s" sp.StartLine sp.StartColumn sp.EndLine sp.EndColumn (textOf sp)) |> ignore + for offset, text in instructions do + if offset >= sp.Offset && offset < nextOffset then + sb.AppendLine(sprintf " IL_%04x: %s" offset text) |> ignore + sb.AppendLine() |> ignore) + sb.ToString().Trim() + "\n" + + let verifySequencePointsBaseline (source: string) (baselineFilePath: string) (result: CompilationResult) : CompilationResult = + match result with + | CompilationResult.Success r -> + match r.OutputPath with + | Some assemblyPath -> + use fileStream = File.OpenRead(Path.ChangeExtension(assemblyPath, ".pdb")) + use provider = MetadataReaderProvider.FromPortablePdbStream fileStream + checkBaseline (formatSequencePoints source assemblyPath (provider.GetMetadataReader())) baselineFilePath + result + | None -> failwith "Operation didn't produce any output!" + | CompilationResult.Failure f -> failwith $"Compilation failed: {f}" + let private verifyPortablePdb (result: CompilationOutput) options : unit = match result.OutputPath with | Some assemblyPath -> diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl index a80d19b37bd..46d9378e1cd 100644 --- a/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl @@ -12,7 +12,7 @@ ImplFile Named (SynIdent (x, None), false, None, (3,6--3,7)), ArrayOrList (false, [], (3,11--3,13)), YieldOrReturn - ((true, false), Const (Unit, (3,17--3,19)), (3,14--3,19), + ((true, false), Const (Unit, (3,17--3,19)), (3,17--3,19), { YieldOrReturnKeyword = (3,14--3,16) }), (3,2--3,19)), (3,0--3,21)), (3,0--3,21))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl index 84d19bf27f3..d06d6769a08 100644 --- a/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl @@ -15,7 +15,7 @@ ImplFile ((true, false), ArbitraryAfterError ("typedSequentialExprBlockR1", (3,16--3,16)), - (3,14--3,16), { YieldOrReturnKeyword = (3,14--3,16) }), + (3,16--3,16), { YieldOrReturnKeyword = (3,14--3,16) }), (3,2--3,16)), (3,0--3,18)), (3,0--3,18))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), From 655fdcd2e2308ee87c3480c19e589b5c2a98d61d Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 4 Jun 2026 17:19:34 +0200 Subject: [PATCH 2/3] Release notes --- docs/release-notes/.FSharp.Compiler.Service/11.0.100.md | 1 + 1 file changed, 1 insertion(+) 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 9509ac72a3a..965957dbc0c 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -81,6 +81,7 @@ * Added warning FS3884 when a function or delegate value is used as an interpolated string argument. ([PR #19289](https://github.com/dotnet/fsharp/pull/19289)) * 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)) ### Changed From 29cd63cea78d973709f48a9a53b499f0b48a4a0c Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 4 Jun 2026 21:59:02 +0200 Subject: [PATCH 3/3] Update baselines --- .../Misc/NoBoxingOnDispose01.fs.il.net472.bsl | 35 +++++++++---------- .../ExprTests.fs | 2 +- .../StructureTests.fs | 2 +- .../EmittedIL/ComputedListExpressions.fs | 6 ++-- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl index 6cc68854c66..ee8bc9d10c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/NoBoxingOnDispose01.fs.il.net472.bsl @@ -49,33 +49,32 @@ .maxstack 3 .locals init (valuetype [runtime]System.Collections.Generic.List`1/Enumerator V_0, !!T V_1) - IL_0000: nop - IL_0001: ldarg.0 - IL_0002: callvirt instance valuetype [runtime]System.Collections.Generic.List`1/Enumerator class [runtime]System.Collections.Generic.List`1::GetEnumerator() - IL_0007: stloc.0 + IL_0000: ldarg.0 + IL_0001: callvirt instance valuetype [runtime]System.Collections.Generic.List`1/Enumerator class [runtime]System.Collections.Generic.List`1::GetEnumerator() + IL_0006: stloc.0 .try { - IL_0008: br.s IL_0013 + IL_0007: br.s IL_0012 - IL_000a: ldloca.s V_0 - IL_000c: call instance !0 valuetype [runtime]System.Collections.Generic.List`1/Enumerator::get_Current() - IL_0011: stloc.1 - IL_0012: nop - IL_0013: ldloca.s V_0 - IL_0015: call instance bool valuetype [runtime]System.Collections.Generic.List`1/Enumerator::MoveNext() - IL_001a: brtrue.s IL_000a + IL_0009: ldloca.s V_0 + IL_000b: call instance !0 valuetype [runtime]System.Collections.Generic.List`1/Enumerator::get_Current() + IL_0010: stloc.1 + IL_0011: nop + IL_0012: ldloca.s V_0 + IL_0014: call instance bool valuetype [runtime]System.Collections.Generic.List`1/Enumerator::MoveNext() + IL_0019: brtrue.s IL_0009 - IL_001c: leave.s IL_002c + IL_001b: leave.s IL_002b } finally { - IL_001e: ldloca.s V_0 - IL_0020: constrained. valuetype [runtime]System.Collections.Generic.List`1/Enumerator - IL_0026: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_002b: endfinally + IL_001d: ldloca.s V_0 + IL_001f: constrained. valuetype [runtime]System.Collections.Generic.List`1/Enumerator + IL_0025: callvirt instance void [runtime]System.IDisposable::Dispose() + IL_002a: endfinally } - IL_002c: ret + IL_002b: ret } } diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs index e2cb6787ebd..2aab772a121 100644 --- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs @@ -900,7 +900,7 @@ let ``Test Optimized Declarations Project1`` () = "let test11(s) = let Pipe #1 input at line 238: Microsoft.FSharp.Core.string = s in M.last2 (Pipe #1 input at line 238) @ (238,4--238,14)"; "let badLoop = badLoop@240.Force Microsoft.FSharp.Core.int>(()) @ (240,8--240,15)"; "type LetLambda"; - "let f = fun a -> fun b -> Operators.op_Addition (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.AdditionDynamic (arg0_0,arg1_0),a,b) @ (247,8--247,24)"; + "let f = ((); fun a -> fun b -> Operators.op_Addition (fun arg0_0 -> fun arg1_0 -> LanguagePrimitives.AdditionDynamic (arg0_0,arg1_0),a,b)) @ (246,8--247,24)"; "let letLambdaRes = let Pipe #1 input at line 249: (Microsoft.FSharp.Core.int * Microsoft.FSharp.Core.int) Microsoft.FSharp.Collections.list = Cons((1,2),Empty()) in ListModule.Map (fun tupledArg -> let a: Microsoft.FSharp.Core.int = tupledArg.Item0 in let b: Microsoft.FSharp.Core.int = tupledArg.Item1 in (LetLambda.f () a) b,Pipe #1 input at line 249) @ (249,19--249,71)"; "let anonRecd = {X = 1; Y = 2} @ (251,15--251,33)"; "let anonRecdGet = (M.anonRecd ().X,M.anonRecd ().Y) @ (252,19--252,41)"] diff --git a/tests/FSharp.Compiler.Service.Tests/StructureTests.fs b/tests/FSharp.Compiler.Service.Tests/StructureTests.fs index 22ff8845e3a..13ea9af5e58 100644 --- a/tests/FSharp.Compiler.Service.Tests/StructureTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/StructureTests.fs @@ -453,7 +453,7 @@ for x in 0 .. 100 -> () """ => [ (2, 0, 4, 14), (2, 0, 4, 14) - (2, 18, 4, 14), (2, 18, 4, 14) ] + (3, 12, 4, 14), (3, 12, 4, 14) ] [] let ``tuple``() = diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs index 6a092d222e6..52be7c610ce 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/ComputedListExpressions.fs @@ -245,9 +245,9 @@ let ListExpressionSteppingTest5 () = IL_0004: stloc.2 IL_0005: br.s IL_0033 - IL_0007: ldloca.s V_0 - IL_0009: ldloc.2 - IL_000a: stloc.3 + IL_0007: ldloc.2 + IL_0008: stloc.3 + IL_0009: ldloca.s V_0 IL_000b: stloc.s V_4 IL_000d: ldloc.s V_4 IL_000f: ldstr "hello"