From 6cfb404e880dd5136653c33f16ca4a2138c5e8ef Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 4 Jun 2026 17:12:04 +0200 Subject: [PATCH 01/50] 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 02/50] 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 03/50] 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" From db1d054d191e3aaf2979881f94d759ddcf2604d6 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 4 Jun 2026 22:08:39 +0200 Subject: [PATCH 04/50] Sequence points: rework conditional erasure, fix stepping over literals Add `isHidden` to `DebugPointAtLeafExpr.Yes` to express it explicitly in the typed tree Co-Authored-By: Claude Opus 4.8 --- .../Checking/CheckIncrementalClasses.fs | 4 +- .../CheckComputationExpressions.fs | 22 +- .../Checking/Expressions/CheckExpressions.fs | 3 +- src/Compiler/CodeGen/IlxGen.fs | 22 +- .../Optimize/LowerComputedCollections.fs | 10 +- src/Compiler/Optimize/LowerSequences.fs | 8 +- src/Compiler/Optimize/LowerStateMachines.fs | 2 +- src/Compiler/Optimize/Optimizer.fs | 28 +- .../Service/FSharpParseFileResults.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 2 +- src/Compiler/TypedTree/TypedTree.fs | 2 +- .../TypedTree/TypedTreeOps.Attributes.fs | 2 +- .../TypedTreeOps.ExprConstruction.fs | 2 +- .../TypedTree/TypedTreeOps.Remapping.fs | 2 +- .../TypedTree/TypedTreeOps.Transforms.fs | 2 +- .../Binding/Local - Erased call 02.bsl | 7 + .../Binding/Local - Erased call 03.bsl | 7 + .../Binding/Local - Erased call 04.bsl | 13 + .../Binding/Local - Erased call 05.bsl | 13 + .../Binding/Local - Erased call 06.bsl | 13 + .../Binding/Local - ErasedCall 01.bsl | 3 + .../Binding/Local - SequentialUnits 01.bsl | 9 + .../Binding/Local - Unit 01.bsl | 6 + .../Binding/Module - Erased call 02.bsl | 7 + .../Binding/Module - Erased call 03.bsl | 7 + .../Binding/Module - Erased call 04.bsl | 13 + .../Binding/Module - Erased call 05.bsl | 13 + .../Binding/Module - Erased call 06.bsl | 13 + .../Binding/Module - ErasedCall 01.bsl | 1 + .../Binding/Module - SequentialUnits 01.bsl | 6 + .../Binding/Module - Unit 01.bsl | 3 + .../ForEach/List - Body - ErasedCall 01.bsl | 25 ++ .../List - Body - ErasedThenKeptCall 01.bsl | 29 ++ .../List - Body - KeptThenErasedCall 01.bsl | 29 ++ .../Function/Body - Erased call 02.bsl | 1 + .../Function/Body - Erased call 03.bsl | 1 + .../Function/Body - Erased call 04.bsl | 3 + .../Function/Body - Erased call 05.bsl | 3 + .../Function/Body - Erased call 06.bsl | 3 + .../Function/Body - ErasedCall 01.bsl | 1 + .../Function/Body - ErasedThenKeptCall 01.bsl | 5 + .../Function/Body - KeptThenErasedCall 01.bsl | 5 + .../SequencePoints/SequencePointsTests.fs | 280 ++++++++++++++++++ .../SteppingMatch/SteppingMatch08.fs.il.bsl | 3 +- ...iler.Service.SurfaceArea.netstandard20.bsl | 8 +- 46 files changed, 589 insertions(+), 56 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl diff --git a/src/Compiler/Checking/CheckIncrementalClasses.fs b/src/Compiler/Checking/CheckIncrementalClasses.fs index 846aa5f9085..1d094bbf874 100644 --- a/src/Compiler/Checking/CheckIncrementalClasses.fs +++ b/src/Compiler/Checking/CheckIncrementalClasses.fs @@ -802,7 +802,7 @@ let MakeCtorForIncrClassConstructionPhase2C( // Extend the range of any immediate debug point to include the 'do' let doExpr = match doExpr with - | Expr.DebugPoint(_, innerExpr) -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, innerExpr) + | Expr.DebugPoint(_, innerExpr) -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), innerExpr) | e -> e let binder = (fun e -> mkSequential mFull doExpr e) let isPriorToSuperInit = false @@ -940,7 +940,7 @@ let MakeCtorForIncrClassConstructionPhase2C( // Add the debug point let inheritsExpr = if inheritsIsVisible then - Expr.DebugPoint(DebugPointAtLeafExpr.Yes inheritsExpr.Range, inheritsExpr) + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, inheritsExpr.Range), inheritsExpr) else inheritsExpr diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 3ab446a6687..35b5f7df008 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -81,7 +81,7 @@ let inline arbKeySelectors m = // Flag that a debug point should get emitted prior to both the evaluation of 'rhsExpr' and the call to Using let inline addBindDebugPoint spBind e = match spBind with - | DebugPointAtBinding.Yes m -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, e) + | DebugPointAtBinding.Yes m -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), false, e) | _ -> e let inline mkSynDelay2 (e: SynExpr) = mkSynDelay (e.Range.MakeSynthetic()) e @@ -1345,7 +1345,7 @@ let rec TryTranslateComputationExpression let forCall = match spFor with - | DebugPointAtFor.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, false, forCall) + | DebugPointAtFor.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFor), false, forCall) | DebugPointAtFor.No -> forCall translatedCtxt forCall) @@ -1389,7 +1389,7 @@ let rec TryTranslateComputationExpression // 'while' is hit just before each time the guard is called let guardExpr = match spWhile with - | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) + | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mWhile), false, guardExpr) | DebugPointAtWhile.No -> guardExpr Some( @@ -1419,7 +1419,7 @@ let rec TryTranslateComputationExpression // 'while!' is hit just before each time the guard is called let guardExpr = match spWhile with - | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mWhile, false, guardExpr) + | DebugPointAtWhile.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mWhile), false, guardExpr) | DebugPointAtWhile.No -> guardExpr let rewrittenWhileExpr = @@ -1557,7 +1557,7 @@ let rec TryTranslateComputationExpression // Put down a debug point for the 'finally' let unwindExpr2 = match spFinally with - | DebugPointAtFinally.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFinally, true, unwindExpr) + | DebugPointAtFinally.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFinally), true, unwindExpr) | DebugPointAtFinally.No -> unwindExpr if ceenv.isQuery then @@ -1571,7 +1571,7 @@ let rec TryTranslateComputationExpression let innerExpr = match spTry with - | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) + | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mTry), true, innerExpr) | _ -> innerExpr Some( @@ -2308,7 +2308,7 @@ let rec TryTranslateComputationExpression let innerExpr = match spTry with - | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mTry, true, innerExpr) + | DebugPointAtTry.Yes _ -> SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mTry), true, innerExpr) | _ -> innerExpr let callExpr = @@ -2345,7 +2345,7 @@ let rec TryTranslateComputationExpression if IsControlFlowExpression synYieldExpr then yieldFromCall else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, false, yieldFromCall) + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), false, yieldFromCall) Some(translatedCtxt yieldFromCall) @@ -2374,7 +2374,7 @@ let rec TryTranslateComputationExpression if IsControlFlowExpression synReturnExpr then returnFromCall else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, false, returnFromCall) + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), false, returnFromCall) Some(translatedCtxt returnFromCall) @@ -2393,7 +2393,7 @@ let rec TryTranslateComputationExpression if IsControlFlowExpression synYieldOrReturnExpr then yieldOrReturnCall else - SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes mFull, false, yieldOrReturnCall) + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFull), false, yieldOrReturnCall) Some(translatedCtxt yieldOrReturnCall) @@ -2704,7 +2704,7 @@ and TranslateComputationExpressionBind and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp varSpace innerComp = match innerComp with | SynExpr.YieldOrReturn((false, _), returnExpr, m, _) -> - let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnExpr) + let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), false, returnExpr) Some(returnExpr, None) | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 4932830a352..e1322bf1db7 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -3103,7 +3103,7 @@ let BuildPossiblyConditionalMethodCall (cenv: cenv) env isMutable m isProp minfo if shouldEraseCall then // Methods marked with 'Conditional' must return 'unit' UnifyTypes cenv env m g.unit_ty (minfo.GetFSharpReturnType(cenv.amap, m, minst)) - mkUnit g m, g.unit_ty + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden = true, range = m), mkUnit g m), g.unit_ty else #if !NO_TYPEPROVIDERS match minfo with @@ -5903,6 +5903,7 @@ and TcNonControlFlowExpr (env: TcEnv) f = let res2 = match res with | IfThenElseExpr _ -> res + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden = true), _) -> res | _ -> mkDebugPoint res.Range res res2, tpenv else diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 46959e56b22..1a57e09a6ca 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -3171,8 +3171,8 @@ and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr (sequel: sequel) = | LinearOpExpr _ | Expr.Match _ -> GenLinearExpr cenv cgbuf eenv expr sequel false id |> ignore - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) -> - if equals m range0 then + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden, m), innerExpr) -> + if isHidden then cgbuf.EmitStartOfHiddenCode() else CG.EmitDebugPoint cgbuf m @@ -3736,8 +3736,8 @@ and GenLinearExpr cenv cgbuf eenv expr sequel preSteps (contf: FakeUnit -> FakeU GenSequel cenv eenv.cloc cgbuf sequelAfterJoin Fake)) - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) -> - if equals m range0 then + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden, m), innerExpr) -> + if isHidden then cgbuf.EmitStartOfHiddenCode() else CG.EmitDebugPoint cgbuf m @@ -10641,10 +10641,20 @@ and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: Co let _, body = CodeGenMethod cenv cgbuf.mgbuf ([], eenv.staticInitializationName, eenv, 0, None, codeGenInitFunc, m) - if CheckCodeDoesSomething body.Code then + let codeDoesSomething = CheckCodeDoesSomething body.Code + + // Keep the init method if it carries a visible debug point, so steppable bindings like 'let i = ()' survive. + let hasVisibleDebugPoint = + body.Code.Instrs + |> Array.exists (function + | I_seqpoint sp -> sp.Line <> FeeFee cenv + | _ -> false) + + if codeDoesSomething || hasVisibleDebugPoint then // We are here because the module we just grabbed has an interesting static initializer let feefee, seqpt = - if body.Code.Instrs.Length > 0 then + // Without real init code, the .cctor's FeeFee marker would just add a stray hidden sequence point. + if codeDoesSomething && body.Code.Instrs.Length > 0 then match body.Code.Instrs[0] with | I_seqpoint sp as i -> [ FeeFeeInstr cenv sp.Document ], [ i ] | _ -> [], [] diff --git a/src/Compiler/Optimize/LowerComputedCollections.fs b/src/Compiler/Optimize/LowerComputedCollections.fs index 896540b0ae6..1dabf4fb142 100644 --- a/src/Compiler/Optimize/LowerComputedCollections.fs +++ b/src/Compiler/Optimize/LowerComputedCollections.fs @@ -114,7 +114,7 @@ let LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr = let cleanupE = BuildDisposableCleanup tcVal g infoReader m enumv // A debug point should get emitted prior to both the evaluation of 'inp' and the call to GetEnumerator - let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, e) + let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFor), e) let spInAsWhile = match spIn with DebugPointAtInOrTo.Yes m -> DebugPointAtWhile.Yes m | DebugPointAtInOrTo.No -> DebugPointAtWhile.No @@ -289,7 +289,7 @@ module List = match body with | Expr.Let(TBind(v, rhs, DebugPointAtBinding.Yes spBind), innerBody, m, flags) -> let bodyForAdd = Expr.Let(TBind(v, rhs, DebugPointAtBinding.NoneAtInvisible), innerBody, m, flags) - Expr.DebugPoint(DebugPointAtLeafExpr.Yes spBind, mkCallCollectorAdd tcVal g reader mBody collector bodyForAdd) + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, spBind), mkCallCollectorAdd tcVal g reader mBody collector bodyForAdd) | _ -> mkCallCollectorAdd tcVal g reader mIn collector body @@ -342,7 +342,7 @@ module List = match body with | Some (loopVal, body) -> mkInvisibleLet m loopVal loopVar - (Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mkCallCollectorAdd tcVal g reader mBody collector body)) + (Expr.DebugPoint (DebugPointAtLeafExpr.Yes(false, mFor), mkCallCollectorAdd tcVal g reader mBody collector body)) | None -> mkCallCollectorAdd tcVal g reader mBody collector loopVar) @@ -447,7 +447,7 @@ module Array = ) // Add a debug point at the `for`, before anything gets evaluated. - Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mapping) + Expr.DebugPoint (DebugPointAtLeafExpr.Yes(false, mFor), mapping) ) /// Whether to check for overflow when converting a value to a native int. @@ -508,7 +508,7 @@ module Array = match body with | Some (loopVal, body) -> - mkInvisibleLet mBody loopVal loopVar (Expr.DebugPoint (DebugPointAtLeafExpr.Yes mFor, mkStore body)) + mkInvisibleLet mBody loopVal loopVar (Expr.DebugPoint (DebugPointAtLeafExpr.Yes(false, mFor), mkStore body)) | None -> mkStore loopVar) diff --git a/src/Compiler/Optimize/LowerSequences.fs b/src/Compiler/Optimize/LowerSequences.fs index 3b7b4a51181..02c9f33373e 100644 --- a/src/Compiler/Optimize/LowerSequences.fs +++ b/src/Compiler/Optimize/LowerSequences.fs @@ -118,7 +118,7 @@ let ConvertSequenceExprToObject g amap overallExpr = let (TBind(v, e, sp)) = bind let addDebugPoint e = match sp with - | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e) + | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e) | _ -> e let vref = mkLocalValRef v { resBody with @@ -262,7 +262,7 @@ let ConvertSequenceExprToObject g amap overallExpr = // body ]] // A debug point should get emitted prior to both the evaluation of 'inp' and the call to GetEnumerator - let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes mFor, e) + let addForDebugPoint e = Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, mFor), e) // The 'in' debug point is put back into the TypedTree at the right place for SeqWhile let mIn = match spIn with DebugPointAtInOrTo.Yes m -> m.NoteSourceConstruct(NotedSourceConstruct.While) | DebugPointAtInOrTo.No -> mIn @@ -293,11 +293,11 @@ let ConvertSequenceExprToObject g amap overallExpr = let asyncVars = unionFreeVars res1.asyncVars (freeInExpr CollectLocals compensation) let addTryDebugPoint e = match spTry with - | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e) + | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e) | _ -> e let addFinallyDebugPoint e = match spFinally with - | DebugPointAtFinally.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e) + | DebugPointAtFinally.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e) | _ -> e Some { phase2 = (fun (pcVar, _currv, _, pcMap as ctxt) -> let generate1, dispose1, checkDispose1 = res1.phase2 ctxt diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index cb9453d3177..a82d57d0789 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -76,7 +76,7 @@ let RepresentBindingAsStateVar g (bind: Binding) (resBody: StateMachineConversio let (TBind(v, e, sp)) = bind let addDebugPoint innerExpr = match sp with - | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, innerExpr) + | DebugPointAtBinding.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), innerExpr) | _ -> innerExpr let vref = mkLocalValRef v { resBody with diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index a6fa90d1e3a..eee8052bd04 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -383,9 +383,6 @@ type OptimizationSettings = /// This optimization is off by default, given tiny overhead of including try/with. See https://github.com/dotnet/fsharp/pull/376 member _.EliminateTryWithAndTryFinally = false - /// Determines if we should eliminate first part of sequential expression if it has no effect - member x.EliminateSequential = x.LocalOptimizationsEnabled - /// Determines if we should determine branches in pattern matching based on known information, e.g. /// eliminate a "if true then .. else ... " member x.EliminateSwitch = x.LocalOptimizationsEnabled @@ -2874,12 +2871,8 @@ and OptimizeLinearExpr cenv env expr contf = OptimizeLinearExpr cenv env e2 (contf << (fun (e2R, e2info) -> if (flag = NormalSeq) && - // Drop bare (compiler-generated) units always; keep a debug-pointed unit in debug code so - // it stays steppable (a unit without one must go, else a dangling breakpoint - FSharp 1.0 bug 6034). - (cenv.settings.EliminateSequential || - (match e1R with - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes _, _) -> false - | _ -> match stripDebugPoints e1R with Expr.Const (Const.Unit, _, _) -> true | _ -> false)) && + (cenv.settings.LocalOptimizationsEnabled || + (match e1R with | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden, _), _) -> isHidden | _ -> false)) && not e1info.HasEffect then e2R, e2info else @@ -2942,9 +2935,11 @@ and OptimizeLinearExpr cenv env expr contf = OptimizeLinearExpr cenv env argLast (contf << (fun (argLastR, argLastInfo) -> OptimizeExprOpReductionsAfter cenv env (op, tyargs, argsHeadR @ [argLastR], argsHeadInfosR @ [argLastInfo], m))) - | Expr.DebugPoint (m, innerExpr) when not (IsDebugPipeRightExpr cenv innerExpr)-> + | Expr.DebugPoint (m, innerExpr) when not (IsDebugPipeRightExpr cenv innerExpr)-> OptimizeLinearExpr cenv env innerExpr (contf << (fun (innerExprR, einfo) -> - Expr.DebugPoint (m, innerExprR), einfo)) + match m with + | DebugPointAtLeafExpr.Yes(isHidden = true) when not einfo.HasEffect -> innerExprR, einfo + | _ -> Expr.DebugPoint (m, innerExprR), einfo)) | _ -> contf (OptimizeExpr cenv env expr) @@ -2966,7 +2961,7 @@ and OptimizeTryFinally cenv env (spTry, spFinally, e1, e2, m, ty) = if cenv.settings.EliminateTryWithAndTryFinally && not e1info.HasEffect then let e1R2 = match spTry with - | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, e1R) + | DebugPointAtTry.Yes m -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), e1R) | DebugPointAtTry.No -> e1R Expr.Sequential (e1R2, e2R, ThenDoSeq, m), info else @@ -4220,7 +4215,14 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = if vref.ShouldInline && IsPartialExprVal einfo.Info then errorR(InternalError("the inline value '"+vref.LogicalName+"' was not inferred to have a known value", vref.Range)) - let env = BindInternalLocalVal cenv vref (mkValInfo einfo vref) env + let env = BindInternalLocalVal cenv vref (mkValInfo einfo vref) env + + // The hidden debug point on the r.h.s. is dropped above, so suppress the binding's debug point too. + let spBind = + match expr with + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(isHidden = true), _) when not einfo.HasEffect -> DebugPointAtBinding.NoneAtLet + | _ -> spBind + (TBind(vref, exprOptimized, spBind), einfo), env with RecoverableException exn -> errorRecovery exn vref.Range diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index 434974de754..119669f22d9 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -568,7 +568,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, | SynInterpolatedStringPart.FillExpr(fillExpr, _) -> yield fillExpr ] - | SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, isControlFlow, innerExpr) -> + | SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(_, m), isControlFlow, innerExpr) -> yield! checkRange m yield! walkExpr isControlFlow innerExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 7c0030e4f3a..f35bb3297de 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -270,7 +270,7 @@ type DebugPointAtTry = | No [] -type DebugPointAtLeafExpr = Yes of range +type DebugPointAtLeafExpr = Yes of isHidden: bool * range: range [] type DebugPointAtWith = diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 2206d199c39..8b152ba2d69 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -258,7 +258,7 @@ type DebugPointAtTarget = /// Represents a debug point at a leaf expression (e.g. an application or constant). [] -type DebugPointAtLeafExpr = Yes of range +type DebugPointAtLeafExpr = Yes of isHidden: bool * range: range /// Represents whether a debug point should be suppressed for either the /// first or second part of a sequential execution, that is whether the diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index 733b269b588..dac2e23c10c 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -5274,7 +5274,7 @@ type Expr = | WitnessArg _ -> "WitnessArg(..)" | TyChoose _ -> "TyChoose(..)" | Link e -> "Link(" + e.Value.ToDebugString(depth) + ")" - | DebugPoint (DebugPointAtLeafExpr.Yes m, e) -> sprintf "DebugPoint(%s, " (m.ToString()) + e.ToDebugString(depth) + ")" + | DebugPoint (DebugPointAtLeafExpr.Yes(_, m), e) -> sprintf "DebugPoint(%s, " (m.ToString()) + e.ToDebugString(depth) + ")" /// Get the mark/range/position information from an expression member expr.Range = diff --git a/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs b/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs index a57c6e23804..d011c2d231f 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Attributes.fs @@ -2075,7 +2075,7 @@ module internal DebugPrint = | Expr.Link rX -> exprL rX.Value |> wrap - | Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, rX) -> + | Expr.DebugPoint(DebugPointAtLeafExpr.Yes(_, m), rX) -> aboveListL [ wordL (tagText "__debugPoint(") ^^ rangeL m ^^ wordL (tagText ")"); exprL rX ] |> wrap diff --git a/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs b/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs index 00761538123..1151c53fca5 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fs @@ -512,7 +512,7 @@ module internal ExprConstruction = let valsOfBinds (binds: Bindings) = binds |> List.map (fun b -> b.Var) let mkDebugPoint m expr = - Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, expr) + Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), expr) // Used to remove Expr.Link for inner expressions in pattern matches let (|InnerExprPat|) expr = stripExpr expr diff --git a/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs b/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs index de28bc34138..7401ed40b14 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Remapping.fs @@ -2873,7 +2873,7 @@ module internal ExprAnalysis = // Incorporate spBind as a note if present let res = match spBind with - | DebugPointAtBinding.Yes dp -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes dp, res) + | DebugPointAtBinding.Yes dp -> Expr.DebugPoint(DebugPointAtLeafExpr.Yes(false, dp), res) | _ -> res res diff --git a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs index a676cc3e6dd..83ff0d3baca 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs @@ -2230,7 +2230,7 @@ module internal TupleCompilation = (mkValSet mIn (mkLocalValRef nextVar) tailOrNullExpr) let bodyAndStep = - mkSequential mIn bodyExpr (Expr.DebugPoint(DebugPointAtLeafExpr.Yes range0, loopStep)) + mkSequential mIn bodyExpr (Expr.DebugPoint(DebugPointAtLeafExpr.Yes(true, mIn), loopStep)) let bodyExpr = mkLet spElem mFor elemVar headOrDefaultExpr bodyAndStep diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl new file mode 100644 index 00000000000..a56d4e22f3f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl @@ -0,0 +1,7 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl new file mode 100644 index 00000000000..a56d4e22f3f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl @@ -0,0 +1,7 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl new file mode 100644 index 00000000000..b5ea48a2b02 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl @@ -0,0 +1,13 @@ +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-5,7) () + IL_0000: ldnull + IL_0001: stsfld i@4 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl new file mode 100644 index 00000000000..89b07eb630f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl @@ -0,0 +1,13 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (6,5-6,7) () + IL_0000: ldnull + IL_0001: stsfld i@4 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl new file mode 100644 index 00000000000..4d2583f7a06 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl @@ -0,0 +1,13 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (7,5-7,7) () + IL_0000: ldnull + IL_0001: stsfld i@4 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl new file mode 100644 index 00000000000..85ce8fcb060 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl @@ -0,0 +1,3 @@ +Module::staticInitialization@ + (6,5-6,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl new file mode 100644 index 00000000000..f8569c7551b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl @@ -0,0 +1,9 @@ +Module::staticInitialization@ + (5,5-5,15) let i = () + IL_0000: nop + + (6,5-6,15) let j = () + IL_0001: nop + + (7,5-7,7) () + IL_0002: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl new file mode 100644 index 00000000000..e06986670e8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl @@ -0,0 +1,6 @@ +Module::staticInitialization@ + (5,5-5,15) let i = () + IL_0000: nop + + (6,5-6,7) () + IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl new file mode 100644 index 00000000000..a56d4e22f3f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl @@ -0,0 +1,7 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl new file mode 100644 index 00000000000..a56d4e22f3f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl @@ -0,0 +1,7 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl new file mode 100644 index 00000000000..b5ea48a2b02 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl @@ -0,0 +1,13 @@ +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-5,7) () + IL_0000: ldnull + IL_0001: stsfld i@4 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl new file mode 100644 index 00000000000..89b07eb630f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl @@ -0,0 +1,13 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (6,5-6,7) () + IL_0000: ldnull + IL_0001: stsfld i@4 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl new file mode 100644 index 00000000000..4d2583f7a06 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl @@ -0,0 +1,13 @@ +Module::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld init@ + IL_0006: ldsfld init@ + IL_000b: pop + IL_000c: ret + +Module::staticInitialization@ + (7,5-7,7) () + IL_0000: ldnull + IL_0001: stsfld i@4 + IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl @@ -0,0 +1 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl new file mode 100644 index 00000000000..5a8bfaee8dd --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl @@ -0,0 +1,6 @@ +Module::staticInitialization@ + (4,1-4,11) let i = () + IL_0000: nop + + (5,1-5,11) let j = () + IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl new file mode 100644 index 00000000000..b41b6aa0392 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl @@ -0,0 +1,3 @@ +Module::staticInitialization@ + (4,1-4,11) let i = () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl new file mode 100644 index 00000000000..cb970fe45cc --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl @@ -0,0 +1,25 @@ +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_001b + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + + IL_0012: ldloc.1 + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: call get_TailOrNull + IL_001a: stloc.1 + + (5,11-5,13) in + IL_001b: ldloc.1 + IL_001c: brtrue.s IL_000b + IL_001e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl new file mode 100644 index 00000000000..13752f34640 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 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_0025 + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (7,9-7,36) System.Console.WriteLine "" + IL_0012: ldstr "" + IL_0017: call WriteLine + + + IL_001c: ldloc.1 + IL_001d: stloc.0 + IL_001e: ldloc.0 + IL_001f: call get_TailOrNull + IL_0024: stloc.1 + + (5,11-5,13) in + IL_0025: ldloc.1 + IL_0026: brtrue.s IL_000b + IL_0028: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl new file mode 100644 index 00000000000..44330778128 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 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_0025 + + (5,5-5,10) for i + IL_000b: ldloc.0 + IL_000c: call get_HeadOrDefault + IL_0011: stloc.2 + + (6,9-6,36) System.Console.WriteLine "" + IL_0012: ldstr "" + IL_0017: call WriteLine + + + IL_001c: ldloc.1 + IL_001d: stloc.0 + IL_001e: ldloc.0 + IL_001f: call get_TailOrNull + IL_0024: stloc.1 + + (5,11-5,13) in + IL_0025: ldloc.1 + IL_0026: brtrue.s IL_000b + IL_0028: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl @@ -0,0 +1 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl @@ -0,0 +1 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl new file mode 100644 index 00000000000..f3a13298d7a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl @@ -0,0 +1,3 @@ +Module::f + (5,5-5,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl new file mode 100644 index 00000000000..5b43fa23219 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl @@ -0,0 +1,3 @@ +Module::f + (6,5-6,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl new file mode 100644 index 00000000000..57c43f3fa5a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl @@ -0,0 +1,3 @@ +Module::f + (7,5-7,7) () + IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl @@ -0,0 +1 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl new file mode 100644 index 00000000000..49a5c633237 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl @@ -0,0 +1,5 @@ +Module::f + (6,5-6,32) System.Console.WriteLine "" + IL_0000: ldstr "" + IL_0005: call WriteLine + IL_000a: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl new file mode 100644 index 00000000000..5210433b28d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl @@ -0,0 +1,5 @@ +Module::f + (5,5-5,32) System.Console.WriteLine "" + IL_0000: ldstr "" + IL_0005: call WriteLine + IL_000a: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs index 3d373e0921f..0fd43b8165e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs @@ -50,6 +50,89 @@ let f () = () """ + [] + let ``Body - ErasedCall 01`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 02`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 03`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 04`` () = + Baseline.verify """ +module Module + +let f () = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 05`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Body - Erased call 06`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +""" + + [] + let ``Body - ErasedThenKeptCall 01`` () = + Baseline.verify """ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +""" + + [] + let ``Body - KeptThenErasedCall 01`` () = + Baseline.verify """ +module Module + +let f () = + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +""" + module ForEach = [] let ``List - Simple 01`` () = @@ -82,6 +165,38 @@ let f (l: int list) = System.Console.WriteLine(i + 1) """ + [] + let ``List - Body - ErasedCall 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" +""" + + [] + let ``List - Body - ErasedThenKeptCall 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +""" + + [] + let ``List - Body - KeptThenErasedCall 01`` () = + Baseline.verify """ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +""" + [] let ``List - Body - ParenUnit 01`` () = Baseline.verify """ @@ -470,3 +585,168 @@ let f (l: string) = for c in l do System.Console.WriteLine c """ + +module Binding = + [] + let ``Module - Unit 01`` () = + Baseline.verify """ +module Module + +let i = () +""" + + [] + let ``Module - SequentialUnits 01`` () = + Baseline.verify """ +module Module + +let i = () +let j = () +""" + + [] + let ``Module - ErasedCall 01`` () = + Baseline.verify """ +module Module + +let i = System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 02`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 03`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 04`` () = + Baseline.verify """ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 05`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Module - Erased call 06`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +""" + + [] + let ``Local - Unit 01`` () = + Baseline.verify """ +module Module + +do + let i = () + () +""" + + [] + let ``Local - SequentialUnits 01`` () = + Baseline.verify """ +module Module + +do + let i = () + let j = () + () +""" + + [] + let ``Local - ErasedCall 01`` () = + Baseline.verify """ +module Module + +do + let i = System.Diagnostics.Debug.Write "" + () +""" + + [] + let ``Local - Erased call 02`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 03`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 04`` () = + Baseline.verify """ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 05`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +""" + + [] + let ``Local - Erased call 06`` () = + Baseline.verify """ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +""" \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl index e038bd5a127..6e8437bbab3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SteppingMatch/SteppingMatch08.fs.il.bsl @@ -51,8 +51,7 @@ IL_0011: ldc.i4.0 IL_0012: nop IL_0013: stloc.0 - IL_0014: nop - IL_0015: ret + IL_0014: ret } } diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl index 93f733ef373..eae525a3866 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.bsl @@ -6132,9 +6132,11 @@ FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(FSharp.Compiler.Synt FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(FSharp.Compiler.Syntax.DebugPointAtLeafExpr, System.Collections.IEqualityComparer) FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(System.Object) FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean Equals(System.Object, System.Collections.IEqualityComparer) -FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Syntax.DebugPointAtLeafExpr NewYes(FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range Item -FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range get_Item() +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean get_isHidden() +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Boolean isHidden +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Syntax.DebugPointAtLeafExpr NewYes(Boolean, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range get_range() +FSharp.Compiler.Syntax.DebugPointAtLeafExpr: FSharp.Compiler.Text.Range range FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Int32 GetHashCode() FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Int32 GetHashCode(System.Collections.IEqualityComparer) FSharp.Compiler.Syntax.DebugPointAtLeafExpr: Int32 Tag From 3d762d7e99651d05465866eaa56f612275a73d09 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 5 Jun 2026 12:25:21 +0200 Subject: [PATCH 05/50] Print source in sequence point dump --- .../Binding/Local - Erased call 02.bsl | 7 +++++ .../Binding/Local - Erased call 03.bsl | 8 ++++++ .../Binding/Local - Erased call 04.bsl | 12 +++++++-- .../Binding/Local - Erased call 05.bsl | 12 +++++++-- .../Binding/Local - Erased call 06.bsl | 12 +++++++-- .../Binding/Local - ErasedCall 01.bsl | 9 ++++++- .../Binding/Local - SequentialUnits 01.bsl | 14 +++++++--- .../Binding/Local - Unit 01.bsl | 11 ++++++-- .../Binding/Module - Erased call 02.bsl | 7 +++++ .../Binding/Module - Erased call 03.bsl | 8 ++++++ .../Binding/Module - Erased call 04.bsl | 12 +++++++-- .../Binding/Module - Erased call 05.bsl | 12 +++++++-- .../Binding/Module - Erased call 06.bsl | 12 +++++++-- .../Binding/Module - ErasedCall 01.bsl | 5 ++++ .../Binding/Module - SequentialUnits 01.bsl | 10 +++++-- .../Binding/Module - Unit 01.bsl | 7 ++++- .../Array - Body - MultipleStatements 01.bsl | 18 +++++++++---- .../Array - Body - SingleStatement 01.bsl | 15 ++++++++--- ...ay - Comprehensions - ActivePattern 01.bsl | 21 +++++++++++---- .../Array - Comprehensions - Arrow 01.bsl | 16 ++++++++--- .../Array - Comprehensions - Tuple 01.bsl | 17 +++++++++--- .../Array - Comprehensions - Tuple 02.bsl | 17 +++++++++--- .../Array - Comprehensions - Value 01.bsl | 19 +++++++++---- .../Array - Comprehensions - Value 02.bsl | 17 +++++++++--- .../Array - Pattern - ActivePattern 01.bsl | 19 +++++++++---- .../ForEach/Array - Pattern - Tuple 01.bsl | 15 ++++++++--- .../ForEach/Array - Simple 01.bsl | 15 ++++++++--- .../ForEach/List - Body - ErasedCall 01.bsl | 13 ++++++--- .../List - Body - ErasedThenKeptCall 01.bsl | 16 ++++++++--- .../List - Body - KeptThenErasedCall 01.bsl | 16 ++++++++--- .../ForEach/List - Body - LetUnit 01.bsl | 18 +++++++++---- .../List - Body - MultipleStatements 01.bsl | 18 +++++++++---- .../ForEach/List - Body - ParenUnit 01.bsl | 15 ++++++++--- .../List - Body - SequentialUnits 01.bsl | 18 +++++++++---- .../List - Body - SingleStatement 01.bsl | 15 ++++++++--- ...st - Comprehensions - ActivePattern 01.bsl | 21 +++++++++++---- .../List - Comprehensions - Arrow 01.bsl | 16 ++++++++--- .../List - Comprehensions - Tuple 01.bsl | 17 +++++++++--- .../List - Comprehensions - Tuple 02.bsl | 17 +++++++++--- .../List - Comprehensions - Value 01.bsl | 19 +++++++++---- .../List - Comprehensions - Value 02.bsl | 17 +++++++++--- .../List - Pattern - ActivePattern 01.bsl | 19 +++++++++---- .../ForEach/List - Pattern - Tuple 01.bsl | 15 ++++++++--- .../ForEach/List - Simple 01.bsl | 15 ++++++++--- .../Seq - Body - MultipleStatements 01.bsl | 18 +++++++++---- .../Seq - Body - SingleStatement 01.bsl | 15 ++++++++--- ...eq - Comprehensions - ActivePattern 01.bsl | 27 +++++++++++++------ .../Seq - Comprehensions - Arrow 01.bsl | 22 ++++++++++----- .../Seq - Comprehensions - Tuple 01.bsl | 23 +++++++++++----- .../Seq - Comprehensions - Tuple 02.bsl | 23 +++++++++++----- .../Seq - Comprehensions - Value 01.bsl | 25 +++++++++++------ .../Seq - Comprehensions - Value 02.bsl | 23 +++++++++++----- .../Seq - Pattern - ActivePattern 01.bsl | 19 +++++++++---- .../ForEach/Seq - Pattern - Tuple 01.bsl | 15 ++++++++--- .../ForEach/Seq - Simple 01.bsl | 15 ++++++++--- .../String - Body - SingleStatement 01.bsl | 15 ++++++++--- .../Function/Body - Erased call 02.bsl | 7 +++++ .../Function/Body - Erased call 03.bsl | 8 ++++++ .../Function/Body - Erased call 04.bsl | 10 ++++++- .../Function/Body - Erased call 05.bsl | 10 ++++++- .../Function/Body - Erased call 06.bsl | 10 ++++++- .../Function/Body - ErasedCall 01.bsl | 6 +++++ .../Function/Body - ErasedThenKeptCall 01.bsl | 9 ++++++- .../Function/Body - KeptThenErasedCall 01.bsl | 9 ++++++- .../Function/Body - LetThenValue 01.bsl | 11 ++++++-- .../Function/Body - SequentialUnits 01.bsl | 11 ++++++-- .../Function/Body - Unit 01.bsl | 8 +++++- .../SequencePoints/SequencePointsTests.fs | 3 ++- tests/FSharp.Test.Utilities/Compiler.fs | 6 +++-- 69 files changed, 755 insertions(+), 225 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl index a56d4e22f3f..9f8de4b8ccb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 02.bsl @@ -1,3 +1,10 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl index a56d4e22f3f..ddef94ec6f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 03.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl index b5ea48a2b02..7926295a77d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 04.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +15,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (5,5-5,7) () + (4,5-4,7) () IL_0000: ldnull - IL_0001: stsfld i@4 + IL_0001: stsfld i@3 IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl index 89b07eb630f..dbeda1b4e15 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 05.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +15,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (6,5-6,7) () + (5,5-5,7) () IL_0000: ldnull - IL_0001: stsfld i@4 + IL_0001: stsfld i@3 IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl index 4d2583f7a06..b4d3f3392e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Erased call 06.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +15,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (7,5-7,7) () + (6,5-6,7) () IL_0000: ldnull - IL_0001: stsfld i@4 + IL_0001: stsfld i@3 IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl index 85ce8fcb060..8784f1fe3c3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - ErasedCall 01.bsl @@ -1,3 +1,10 @@ +module Module + +do + let i = System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + Module::staticInitialization@ - (6,5-6,7) () + (5,5-5,7) () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl index f8569c7551b..39a42b809a6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - SequentialUnits 01.bsl @@ -1,9 +1,17 @@ +module Module + +do + let i = () + let j = () + () +-------------------------------------------------------------------------------- + Module::staticInitialization@ - (5,5-5,15) let i = () + (4,5-4,15) let i = () IL_0000: nop - (6,5-6,15) let j = () + (5,5-5,15) let j = () IL_0001: nop - (7,5-7,7) () + (6,5-6,7) () IL_0002: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl index e06986670e8..89970bd86f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Local - Unit 01.bsl @@ -1,6 +1,13 @@ +module Module + +do + let i = () + () +-------------------------------------------------------------------------------- + Module::staticInitialization@ - (5,5-5,15) let i = () + (4,5-4,15) let i = () IL_0000: nop - (6,5-6,7) () + (5,5-5,7) () IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl index a56d4e22f3f..9f8de4b8ccb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 02.bsl @@ -1,3 +1,10 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl index a56d4e22f3f..ddef94ec6f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 03.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl index b5ea48a2b02..7926295a77d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 04.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +15,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (5,5-5,7) () + (4,5-4,7) () IL_0000: ldnull - IL_0001: stsfld i@4 + IL_0001: stsfld i@3 IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl index 89b07eb630f..dbeda1b4e15 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 05.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +15,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (6,5-6,7) () + (5,5-5,7) () IL_0000: ldnull - IL_0001: stsfld i@4 + IL_0001: stsfld i@3 IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl index 4d2583f7a06..b4d3f3392e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Erased call 06.bsl @@ -1,3 +1,11 @@ +module Module + +let i = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +15,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (7,5-7,7) () + (6,5-6,7) () IL_0000: ldnull - IL_0001: stsfld i@4 + IL_0001: stsfld i@3 IL_0006: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl index 8b137891791..7def5b5213a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - ErasedCall 01.bsl @@ -1 +1,6 @@ +module Module + +let i = System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl index 5a8bfaee8dd..527031e40ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - SequentialUnits 01.bsl @@ -1,6 +1,12 @@ +module Module + +let i = () +let j = () +-------------------------------------------------------------------------------- + Module::staticInitialization@ - (4,1-4,11) let i = () + (3,1-3,11) let i = () IL_0000: nop - (5,1-5,11) let j = () + (4,1-4,11) let j = () IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl index b41b6aa0392..690723ece92 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Binding/Module - Unit 01.bsl @@ -1,3 +1,8 @@ +module Module + +let i = () +-------------------------------------------------------------------------------- + Module::staticInitialization@ - (4,1-4,11) let i = () + (3,1-3,11) let i = () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl index beb451d8511..30b0f457e37 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - MultipleStatements 01.bsl @@ -1,22 +1,30 @@ +module Module + +let f (l: int[]) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_001c - (5,5-5,10) for i + (4,5-4,10) for i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_000a: ldloc.2 IL_000b: call WriteLine - (7,9-7,40) System.Console.WriteLine(i + 1) + (6,9-6,40) System.Console.WriteLine(i + 1) IL_0010: ldloc.2 IL_0011: ldc.i4.1 IL_0012: add @@ -28,7 +36,7 @@ Module::f IL_001a: add IL_001b: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001c: ldloc.1 IL_001d: ldloc.0 IL_001e: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl index 022d36579ed..97d32670fa4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Body - SingleStatement 01.bsl @@ -1,18 +1,25 @@ +module Module + +let f (l: int[]) = + for i in l do + System.Console.WriteLine i +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_0014 - (5,5-5,10) for i + (4,5-4,10) for i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_000a: ldloc.2 IL_000b: call WriteLine @@ -22,7 +29,7 @@ Module::f IL_0012: add IL_0013: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0014: ldloc.1 IL_0015: ldloc.0 IL_0016: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl index a2dd006417a..fb31f91aec7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - ActivePattern 01.bsl @@ -1,13 +1,24 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + [| + for Id i in l do + yield i + |] +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,5-10,7) [| for Id i in l do yield i |] + (6,5-9,7) [| for Id i in l do yield i |] IL_0000: nop - (8,9-8,12) for + (7,9-7,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -21,13 +32,13 @@ Module::f IL_0019: ldloc.s 4 IL_001b: stloc.s 5 - (9,13-9,20) yield i + (8,13-8,20) yield i IL_001d: ldloca.s 0 IL_001f: ldloc.s 5 IL_0021: call Add IL_0026: nop - (8,18-8,20) in + (7,18-7,20) in IL_0027: ldloc.1 IL_0028: callvirt MoveNext IL_002d: brtrue.s IL_000a diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl index 048c51b972b..2949cfe2441 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Arrow 01.bsl @@ -1,8 +1,16 @@ +module Module + +let f (l: int list) = + [| + for n in l -> n + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-7,7) [| for n in l -> n |] + (4,5-6,7) [| for n in l -> n |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -13,13 +21,13 @@ Module::f IL_0011: ldloca.s 0 IL_0013: stloc.s 4 - (6,23-6,24) n + (5,23-5,24) n IL_0015: ldloc.s 4 IL_0017: ldloc.3 IL_0018: call Add IL_001d: nop - (6,15-6,17) in + (5,15-5,17) in IL_001e: ldloc.1 IL_001f: callvirt MoveNext IL_0024: brtrue.s IL_000a diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl index 234b112f656..4a08a514d4d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 01.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [| + for n in l do + yield n + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,7) [| for n in l do yield n |] + (4,5-7,7) [| for n in l do yield n |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -13,13 +22,13 @@ Module::f IL_0011: ldloca.s 0 IL_0013: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0015: ldloc.s 4 IL_0017: ldloc.3 IL_0018: call Add IL_001d: nop - (6,15-6,17) in + (5,15-5,17) in IL_001e: ldloc.1 IL_001f: callvirt MoveNext IL_0024: brtrue.s IL_000a diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl index d9b3362ac39..88845077d34 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Tuple 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [| + for i, i1 in l do + yield i + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,7) [| for i, i1 in l do yield i |] + (4,5-7,7) [| for i, i1 in l do yield i |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -17,13 +26,13 @@ Module::f IL_001a: call get_Item1 IL_001f: stloc.s 5 - (7,13-7,20) yield i + (6,13-6,20) yield i IL_0021: ldloca.s 0 IL_0023: ldloc.s 5 IL_0025: call Add IL_002a: nop - (6,19-6,21) in + (5,19-5,21) in IL_002b: ldloc.1 IL_002c: callvirt MoveNext IL_0031: brtrue.s IL_000a diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl index 0e9884491ae..5ef6a83c0a3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 01.bsl @@ -1,3 +1,12 @@ +module Module + +let a = + [| + for n in 1..10 do + yield n + |] +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +16,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (4,1-8,7) let a = [| for n in 1..10 do yield n |] + (3,1-7,7) let a = [| for n in 1..10 do yield n |] IL_0000: ldc.i4.s 10 IL_0002: conv.i8 IL_0003: conv.ovf.i.un @@ -22,14 +31,14 @@ Module::staticInitialization@ IL_0011: ldloc.2 IL_0012: stloc.3 - (6,9-6,12) for + (5,9-5,12) for IL_0013: ldloc.0 IL_0014: ldloc.1 IL_0015: conv.i IL_0016: stloc.s 4 IL_0018: stloc.s 5 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_001a: ldloc.s 5 IL_001c: ldloc.s 4 IL_001e: ldloc.3 @@ -44,11 +53,11 @@ Module::staticInitialization@ IL_0027: add IL_0028: stloc.1 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.1 IL_002a: ldc.i4.s 10 IL_002c: conv.i8 IL_002d: blt.un.s IL_0011 IL_002f: ldloc.0 - IL_0030: stsfld a@4 + IL_0030: stsfld a@3 IL_0035: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl index 234b112f656..375f75f94bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Comprehensions - Value 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: int list) = + [| + for n in l do + yield n + |] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,7) [| for n in l do yield n |] + (4,5-7,7) [| for n in l do yield n |] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: callvirt GetEnumerator IL_0007: stloc.1 @@ -13,13 +22,13 @@ Module::f IL_0011: ldloca.s 0 IL_0013: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0015: ldloc.s 4 IL_0017: ldloc.3 IL_0018: call Add IL_001d: nop - (6,15-6,17) in + (5,15-5,17) in IL_001e: ldloc.1 IL_001f: callvirt MoveNext IL_0024: brtrue.s IL_000a diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl index 735b64ef291..a162545aa41 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - ActivePattern 01.bsl @@ -1,17 +1,26 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int[]) = + for Id i in l do + () +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,17-7,18) l + (6,17-6,18) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_0019 - (7,5-7,13) for Id i + (6,5-6,13) for Id i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 @@ -22,7 +31,7 @@ Module::f IL_0011: ldloc.3 IL_0012: stloc.s 4 - (8,9-8,11) () + (7,9-7,11) () IL_0014: nop @@ -31,7 +40,7 @@ Module::f IL_0017: add IL_0018: stloc.1 - (7,14-7,16) in + (6,14-6,16) in IL_0019: ldloc.1 IL_001a: ldloc.0 IL_001b: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl index 117072dd130..f8618ea40c5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Pattern - Tuple 01.bsl @@ -1,12 +1,19 @@ +module Module + +let f (l: (int * int)[]) = + for i1, i2 in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,19-5,20) l + (4,19-4,20) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_0022 - (5,5-5,15) for i1, i2 + (4,5-4,15) for i1, i2 IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem 0x1b000001 @@ -18,7 +25,7 @@ Module::f IL_0016: call get_Item1 IL_001b: stloc.s 4 - (6,9-6,11) () + (5,9-5,11) () IL_001d: nop @@ -27,7 +34,7 @@ Module::f IL_0020: add IL_0021: stloc.1 - (5,16-5,18) in + (4,16-4,18) in IL_0022: ldloc.1 IL_0023: ldloc.0 IL_0024: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl index ad1455f0b35..5b6e9dedcc1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Array - Simple 01.bsl @@ -1,18 +1,25 @@ +module Module + +let f (l: int[]) = + for i in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 IL_0003: stloc.1 IL_0004: br.s IL_000f - (5,5-5,10) for i + (4,5-4,10) for i IL_0006: ldloc.0 IL_0007: ldloc.1 IL_0008: ldelem.i4 IL_0009: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_000a: nop @@ -21,7 +28,7 @@ Module::f IL_000d: add IL_000e: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_000f: ldloc.1 IL_0010: ldloc.0 IL_0011: ldlen diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl index cb970fe45cc..fc9ede4e5a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedCall 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,7 +14,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001b - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 @@ -19,7 +26,7 @@ Module::f IL_0015: call get_TailOrNull IL_001a: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001b: ldloc.1 IL_001c: brtrue.s IL_000b IL_001e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl index 13752f34640..cadd3d20fcd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ErasedThenKeptCall 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +15,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0025 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (7,9-7,36) System.Console.WriteLine "" + (6,9-6,36) System.Console.WriteLine "" IL_0012: ldstr "" IL_0017: call WriteLine @@ -23,7 +31,7 @@ Module::f IL_001f: call get_TailOrNull IL_0024: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0025: ldloc.1 IL_0026: brtrue.s IL_000b IL_0028: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl index 44330778128..290e4b0f1ce 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - KeptThenErasedCall 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +15,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0025 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,36) System.Console.WriteLine "" + (5,9-5,36) System.Console.WriteLine "" IL_0012: ldstr "" IL_0017: call WriteLine @@ -23,7 +31,7 @@ Module::f IL_001f: call get_TailOrNull IL_0024: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0025: ldloc.1 IL_0026: brtrue.s IL_000b IL_0028: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl index 5eec9beaeb0..d6607455ef3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - LetUnit 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + let _ = () + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,15 +15,15 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001d - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,17-6,19) () + (5,17-5,19) () IL_0012: nop - (7,9-7,11) () + (6,9-6,11) () IL_0013: nop @@ -25,7 +33,7 @@ Module::f IL_0017: call get_TailOrNull IL_001c: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001d: ldloc.1 IL_001e: brtrue.s IL_000b IL_0020: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl index cabffb41911..2e5f819890c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - MultipleStatements 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,16 +15,16 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0029 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 IL_0013: call WriteLine - (7,9-7,40) System.Console.WriteLine(i + 1) + (6,9-6,40) System.Console.WriteLine(i + 1) IL_0018: ldloc.2 IL_0019: ldc.i4.1 IL_001a: add @@ -29,7 +37,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0029: ldloc.1 IL_002a: brtrue.s IL_000b IL_002c: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl index 401652494b3..f6f184a7701 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - ParenUnit 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + (()) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +14,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001c - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,10-6,12) () + (5,10-5,12) () IL_0012: nop @@ -22,7 +29,7 @@ Module::f IL_0016: call get_TailOrNull IL_001b: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001c: ldloc.1 IL_001d: brtrue.s IL_000b IL_001f: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl index c3c76afe5aa..315504bd6a5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SequentialUnits 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + for i in l do + () + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,15 +15,15 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001d - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_0012: nop - (7,9-7,11) () + (6,9-6,11) () IL_0013: nop @@ -25,7 +33,7 @@ Module::f IL_0017: call get_TailOrNull IL_001c: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001d: ldloc.1 IL_001e: brtrue.s IL_000b IL_0020: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl index 9dc76f432cc..8d01936eae3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Body - SingleStatement 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + System.Console.WriteLine i +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +14,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0021 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 IL_0013: call WriteLine @@ -23,7 +30,7 @@ Module::f IL_001b: call get_TailOrNull IL_0020: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_0021: ldloc.1 IL_0022: brtrue.s IL_000b IL_0024: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl index 08615e86be6..1193bb29a7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - ActivePattern 01.bsl @@ -1,13 +1,24 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + [ + for Id i in l do + yield i + ] +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,5-10,6) [ for Id i in l do yield i ] + (6,5-9,6) [ for Id i in l do yield i ] IL_0000: nop - (8,9-8,12) for + (7,9-7,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -25,7 +36,7 @@ Module::f IL_001f: stloc.s 5 IL_0021: stloc.s 6 - (9,13-9,20) yield i + (8,13-8,20) yield i IL_0023: ldloc.s 6 IL_0025: ldloc.s 5 IL_0027: call Add @@ -36,7 +47,7 @@ Module::f IL_0030: call get_TailOrNull IL_0035: stloc.2 - (8,18-8,20) in + (7,18-7,20) in IL_0036: ldloc.2 IL_0037: brtrue.s IL_000c IL_0039: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl index 108c8700c6f..b63ad05c8dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Arrow 01.bsl @@ -1,8 +1,16 @@ +module Module + +let f (l: int list) = + [ + for n in l -> n + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-7,6) [ for n in l -> n ] + (4,5-6,6) [ for n in l -> n ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -15,7 +23,7 @@ Module::f IL_0013: ldloca.s 0 IL_0015: stloc.s 4 - (6,23-6,24) n + (5,23-5,24) n IL_0017: ldloc.s 4 IL_0019: ldloc.3 IL_001a: call Add @@ -26,7 +34,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.2 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.2 IL_002a: brtrue.s IL_000c IL_002c: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl index 3a82bf3d6bf..e89ee794a8c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 01.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [ + for n in l do + yield n + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) [ for n in l do yield n ] + (4,5-7,6) [ for n in l do yield n ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -15,7 +24,7 @@ Module::f IL_0013: ldloca.s 0 IL_0015: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0017: ldloc.s 4 IL_0019: ldloc.3 IL_001a: call Add @@ -26,7 +35,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.2 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.2 IL_002a: brtrue.s IL_000c IL_002c: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl index d308682b1cc..52d43e9b92e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Tuple 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: (int * int) list) = + [ + for i, i1 in l do + yield i + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) [ for i, i1 in l do yield i ] + (4,5-7,6) [ for i, i1 in l do yield i ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -21,7 +30,7 @@ Module::f IL_0023: stloc.s 5 IL_0025: stloc.s 6 - (7,13-7,20) yield i + (6,13-6,20) yield i IL_0027: ldloc.s 6 IL_0029: ldloc.s 5 IL_002b: call Add @@ -32,7 +41,7 @@ Module::f IL_0034: call get_TailOrNull IL_0039: stloc.2 - (6,19-6,21) in + (5,19-5,21) in IL_003a: ldloc.2 IL_003b: brtrue.s IL_000c IL_003d: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl index 5e0accf23b8..3af247f1849 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 01.bsl @@ -1,3 +1,12 @@ +module Module + +let a = + [ + for n in 1..10 do + yield n + ] +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,7 +16,7 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (4,1-8,6) let a = [ for n in 1..10 do yield n ] + (3,1-7,6) let a = [ for n in 1..10 do yield n ] IL_0000: ldc.i4.0 IL_0001: conv.i8 IL_0002: stloc.1 @@ -17,11 +26,11 @@ Module::staticInitialization@ IL_0007: ldloc.2 IL_0008: stloc.3 - (6,9-6,12) for + (5,9-5,12) for IL_0009: ldloca.s 0 IL_000b: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_000d: ldloc.s 4 IL_000f: ldloc.3 IL_0010: call Add @@ -36,12 +45,12 @@ Module::staticInitialization@ IL_001d: add IL_001e: stloc.1 - (6,15-6,17) in + (5,15-5,17) in IL_001f: ldloc.1 IL_0020: ldc.i4.s 10 IL_0022: conv.i8 IL_0023: blt.un.s IL_0007 IL_0025: ldloca.s 0 IL_0027: call Close - IL_002c: stsfld a@4 + IL_002c: stsfld a@3 IL_0031: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl index 3a82bf3d6bf..c4071f0681a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Comprehensions - Value 02.bsl @@ -1,8 +1,17 @@ +module Module + +let f (l: int list) = + [ + for n in l do + yield n + ] +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) [ for n in l do yield n ] + (4,5-7,6) [ for n in l do yield n ] IL_0000: nop - (6,9-6,12) for + (5,9-5,12) for IL_0001: ldarg.0 IL_0002: stloc.1 IL_0003: ldloc.1 @@ -15,7 +24,7 @@ Module::f IL_0013: ldloca.s 0 IL_0015: stloc.s 4 - (7,13-7,20) yield n + (6,13-6,20) yield n IL_0017: ldloc.s 4 IL_0019: ldloc.3 IL_001a: call Add @@ -26,7 +35,7 @@ Module::f IL_0023: call get_TailOrNull IL_0028: stloc.2 - (6,15-6,17) in + (5,15-5,17) in IL_0029: ldloc.2 IL_002a: brtrue.s IL_000c IL_002c: ldloca.s 0 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl index 04c4ef9351d..5bac23a29c8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - ActivePattern 01.bsl @@ -1,10 +1,19 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + for Id i in l do + () +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,17-7,18) l + (6,17-6,18) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -12,7 +21,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0026 - (7,5-7,13) for Id i + (6,5-6,13) for Id i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 @@ -22,7 +31,7 @@ Module::f IL_0019: ldloc.3 IL_001a: stloc.s 4 - (8,9-8,11) () + (7,9-7,11) () IL_001c: nop @@ -32,7 +41,7 @@ Module::f IL_0020: call get_TailOrNull IL_0025: stloc.1 - (7,14-7,16) in + (6,14-6,16) in IL_0026: ldloc.1 IL_0027: brtrue.s IL_000b IL_0029: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl index afdc8ca112c..b00aa0c54a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Pattern - Tuple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: (int * int) list) = + for i1, i2 in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,19-5,20) l + (4,19-4,20) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,7 +14,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_002b - (5,5-5,15) for i1, i2 + (4,5-4,15) for i1, i2 IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 @@ -18,7 +25,7 @@ Module::f IL_001a: call get_Item1 IL_001f: stloc.s 4 - (6,9-6,11) () + (5,9-5,11) () IL_0021: nop @@ -28,7 +35,7 @@ Module::f IL_0025: call get_TailOrNull IL_002a: stloc.1 - (5,16-5,18) in + (4,16-4,18) in IL_002b: ldloc.1 IL_002c: brtrue.s IL_000b IL_002e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl index e0cc6be0c47..c1a29adad2c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/List - Simple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int list) = + for i in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,12 +14,12 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001c - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.0 IL_000c: call get_HeadOrDefault IL_0011: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_0012: nop @@ -22,7 +29,7 @@ Module::f IL_0016: call get_TailOrNull IL_001b: stloc.1 - (5,11-5,13) in + (4,11-4,13) in IL_001c: ldloc.1 IL_001d: brtrue.s IL_000b IL_001f: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl index 0e16ad2c8e2..8d943b2d939 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - MultipleStatements 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int seq) = + for i in l do + System.Console.WriteLine i + System.Console.WriteLine(i + 1) +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,22 +15,22 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0020 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 IL_0013: call WriteLine - (7,9-7,40) System.Console.WriteLine(i + 1) + (6,9-6,40) System.Console.WriteLine(i + 1) IL_0018: ldloc.2 IL_0019: ldc.i4.1 IL_001a: add IL_001b: call WriteLine - (5,11-5,13) in + (4,11-4,13) in IL_0020: ldloc.1 IL_0021: callvirt MoveNext IL_0026: brtrue.s IL_000b diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl index b6d13c7e7ab..837865a7b38 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Body - SingleStatement 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int seq) = + for i in l do + System.Console.WriteLine i +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,16 +14,16 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0018 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 - (6,9-6,35) System.Console.WriteLine i + (5,9-5,35) System.Console.WriteLine i IL_0012: ldloc.2 IL_0013: call WriteLine - (5,11-5,13) in + (4,11-4,13) in IL_0018: ldloc.1 IL_0019: callvirt MoveNext IL_001e: brtrue.s IL_000b diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl index a1d4ee342ca..996684699a2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - ActivePattern 01.bsl @@ -1,10 +1,21 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int list) = + seq { + for Id i in l do + yield i + } +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,5-10,6) seq { for Id i in l do yield i } + (6,5-9,6) seq { for Id i in l do yield i } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 @@ -12,7 +23,7 @@ Module::f IL_0004: newobj .ctor IL_0009: ret -f@8::GenerateNext +f@7::GenerateNext IL_0000: ldarg.0 IL_0001: ldfld pc @@ -37,7 +48,7 @@ f@8::GenerateNext IL_0024: nop IL_0025: br.s IL_0027 - (8,9-8,12) for + (7,9-7,12) for IL_0027: ldarg.0 IL_0028: ldarg.0 IL_0029: ldfld l @@ -57,7 +68,7 @@ f@8::GenerateNext IL_0054: ldloc.1 IL_0055: stloc.2 - (9,13-9,20) yield i + (8,13-8,20) yield i IL_0056: ldarg.0 IL_0057: ldc.i4.2 IL_0058: stfld pc @@ -67,7 +78,7 @@ f@8::GenerateNext IL_0064: ldc.i4.1 IL_0065: ret - (8,18-8,20) in + (7,18-7,20) in IL_0066: ldarg.0 IL_0067: ldfld enum IL_006c: callvirt MoveNext @@ -91,7 +102,7 @@ f@8::GenerateNext IL_009b: ldc.i4.0 IL_009c: ret -f@8::Close +f@7::Close IL_0000: ldarg.0 IL_0001: ldfld pc @@ -175,7 +186,7 @@ f@8::Close -f@8::get_CheckClose +f@7::get_CheckClose IL_0000: ldarg.0 IL_0001: ldfld pc diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl index c22c1947a13..2b7fa0caa44 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Arrow 01.bsl @@ -1,5 +1,13 @@ +module Module + +let f (l: int list) = + seq { + for n in l -> n + } +-------------------------------------------------------------------------------- + Module::f - (5,5-7,6) seq { for n in l -> n } + (4,5-6,6) seq { for n in l -> n } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 @@ -7,7 +15,7 @@ Module::f IL_0004: newobj .ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 IL_0001: ldfld pc @@ -32,7 +40,7 @@ f@6::GenerateNext IL_0024: nop IL_0025: br.s IL_0027 - (6,9-6,12) for + (5,9-5,12) for IL_0027: ldarg.0 IL_0028: ldarg.0 IL_0029: ldfld l @@ -52,14 +60,14 @@ f@6::GenerateNext IL_0054: ldarg.0 IL_0055: stloc.1 - (6,23-6,24) n + (5,23-5,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 + (5,15-5,17) in IL_005f: ldarg.0 IL_0060: ldfld enum IL_0065: callvirt MoveNext @@ -83,7 +91,7 @@ f@6::GenerateNext IL_0094: ldc.i4.0 IL_0095: ret -f@6::Close +f@5::Close IL_0000: ldarg.0 IL_0001: ldfld pc @@ -167,7 +175,7 @@ f@6::Close -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 IL_0001: ldfld pc diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl index c87c15661e4..41d3ecc5e70 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 01.bsl @@ -1,5 +1,14 @@ +module Module + +let f (l: (int * int) list) = + seq { + for n in l do + yield n + } +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) seq { for n in l do yield n } + (4,5-7,6) seq { for n in l do yield n } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 @@ -7,7 +16,7 @@ Module::f IL_0004: newobj .ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 IL_0001: ldfld pc @@ -32,7 +41,7 @@ f@6::GenerateNext IL_0024: nop IL_0025: br.s IL_0027 - (6,9-6,12) for + (5,9-5,12) for IL_0027: ldarg.0 IL_0028: ldarg.0 IL_0029: ldfld l @@ -52,14 +61,14 @@ f@6::GenerateNext IL_0054: ldarg.0 IL_0055: stloc.1 - (7,13-7,20) yield n + (6,13-6,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 + (5,15-5,17) in IL_005f: ldarg.0 IL_0060: ldfld enum IL_0065: callvirt MoveNext @@ -83,7 +92,7 @@ f@6::GenerateNext IL_0094: ldc.i4.0 IL_0095: ret -f@6::Close +f@5::Close IL_0000: ldarg.0 IL_0001: ldfld pc @@ -167,7 +176,7 @@ f@6::Close -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 IL_0001: ldfld pc diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl index 563e2b0a3f0..05ef2cc3925 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Tuple 02.bsl @@ -1,5 +1,14 @@ +module Module + +let f (l: (int * int) list) = + seq { + for i, i1 in l do + yield i + } +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) seq { for i, i1 in l do yield i } + (4,5-7,6) seq { for i, i1 in l do yield i } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 @@ -7,7 +16,7 @@ Module::f IL_0004: newobj .ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 IL_0001: ldfld pc @@ -32,7 +41,7 @@ f@6::GenerateNext IL_0024: nop IL_0025: br.s IL_0027 - (6,9-6,12) for + (5,9-5,12) for IL_0027: ldarg.0 IL_0028: ldarg.0 IL_0029: ldfld l @@ -53,7 +62,7 @@ f@6::GenerateNext IL_0055: call get_Item1 IL_005a: stloc.2 - (7,13-7,20) yield i + (6,13-6,20) yield i IL_005b: ldarg.0 IL_005c: ldc.i4.2 IL_005d: stfld pc @@ -63,7 +72,7 @@ f@6::GenerateNext IL_0069: ldc.i4.1 IL_006a: ret - (6,19-6,21) in + (5,19-5,21) in IL_006b: ldarg.0 IL_006c: ldfld enum IL_0071: callvirt MoveNext @@ -87,7 +96,7 @@ f@6::GenerateNext IL_00a0: ldc.i4.0 IL_00a1: ret -f@6::Close +f@5::Close IL_0000: ldarg.0 IL_0001: ldfld pc @@ -171,7 +180,7 @@ f@6::Close -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 IL_0001: ldfld pc diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl index 6e703a4a985..10eb84e2fb6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 01.bsl @@ -1,3 +1,12 @@ +module Module + +let a = + seq { + for n in 1..10 do + yield n + } +-------------------------------------------------------------------------------- + Module::.cctor IL_0000: ldc.i4.0 @@ -7,15 +16,15 @@ Module::.cctor IL_000c: ret Module::staticInitialization@ - (5,5-8,6) seq { for n in 1..10 do yield n } + (4,5-7,6) seq { for n in 1..10 do yield n } IL_0000: ldnull IL_0001: ldc.i4.0 IL_0002: ldc.i4.0 IL_0003: newobj .ctor - IL_0008: stsfld a@4 + IL_0008: stsfld a@3 IL_000d: ret -a@6::GenerateNext +a@5::GenerateNext IL_0000: ldarg.0 IL_0001: ldfld pc @@ -40,7 +49,7 @@ a@6::GenerateNext IL_0024: nop IL_0025: br.s IL_0027 - (6,9-6,12) for + (5,9-5,12) for IL_0027: ldarg.0 IL_0028: ldc.i4.1 IL_0029: ldc.i4.1 @@ -62,14 +71,14 @@ a@6::GenerateNext IL_0057: ldarg.0 IL_0058: stloc.1 - (7,13-7,20) yield n + (6,13-6,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 + (5,15-5,17) in IL_0062: ldarg.0 IL_0063: ldfld enum IL_0068: callvirt MoveNext @@ -93,7 +102,7 @@ a@6::GenerateNext IL_0097: ldc.i4.0 IL_0098: ret -a@6::Close +a@5::Close IL_0000: ldarg.0 IL_0001: ldfld pc @@ -177,7 +186,7 @@ a@6::Close -a@6::get_CheckClose +a@5::get_CheckClose IL_0000: ldarg.0 IL_0001: ldfld pc diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl index 93ea36c1411..264b30b5d4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Comprehensions - Value 02.bsl @@ -1,5 +1,14 @@ +module Module + +let f (l: int list) = + seq { + for n in l do + yield n + } +-------------------------------------------------------------------------------- + Module::f - (5,5-8,6) seq { for n in l do yield n } + (4,5-7,6) seq { for n in l do yield n } IL_0000: ldarg.0 IL_0001: ldnull IL_0002: ldc.i4.0 @@ -7,7 +16,7 @@ Module::f IL_0004: newobj .ctor IL_0009: ret -f@6::GenerateNext +f@5::GenerateNext IL_0000: ldarg.0 IL_0001: ldfld pc @@ -32,7 +41,7 @@ f@6::GenerateNext IL_0024: nop IL_0025: br.s IL_0027 - (6,9-6,12) for + (5,9-5,12) for IL_0027: ldarg.0 IL_0028: ldarg.0 IL_0029: ldfld l @@ -52,14 +61,14 @@ f@6::GenerateNext IL_0054: ldarg.0 IL_0055: stloc.1 - (7,13-7,20) yield n + (6,13-6,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 + (5,15-5,17) in IL_005f: ldarg.0 IL_0060: ldfld enum IL_0065: callvirt MoveNext @@ -83,7 +92,7 @@ f@6::GenerateNext IL_0094: ldc.i4.0 IL_0095: ret -f@6::Close +f@5::Close IL_0000: ldarg.0 IL_0001: ldfld pc @@ -167,7 +176,7 @@ f@6::Close -f@6::get_CheckClose +f@5::get_CheckClose IL_0000: ldarg.0 IL_0001: ldfld pc diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl index b367716fac3..ae75a38ec8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - ActivePattern 01.bsl @@ -1,10 +1,19 @@ +module Module + +let (|Id|) (x: int) = x + +let f (l: int seq) = + for Id i in l do + () +-------------------------------------------------------------------------------- + Module::|Id| - (4,23-4,24) x + (3,23-3,24) x IL_0000: ldarg.0 IL_0001: ret Module::f - (7,17-7,18) l + (6,17-6,18) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -12,7 +21,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_001d - (7,5-7,13) for Id i + (6,5-6,13) for Id i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 @@ -22,10 +31,10 @@ Module::f IL_0019: ldloc.3 IL_001a: stloc.s 4 - (8,9-8,11) () + (7,9-7,11) () IL_001c: nop - (7,14-7,16) in + (6,14-6,16) in IL_001d: ldloc.1 IL_001e: callvirt MoveNext IL_0023: brtrue.s IL_000b diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl index 1d789aafae2..de0f3f3ff5e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Pattern - Tuple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: (int * int) seq) = + for i1, i2 in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,19-5,20) l + (4,19-4,20) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,7 +14,7 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0022 - (5,5-5,15) for i1, i2 + (4,5-4,15) for i1, i2 IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 @@ -18,10 +25,10 @@ Module::f IL_001a: call get_Item1 IL_001f: stloc.s 4 - (6,9-6,11) () + (5,9-5,11) () IL_0021: nop - (5,16-5,18) in + (4,16-4,18) in IL_0022: ldloc.1 IL_0023: callvirt MoveNext IL_0028: brtrue.s IL_000b diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl index cf20ed793cc..2b8bfc3ba49 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/Seq - Simple 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: int seq) = + for i in l do + () +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldloc.0 @@ -7,15 +14,15 @@ Module::f IL_0008: stloc.1 IL_0009: br.s IL_0013 - (5,5-5,10) for i + (4,5-4,10) for i IL_000b: ldloc.1 IL_000c: callvirt get_Current IL_0011: stloc.2 - (6,9-6,11) () + (5,9-5,11) () IL_0012: nop - (5,11-5,13) in + (4,11-4,13) in IL_0013: ldloc.1 IL_0014: callvirt MoveNext IL_0019: brtrue.s IL_000b diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl index 571e8a5476a..9dd087ba1b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/ForEach/String - Body - SingleStatement 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f (l: string) = + for c in l do + System.Console.WriteLine c +-------------------------------------------------------------------------------- + Module::f - (5,14-5,15) l + (4,14-4,15) l IL_0000: ldarg.0 IL_0001: stloc.0 IL_0002: ldc.i4.0 @@ -13,13 +20,13 @@ Module::f IL_000e: ldloc.2 IL_000f: blt.s IL_0029 - (5,5-5,10) for c + (4,5-4,10) for c IL_0011: ldloc.0 IL_0012: ldloc.2 IL_0013: callvirt get_Chars IL_0018: stloc.3 - (6,9-6,35) System.Console.WriteLine c + (5,9-5,35) System.Console.WriteLine c IL_0019: ldloc.3 IL_001a: call WriteLine @@ -29,7 +36,7 @@ Module::f IL_0021: add IL_0022: stloc.2 - (5,11-5,13) in + (4,11-4,13) in IL_0023: ldloc.2 IL_0024: ldloc.1 IL_0025: ldc.i4.1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl index 8b137891791..6b8bd6c7183 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 02.bsl @@ -1 +1,8 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl index 8b137891791..29f72e56448 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 03.bsl @@ -1 +1,9 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl index f3a13298d7a..bdfbdb06041 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 04.bsl @@ -1,3 +1,11 @@ +module Module + +let f () = + () + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::f - (5,5-5,7) () + (4,5-4,7) () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl index 5b43fa23219..3b406721679 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 05.bsl @@ -1,3 +1,11 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + () + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::f - (6,5-6,7) () + (5,5-5,7) () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl index 57c43f3fa5a..43b4c570085 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Erased call 06.bsl @@ -1,3 +1,11 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Diagnostics.Debug.Write "" + () +-------------------------------------------------------------------------------- + Module::f - (7,5-7,7) () + (6,5-6,7) () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl index 8b137891791..47b52e134d2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedCall 01.bsl @@ -1 +1,7 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl index 49a5c633237..a35373ff798 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - ErasedThenKeptCall 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f () = + System.Diagnostics.Debug.Write "" + System.Console.WriteLine "" +-------------------------------------------------------------------------------- + Module::f - (6,5-6,32) System.Console.WriteLine "" + (5,5-5,32) System.Console.WriteLine "" IL_0000: ldstr "" IL_0005: call WriteLine IL_000a: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl index 5210433b28d..9eaa2d22ee8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - KeptThenErasedCall 01.bsl @@ -1,5 +1,12 @@ +module Module + +let f () = + System.Console.WriteLine "" + System.Diagnostics.Debug.Write "" +-------------------------------------------------------------------------------- + Module::f - (5,5-5,32) System.Console.WriteLine "" + (4,5-4,32) System.Console.WriteLine "" IL_0000: ldstr "" IL_0005: call WriteLine IL_000a: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl index 7d3acc1e66a..e433d98d6dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - LetThenValue 01.bsl @@ -1,8 +1,15 @@ +module Module + +let f () = + let i = 1 + 1 +-------------------------------------------------------------------------------- + Module::f - (5,5-5,14) let i = 1 + (4,5-4,14) let i = 1 IL_0000: ldc.i4.1 IL_0001: stloc.0 - (6,5-6,6) 1 + (5,5-5,6) 1 IL_0002: ldc.i4.1 IL_0003: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl index 61f9775be11..2e679cf0419 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - SequentialUnits 01.bsl @@ -1,6 +1,13 @@ +module Module + +let f () = + () + () +-------------------------------------------------------------------------------- + Module::f - (5,5-5,7) () + (4,5-4,7) () IL_0000: nop - (6,5-6,7) () + (5,5-5,7) () IL_0001: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl index f3a13298d7a..aeebdef981e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/Function/Body - Unit 01.bsl @@ -1,3 +1,9 @@ +module Module + +let f () = + () +-------------------------------------------------------------------------------- + Module::f - (5,5-5,7) () + (4,5-4,7) () IL_0000: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs index 0fd43b8165e..f26924ba5eb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SequencePoints/SequencePointsTests.fs @@ -9,7 +9,8 @@ open FSharp.Test.Compiler [] type private Baseline = - static member verify(source, [] name: string) = + static member verify(source: string, [] name: string) = + let source = source.Trim() let moduleName = StackTrace().GetFrame(1).GetMethod().DeclaringType.Name FSharp source |> asLibrary diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 86f760a3bee..d6823a921d0 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1802,7 +1802,8 @@ $ code --diff {outFile} {expectedFile} yield offset, op.Name + text ] let private formatSequencePoints (source: string) (assemblyPath: string) (pdbReader: MetadataReader) = - let lines = source.Replace("\r\n", "\n").Replace("\r", "\n").Split('\n') + let normalizedSource = source.Replace("\r\n", "\n").Replace("\r", "\n") + let lines = normalizedSource.Split('\n') let textOf (sp: SequencePoint) = let sb = StringBuilder() @@ -1840,7 +1841,8 @@ $ code --diff {outFile} {expectedFile} if offset >= sp.Offset && offset < nextOffset then sb.AppendLine(sprintf " IL_%04x: %s" offset text) |> ignore sb.AppendLine() |> ignore) - sb.ToString().Trim() + "\n" + + normalizedSource.Trim() + "\n" + String.replicate 80 "-" + "\n\n" + sb.ToString().Trim() + "\n" let verifySequencePointsBaseline (source: string) (baselineFilePath: string) (result: CompilationResult) : CompilationResult = match result with From e1a3f86ce87d77c9ebf4099bdd4b776384d6249b Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 5 Jun 2026 12:36:57 +0200 Subject: [PATCH 06/50] Fantomas --- .../Checking/Expressions/CheckComputationExpressions.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 35b5f7df008..b05df442d36 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -2704,7 +2704,9 @@ and TranslateComputationExpressionBind and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp varSpace innerComp = match innerComp with | SynExpr.YieldOrReturn((false, _), returnExpr, m, _) -> - let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), false, returnExpr) + let returnExpr = + SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes(false, m), false, returnExpr) + Some(returnExpr, None) | SynExpr.Match(spMatch, expr, clauses, m, trivia) -> From 23d894679dd1bbaecfdff729ff35c9d9476fbfa4 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 5 Jun 2026 15:16:36 +0200 Subject: [PATCH 07/50] Fix hasVisibleDebugPoint, update baselines Co-Authored-By: Claude Opus 4.8 --- src/Compiler/CodeGen/IlxGen.fs | 9 ++- ....fs.RealInternalSignatureOn.il.netcore.bsl | 31 +++++++- ...ember04a.fs.RealInternalSignatureOn.il.bsl | 31 +++++++- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 60 +++++++++++---- ....fs.RealInternalSignatureOn.il.netcore.bsl | 44 ++++++++++- ....fs.RealInternalSignatureOn.il.netcore.bsl | 44 ++++++++++- .../Tuples/Tuple01.fs.OptimizeOff.il.bsl | 77 +++++++++++++++++++ ...fs.il.bsl => Tuple01.fs.OptimizeOn.il.bsl} | 1 - 8 files changed, 275 insertions(+), 22 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl rename tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/{Tuple01.fs.il.bsl => Tuple01.fs.OptimizeOn.il.bsl} (99%) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 1a57e09a6ca..c50b16c2628 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -10645,10 +10645,11 @@ and CodeGenInitMethod cenv (cgbuf: CodeGenBuffer) eenv tref (codeGenInitFunc: Co // Keep the init method if it carries a visible debug point, so steppable bindings like 'let i = ()' survive. let hasVisibleDebugPoint = - body.Code.Instrs - |> Array.exists (function - | I_seqpoint sp -> sp.Line <> FeeFee cenv - | _ -> false) + not cenv.options.localOptimizationsEnabled + && body.Code.Instrs + |> Array.exists (function + | I_seqpoint sp -> sp.Line <> FeeFee cenv + | _ -> false) if codeDoesSomething || hasVisibleDebugPoint then // We are here because the module we just grabbed has an interesting static initializer diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl index 5178c62e41d..ee6ecc8e060 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.netcore.bsl @@ -517,6 +517,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property class assembly/C e2() { .get class assembly/C assembly::get_e2() @@ -526,8 +544,19 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { -} + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } +} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl index 87d3e2bfa45..98f8426f18b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember04a.fs.RealInternalSignatureOn.il.bsl @@ -91,6 +91,24 @@ IL_0001: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property int32 x() { .get int32 assembly::get_x() @@ -100,8 +118,19 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { -} + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } +} diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 42385696441..edc3c3437db 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/EntryPoint01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -49,21 +49,43 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.EntryPointAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 - IL_0000: nop - IL_0001: nop - IL_0002: call int32 assembly::get_static_initializer() - IL_0007: ldc.i4.s 10 - IL_0009: bne.un.s IL_000f - - IL_000b: ldc.i4.0 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop IL_000c: nop - IL_000d: br.s IL_0011 + IL_000d: nop + IL_000e: call int32 assembly::get_static_initializer() + IL_0013: ldc.i4.s 10 + IL_0015: bne.un.s IL_001b + + IL_0017: ldc.i4.0 + IL_0018: nop + IL_0019: br.s IL_001d + + IL_001b: ldc.i4.1 + IL_001c: nop + IL_001d: tail. + IL_001f: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_0024: ret + } - IL_000f: ldc.i4.1 - IL_0010: nop - IL_0011: tail. - IL_0013: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_0018: ret + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret } .property int32 static_initializer() @@ -75,6 +97,18 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl index 4f12c1595c8..d464c830e32 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.netcore.bsl @@ -1455,6 +1455,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string ABC/ABC::get_greeting() @@ -1483,6 +1501,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string ABC::get_greeting() @@ -1492,12 +1529,17 @@ .class private abstract auto ansi sealed ''.$ABC extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl index ef41cabbfcb..68b3d9701f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.netcore.bsl @@ -2153,6 +2153,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string XYZ.ABC/ABC::get_greeting() @@ -2181,6 +2199,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void XYZ.ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string XYZ.ABC::get_greeting() @@ -2190,12 +2227,17 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void XYZ.ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl new file mode 100644 index 00000000000..59b47aeff0b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOff.il.bsl @@ -0,0 +1,77 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOn.il.bsl similarity index 99% rename from tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl rename to tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOn.il.bsl index d13107b7a6f..a55b6493f84 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/Tuple01.fs.OptimizeOn.il.bsl @@ -52,4 +52,3 @@ - From aa147a545f3216a569a427baae9038cfec89ff27 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 5 Jun 2026 16:30:35 +0200 Subject: [PATCH 08/50] Update baselines Co-Authored-By: Claude Opus 4.8 --- ...a.fs.RealInternalSignatureOn.il.net472.bsl | 30 +++++++++++++ ...e.fs.RealInternalSignatureOn.il.net472.bsl | 44 ++++++++++++++++++- ...e.fs.RealInternalSignatureOn.il.net472.bsl | 44 ++++++++++++++++++- 3 files changed, 116 insertions(+), 2 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl index 0d32a2de1dd..7ab998bc870 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/CCtorDUWithMember/CCtorDUWithMember01a.fs.RealInternalSignatureOn.il.net472.bsl @@ -517,6 +517,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property class assembly/C e2() { .get class assembly/C assembly::get_e2() @@ -526,6 +544,18 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + } .class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl index 0d7172dfc0a..31aa835e6dd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelModule.fs.RealInternalSignatureOn.il.net472.bsl @@ -1455,6 +1455,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string ABC/ABC::get_greeting() @@ -1483,6 +1501,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$ABC::init@ + IL_0006: ldsfld int32 ''.$ABC::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string ABC::get_greeting() @@ -1492,12 +1529,17 @@ .class private abstract auto ansi sealed ''.$ABC extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void ABC::staticInitialization@() + IL_0005: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl index 407197b1184..b9733cee415 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SerializableAttribute/ToplevelNamespace.fs.RealInternalSignatureOn.il.net472.bsl @@ -2153,6 +2153,24 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ret + } + .property string greeting() { .get string XYZ.ABC/ABC::get_greeting() @@ -2181,6 +2199,25 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: call void XYZ.ABC/ABC::staticInitialization@() + IL_0005: ret + } + .property string greeting() { .get string XYZ.ABC::get_greeting() @@ -2190,12 +2227,17 @@ .class private abstract auto ansi sealed ''.$assembly extends [runtime]System.Object { + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .method public static void main@() cil managed { .entrypoint .maxstack 8 - IL_0000: ret + IL_0000: call void XYZ.ABC::staticInitialization@() + IL_0005: ret } } From fd9f1698ea823d6b17a15ad5f364da1e638bd262 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 3 Apr 2026 20:55:44 +0200 Subject: [PATCH 09/50] Optimizer: don't inline named functions in debug builds --- src/Compiler/CodeGen/IlxGen.fs | 4 + src/Compiler/Driver/CompilerConfig.fs | 4 + src/Compiler/Driver/CompilerConfig.fsi | 4 + src/Compiler/Driver/CompilerOptions.fs | 8 + src/Compiler/Driver/OptimizeInputs.fs | 4 + src/Compiler/FSComp.txt | 1 + src/Compiler/Optimize/Optimizer.fs | 68 ++- src/Compiler/Optimize/Optimizer.fsi | 2 + src/Compiler/Symbols/Symbols.fs | 2 +- src/Compiler/TypedTree/TypedTree.fs | 13 +- src/Compiler/TypedTree/TypedTree.fsi | 3 + .../EmittedIL/DebugInlineAsCall.fs | 414 ++++++++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + 13 files changed, 516 insertions(+), 12 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c50b16c2628..26adf6c974a 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -312,6 +312,7 @@ type cenv = /// Guard the stack and move to a new one if necessary mutable stackGuard: StackGuard + emittedSpecializedInlineVals: HashSet } member cenv.options = @@ -8756,6 +8757,8 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = GenExpr cenv cgbuf eenv cctorBody discard | Method(valReprInfo, _, mspec, mspecW, _, ctps, mtps, curriedArgInfos, paramInfos, witnessInfos, argTys, retInfo) when not isStateVar -> + if vspec.InlineInfo = ValInline.InlinedDefinition && not (cenv.emittedSpecializedInlineVals.Add(vspec.Stamp)) then + CommitStartScope cgbuf startMarkOpt else let methLambdaTypars, methLambdaCtorThisValOpt, methLambdaBaseValOpt, methLambdaCurriedVars, methLambdaBody, methLambdaBodyTy = IteratedAdjustLambdaToMatchValReprInfo g cenv.amap valReprInfo rhsExpr @@ -12859,6 +12862,7 @@ type IlxAssemblyGenerator(amap: ImportMap, g: TcGlobals, tcVal: ConstraintSolver optimizeDuringCodeGen = (fun _flag expr -> expr) stackGuard = getEmptyStackGuard () delayedGenMethods = Queue() + emittedSpecializedInlineVals = HashSet() } /// Register a set of referenced assemblies with the ILX code generator diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index 0fbe48fb2eb..6075a7a32a7 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -600,6 +600,8 @@ type TcConfigBuilder = mutable strictIndentation: bool option + mutable inlineNamedFunctions: bool option + mutable exename: string option // If true - the compiler will copy FSharp.Core.dll along the produced binaries @@ -853,6 +855,7 @@ type TcConfigBuilder = dumpSignatureData = false realsig = false strictIndentation = None + inlineNamedFunctions = None compilationMode = TcGlobals.CompilationMode.Unset } @@ -1253,6 +1256,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member _.fsiMultiAssemblyEmit = data.fsiMultiAssemblyEmit member _.FxResolver = data.FxResolver member _.strictIndentation = data.strictIndentation + member _.inlineNamedFunctions = data.inlineNamedFunctions member _.primaryAssembly = data.primaryAssembly member _.noFeedback = data.noFeedback member _.stackReserveSize = data.stackReserveSize diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index 17e035109ab..85ce24133a6 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -472,6 +472,8 @@ type TcConfigBuilder = mutable strictIndentation: bool option + mutable inlineNamedFunctions: bool option + mutable exename: string option mutable copyFSharpCore: CopyFSharpCoreFlag @@ -814,6 +816,8 @@ type TcConfig = member strictIndentation: bool option + member inlineNamedFunctions: bool option + member GetTargetFrameworkDirectories: unit -> string list /// Get the loaded sources that exist and issue a warning for the ones that don't diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 98cec17265c..0ba0afb60ca 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -1207,6 +1207,14 @@ let languageFlags tcConfigB = None, Some(FSComp.SR.optsStrictIndentation (formatOptionSwitch (Option.defaultValue false tcConfigB.strictIndentation))) ) + + CompilerOption( + "inline-named-functions", + tagNone, + OptionSwitch(fun switch -> tcConfigB.inlineNamedFunctions <- Some(switch = OptionSwitch.On)), + None, + Some(FSComp.SR.optsInlineNamedFunctions ()) + ) ] // OptionBlock: Advanced user options diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index 78bca4bf979..cace428af4d 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -327,6 +327,9 @@ let ApplyAllOptimizations // Only do abstractBigTargets in the first phase, and only when TLR is on. abstractBigTargets = tcConfig.doTLR reportingPhase = true + inlineNamedFunctions = + tcConfig.inlineNamedFunctions + |> Option.defaultValue (not tcConfig.debuginfo || tcConfig.optSettings.LocalOptimizationsEnabled) } // Only do these two steps in the first phase. @@ -334,6 +337,7 @@ let ApplyAllOptimizations { firstLoopSettings with abstractBigTargets = false reportingPhase = false + inlineNamedFunctions = false } let addPhaseDiagnostics (f: PhaseFunc) (info: Phase) = diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index f9765bdbd6e..c5d4948db0a 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1561,6 +1561,7 @@ optsSetLangVersion,"Specify language version such as 'latest' or 'preview'." optsDisableLanguageFeature,"Disable a specific language feature by name." optsSupportedLangVersions,"Supported language versions:" optsStrictIndentation,"Override indentation rules implied by the language version (%s by default)" +optsInlineNamedFunctions,"Inline named 'inline' functions" nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format." nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malformed." formatDashItem," - %s" diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index eee8052bd04..bdda687d143 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -23,6 +23,7 @@ open FSharp.Compiler.Text.LayoutRender open FSharp.Compiler.Text.TaggedText open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeBasics +open FSharp.Compiler.Xml open FSharp.Compiler.TypedTreeOps open FSharp.Compiler.TypedTreeOps.DebugPrint open FSharp.Compiler.TypedTreePickle @@ -327,6 +328,8 @@ type OptimizationSettings = reportTotalSizes : bool processingMode : OptimizationProcessingMode + + inlineNamedFunctions: bool } static member Defaults = @@ -344,6 +347,7 @@ type OptimizationSettings = reportHasEffect = false reportTotalSizes = false processingMode = OptimizationProcessingMode.Parallel + inlineNamedFunctions = false } /// Determines if JIT optimizations are enabled @@ -429,6 +433,8 @@ type cenv = stackGuard: StackGuard realsig: bool + + specializedInlineVals: HashMultiMap } override x.ToString() = "" @@ -1689,6 +1695,7 @@ let TryEliminateBinding cenv _env bind e2 _m = not vspec1.IsCompilerGenerated then None elif vspec1.IsFixed then None + elif vspec1.InlineInfo = ValInline.InlinedDefinition then None elif vspec1.LogicalName.StartsWithOrdinal stackVarPrefix || vspec1.LogicalName.Contains suffixForVariablesThatMayNotBeEliminated then None else @@ -3419,8 +3426,60 @@ and TryDevirtualizeApplication cenv env (f, tyargs, args, m) = | _ -> None /// Attempt to inline an application of a known value at callsites -and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m) = +and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, args: Expr list, m) = let g = cenv.g + + match cenv.settings.inlineNamedFunctions, stripExpr valExpr with + | false, Expr.Val(vref, _, _) when vref.ShouldInline -> + let origFinfo = GetInfoForValWithCheck cenv env m vref + match stripValue origFinfo.ValExprInfo with + | CurriedLambdaValue(origLambdaId, _, _, origLambda, origLambdaTy) when not (Zset.contains origLambdaId env.dontInline) -> + let argsR = args |> List.map (OptimizeExpr cenv env >> fst) + let info = { TotalSize = 1; FunctionSize = 1; HasEffect = true; MightMakeCriticalTailcall = false; Info = UnknownValue } + + let canCallDirectly = + let hasNoTraits = + match vref.ValReprInfo with + | Some reprInfo -> + let tps, _, _, _ = GetValReprTypeInFSharpForm g reprInfo vref.Type m + GetTraitWitnessInfosOfTypars g 0 tps |> List.isEmpty + | None -> false + + let hasNoFreeTyargs = + tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) |> not + + hasNoTraits || hasNoFreeTyargs + + if canCallDirectly then + Some(mkApps g ((exprForValRef m vref, vref.Type), [tyargs], argsR, m), info) + else + let f2R = CopyExprForInlining cenv true origLambda m + let specLambda = MakeApplicationAndBetaReduce g (f2R, origLambdaTy, [tyargs], [], m) + let specLambdaTy = tyOfExpr g specLambda + + let debugVal, specLambdaR = + match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _, _) -> typeEquiv g ty specLambdaTy) with + | Some (_, v, body) -> v, body + | None -> + + let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + let debugVal = + let name = $"<{vref.LogicalName}>__debug" + let valReprInfo = Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) + + Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, + NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, + ParentNone) + + cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, debugVal, specLambdaR)) + debugVal, specLambdaR + + let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) + Some(mkCompGenLet m debugVal specLambdaR callExpr, info) + + | _ -> None + | _ -> + // Considering inlining app match finfo.Info with | StripLambdaValue (lambdaId, arities, size, f2, f2ty) when @@ -3619,7 +3678,7 @@ and OptimizeApplication cenv env (f0, f0ty, tyargs, args, m) = OptimizeExpr cenv env remade | Choice2Of2 (newf0, remake) -> - match TryInlineApplication cenv env finfo (tyargs, args, m) with + match TryInlineApplication cenv env finfo f0 (tyargs, args, m) with | Some (res, info) -> // inlined (res |> remake), info @@ -3867,6 +3926,10 @@ and OptimizeLambdas (vspec: Val option) cenv env valReprInfo expr exprTy = // can't inline any values with semi-recursive object references to self or base let value_ = + match vspec with + | Some v when v.InlineInfo = ValInline.InlinedDefinition -> UnknownValue + | _ -> + match baseValOpt with | None -> CurriedLambdaValue (lambdaId, arities, bsize, exprR, exprTy) | Some baseVal -> @@ -4408,6 +4471,7 @@ let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncr casApplied=Dictionary() stackGuard = StackGuard("OptimizerStackGuardDepth") realsig = tcGlobals.realsig + specializedInlineVals = HashMultiMap(HashIdentity.Structural, true) } let env, _, _, _ as results = OptimizeImplFileInternal cenv optEnv isIncrementalFragment hidden mimpls diff --git a/src/Compiler/Optimize/Optimizer.fsi b/src/Compiler/Optimize/Optimizer.fsi index 17912af7598..10335e93a64 100644 --- a/src/Compiler/Optimize/Optimizer.fsi +++ b/src/Compiler/Optimize/Optimizer.fsi @@ -51,6 +51,8 @@ type OptimizationSettings = reportTotalSizes: bool processingMode: OptimizationProcessingMode + + inlineNamedFunctions: bool } member JitOptimizationsEnabled: bool diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 2425aad5877..c5da5e4d322 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -1886,7 +1886,7 @@ type FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = match v.InlineInfo with | ValInline.Always -> FSharpInlineAnnotation.AlwaysInline | ValInline.Optional -> FSharpInlineAnnotation.OptionalInline - | ValInline.Never -> FSharpInlineAnnotation.NeverInline + | ValInline.Never | ValInline.InlinedDefinition -> FSharpInlineAnnotation.NeverInline member _.IsMutable = if isUnresolved() then false else diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index dac2e23c10c..b1f65a35062 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -41,21 +41,15 @@ type StampMap<'T> = Map [] type ValInline = - - /// Indicates the value is inlined but the .NET IL code for the function still exists, e.g. to satisfy interfaces on objects, but that it is also always inlined | Always - - /// Indicates the value may optionally be inlined by the optimizer | Optional - - /// Indicates the value must never be inlined by the optimizer | Never + | InlinedDefinition - /// Returns true if the implementation of a value should be inlined member x.ShouldInline = match x with | ValInline.Always -> true - | ValInline.Optional | ValInline.Never -> false + | ValInline.Optional | ValInline.Never | ValInline.InlinedDefinition -> false /// A flag associated with values that indicates whether the recursive scope of the value is currently being processed, and /// if the value has been generalized or not as yet. @@ -110,6 +104,7 @@ type ValFlags(flags: int64) = (if isCompGen then 0b00000000000000001000L else 0b000000000000000000000L) ||| (match inlineInfo with + | ValInline.InlinedDefinition -> 0b00000000000000000000L | ValInline.Always -> 0b00000000000000010000L | ValInline.Optional -> 0b00000000000000100000L | ValInline.Never -> 0b00000000000000110000L) ||| @@ -166,7 +161,7 @@ type ValFlags(flags: int64) = member x.InlineInfo = match (flags &&& 0b00000000000000110000L) with - | 0b00000000000000000000L + | 0b00000000000000000000L -> ValInline.InlinedDefinition | 0b00000000000000010000L -> ValInline.Always | 0b00000000000000100000L -> ValInline.Optional | 0b00000000000000110000L -> ValInline.Never diff --git a/src/Compiler/TypedTree/TypedTree.fsi b/src/Compiler/TypedTree/TypedTree.fsi index 7fbe446641a..e104625655f 100644 --- a/src/Compiler/TypedTree/TypedTree.fsi +++ b/src/Compiler/TypedTree/TypedTree.fsi @@ -41,6 +41,9 @@ type ValInline = /// Indicates the value must never be inlined by the optimizer | Never + /// Indicates a debug-only value produced from inlining an 'inline' function definition. + | InlinedDefinition + /// Returns true if the implementation of a value must always be inlined member ShouldInline: bool diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs new file mode 100644 index 00000000000..94fb1c79a4b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -0,0 +1,414 @@ +namespace EmittedIL + +open Xunit +open FSharp.Test.Compiler + +module DebugInlineAsCall = + + [] + let ``Call 01 - Release`` () = + FSharp """ +let inline f (x: int) = + x + x + +let i = f 5 +""" + |> asExe + |> compile + |> verifyILContains ["ldc.i4.s 10"] + |> shouldSucceed + + [] + let ``Call 02 - Debug`` () = + FSharp """ +let inline f (x: int) = + x + x + +[] +let main _ = + let i = f 5 + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::f(int32)"] + |> shouldSucceed + + [] + let ``Call 03 - Two args`` () = + FSharp """ + +let inline add a b = + a + b + +[] +let main _ = + let i = add 1 2 + if i = 3 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@8'(int32,"] + |> shouldSucceed + + [] + let ``Call 04 - Function arg`` () = + FSharp """ +let inline apply (f: 'a -> 'b -> 'c) (x: 'a) (y: 'b) : 'c = + f x y + +[] +let main _ = + let i = apply (+) 3 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call !!2 Test::apply(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>,"] + |> shouldSucceed + + + [] + let ``Call 05 - Nested inline`` () = + FSharp """ +let inline double (x: int) = + x + x + +let inline quadruple (x: int) = + double (double x) + +[] +let main _ = + let i = quadruple 3 + if i = 12 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains + ["call int32 Test::double(int32)" + "call int32 Test::quadruple(int32)"] + |> shouldSucceed + + [] + let ``Call 06 - Multiple calls`` () = + FSharp """ +let inline double (x: int) = + x + x + +[] +let main _ = + let i = double 1 + double 2 + if i = 6 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains [ "call int32 Test::double(int32)" ] + + [] + let ``Call 07 - Local function`` () = + FSharp """ +[] +let main _ = + let inline double (x: int) = x + x + let i = double 5 + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@5'(int32)"] + |> shouldSucceed + + [] + let ``Call 08 - Local generic function`` () = + FSharp """ +[] +let main _ = + let inline apply (f: 'a -> 'b) (x: 'a) : 'b = f x + let i = apply (fun x -> x + 1) 5 + if i = 6 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@5'(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,"] + |> shouldSucceed + + [] + let ``Call 09 - FSharp.Core not`` () = + FSharp """ +[] +let main _ = + let b = not true + if b = false then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call bool [FSharp.Core]Microsoft.FSharp.Core.Operators::Not(bool)"] + |> shouldSucceed + + [] + let ``Call 10 - Different assembly`` () = + let library = + FSharp """ +module MyLib + +let inline triple (x: int) = x + x + x +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> withName "mylib" + + FSharp """ +open MyLib + +[] +let main _ = + let i = triple 3 + if i = 9 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 [mylib]MyLib::triple(int32)"] + |> shouldSucceed + + [] + let ``Call 11 - Measure`` () = + FSharp """ +[] type cm + +let inline scale (x: float<'u>) = x * 2.0 + +[] +let main _ = + let v = scale 5.0 + if v = 10.0 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call float64 Test::scale(float64)"] + |> shouldSucceed + + [] + let ``Call 12 - No inner optimization`` () = + FSharp """ +[] +let main _ = + let inline f (x: int) = + let i = 5 + 10 + x + i + + let i = f 20 + if i = 35 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains + [ "ldc.i4.5" + "ldc.i4.s 10" + "call int32 Test::'__debug@8'(int32)" ] + |> shouldSucceed + + [] + let ``SRTP 01`` () = + FSharp """ +let inline add (x: ^T) (y: ^T) = + x + y + +[] +let main _ = + let i = add 3 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@7'(int32,"] + |> shouldSucceed + + [] + let ``SRTP 02 - Local `` () = + FSharp """ +[] +let main _ = + let inline add (x: ^T) (y: ^T) = x + y + let i = add 3 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@5'(int32,"] + |> shouldSucceed + + [] + let ``SRTP 03 - Different type arguments`` () = + FSharp """ +let inline getLength (x: ^T) = + (^T : (member Length : int) x) + +[] +let main _ = + let i = getLength "hello" + let j = getLength [1; 2; 3] + if i = 5 && j = 3 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains + [ "call int32 Test::'__debug@7'(string)" + "call int32 Test::'__debug@8-1'(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1)" ] + |> shouldSucceed + + [] + let ``SRTP 04 - Multiple calls`` () = + FSharp """ +let inline add (x: ^T) (y: ^T) = x + y + +[] +let main _ = + let i = add 1 2 + add 3 4 + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains [ "call int32 Test::'__debug@6'(int32," ] + |> shouldSucceed + + + [] + let ``SRTP 05 - Different assembly`` () = + let library = + FSharp """ +module MyLib + +let inline add (x: ^T) (y: ^T) = x + y +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> withName "mylib2" + + FSharp """ +open MyLib + +[] +let main _ = + let i = add 3 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@6'(int32,"] + |> shouldSucceed + + [] + let ``SRTP 06 - Different assembly`` () = + let library = + FSharp """ +module MyLib + +let inline add (x: ^T) (y: ^T) = x + y +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> withName "mylib3" + + FSharp """ +open MyLib + +let inline double (x: ^T) = add x x + +[] +let main _ = + let i = double 5 + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> verifyILContains + [ "call int32 Test::'__debug@8'(int32)" + "call int32 Test::'__debug@4'(int32," ] + |> shouldSucceed + + [] + let ``SRTP 07 - Nested - Same project`` () = + FSharp """ +let inline add (x: ^T) (y: ^T) = x + y + +let inline double (x: ^T) = add x x + +[] +let main _ = + let i = double 5 + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains + [ "call int32 Test::'__debug@8'(int32)" + "call int32 Test::'__debug@4'(int32," ] + |> shouldSucceed + + + + [] + let ``SRTP 08 - Nested - Different type arguments`` () = + FSharp """ +let inline add (x: ^T) (y: ^T) = x + y + +let inline addBoth (x: ^A) (y: ^B) = + let a = add x x + let b = add y y + (a, b) + +[] +let main _ = + let (a, b) = addBoth 2 3.0 + if a = 4 && b = 6.0 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains + [ "call int32 Test::'__debug@5'(int32," + "call float64 Test::'__debug@6-1'(float64," ] + |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 954c02b8aca..896abb414c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -234,6 +234,7 @@ + From b5dc33adc3a0b92cfbef8e76339e73ad3477e8af Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 7 Apr 2026 15:09:05 +0200 Subject: [PATCH 10/50] Xlf --- src/Compiler/xlf/FSComp.txt.cs.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.de.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.es.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.fr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.it.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ja.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ko.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pl.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.ru.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 +++++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 +++++ 13 files changed, 65 insertions(+) diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 10fe84e6ab1..99b7b5ca382 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1037,6 +1037,11 @@ Zobrazí povolené hodnoty pro jazykovou verzi. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Neplatné použití generování referenčního sestavení, nepoužívejte --standalone ani --staticlink s --refonly nebo --refout. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 17f93260936..b87eec33dca 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1037,6 +1037,11 @@ Anzeigen der zulässigen Werte für die Sprachversion. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht „--standalone“ oder „--staticlink“ mit „--refonly“ oder „--refout“. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index ecc7e4a3f27..10b2a2b4c4f 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1037,6 +1037,11 @@ Muestra los valores permitidos para la versión del lenguaje. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Uso no válido de emisión de un ensamblado de referencia, no use '--standalone or --staticlink' con '--refonly or --refout'. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 3e0ab156a68..05725c185ca 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1037,6 +1037,11 @@ Affichez les valeurs autorisées pour la version du langage. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Utilisation non valide de l’émission d’un assembly de référence, n’utilisez pas '--standalone ou --staticlink' avec '--refonly ou --refout'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 424a8e0310b..9d9298b1b18 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1037,6 +1037,11 @@ Visualizzare i valori consentiti per la versione della lingua. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--standalone o --staticlink' con '--refonly o --refout'.. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index d588b1908d7..ab93720911b 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1037,6 +1037,11 @@ 言語バージョンで許可されている値を表示します。 + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 参照アセンブリの出力の使用が無効です。'--standalone または --staticlink' を '--relabelly または --refout' と共に使用しないでください。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index ec0d939e7b2..864f828d8fc 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1037,6 +1037,11 @@ 언어 버전에 허용되는 값을 표시합니다. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 참조 어셈블리 내보내기를 잘못 사용했습니다. '--refonly 또는 --refout'과 함께 '--standalone 또는 --staticlink'를 사용하지 마세요. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index ae93051caa0..2cd04f84bda 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1037,6 +1037,11 @@ Wyświetl dozwolone wartości dla wersji językowej. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Nieprawidłowe użycie emitowania zestawu odwołania. Nie używaj elementu „--standalone ani --staticlink” z elementem „--refonly lub --refout”. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 0e0c2367513..c1cac06ba19 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1037,6 +1037,11 @@ Exiba os valores permitidos para a versão do idioma. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Uso inválido da emissão de um assembly de referência, não use '--standalone ou --staticlink' com '--refonly ou --refout'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index e25503d865e..5cc075702f9 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1037,6 +1037,11 @@ Отображение допустимых значений для версии языка. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Недопустимое использование при создании базовой сборки. Не используйте "--standalone or --staticlink" с "--refonly or --refout". diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index a296c02e44c..ee548521e6d 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1037,6 +1037,11 @@ Dil sürümü için izin verilen değerleri görüntüleyin. + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Başvuru bütünleştirilmiş kodu oluşturmanın geçersiz kullanımı; '--standalone’ veya ‘--staticlink' seçeneğini '--refonly’ veya ‘--refout' ile birlikte kullanmayın. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index aa66fa326f6..9b89af11acd 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1037,6 +1037,11 @@ 显示语言版本的允许值。 + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 发出引用程序集的使用无效,请勿将 '--standalone 或 --staticlink' 与 '--refonly 或 --refout' 一起使用。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index d8517bff3ff..b54c21177df 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1037,6 +1037,11 @@ 顯示語言版本的允許值。 + + Inline named 'inline' functions + Inline named 'inline' functions + + Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 發出參考組件的使用無效,請勿同時使用 '--standalone 或 '--refonly' 和 '--refout'。 From 149480b7490a7292ae0039926b94fbda76a3c319 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 7 Apr 2026 15:11:35 +0200 Subject: [PATCH 11/50] 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 965957dbc0c..63a02478111 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -89,3 +89,4 @@ * Exception field serialization (`GetObjectData` and field-restoring constructor) is now gated behind `langversion:11` (`LanguageFeature.ExceptionFieldSerializationSupport`). With langversion ≤10, exception codegen is unchanged from pre-#19342 behavior. ([PR #19746](https://github.com/dotnet/fsharp/pull/19746)) ### Breaking Changes +* Optimizer: don't inline named functions in debug builds ([PR #19548](https://github.com/dotnet/fsharp/pull/19548) \ No newline at end of file From 907e4b40177b695e38ab334416c1473a9c5ea27b Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 7 Apr 2026 16:37:54 +0200 Subject: [PATCH 12/50] Don't specialize local functions --- src/Compiler/Optimize/Optimizer.fs | 7 ++----- .../EmittedIL/DebugInlineAsCall.fs | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index bdda687d143..39878f76bc9 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3439,11 +3439,8 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let canCallDirectly = let hasNoTraits = - match vref.ValReprInfo with - | Some reprInfo -> - let tps, _, _, _ = GetValReprTypeInFSharpForm g reprInfo vref.Type m - GetTraitWitnessInfosOfTypars g 0 tps |> List.isEmpty - | None -> false + let tps, _ = tryDestForallTy g vref.Type + GetTraitConstraintInfosOfTypars g tps |> List.isEmpty let hasNoFreeTyargs = tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) |> not diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 94fb1c79a4b..dea745e707f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -127,7 +127,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun - |> verifyILContains ["call int32 Test::'__debug@5'(int32)"] + |> verifyILContains ["callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0)"] |> shouldSucceed [] @@ -143,7 +143,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun - |> verifyILContains ["call int32 Test::'__debug@5'(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,"] + |> verifyILContains ["call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>,"] |> shouldSucceed [] @@ -228,7 +228,7 @@ let main _ = |> verifyILContains [ "ldc.i4.5" "ldc.i4.s 10" - "call int32 Test::'__debug@8'(int32)" ] + "callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0)" ] |> shouldSucceed [] From b2d836f8528f2bf54618595aa0708a01d7046dcd Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 7 Apr 2026 17:03:03 +0200 Subject: [PATCH 13/50] Remove specialized values caching --- src/Compiler/CodeGen/IlxGen.fs | 4 ---- src/Compiler/Optimize/Optimizer.fs | 24 +++++++++---------- .../EmittedIL/DebugInlineAsCall.fs | 4 +++- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 26adf6c974a..c50b16c2628 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -312,7 +312,6 @@ type cenv = /// Guard the stack and move to a new one if necessary mutable stackGuard: StackGuard - emittedSpecializedInlineVals: HashSet } member cenv.options = @@ -8757,8 +8756,6 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = GenExpr cenv cgbuf eenv cctorBody discard | Method(valReprInfo, _, mspec, mspecW, _, ctps, mtps, curriedArgInfos, paramInfos, witnessInfos, argTys, retInfo) when not isStateVar -> - if vspec.InlineInfo = ValInline.InlinedDefinition && not (cenv.emittedSpecializedInlineVals.Add(vspec.Stamp)) then - CommitStartScope cgbuf startMarkOpt else let methLambdaTypars, methLambdaCtorThisValOpt, methLambdaBaseValOpt, methLambdaCurriedVars, methLambdaBody, methLambdaBodyTy = IteratedAdjustLambdaToMatchValReprInfo g cenv.amap valReprInfo rhsExpr @@ -12862,7 +12859,6 @@ type IlxAssemblyGenerator(amap: ImportMap, g: TcGlobals, tcVal: ConstraintSolver optimizeDuringCodeGen = (fun _flag expr -> expr) stackGuard = getEmptyStackGuard () delayedGenMethods = Queue() - emittedSpecializedInlineVals = HashSet() } /// Register a set of referenced assemblies with the ILX code generator diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 39878f76bc9..e72f61aa582 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -434,7 +434,7 @@ type cenv = realsig: bool - specializedInlineVals: HashMultiMap + specializedInlineVals: HashMultiMap } override x.ToString() = "" @@ -3454,22 +3454,22 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let specLambda = MakeApplicationAndBetaReduce g (f2R, origLambdaTy, [tyargs], [], m) let specLambdaTy = tyOfExpr g specLambda - let debugVal, specLambdaR = - match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _, _) -> typeEquiv g ty specLambdaTy) with - | Some (_, v, body) -> v, body + let specLambdaR = + match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _) -> typeEquiv g ty specLambdaTy) with + | Some (_, body) -> copyExpr g CloneAll body | None -> let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda - let debugVal = - let name = $"<{vref.LogicalName}>__debug" - let valReprInfo = Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) + cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, specLambdaR)) + specLambdaR - Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, - NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, - ParentNone) + let debugVal = + let name = $"<{vref.LogicalName}>__debug" + let valReprInfo = Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) - cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, debugVal, specLambdaR)) - debugVal, specLambdaR + Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, + NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, + ParentNone) let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) Some(mkCompGenLet m debugVal specLambdaR callExpr, info) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index dea745e707f..e85be18d47b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -300,7 +300,9 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun - |> verifyILContains [ "call int32 Test::'__debug@6'(int32," ] + |> verifyILContains + [ "call int32 Test::'__debug@6'(int32," + "call int32 Test::'__debug@6-1'(int32," ] |> shouldSucceed From 7a46f1a0e4450dcd1d0ebb619c311e45441bf9fc Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 8 Apr 2026 16:20:46 +0200 Subject: [PATCH 14/50] Fix witness passing --- src/Compiler/Optimize/Optimizer.fs | 40 +++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index e72f61aa582..85720641412 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3437,15 +3437,15 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let argsR = args |> List.map (OptimizeExpr cenv env >> fst) let info = { TotalSize = 1; FunctionSize = 1; HasEffect = true; MightMakeCriticalTailcall = false; Info = UnknownValue } - let canCallDirectly = - let hasNoTraits = - let tps, _ = tryDestForallTy g vref.Type - GetTraitConstraintInfosOfTypars g tps |> List.isEmpty + let hasNoTraits = + let tps, _ = tryDestForallTy g vref.Type + GetTraitConstraintInfosOfTypars g tps |> List.isEmpty - let hasNoFreeTyargs = - tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) |> not + let allTyargsAreConcrete = + tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) - hasNoTraits || hasNoFreeTyargs + let canCallDirectly = + hasNoTraits || (not allTyargsAreConcrete && vref.ValReprInfo.IsSome) if canCallDirectly then Some(mkApps g ((exprForValRef m vref, vref.Type), [tyargs], argsR, m), info) @@ -3455,17 +3455,27 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let specLambdaTy = tyOfExpr g specLambda let specLambdaR = - match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _) -> typeEquiv g ty specLambdaTy) with - | Some (_, body) -> copyExpr g CloneAll body - | None -> - - let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda - cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, specLambdaR)) - specLambdaR + if allTyargsAreConcrete then + match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _) -> typeEquiv g ty specLambdaTy) with + | Some (_, body) -> copyExpr g CloneAll body + | None -> + + let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, specLambdaR)) + specLambdaR + else + let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + specLambdaR let debugVal = let name = $"<{vref.LogicalName}>__debug" - let valReprInfo = Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) + // When tyargs have free type variables, omit ValReprInfo so IlxGen compiles this + // as a closure that captures type variables and witnesses from the enclosing scope. + let valReprInfo = + if allTyargsAreConcrete then + Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) + else + None Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, From 591674c25cc25b1aa6c57cf470abfda2f5e6fcbd Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 9 Apr 2026 16:53:27 +0200 Subject: [PATCH 15/50] Inline NoDynamicInvocation and some builtin functions --- src/Compiler/Optimize/Optimizer.fs | 13 ++++++++++++- src/Compiler/TypedTree/TcGlobals.fs | 14 ++++++++++++++ src/Compiler/TypedTree/TcGlobals.fsi | 2 ++ .../EmittedIL/DebugInlineAsCall.fs | 3 +-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 85720641412..9f8c03bc0fa 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -2338,6 +2338,17 @@ let inline IsStateMachineExpr g overallExpr = isReturnsResumableCodeTy g valRef.TauType | _ -> false +let shouldForceInlineMembersInDebug (g: TcGlobals) (tcref: EntityRef) = + match g.fslibForceInlineModules.TryGetValue tcref.LogicalName with + | true, modRef -> tyconRefEq g tcref modRef + | _ -> false + +let shouldForceInlineInDebug (g: TcGlobals) (vref: ValRef) : bool = + ValHasWellKnownAttribute g WellKnownValAttributes.NoDynamicInvocationAttribute_True vref.Deref || + ValHasWellKnownAttribute g WellKnownValAttributes.NoDynamicInvocationAttribute_False vref.Deref || + + vref.HasDeclaringEntity && shouldForceInlineMembersInDebug g vref.DeclaringEntity + /// Optimize/analyze an expression let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr = cenv.stackGuard.Guard <| fun () -> @@ -3430,7 +3441,7 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let g = cenv.g match cenv.settings.inlineNamedFunctions, stripExpr valExpr with - | false, Expr.Val(vref, _, _) when vref.ShouldInline -> + | false, Expr.Val(vref, _, _) when vref.ShouldInline && not (shouldForceInlineInDebug cenv.g vref) -> let origFinfo = GetInfoForValWithCheck cenv env m vref match stripValue origFinfo.ValExprInfo with | CurriedLambdaValue(origLambdaId, _, _, origLambda, origLambdaTy) when not (Zset.contains origLambdaId env.dontInline) -> diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 6dfbd42f98c..d3ee0083fb9 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -646,6 +646,18 @@ type TcGlobals( yield nleref.LastItemMangledName, ERefNonLocal nleref ] + let v_FSharpCoreForceInlineModules = + dict [ for nleref in [ fslib_MFIntrinsicFunctions_nleref + fslib_MFIntrinsicOperators_nleref + fslib_MFLanguagePrimitives_nleref + fslib_MFOperators_nleref + fslib_MFOperatorIntrinsics_nleref + fslib_MFOperatorsChecked_nleref + fslib_MFOperatorsUnchecked_nleref + fslib_MFNativePtrModule_nleref ] do + + yield nleref.LastItemMangledName, ERefNonLocal nleref ] + let tryDecodeTupleTy tupInfo l = match l with | [t1;t2;t3;t4;t5;t6;t7;markerTy] -> @@ -1133,6 +1145,8 @@ type TcGlobals( // better the job we do of mapping from provided expressions back to FSharp.Core F# functions and values. member _.knownFSharpCoreModules = v_knownFSharpCoreModules + member _.fslibForceInlineModules = v_FSharpCoreForceInlineModules + member _.compilingFSharpCore = compilingFSharpCore member _.useReflectionFreeCodeGen = useReflectionFreeCodeGen diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi index e27bc1605a2..214ad0d17cd 100644 --- a/src/Compiler/TypedTree/TcGlobals.fsi +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -698,6 +698,8 @@ type internal TcGlobals = member knownFSharpCoreModules: System.Collections.Generic.IDictionary + member fslibForceInlineModules: System.Collections.Generic.IDictionary + member knownIntrinsics: System.Collections.Concurrent.ConcurrentDictionary diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index e85be18d47b..b85bf372fa6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -158,8 +158,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun - |> verifyILContains ["call bool [FSharp.Core]Microsoft.FSharp.Core.Operators::Not(bool)"] - |> shouldSucceed + |> verifyILNotPresent ["call bool [FSharp.Core]Microsoft.FSharp.Core.Operators::Not(bool)"] [] let ``Call 10 - Different assembly`` () = From bfa89b96a707eea53da82bac5519cd89b7516b6f Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 9 Apr 2026 17:07:13 +0200 Subject: [PATCH 16/50] Add more tests --- .../EmittedIL/DebugInlineAsCall.fs | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index b85bf372fa6..51d6f492120 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -413,3 +413,196 @@ let main _ = [ "call int32 Test::'__debug@5'(int32," "call float64 Test::'__debug@6-1'(float64," ] |> shouldSucceed + + [] + let ``SRTP 09 - Witness`` () = + FSharp """ +let check s (b1: 'a) (b2: 'a) = if b1 = b2 then () else failwith s + +let inline add (x: ^T) (y: ^T) = x + y + +[] +let main _ = + check "int" (add 3 4) 7 + check "float" (add 1.0 2.0) 3.0 + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``SRTP 10 - Witness`` () = + FSharp """ +type MyNum = + { Value: float } + static member FromFloat (_: MyNum) = fun (x: float) -> { Value = x } + +type T = + static member inline Invoke(x: float) : 'Num = + let inline call (a: ^a) = (^a: (static member FromFloat : _ -> _) a) + call Unchecked.defaultof<'Num> x + +[] +let main _ = + let result = T.Invoke(3.14) + if result.Value = 3.14 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains [ "call class Test/MyNum Test::'__debug@13'(float64)" ] + |> shouldSucceed + + [] + let ``SRTP 11 - Witness`` () = + FSharp """ +type MyNum = + { Value: float } + static member FromFloat (_: MyNum, _: T) = fun (x: float) -> { Value = x } + +and T = + { Dummy: int } + static member inline Invoke(x: float) : 'Num = + let inline call2 (a: ^a, b: ^b) = ((^a or ^b) : (static member FromFloat : _ * _ -> _) (b, a)) + let inline call (a: 'a) = fun (x: 'x) -> call2 (a, Unchecked.defaultof<'r>) x : 'r + call Unchecked.defaultof x + +[] +let main _ = + let result = T.Invoke(2.71) + if result.Value = 2.71 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains [ "call class Test/MyNum Test::'__debug@15'(float64)" ] + |> shouldSucceed + + + [] + let ``Member 01 - Non-generic`` () = + FSharp """ +type T() = + member inline _.Double(x: int) = x + x + +[] +let main _ = + let t = T() + let i = t.Double(5) + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["callvirt instance int32 Test/T::Double(int32)"] + |> shouldSucceed + + [] + let ``Member 02 - Generic`` () = + FSharp """ +type T() = + member inline _.Apply(f: 'a -> 'b, x: 'a) : 'b = f x + +[] +let main _ = + let t = T() + let i = t.Apply((fun x -> x + 1), 5) + if i = 6 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["callvirt instance !!1 Test/T::Apply(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,"] + |> shouldSucceed + + [] + let ``Member 03 - SRTP`` () = + FSharp """ +type T() = + member inline _.Add(x: ^T, y: ^T) = x + y + +[] +let main _ = + let t = T() + let i = t.Add(3, 4) + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@8'(class Test/T,"] + |> shouldSucceed + + [] + let ``Operator 01 - Top-level`` () = + FSharp """ +let inline (++) (x: int) (y: int) = x + y + 1 + +[] +let main _ = + let i = 3 ++ 4 + if i = 8 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::op_PlusPlus(int32,"] + |> shouldSucceed + + [] + let ``Operator 02 - Top-level SRTP`` () = + FSharp """ +let inline (++) (x: ^T) (y: ^T) = x + y + +[] +let main _ = + let i = 3 ++ 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@6'(int32,"] + |> shouldSucceed + + [] + let ``Operator 03 - Local`` () = + FSharp """ +[] +let main _ = + let inline (++) (x: int) (y: int) = x + y + 1 + let i = 3 ++ 4 + if i = 8 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call !!0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::InvokeFast(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>,"] + |> shouldSucceed + + [] + let ``Operator 04 - Local SRTP`` () = + FSharp """ +[] +let main _ = + let inline (++) (x: ^T) (y: ^T) = x + y + let i = 3 ++ 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@5'(int32,"] + |> shouldSucceed From a0bddb8f2572e02465eeb079efcf11219fa8674a Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 11 Apr 2026 10:03:23 +0200 Subject: [PATCH 17/50] More witness fixes --- src/Compiler/Optimize/Optimizer.fs | 5 +- .../EmittedIL/DebugInlineAsCall.fs | 55 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 9f8c03bc0fa..14040693094 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3455,8 +3455,11 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let allTyargsAreConcrete = tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) + let allTyargsAreGeneric = + tyargs |> List.forall (fun t -> not (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) + let canCallDirectly = - hasNoTraits || (not allTyargsAreConcrete && vref.ValReprInfo.IsSome) + hasNoTraits || (allTyargsAreGeneric && vref.ValReprInfo.IsSome) if canCallDirectly then Some(mkApps g ((exprForValRef m vref, vref.Type), [tyargs], argsR, m), info) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 51d6f492120..299232238b7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -484,6 +484,61 @@ let main _ = |> shouldSucceed + [] + let ``SRTP 12 - Witness - Struct with partially resolved type args`` () = + FSharp """ +[] +type S = + member _.M() = () + +type T() = + member _.N() = () + +let inline f (a: ^A when ^A: (member M: unit -> unit)) (_b: ^B when ^B: (member N: unit -> unit)) = + (^A: (member M: unit -> unit) a) + +let inline g b = f (S()) b + +[] +let main _ = + g (T()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``SRTP 13 - Witness - Struct with ResumableCode and partially resolved type args`` () = + FSharp """ +open Microsoft.FSharp.Core.CompilerServices + +[] +type S = member this.Foo() = () + +type D = member _.Bar() = true + +let inline f (x: ^A) = + ResumableCode< ^B, _>(fun sm -> + (^A: (member Foo: unit -> unit) x) + (^B: (member Bar: unit -> bool) sm.Data) + ) + +let inline g () = f (S()) + +[] +let main _ = + let _ : ResumableCode = g () + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From 699a9fb3c9a2cf4882bcebb989dfbaa4cfb89178 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 10 Apr 2026 17:27:50 +0200 Subject: [PATCH 18/50] Don't check accessibility for non-inlined functions --- src/Compiler/Optimize/Optimizer.fs | 31 +++++++++--------- .../EmittedIL/DebugInlineAsCall.fs | 32 +++++++++++++++++++ 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 14040693094..940e4efee64 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -503,8 +503,9 @@ let CheckInlineValueIsComplete (v: Val) res = errorR(Error(FSComp.SR.optValueMarkedInlineButIncomplete(v.DisplayName), v.Range)) //System.Diagnostics.Debug.Assert(false, sprintf "Break for incomplete inline value %s" v.DisplayName) -let check (vref: ValRef) (res: ValInfo) = - CheckInlineValueIsComplete vref.Deref res.ValExprInfo +let check (cenv: cenv) (vref: ValRef) (res: ValInfo) = + if cenv.settings.inlineNamedFunctions then + CheckInlineValueIsComplete vref.Deref res.ValExprInfo (vref, res) //------------------------------------------------------------------------- @@ -694,7 +695,7 @@ let GetInfoForVal cenv env m (vref: ValRef) = let GetInfoForValWithCheck cenv env m (vref: ValRef) = let res = GetInfoForVal cenv env m vref - check vref res |> ignore + check cenv vref res |> ignore res let IsPartialExpr cenv env m x = @@ -1328,7 +1329,7 @@ let CombineValueInfos einfos res = let CombineValueInfosUnknown einfos = CombineValueInfos einfos UnknownValue /// Hide information because of a signature -let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi = +let AbstractLazyModulInfoByHiding isAssemblyBoundary (cenv: cenv) mhi = // The freevars and FreeTyvars can indicate if the non-public (hidden) items have been used. // Under those checks, the further hidden* checks may be subsumed (meaning, not required anymore). @@ -1403,7 +1404,7 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary mhi = ValInfos = ValInfos(ss.ValInfos.Entries |> Seq.filter (fun (vref, _) -> not (hiddenVal vref.Deref)) - |> Seq.map (fun (vref, e) -> check (* "its implementation uses a binding hidden by a signature" m *) vref (abstractValInfo e) )) } + |> Seq.map (fun (vref, e) -> check cenv vref (abstractValInfo e) )) } and abstractLazyModulInfo (ss: LazyModuleInfo) = ss.Force() |> abstractModulInfo |> notlazy @@ -1422,7 +1423,7 @@ let AbstractOptimizationInfoToEssentials = abstractLazyModulInfo /// Hide information because of a "let ... in ..." or "let rec ... in ... " -let AbstractExprInfoByVars (boundVars: Val list, boundTyVars) ivalue = +let AbstractExprInfoByVars (cenv: cenv) (boundVars: Val list, boundTyVars) ivalue = // Module and member bindings can be skipped when checking abstraction, since abstraction of these values has already been done when // we hit the end of the module and called AbstractLazyModulInfoByHiding. If we don't skip these then we end up quadratically retraversing // the inferred optimization data, i.e. at each binding all the way up a sequences of 'lets' in a module. @@ -1482,7 +1483,7 @@ let AbstractExprInfoByVars (boundVars: Val list, boundTyVars) ivalue = let rec abstractModulInfo ss = { ModuleOrNamespaceInfos = ss.ModuleOrNamespaceInfos |> NameMap.map (InterruptibleLazy.force >> abstractModulInfo >> notlazy) ValInfos = ss.ValInfos.Map (fun (vref, e) -> - check vref (abstractValInfo e) ) } + check cenv vref (abstractValInfo e)) } abstractExprInfo ivalue @@ -1522,9 +1523,9 @@ let RemapOptimizationInfo g tmenv = remapLazyModulInfo /// Hide information when a value is no longer visible -let AbstractAndRemapModulInfo g (repackage, hidden) info = +let AbstractAndRemapModulInfo g (cenv: cenv) (repackage, hidden) info = let mrpi = mkRepackageRemapping repackage - let info = info |> AbstractLazyModulInfoByHiding false hidden + let info = info |> AbstractLazyModulInfoByHiding false cenv hidden let info = info |> RemapOptimizationInfo g mrpi info @@ -2847,7 +2848,7 @@ and OptimizeLetRec cenv env (binds, bodyExpr, m) = let fvs = List.fold (fun acc x -> unionFreeVars acc (fst x |> freeInBindingRhs CollectLocals)) fvs0 bindsR SplitValuesByIsUsedOrHasEffect cenv (fun () -> fvs.FreeLocals) bindsR // Trim out any optimization info that involves escaping values - let evalueR = AbstractExprInfoByVars (vs, []) einfo.Info + let evalueR = AbstractExprInfoByVars cenv (vs, []) einfo.Info // REVIEW: size of constructing new closures - should probably add #freevars + #recfixups here let bodyExprR = Expr.LetRec (bindsRR, bodyExprR, m, Construct.NewFreeVarsCache()) let info = CombineValueInfos (einfo :: bindinfos) evalueR @@ -2922,7 +2923,7 @@ and OptimizeLinearExpr cenv env expr contf = Info = UnknownValue } else // On the way back up: Trim out any optimization info that involves escaping values on the way back up - let evalueR = AbstractExprInfoByVars ([bindR.Var], []) bodyInfo.Info + let evalueR = AbstractExprInfoByVars cenv ([bindR.Var], []) bodyInfo.Info // Preserve the debug points for eliminated bindings that have debug points. let bodyR = @@ -4099,7 +4100,7 @@ and OptimizeDecisionTreeTarget cenv env _m (TTarget(vs, expr, flags)) = let env = BindInternalValsToUnknown cenv vs env let exprR, einfo = OptimizeExpr cenv env expr let exprR, einfo = ConsiderSplitToMethod cenv.settings.abstractBigTargets cenv.settings.bigTargetSize cenv env (exprR, einfo) - let evalueR = AbstractExprInfoByVars (vs, []) einfo.Info + let evalueR = AbstractExprInfoByVars cenv (vs, []) einfo.Info TTarget(vs, exprR, flags), { TotalSize=einfo.TotalSize FunctionSize=einfo.FunctionSize @@ -4390,7 +4391,7 @@ and OptimizeModuleExprWithSig cenv env mty def = elimModuleDefn def - let info = AbstractAndRemapModulInfo g rpi info + let info = AbstractAndRemapModulInfo g cenv rpi info def, info @@ -4463,14 +4464,14 @@ and OptimizeImplFileInternal cenv env isIncrementalFragment hidden implFile = // This optimizes and builds minfo ignoring the signature let (defR, minfo), (_env, _bindInfosColl) = OptimizeModuleContents cenv (env, []) contents let hidden = ComputeImplementationHidingInfoAtAssemblyBoundary defR hidden - let minfo = AbstractLazyModulInfoByHiding false hidden minfo + let minfo = AbstractLazyModulInfoByHiding false cenv hidden minfo let env = BindValsInModuleOrNamespace cenv minfo env env, defR, minfo, hidden else // This optimizes and builds minfo w.r.t. the signature let mexprR, minfo = OptimizeModuleExprWithSig cenv env signature contents let hidden = ComputeSignatureHidingInfoAtAssemblyBoundary signature hidden - let minfoExternal = AbstractLazyModulInfoByHiding true hidden minfo + let minfoExternal = AbstractLazyModulInfoByHiding true cenv hidden minfo let env = BindValsInModuleOrNamespace cenv minfo env env, mexprR, minfoExternal, hidden diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 299232238b7..ef0ac23b709 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -661,3 +661,35 @@ let main _ = |> compileAndRun |> verifyILContains ["call int32 Test::'__debug@5'(int32,"] |> shouldSucceed + + [] + let ``Accessibility 01`` () = + FSharp """ +module Module + +let inline internal fInternal () = () +let inline f () = fInternal () +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> compile + |> shouldSucceed + + [] + let ``Accessibility 02`` () = + FSharp """ +module Module + +type T() = + member inline internal this.InternalMethod() = + () + + member inline this.Method() = + this.InternalMethod() +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> compile + |> shouldSucceed \ No newline at end of file From dd20e31d25066e19dab436a99be1dd498037198a Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sun, 12 Apr 2026 17:10:51 +0200 Subject: [PATCH 19/50] Fix --- src/Compiler/CodeGen/IlxGen.fs | 11 +++- src/Compiler/CodeGen/IlxGen.fsi | 3 + src/Compiler/Driver/OptimizeInputs.fs | 3 + .../EmittedIL/DebugInlineAsCall.fs | 56 +++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index c50b16c2628..220462104c1 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -269,6 +269,8 @@ type IlxGenOptions = /// When set to true, the IlxGen will delay generation of method bodies and generated them later in parallel (parallelized across files) parallelIlxGenEnabled: bool + + inlineNamedFunctions: bool } /// Compilation environment for compiling a fragment of an assembly @@ -5760,8 +5762,13 @@ and GenTraitCall (cenv: cenv) cgbuf eenv (traitInfo: TraitConstraintInfo, argExp | None -> - // If witnesses are available, we should now always find trait witnesses in scope - assert not generateWitnesses + // When inlineNamedFunctions is true, all trait calls should be resolved via witnesses in scope. + // When inlineNamedFunctions is false, inline functions are kept as calls rather than inlined. + // Their witness arguments may contain TraitCall operations for constraints that were resolved + // without a witness (e.g., when the constraint is satisfied by a known concrete type). + // In such cases, generateWitnesses can be true (because other witnesses are in scope) but + // the specific trait's witness is not found. Fall through to the constraint solver to resolve it. + assert (not generateWitnesses || not cenv.options.inlineNamedFunctions) let exprOpt = CommitOperationResult(ConstraintSolver.CodegenWitnessExprForTraitConstraint cenv.tcVal g cenv.amap m traitInfo argExprs) diff --git a/src/Compiler/CodeGen/IlxGen.fsi b/src/Compiler/CodeGen/IlxGen.fsi index cd9dd0f2ffb..abf5320b697 100644 --- a/src/Compiler/CodeGen/IlxGen.fsi +++ b/src/Compiler/CodeGen/IlxGen.fsi @@ -61,6 +61,9 @@ type internal IlxGenOptions = /// When set to true, the IlxGen will delay generation of method bodies and generate them later in parallel (parallelized across files) parallelIlxGenEnabled: bool + + /// Indicates if inline named functions are being inlined or emitted as calls + inlineNamedFunctions: bool } /// The results of the ILX compilation of one fragment of an assembly diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index cace428af4d..81825929f3b 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -582,6 +582,9 @@ let GenerateIlxCode isInteractiveItExpr = isInteractiveItExpr alwaysCallVirt = tcConfig.alwaysCallVirt parallelIlxGenEnabled = tcConfig.parallelIlxGen + inlineNamedFunctions = + tcConfig.inlineNamedFunctions + |> Option.defaultValue (not tcConfig.debuginfo || tcConfig.optSettings.LocalOptimizationsEnabled) } ilxGenerator.GenerateCode(ilxGenOpts, optimizedImpls, topAttrs.assemblyAttrs, topAttrs.netModuleAttrs) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index ef0ac23b709..9869c9febdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -539,6 +539,62 @@ let main _ = |> compileAndRun |> shouldSucceed + [] + let ``SRTP 14 - StateMachine with unresolved trait from composed inline function`` () = + FSharp """ +open Microsoft.FSharp.Core.CompilerServices +open Microsoft.FSharp.Core.CompilerServices.StateMachineHelpers +open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators + +[] +type S<'T> = member _.M(_: 'T) = () + +let inline f<'A, 'R, 'B when 'A: (member M: int -> 'R) and 'B: (member M: 'R -> unit)> (_a: 'A) : 'B = Unchecked.defaultof<_> + +let inline g (_: S<'T>) = + if __useResumableCode then + __stateMachine, int> + (MoveNextMethodImpl<_>(fun _ -> ())) + (SetStateMachineMethodImpl<_>(fun _ _ -> ())) + (AfterCode<_, _>(fun _ -> 0)) + else 0 + +let inline h a = g (f a) + +[] +let main _ = + let _ = h (S()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``SRTP 15 - Composed inline with linked constraints`` () = + FSharp """ +[] +type S<'T> = member _.M(_: 'T) = () + +let inline f<'A, 'R, 'B when 'A: (member M: int -> 'R) and 'B: (member M: 'R -> unit)> (_a: 'A) : 'B = Unchecked.defaultof<_> + +let inline g (_: S<'T>) = 42 + +let inline h a = g (f a) + +[] +let main _ = + let i = h (S()) + if i = 42 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From e8fd584ffc4ddac80e11a0f855ef204bc9c18b8a Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sun, 12 Apr 2026 19:37:33 +0200 Subject: [PATCH 20/50] Fix cross-file inline same collision --- src/Compiler/Optimize/Optimizer.fs | 6 ++ .../EmittedIL/DebugInlineAsCall.fs | 58 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 940e4efee64..f964a6db147 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3482,6 +3482,12 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda specLambdaR + let specLambdaR = + match specLambdaR with + | Expr.Lambda(uniq, a, b, c, d, _, ty) -> Expr.Lambda(uniq, a, b, c, d, m, ty) + | Expr.TyLambda(uniq, a, b, _, ty) -> Expr.TyLambda(uniq, a, b, m, ty) + | _ -> specLambdaR + let debugVal = let name = $"<{vref.LogicalName}>__debug" // When tyargs have free type variables, omit ValReprInfo so IlxGen compiles this diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 9869c9febdd..4f814e9d7f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -595,6 +595,64 @@ let main _ = |> compileAndRun |> shouldSucceed + [] + let ``SRTP 16 - Same line`` () = + let additionalSource = FsSourceWithFileName "Program.fs" """ +module Program + +open Module + +let inline foo (a: 'a) = U.F(a, 0); fun () -> () + +[] +let main _ = + let _ = foo (T()) + 0 +""" + FSharpWithFileName "Module.fs" """ +module Module + +type T() = member _.M() = () + +type U = static member inline F<'a, 'b when 'a: (member M: unit -> unit)>(_a: 'a, _b: 'b) = () +""" + |> withAdditionalSourceFile additionalSource + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``SRTP 17 - Same line`` () = + let library = + FSharp """ +module Module + +let inline add<'a, 'b, 'c when 'a: (static member (+): 'a * 'a -> 'b)> (x: 'a) (y: 'a) = + x + y +""" + |> withDebug + |> withNoOptimize + |> asLibrary + + FSharp """ +open Module + +let inline foo x y = add x y |> ignore; fun () -> () + +[] +let main _ = + let _ = foo 1 2 + 0 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From 7f68b8db33453158af9f96874ba45653310e9254 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sun, 12 Apr 2026 22:06:25 +0200 Subject: [PATCH 21/50] More SRTP --- src/Compiler/CodeGen/IlxGen.fs | 12 ++++++++ .../EmittedIL/DebugInlineAsCall.fs | 30 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 220462104c1..7e3c3020f8e 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -7275,6 +7275,18 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames let cloFreeTyvars = cloFreeTyvars.FreeTypars |> Zset.elements + // When generating witnesses, witness types may reference type variables that appear + // only in SRTP constraints of the captured type variables (e.g. 'b in 'a : (member M: unit -> 'b)). + // Include those so they are available when generating witness field types. + let cloFreeTyvars = + if ComputeGenerateWitnesses g eenv then + let extra = + GetTraitWitnessInfosOfTypars g 0 cloFreeTyvars + |> List.collect (fun w -> (freeInType CollectTyparsNoCaching (GenWitnessTy g w)).FreeTypars |> Zset.elements) + (cloFreeTyvars @ extra) |> List.distinctBy (fun tp -> tp.Stamp) + else + cloFreeTyvars + let eenvinner = eenv |> EnvForTypars cloFreeTyvars let ilCloTyInner = diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 4f814e9d7f6..69a4df4a23a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -653,6 +653,36 @@ let main _ = |> compileAndRun |> shouldSucceed + [] + let ``SRTP 18 - Type abbreviation with constraint`` () = + let additionalSource = FsSourceWithFileName "Program.fs" """ +module Program + +open Module + +type T() = member _.M() = 42 + +let inline foo (a: 'a) = C.F(a); fun () -> () + +[] +let main _ = + let _ = foo (T()) + 0 +""" + FSharpWithFileName "Module.fs" """ +module Module + +type C<'a, 'b when 'a: (member M: unit -> 'b)> = 'a + +type C = static member inline F<'a, 'b, 'c when C<'a, 'b>>(_a: 'a) = () +""" + |> withAdditionalSourceFile additionalSource + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From 7229e864dcc0b479237513efb82c2f606fc6dd09 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 13 Apr 2026 12:30:20 +0200 Subject: [PATCH 22/50] Accessibility --- src/Compiler/Optimize/Optimizer.fs | 121 +++++++++--------- .../EmittedIL/DebugInlineAsCall.fs | 94 +++++++++++++- 2 files changed, 156 insertions(+), 59 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index f964a6db147..427c4baa72e 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -1355,8 +1355,9 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary (cenv: cenv) mhi = then detailR else ValValue (vref2, detailR) - // Check for escape in lambda - | CurriedLambdaValue (_, _, _, expr, _) | ConstExprValue(_, expr) when + // Check for escape in lambda + | CurriedLambdaValue (_, _, _, expr, _) | ConstExprValue(_, expr) when + cenv.settings.inlineNamedFunctions && (let fvs = freeInExpr CollectAll expr (isAssemblyBoundary && not (freeVarsAllPublic fvs)) || Zset.exists hiddenVal fvs.FreeLocals || @@ -1403,7 +1404,9 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary (cenv: cenv) mhi = { ModuleOrNamespaceInfos = NameMap.map abstractLazyModulInfo ss.ModuleOrNamespaceInfos ValInfos = ValInfos(ss.ValInfos.Entries - |> Seq.filter (fun (vref, _) -> not (hiddenVal vref.Deref)) + |> Seq.filter (fun (vref, _) -> + not (hiddenVal vref.Deref) || + (not cenv.settings.inlineNamedFunctions && vref.Deref.ShouldInline)) |> Seq.map (fun (vref, e) -> check cenv vref (abstractValInfo e) )) } and abstractLazyModulInfo (ss: LazyModuleInfo) = @@ -3102,7 +3105,8 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, failwith "tuple, union and record values cannot be marked 'inline'" | UnknownValue when shouldInline -> - warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)) + if cenv.settings.inlineNamedFunctions then + warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)) None | _ when shouldInline -> @@ -3151,7 +3155,7 @@ and OptimizeVal cenv env expr (v: ValRef, m) = e, AddValEqualityInfo g m v einfo | None -> - if v.ShouldInline then + if v.ShouldInline && cenv.settings.inlineNamedFunctions then match valInfoForVal.ValExprInfo with | UnknownValue -> error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) | _ -> warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) @@ -3443,67 +3447,68 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg match cenv.settings.inlineNamedFunctions, stripExpr valExpr with | false, Expr.Val(vref, _, _) when vref.ShouldInline && not (shouldForceInlineInDebug cenv.g vref) -> - let origFinfo = GetInfoForValWithCheck cenv env m vref - match stripValue origFinfo.ValExprInfo with - | CurriedLambdaValue(origLambdaId, _, _, origLambda, origLambdaTy) when not (Zset.contains origLambdaId env.dontInline) -> - let argsR = args |> List.map (OptimizeExpr cenv env >> fst) - let info = { TotalSize = 1; FunctionSize = 1; HasEffect = true; MightMakeCriticalTailcall = false; Info = UnknownValue } + let hasNoTraits = + let tps, _ = tryDestForallTy g vref.Type + GetTraitConstraintInfosOfTypars g tps |> List.isEmpty - let hasNoTraits = - let tps, _ = tryDestForallTy g vref.Type - GetTraitConstraintInfosOfTypars g tps |> List.isEmpty + let allTyargsAreConcrete = + tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) - let allTyargsAreConcrete = - tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) + let allTyargsAreGeneric = + tyargs |> List.forall (fun t -> not (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) - let allTyargsAreGeneric = - tyargs |> List.forall (fun t -> not (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) + let canCallDirectly = + hasNoTraits || (allTyargsAreGeneric && vref.ValReprInfo.IsSome) - let canCallDirectly = - hasNoTraits || (allTyargsAreGeneric && vref.ValReprInfo.IsSome) + let argsR = args |> List.map (OptimizeExpr cenv env >> fst) + let info = { TotalSize = 1; FunctionSize = 1; HasEffect = true; MightMakeCriticalTailcall = false; Info = UnknownValue } - if canCallDirectly then - Some(mkApps g ((exprForValRef m vref, vref.Type), [tyargs], argsR, m), info) - else - let f2R = CopyExprForInlining cenv true origLambda m - let specLambda = MakeApplicationAndBetaReduce g (f2R, origLambdaTy, [tyargs], [], m) - let specLambdaTy = tyOfExpr g specLambda + if canCallDirectly then + Some(mkApps g ((exprForValRef m vref, vref.Type), [tyargs], argsR, m), info) + else - let specLambdaR = + let origFinfo = GetInfoForValWithCheck cenv env m vref + match stripValue origFinfo.ValExprInfo with + | CurriedLambdaValue(origLambdaId, _, _, origLambda, origLambdaTy) when not (Zset.contains origLambdaId env.dontInline) -> + let f2R = CopyExprForInlining cenv true origLambda m + let specLambda = MakeApplicationAndBetaReduce g (f2R, origLambdaTy, [tyargs], [], m) + let specLambdaTy = tyOfExpr g specLambda + + let specLambdaR = + if allTyargsAreConcrete then + match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _) -> typeEquiv g ty specLambdaTy) with + | Some (_, body) -> copyExpr g CloneAll body + | None -> + + let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, specLambdaR)) + specLambdaR + else + let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + specLambdaR + + let specLambdaR = + match specLambdaR with + | Expr.Lambda(uniq, a, b, c, d, _, ty) -> Expr.Lambda(uniq, a, b, c, d, m, ty) + | Expr.TyLambda(uniq, a, b, _, ty) -> Expr.TyLambda(uniq, a, b, m, ty) + | _ -> specLambdaR + + let debugVal = + let name = $"<{vref.LogicalName}>__debug" + // When tyargs have free type variables, omit ValReprInfo so IlxGen compiles this + // as a closure that captures type variables and witnesses from the enclosing scope. + let valReprInfo = if allTyargsAreConcrete then - match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _) -> typeEquiv g ty specLambdaTy) with - | Some (_, body) -> copyExpr g CloneAll body - | None -> - - let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda - cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, specLambdaR)) - specLambdaR + Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) else - let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda - specLambdaR - - let specLambdaR = - match specLambdaR with - | Expr.Lambda(uniq, a, b, c, d, _, ty) -> Expr.Lambda(uniq, a, b, c, d, m, ty) - | Expr.TyLambda(uniq, a, b, _, ty) -> Expr.TyLambda(uniq, a, b, m, ty) - | _ -> specLambdaR - - let debugVal = - let name = $"<{vref.LogicalName}>__debug" - // When tyargs have free type variables, omit ValReprInfo so IlxGen compiles this - // as a closure that captures type variables and witnesses from the enclosing scope. - let valReprInfo = - if allTyargsAreConcrete then - Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) - else - None - - Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, - NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, - ParentNone) - - let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) - Some(mkCompGenLet m debugVal specLambdaR callExpr, info) + None + + Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, + NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, + ParentNone) + + let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) + Some(mkCompGenLet m debugVal specLambdaR callExpr, info) | _ -> None | _ -> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 69a4df4a23a..342ac0f8a89 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -836,4 +836,96 @@ type T() = |> withNoOptimize |> asLibrary |> compile - |> shouldSucceed \ No newline at end of file + |> shouldSucceed + + [] + let ``Accessibility 03`` () = + let library = + FSharp """ +module Lib + +type T() = + member inline internal _.F(x) = x + member inline this.G(x) = this.F(x) +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> withName "lib" + + FSharp """ +module App +let r = Lib.T().G(1) +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> compile + |> shouldSucceed + + + [] + let ``Accessibility 04`` () = + let library = + FSharp """ +module MyLib + +let inline internal addInternal (x: ^T) (y: ^T) = x + y +let inline addPublic (x: ^T) (y: ^T) = addInternal x y +""" + |> withDebug + |> withNoOptimize + |> asLibrary + + FSharp """ +open MyLib + +[] +let main _ = + let i = addPublic 3 4 + if i = 7 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``Accessibility 05`` () = + let library = + FSharp """ +module Module + +type MyNum = + { Value: float } + static member FromFloat (_: MyNum) = fun (x: float) -> { Value = x } + +type T = + static member inline internal InvokeInternal(x: float) : 'Num = + let inline call (a: ^a) = (^a: (static member FromFloat : _ -> _) a) + call Unchecked.defaultof<'Num> x + + static member inline Invoke(x: float) : 'Num = + T.InvokeInternal<'Num>(x) +""" + |> withDebug + |> withNoOptimize + |> asLibrary + |> withName "Library" + + FSharp """ +open Module + +[] +let main _ = + let result = T.Invoke(3.14) + if result.Value = 3.14 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed From 12c326d6db9cdd5baea523d968853b77fc4c9c50 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 13 Apr 2026 12:54:19 +0200 Subject: [PATCH 23/50] Fantomas --- src/Compiler/CodeGen/IlxGen.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 7e3c3020f8e..8e6bf731dd2 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -7282,7 +7282,10 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames if ComputeGenerateWitnesses g eenv then let extra = GetTraitWitnessInfosOfTypars g 0 cloFreeTyvars - |> List.collect (fun w -> (freeInType CollectTyparsNoCaching (GenWitnessTy g w)).FreeTypars |> Zset.elements) + |> List.collect (fun w -> + (freeInType CollectTyparsNoCaching (GenWitnessTy g w)).FreeTypars + |> Zset.elements) + (cloFreeTyvars @ extra) |> List.distinctBy (fun tp -> tp.Stamp) else cloFreeTyvars From 622d88ab516edcd3a5a66f72849436e4a14e2ca8 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 13 Apr 2026 16:37:40 +0200 Subject: [PATCH 24/50] Inline when extra optimization loops --- src/Compiler/Driver/CompilerConfig.fs | 10 +++++++++- src/Compiler/Driver/CompilerConfig.fsi | 2 +- src/Compiler/Driver/OptimizeInputs.fs | 9 ++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index 6075a7a32a7..ed8d7914497 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -1256,7 +1256,15 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member _.fsiMultiAssemblyEmit = data.fsiMultiAssemblyEmit member _.FxResolver = data.FxResolver member _.strictIndentation = data.strictIndentation - member _.inlineNamedFunctions = data.inlineNamedFunctions + + member _.inlineNamedFunctions = + data.inlineNamedFunctions + |> Option.defaultValue ( + not data.debuginfo + || data.optSettings.LocalOptimizationsEnabled + || data.extraOptimizationIterations > 0 + ) + member _.primaryAssembly = data.primaryAssembly member _.noFeedback = data.noFeedback member _.stackReserveSize = data.stackReserveSize diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index 85ce24133a6..b81a37917c5 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -816,7 +816,7 @@ type TcConfig = member strictIndentation: bool option - member inlineNamedFunctions: bool option + member inlineNamedFunctions: bool member GetTargetFrameworkDirectories: unit -> string list diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index 81825929f3b..120285358a3 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -327,9 +327,7 @@ let ApplyAllOptimizations // Only do abstractBigTargets in the first phase, and only when TLR is on. abstractBigTargets = tcConfig.doTLR reportingPhase = true - inlineNamedFunctions = - tcConfig.inlineNamedFunctions - |> Option.defaultValue (not tcConfig.debuginfo || tcConfig.optSettings.LocalOptimizationsEnabled) + inlineNamedFunctions = tcConfig.inlineNamedFunctions } // Only do these two steps in the first phase. @@ -337,7 +335,6 @@ let ApplyAllOptimizations { firstLoopSettings with abstractBigTargets = false reportingPhase = false - inlineNamedFunctions = false } let addPhaseDiagnostics (f: PhaseFunc) (info: Phase) = @@ -582,9 +579,7 @@ let GenerateIlxCode isInteractiveItExpr = isInteractiveItExpr alwaysCallVirt = tcConfig.alwaysCallVirt parallelIlxGenEnabled = tcConfig.parallelIlxGen - inlineNamedFunctions = - tcConfig.inlineNamedFunctions - |> Option.defaultValue (not tcConfig.debuginfo || tcConfig.optSettings.LocalOptimizationsEnabled) + inlineNamedFunctions = tcConfig.inlineNamedFunctions } ilxGenerator.GenerateCode(ilxGenOpts, optimizedImpls, topAttrs.assemblyAttrs, topAttrs.netModuleAttrs) From f01622f97c148702e3905921277f149db85a7e75 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 13 Apr 2026 17:13:50 +0200 Subject: [PATCH 25/50] Specialize signature-hidden values --- src/Compiler/Optimize/Optimizer.fs | 27 +++++-- .../EmittedIL/DebugInlineAsCall.fs | 80 +++++++++++++++++++ 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 427c4baa72e..35d6fa4a959 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -435,6 +435,8 @@ type cenv = realsig: bool specializedInlineVals: HashMultiMap + + signatureHidingInfo: SignatureHidingInfo } override x.ToString() = "" @@ -3457,8 +3459,14 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let allTyargsAreGeneric = tyargs |> List.forall (fun t -> not (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) + // When inside an inline function body being prepared for export (!cenv.optimizing), + // only emit a direct call if the callee is publicly accessible. Non-public vals + // (e.g. in internal modules, or hidden by .fsi) can't be called by consumers, + // so route those through the specialization path which inlines the body. + let isHiddenBySignature = cenv.signatureHidingInfo.HiddenVals.Contains vref.Deref let canCallDirectly = - hasNoTraits || (allTyargsAreGeneric && vref.ValReprInfo.IsSome) + (cenv.optimizing || (vref.Accessibility.IsPublic && not isHiddenBySignature)) && + (hasNoTraits || (allTyargsAreGeneric && vref.ValReprInfo.IsSome)) let argsR = args |> List.map (OptimizeExpr cenv env >> fst) let info = { TotalSize = 1; FunctionSize = 1; HasEffect = true; MightMakeCriticalTailcall = false; Info = UnknownValue } @@ -4329,17 +4337,23 @@ and OptimizeBindings cenv isRec env xs = and OptimizeModuleExprWithSig cenv env mty def = let g = cenv.g - // Optimize the module implementation - let (def, info), (_env, bindInfosColl) = OptimizeModuleContents cenv (env, []) def - let bindInfosColl = List.concat bindInfosColl - + // Compute the elements truly hidden by the module signature. // The hidden set here must contain NOT MORE THAN the set of values made inaccessible by // the application of the signature. If it contains extra elements we'll accidentally eliminate // bindings. - + // This only walks structural elements (Val/Entity declarations), not expressions, + // so it gives the same result before and after optimization. let _renaming, hidden as rpi = ComputeRemappingFromImplementationToSignature g def mty + // Make hiding info available during optimization so TryInlineApplication + // can avoid emitting direct calls to vals hidden by signature. + let cenv = { cenv with signatureHidingInfo = hidden } + + // Optimize the module implementation + let (def, info), (_env, bindInfosColl) = OptimizeModuleContents cenv (env, []) def + let bindInfosColl = List.concat bindInfosColl + let def = if not cenv.settings.LocalOptimizationsEnabled then def else @@ -4505,6 +4519,7 @@ let OptimizeImplFile (settings, ccu, tcGlobals, tcVal, importMap, optEnv, isIncr stackGuard = StackGuard("OptimizerStackGuardDepth") realsig = tcGlobals.realsig specializedInlineVals = HashMultiMap(HashIdentity.Structural, true) + signatureHidingInfo = SignatureHidingInfo.Empty } let env, _, _, _ as results = OptimizeImplFileInternal cenv optEnv isIncrementalFragment hidden mimpls diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 342ac0f8a89..dcfb2f90295 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -922,6 +922,86 @@ open Module let main _ = let result = T.Invoke(3.14) if result.Value = 3.14 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``Accessibility 06`` () = + let impl = + FsSource """ +module Lib + +module internal Impl = + let inline implFn (x: int) = + x * x + +let inline publicFn (x: int) = + Impl.implFn x + 1 +""" + let fsi = Fsi """ +module Lib + +val inline publicFn: x: int -> int +""" + let library = + fsi + |> withAdditionalSourceFile impl + |> withDebug + |> withNoOptimize + |> asLibrary + + FSharp """ +open Lib + +[] +let main _ = + let i = publicFn 3 + if i = 10 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``Accessibility 07`` () = + let impl = + FsSource """ +module Lib + +module Impl = + let inline implFn (x: int) = + x * x + +let inline publicFn (x: int) = + Impl.implFn x + 1 +""" + let fsi = Fsi """ +module Lib + +val inline publicFn: x: int -> int +""" + let library = + fsi + |> withAdditionalSourceFile impl + |> withDebug + |> withNoOptimize + |> asLibrary + + FSharp """ +open Lib + +[] +let main _ = + let i = publicFn 3 + if i = 10 then 0 else 1 """ |> withDebug |> withNoOptimize From e4d09645b771a742bfc1f8f33fe571b73a051ee4 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 14 Apr 2026 12:59:48 +0200 Subject: [PATCH 26/50] Byref --- src/Compiler/Optimize/Optimizer.fs | 6 +- .../EmittedIL/DebugInlineAsCall.fs | 147 +++++++++++++++++- 2 files changed, 146 insertions(+), 7 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 35d6fa4a959..1bd83c562ab 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3507,7 +3507,11 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg // as a closure that captures type variables and witnesses from the enclosing scope. let valReprInfo = if allTyargsAreConcrete then - Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) + match vref.ValReprInfo with + | Some(ValReprInfo(_, argInfos, retInfo)) -> + Some(ValReprInfo([], argInfos, retInfo)) + | None -> + Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) else None diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index dcfb2f90295..36de5f4536f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -171,7 +171,7 @@ let inline triple (x: int) = x + x + x |> withDebug |> withNoOptimize |> asLibrary - |> withName "mylib" + |> withName "Lib" FSharp """ open MyLib @@ -186,7 +186,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun - |> verifyILContains ["call int32 [mylib]MyLib::triple(int32)"] + |> verifyILContains ["call int32 [Lib]MyLib::triple(int32)"] |> shouldSucceed [] @@ -230,6 +230,51 @@ let main _ = "callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0)" ] |> shouldSucceed + [] + let ``Call 13`` () = + FSharp """ +[] +let inline f x = x + 1 + +let inline g x = f x + +g 1 |> ignore +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + + [] + let ``Call 14`` () = + FSharp """ +[] +let inline f x = x + 1 + +let inline g (x: ^T) (y: ^T) = f (x + y) + +g 1 2 |> ignore +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + + [] + let ``Call 15`` () = + FSharp """ +[] +let inline f (x: ^T) = x + +let inline g (x: ^T) (y: ^T) = f (x + y) + +g 1 2 |> ignore +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + [] let ``SRTP 01`` () = FSharp """ @@ -316,7 +361,6 @@ let inline add (x: ^T) (y: ^T) = x + y |> withDebug |> withNoOptimize |> asLibrary - |> withName "mylib2" FSharp """ open MyLib @@ -345,7 +389,6 @@ let inline add (x: ^T) (y: ^T) = x + y |> withDebug |> withNoOptimize |> asLibrary - |> withName "mylib3" FSharp """ open MyLib @@ -683,6 +726,100 @@ type C = static member inline F<'a, 'b, 'c when C<'a, 'b>>(_a: 'a) = () |> compileAndRun |> shouldSucceed + [] + let ``SRTP 19 - byref`` () = + FSharp """ +let inline f<'T, 'U when 'T: (member M: byref<'U> -> unit)> (x: byref<'T>, y: byref<'U>) = + x.M(&y) + +[] +type S = + member _.M(x: byref) = x <- 42 + +[] +let main _ = + let mutable s = S() + let mutable v = 0 + f(&s, &v) + if v = 42 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``SRTP 20 - byref`` () = + let library = + FSharp """ +module MyLib + +let inline f<'T, 'U when 'T: (member M: byref<'U> -> unit)> (x: byref<'T>, y: byref<'U>) = + x.M(&y) +""" + |> withDebug + |> withNoOptimize + |> asLibrary + + FSharp """ +open MyLib + +[] +type S = + member _.M(x: byref) = x <- 42 + +[] +let main _ = + let mutable s = S() + let mutable v = 0 + f(&s, &v) + if v = 42 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``SRTP 21 - byref`` () = + let library = + FSharp """ +module MyLib + +let inline f<'T, 'U when 'T: (member M: byref<'U> -> unit)> (x: byref<'T>, y: byref<'U>) = + x.M(&y) + +let inline g<'T, 'U when 'T: (member M: byref<'U> -> unit)> (x: byref<'T>, y: byref<'U>) = + f(&x, &y) +""" + |> withDebug + |> withNoOptimize + |> asLibrary + + FSharp """ +open MyLib + +[] +type S = + member _.M(x: byref) = x <- 42 + +[] +let main _ = + let mutable s = S() + let mutable v = 0 + g(&s, &v) + if v = 42 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> withReferences [library] + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ @@ -851,7 +988,6 @@ type T() = |> withDebug |> withNoOptimize |> asLibrary - |> withName "lib" FSharp """ module App @@ -913,7 +1049,6 @@ type T = |> withDebug |> withNoOptimize |> asLibrary - |> withName "Library" FSharp """ open Module From 9e3f529f7ed9515921772b7b1728ca96bd5cf36f Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 14 Apr 2026 15:09:27 +0200 Subject: [PATCH 27/50] Add more tests --- .../EmittedIL/DebugInlineAsCall.fs | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 36de5f4536f..d2a90331e4f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -244,6 +244,9 @@ g 1 |> ignore |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call int32 Test::g(int32)"] + |> shouldSucceed + |> verifyILNotPresent ["Test::'__debug"] [] let ``Call 14`` () = @@ -259,6 +262,9 @@ g 1 2 |> ignore |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@7'(int32,"] + |> shouldSucceed + |> verifyILNotPresent ["Test::'__debug"] [] let ``Call 15`` () = @@ -274,6 +280,9 @@ g 1 2 |> ignore |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@7'(int32,"] + |> shouldSucceed + |> verifyILNotPresent ["Test::'__debug"] [] let ``SRTP 01`` () = @@ -474,6 +483,9 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains + [ "call int32 Test::'__debug@8'(int32," + "call float64 Test::'__debug@9-1'(float64," ] |> shouldSucceed [] @@ -551,6 +563,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call void Test::'__debug@16'(class Test/T)"] |> shouldSucceed [] @@ -580,6 +593,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["Test::'__debug@19'()"] |> shouldSucceed [] @@ -613,6 +627,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@23'(valuetype Test/S`1)"] |> shouldSucceed [] @@ -636,6 +651,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@13'(valuetype Test/S`1)"] |> shouldSucceed [] @@ -664,6 +680,7 @@ type U = static member inline F<'a, 'b when 'a: (member M: unit -> unit)>(_a: 'a |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["Program::'__debug@10'(class Module/T)"] |> shouldSucceed [] @@ -694,6 +711,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["Test::'__debug@8'(int32,"] |> shouldSucceed [] @@ -724,6 +742,7 @@ type C = static member inline F<'a, 'b, 'c when C<'a, 'b>>(_a: 'a) = () |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["Program::'__debug@12'(class Program/T)"] |> shouldSucceed [] @@ -747,6 +766,7 @@ let main _ = |> withNoOptimize |> asExe |> compileAndRun + |> verifyILContains ["call void Test::'__debug@13'(valuetype Test/S&,"] |> shouldSucceed [] @@ -781,6 +801,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["call void Test::'__debug@12'(valuetype Test/S&,"] |> shouldSucceed [] @@ -818,6 +839,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["call void Test::'__debug@12'(valuetype Test/S&,"] |> shouldSucceed [] @@ -955,6 +977,7 @@ let inline f () = fInternal () |> withNoOptimize |> asLibrary |> compile + |> verifyILContains ["call void Module::'__debug@5'()"] |> shouldSucceed [] @@ -973,6 +996,7 @@ type T() = |> withNoOptimize |> asLibrary |> compile + |> verifyILContains ["call void Module/T::'__debug@9'(class Module/T)"] |> shouldSucceed [] @@ -997,6 +1021,7 @@ let r = Lib.T().G(1) |> withNoOptimize |> withReferences [library] |> compile + |> verifyILContains ["Lib/T::G(!!0)"] |> shouldSucceed @@ -1026,6 +1051,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["call int32 Test::'__debug@6'(int32,"] |> shouldSucceed [] @@ -1063,6 +1089,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["Test::'__debug@6'(float64)"] |> shouldSucceed [] @@ -1089,6 +1116,7 @@ val inline publicFn: x: int -> int |> withDebug |> withNoOptimize |> asLibrary + |> withName "Lib" FSharp """ open Lib @@ -1103,6 +1131,7 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["call int32 [Lib]Lib::publicFn(int32)"] |> shouldSucceed [] @@ -1129,6 +1158,7 @@ val inline publicFn: x: int -> int |> withDebug |> withNoOptimize |> asLibrary + |> withName "Lib" FSharp """ open Lib @@ -1143,4 +1173,70 @@ let main _ = |> withReferences [library] |> asExe |> compileAndRun + |> verifyILContains ["call int32 [Lib]Lib::publicFn(int32)"] + |> shouldSucceed + + [] + let ``Resumable 01`` () = + FSharp """ +open System.Threading.Tasks + +[] +let main _ = + let t = task { return 1 } + if t.Result = 1 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``Resumable 02`` () = + FSharp """ +open System.Threading.Tasks + +[] +let main _ = + let t = task { + let! x = Task.FromResult(1) + let! y = Task.FromResult(2) + return x + y + } + if t.Result = 3 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + + [] + let ``Resumable 03`` () = + FSharp """ +open Microsoft.FSharp.Core.CompilerServices +open Microsoft.FSharp.Core.CompilerServices.StateMachineHelpers +open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators + +[] +type S<'T> = member _.M(_: 'T) = () + +let inline g (_: S<'T>) = + if __useResumableCode then + __stateMachine, int> + (MoveNextMethodImpl<_>(fun _ -> ())) + (SetStateMachineMethodImpl<_>(fun _ _ -> ())) + (AfterCode<_, _>(fun _ -> 42)) + else 42 + +[] +let main _ = + let r = g (S()) + if r = 42 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun |> shouldSucceed From f6e73c1a2f829cc70d7753216eaf3532d6cd7e5c Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 15 Apr 2026 09:56:30 +0200 Subject: [PATCH 28/50] Another accessibility attempt --- src/Compiler/Optimize/Optimizer.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 1bd83c562ab..9bb418e8d03 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -1359,14 +1359,14 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary (cenv: cenv) mhi = // Check for escape in lambda | CurriedLambdaValue (_, _, _, expr, _) | ConstExprValue(_, expr) when - cenv.settings.inlineNamedFunctions && (let fvs = freeInExpr CollectAll expr - (isAssemblyBoundary && not (freeVarsAllPublic fvs)) || - Zset.exists hiddenVal fvs.FreeLocals || - Zset.exists hiddenTycon fvs.FreeTyvars.FreeTycons || Zset.exists hiddenTyconRepr fvs.FreeLocalTyconReprs || Zset.exists hiddenRecdField fvs.FreeRecdFields || - Zset.exists hiddenUnionCase fvs.FreeUnionCases ) -> + Zset.exists hiddenUnionCase fvs.FreeUnionCases || + (cenv.settings.inlineNamedFunctions && + ((isAssemblyBoundary && not (freeVarsAllPublic fvs)) || + Zset.exists hiddenVal fvs.FreeLocals || + Zset.exists hiddenTycon fvs.FreeTyvars.FreeTycons))) -> UnknownValue // Check for escape in constant From cdf3bac79c9028560a4117c4e79b623abff3879c Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 15 Apr 2026 12:14:48 +0200 Subject: [PATCH 29/50] Fix inlined definition check --- src/Compiler/Optimize/Optimizer.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 9bb418e8d03..87f06d157e0 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -1701,7 +1701,7 @@ let TryEliminateBinding cenv _env bind e2 _m = not vspec1.IsCompilerGenerated then None elif vspec1.IsFixed then None - elif vspec1.InlineInfo = ValInline.InlinedDefinition then None + elif not cenv.settings.inlineNamedFunctions && vspec1.InlineInfo = ValInline.InlinedDefinition then None elif vspec1.LogicalName.StartsWithOrdinal stackVarPrefix || vspec1.LogicalName.Contains suffixForVariablesThatMayNotBeEliminated then None else @@ -3972,7 +3972,7 @@ and OptimizeLambdas (vspec: Val option) cenv env valReprInfo expr exprTy = // can't inline any values with semi-recursive object references to self or base let value_ = match vspec with - | Some v when v.InlineInfo = ValInline.InlinedDefinition -> UnknownValue + | Some v when not cenv.settings.inlineNamedFunctions && v.InlineInfo = ValInline.InlinedDefinition -> UnknownValue | _ -> match baseValOpt with From e0088728db3517477fc9f2b7d61f05b1fcad0385 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 15 Apr 2026 12:56:35 +0200 Subject: [PATCH 30/50] Fix referencing debug builds from optimized --- src/Compiler/Optimize/Optimizer.fs | 10 +++--- .../EmittedIL/DebugInlineAsCall.fs | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 87f06d157e0..562baaa7c1c 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3094,7 +3094,9 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, | ConstExprValue(_size, expr) -> Some (remarkExpr m (copyExpr g CloneAllAndMarkExprValsAsCompilerGenerated expr)) - | CurriedLambdaValue (_, _, _, expr, _) when shouldInline || inlineIfLambda -> + | CurriedLambdaValue (_, _, _, expr, _) when + shouldInline && (cenv.settings.inlineNamedFunctions || Option.exists (shouldForceInlineInDebug cenv.g) vOpt) || + inlineIfLambda -> let fvs = freeInExpr CollectLocals expr if fvs.UsesMethodLocalConstructs then // Discarding lambda for binding because uses protected members --- TBD: Should we warn or error here @@ -3111,7 +3113,7 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)) None - | _ when shouldInline -> + | _ when shouldInline && cenv.settings.inlineNamedFunctions -> warning(Error(FSComp.SR.optValueMarkedInlineCouldNotBeInlined(), m)) None @@ -3971,10 +3973,6 @@ and OptimizeLambdas (vspec: Val option) cenv env valReprInfo expr exprTy = // can't inline any values with semi-recursive object references to self or base let value_ = - match vspec with - | Some v when not cenv.settings.inlineNamedFunctions && v.InlineInfo = ValInline.InlinedDefinition -> UnknownValue - | _ -> - match baseValOpt with | None -> CurriedLambdaValue (lambdaId, arities, bsize, exprR, exprTy) | Some baseVal -> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index d2a90331e4f..24c401679dc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -284,6 +284,41 @@ g 1 2 |> ignore |> shouldSucceed |> verifyILNotPresent ["Test::'__debug"] + [] + let ``Call 16 - Debug lib called from optimized app`` () = + let lib = + FSharp """ +module Module + +let inline double (x: int) = x + x + +let inline quadruple (x: int) = double (double x) +""" + |> withDebug + |> withNoOptimize + |> asLibrary + + lib + |> compile + |> verifyILContains ["call int32 Module::double(int32)"] + |> shouldSucceed + |> ignore + + FSharp """ +open Module + +[] +let main (args: string[]) = + let i = quadruple args.Length + i +""" + |> withOptimize + |> withReferences [lib] + |> asExe + |> compile + |> verifyILContains ["add"] |> shouldSucceed + |> verifyILNotPresent ["quadruple"; "double"] + [] let ``SRTP 01`` () = FSharp """ From e7051b6af2fdc95fa70a4025b2ae0903d346e082 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 15 Apr 2026 17:22:12 +0200 Subject: [PATCH 31/50] Nested inline with different type args --- src/Compiler/Optimize/Optimizer.fs | 33 ++++++++++++++----- .../EmittedIL/DebugInlineAsCall.fs | 23 +++++++++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 562baaa7c1c..48b24c2ebbc 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -451,8 +451,12 @@ type IncrementalOptimizationEnv = { /// An identifier to help with name generation latestBoundId: Ident option - /// The set of lambda IDs we've inlined to reach this point. Helps to prevent recursive inlining - dontInline: Zset + /// Prevents recursive inlining/specialization. Maps lambda ID to a list of specialized types + /// currently being processed. An empty list means "block unconditionally" (used by normal + /// inlining and non-concrete debug specialization). A non-empty list means "block only these + /// specific type specializations" (used by concrete debug specialization, allowing different + /// type instantiations of the same function to proceed). + dontInline: Map /// Recursively bound vars. If an sub-expression that is a candidate for method splitting /// contains any of these variables then don't split it, for fear of mucking up tailcalls. @@ -476,7 +480,7 @@ type IncrementalOptimizationEnv = static member Empty = { latestBoundId = None - dontInline = Zset.empty Int64.order + dontInline = Map.empty typarInfos = [] functionVal = None dontSplitVars = ValMap.Empty @@ -3479,22 +3483,35 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let origFinfo = GetInfoForValWithCheck cenv env m vref match stripValue origFinfo.ValExprInfo with - | CurriedLambdaValue(origLambdaId, _, _, origLambda, origLambdaTy) when not (Zset.contains origLambdaId env.dontInline) -> + | CurriedLambdaValue(origLambdaId, _, _, origLambda, origLambdaTy) -> let f2R = CopyExprForInlining cenv true origLambda m let specLambda = MakeApplicationAndBetaReduce g (f2R, origLambdaTy, [tyargs], [], m) let specLambdaTy = tyOfExpr g specLambda + // For concrete type args, only block the exact same (stamp, type) pair, allowing different + // type instantiations to proceed (e.g. sumint> calling sum in its body). + // For non-concrete type args, block unconditionally. + let shouldInline = + match Map.tryFind origLambdaId env.dontInline with + | Some tys -> not allTyargsAreConcrete || tys.IsEmpty || tys |> List.exists (typeEquiv g specLambdaTy) + | None -> false + + if shouldInline then + None else + let specLambdaR = if allTyargsAreConcrete then match cenv.specializedInlineVals.FindAll(origLambdaId) |> List.tryFind (fun (ty, _) -> typeEquiv g ty specLambdaTy) with | Some (_, body) -> copyExpr g CloneAll body | None -> - let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + let existingTypes = defaultArg (Map.tryFind origLambdaId env.dontInline) [] + let env = { env with dontInline = Map.add origLambdaId (specLambdaTy :: existingTypes) env.dontInline } + let specLambdaR, _ = OptimizeExpr cenv env specLambda cenv.specializedInlineVals.Add(origLambdaId, (specLambdaTy, specLambdaR)) specLambdaR else - let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Zset.add origLambdaId env.dontInline } specLambda + let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Map.add origLambdaId [] env.dontInline } specLambda specLambdaR let specLambdaR = @@ -3535,7 +3552,7 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg cenv.settings.InlineLambdas && not finfo.HasEffect && // Don't inline recursively! - not (Zset.contains lambdaId env.dontInline) && + not (Map.containsKey lambdaId env.dontInline) && (// Check the number of argument groups is enough to saturate the lambdas of the target. (if tyargs |> List.exists (fun t -> match t with TType_measure _ -> false | _ -> true) then 1 else 0) + args.Length = arities && if size <= cenv.settings.lambdaInlineThreshold + args.Length then true @@ -3607,7 +3624,7 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg // Inlining: beta reducing let exprR = MakeApplicationAndBetaReduce g (f2R, f2ty, [tyargs], argsR, m) // Inlining: reoptimizing - Some(OptimizeExpr cenv {env with dontInline= Zset.add lambdaId env.dontInline} exprR) + Some(OptimizeExpr cenv {env with dontInline = Map.add lambdaId [] env.dontInline} exprR) | _ -> None diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 24c401679dc..406ada61691 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -877,6 +877,29 @@ let main _ = |> verifyILContains ["call void Test::'__debug@12'(valuetype Test/S&,"] |> shouldSucceed + [] + let ``SRTP 22 - Recursive inline with different type arg`` () = + FSharp """ +type T = T with + static member ($) (T, _:int) = (+) + static member ($) (T, _:decimal) = (+) + +let inline sum (i:'a) (x:'a) :'r = (T $ Unchecked.defaultof<'r>) i x + +type T with + static member inline ($) (T, _:'t -> 'rest) = fun (a:'t) x -> sum (x + a) + +[] +let main _ = + let y:int = sum 2 3 4 + if y = 9 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From 242df1ecc8561f46e655cb5eaff30fd3defcdcb8 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 16 Apr 2026 16:17:49 +0200 Subject: [PATCH 32/50] Pickle ValInline.InlinedDefinition as ValInline.Always --- src/Compiler/TypedTree/TypedTree.fs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Compiler/TypedTree/TypedTree.fs b/src/Compiler/TypedTree/TypedTree.fs index b1f65a35062..ce7ebc7db36 100644 --- a/src/Compiler/TypedTree/TypedTree.fs +++ b/src/Compiler/TypedTree/TypedTree.fs @@ -243,7 +243,12 @@ type ValFlags(flags: int64) = // Clear the IsCompiledAsStaticPropertyWithoutField, only used to determine whether to use a true field for a value, and to eliminate the optimization info for observable bindings // Clear the HasBeenReferenced, only used to report "unreferenced variable" warnings and to help collect 'it' values in FSI.EXE // Clear the IsGeneratedEventVal, since there's no use in propagating specialname information for generated add/remove event vals - (flags &&& ~~~0b010011001100000000000L) + let bits = (flags &&& ~~~0b010011001100000000000L) + // Pickle ValInline.InlinedDefinition as ValInline.Always. + if bits &&& 0b00000000000000110000L = 0L then + bits ||| 0b00000000000000010000L + else + bits /// Represents the kind of a type parameter [] From 0b4b827b5510980ca370d29d17dbd362323017da Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 18 Apr 2026 11:37:46 +0200 Subject: [PATCH 33/50] Better cross-file name collision fix --- src/Compiler/CodeGen/IlxGen.fs | 14 +++++- src/Compiler/Optimize/Optimizer.fs | 6 --- .../EmittedIL/DebugInlineAsCall.fs | 44 +++++++++++++++++++ 3 files changed, 57 insertions(+), 7 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 8e6bf731dd2..f64d8bcf7c4 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -7217,7 +7217,19 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames let cloName = // Ensure that we have an g.CompilerGlobalState assert (g.CompilerGlobalState |> Option.isSome) - g.CompilerGlobalState.Value.StableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename, expr.Range, uniq) + // The closure name counter is keyed by (basicName, fileIndex). When an expression is copied + // from another file (e.g. specializing an inline function body across files), its ranges + // still point at the original file, so its closures fall into a different counter bucket + // than closures minted for the current file. Since all these closures live under the same + // enclosing type, that can produce two closures with the same final name. Bucket the counter + // by the enclosing type's file while keeping expr.Range's StartLine for the displayed name. + let nameRange = + if expr.Range.FileIndex = eenv.cloc.Range.FileIndex then + expr.Range + else + Range.mkFileIndexRange eenv.cloc.Range.FileIndex expr.Range.Start expr.Range.End + + g.CompilerGlobalState.Value.StableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename, nameRange, uniq) let ilCloTypeRef = NestedTypeRefForCompLoc eenv.cloc cloName diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 48b24c2ebbc..f2dc0e7cfe8 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3514,12 +3514,6 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Map.add origLambdaId [] env.dontInline } specLambda specLambdaR - let specLambdaR = - match specLambdaR with - | Expr.Lambda(uniq, a, b, c, d, _, ty) -> Expr.Lambda(uniq, a, b, c, d, m, ty) - | Expr.TyLambda(uniq, a, b, _, ty) -> Expr.TyLambda(uniq, a, b, m, ty) - | _ -> specLambdaR - let debugVal = let name = $"<{vref.LogicalName}>__debug" // When tyargs have free type variables, omit ValReprInfo so IlxGen compiles this diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 406ada61691..42e466a143b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -900,6 +900,50 @@ let main _ = |> compileAndRun |> shouldSucceed + [] + let ``SRTP 23 - Cross-file specialization with nested closures at same line`` () = + // Two specializations in wrap's body each contain nested closures whose ranges are in the + // other file. Without bucketing the closure-name counter by the enclosing type's file, the + // two nested closures end up with identical names ('wrap@12-1') and ilwrite rejects them + // with FS2014 duplicate entry in type index table. + let additionalSource = FsSourceWithFileName "Program.fs" """ +module Program +open Module + + +let inline wrap source = + let mutable state = false + monad' { + match state with + | true -> return false + | _ -> + let! _ = source + state <- true + return true } +""" + FSharpWithFileName "Module.fs" """ +module Module +type Bind = + static member inline Invoke (s: 'M) (b: 'T -> 'U) = + ((^M or ^U) : (static member (>>=) : _*_ -> _) s, b) + +type Return = + static member Return (_: 'T list, _: Return) : 'T -> 'T list = Unchecked.defaultof<_> + static member inline Invoke (x: 'T) = + (^A : (static member Return : 'T -> ^A) x) + +type MonadBuilder () = + member inline _.Return x = Return.Invoke x + member inline _.Bind (p, r) = Bind.Invoke p r +let monad' = MonadBuilder () +""" + |> withAdditionalSourceFile additionalSource + |> withDebug + |> withNoOptimize + |> asLibrary + |> compile + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From 33a555343e14bcbd4f90644a27b88e6188142519 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 18 Apr 2026 14:37:13 +0200 Subject: [PATCH 34/50] Better byref fix --- src/Compiler/Optimize/Optimizer.fs | 66 ++++++++++---- .../EmittedIL/DebugInlineAsCall.fs | 91 +++++++++++++++++++ 2 files changed, 137 insertions(+), 20 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index f2dc0e7cfe8..ec54deb2537 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3459,9 +3459,6 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let tps, _ = tryDestForallTy g vref.Type GetTraitConstraintInfosOfTypars g tps |> List.isEmpty - let allTyargsAreConcrete = - tyargs |> List.forall (fun t -> (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) - let allTyargsAreGeneric = tyargs |> List.forall (fun t -> not (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) @@ -3488,6 +3485,15 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let specLambda = MakeApplicationAndBetaReduce g (f2R, origLambdaTy, [tyargs], [], m) let specLambdaTy = tyOfExpr g specLambda + // Typars that flow in from the enclosing scope when tyargs are non-concrete. + // specLambdaTy is closed over the vref's typars after beta-reduction, so its free + // typars are exactly the ones carried in by tyargs. + let freeTypars = + (freeInType CollectTyparsNoCaching specLambdaTy).FreeTypars + |> Zset.elements + + let allTyargsAreConcrete = List.isEmpty freeTypars + // For concrete type args, only block the exact same (stamp, type) pair, allowing different // type instantiations to proceed (e.g. sumint> calling sum in its body). // For non-concrete type args, block unconditionally. @@ -3514,26 +3520,46 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let specLambdaR, _ = OptimizeExpr cenv { env with dontInline = Map.add origLambdaId [] env.dontInline } specLambda specLambdaR - let debugVal = - let name = $"<{vref.LogicalName}>__debug" - // When tyargs have free type variables, omit ValReprInfo so IlxGen compiles this - // as a closure that captures type variables and witnesses from the enclosing scope. - let valReprInfo = - if allTyargsAreConcrete then + // Abstract the specialized lambda over its free typars so IlxGen emits a static + // method with flattened arguments. The alternative closure form (valReprInfo = None) + // wraps args in a reference Tuple<>, which cannot hold byrefs and fails to load at + // runtime. When a free typar carries SRTP constraints the specialized body still + // needs runtime witnesses from the enclosing scope; those only flow through the + // closure path, so keep the closure compilation for that case. + let freeTyparsNeedWitnesses = + not (GetTraitWitnessInfosOfTypars g 0 freeTypars |> List.isEmpty) + + let debugValName = $"<{vref.LogicalName}>__debug" + + if not freeTyparsNeedWitnesses then + let debugValTy = mkForallTyIfNeeded freeTypars specLambdaTy + let debugValBody = mkTypeLambda m freeTypars (specLambdaR, specLambdaTy) + + let debugVal = + let argInfos, retInfo = match vref.ValReprInfo with - | Some(ValReprInfo(_, argInfos, retInfo)) -> - Some(ValReprInfo([], argInfos, retInfo)) + | Some(ValReprInfo(_, argInfos, retInfo)) -> argInfos, retInfo | None -> - Some(InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR) - else - None - - Construct.NewVal(name, m, None, specLambdaTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, - NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, - ParentNone) + let (ValReprInfo(_, a, r)) = + InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR + a, r + let valReprInfo = ValReprInfo(ValReprInfo.InferTyparInfo freeTypars, argInfos, retInfo) + + Construct.NewVal(debugValName, m, None, debugValTy, Immutable, true, Some valReprInfo, taccessPublic, ValNotInRecScope, None, + NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, + ParentNone) + + let callTyargs = freeTypars |> List.map mkTyparTy + let callExpr = mkApps g ((exprForVal m debugVal, debugValTy), [callTyargs], argsR, m) + Some(mkCompGenLet m debugVal debugValBody callExpr, info) + else + let debugVal = + Construct.NewVal(debugValName, m, None, specLambdaTy, Immutable, true, None, taccessPublic, ValNotInRecScope, None, + NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, + ParentNone) - let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) - Some(mkCompGenLet m debugVal specLambdaR callExpr, info) + let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) + Some(mkCompGenLet m debugVal specLambdaR callExpr, info) | _ -> None | _ -> diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 42e466a143b..b9139021e0d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -944,6 +944,97 @@ let monad' = MonadBuilder () |> compile |> shouldSucceed + [] + let ``SRTP 24 - byref with free typar at callsite`` () = + FSharp """ +type MyBuilder<'T>() = + member _.M(a: byref, b: byref) = () + +let inline callMember<'Builder, 'A + when 'Builder: (member M: byref<'A> * byref<'A> -> unit)> + (builder: 'Builder, a: byref<'A>) = + builder.M(&a, &a) + +let runDynamic (builder: MyBuilder<'T>) = + let mutable x = 0 + callMember (builder, &x) + +[] +let main _ = + runDynamic (MyBuilder()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call void Test::'__debug@12'(class Test/MyBuilder`1,"] + |> shouldSucceed + + [] + let ``SRTP 25 - byref with free typar at callsite - large tuple`` () = + // F# represents tuples with 8+ elements as nested System.Tuple. When building a closure + // for such a call the compiler would otherwise pack args into a reference Tuple shape + // that cannot contain byrefs. The debug-call path must flatten to a method regardless + // of arity. + FSharp """ +type MyBuilder<'T>() = + member _.M(a1: byref, a2: byref, a3: byref, + a4: byref, a5: byref, a6: byref, + a7: byref, a8: byref) = + a1 <- 1 + +let inline callMember<'Builder, 'A + when 'Builder: (member M: byref<'A> * byref<'A> * byref<'A> * byref<'A> + * byref<'A> * byref<'A> * byref<'A> * byref<'A> -> unit)> + (builder: 'Builder, + a1: byref<'A>, a2: byref<'A>, a3: byref<'A>, a4: byref<'A>, + a5: byref<'A>, a6: byref<'A>, a7: byref<'A>, a8: byref<'A>) = + builder.M(&a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8) + +let runDynamic (builder: MyBuilder<'T>) = + let mutable x = 0 + callMember (builder, &x, &x, &x, &x, &x, &x, &x, &x) + +[] +let main _ = + runDynamic (MyBuilder()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call void Test::'__debug@18'(class Test/MyBuilder`1,"] + |> shouldSucceed + + [] + let ``SRTP 26 - byref with free typar at callsite - three tupled args`` () = + FSharp """ +type MyBuilder<'T>() = + member _.M(a: byref, b: byref) = () + +let inline callMember<'Builder, 'A + when 'Builder: (member M: byref<'A> * byref<'A> -> unit)> + (builder: 'Builder, a: byref<'A>, b: byref<'A>) = + builder.M(&a, &b) + +let runDynamic (builder: MyBuilder<'T>) = + let mutable x = 0 + callMember (builder, &x, &x) + +[] +let main _ = + runDynamic (MyBuilder()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call void Test::'__debug@12'(class Test/MyBuilder`1,"] + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From 5e6a4a4350dbcc9208089b3413e6152fccc79041 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 18 Apr 2026 15:18:36 +0200 Subject: [PATCH 35/50] Better SRTP fix --- src/Compiler/Optimize/Optimizer.fs | 11 ++-- .../EmittedIL/DebugInlineAsCall.fs | 53 +++++++++++++++++++ 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index ec54deb2537..632b7b41cd8 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3459,8 +3459,13 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let tps, _ = tryDestForallTy g vref.Type GetTraitConstraintInfosOfTypars g tps |> List.isEmpty - let allTyargsAreGeneric = - tyargs |> List.forall (fun t -> not (freeInType CollectTyparsNoCaching t).FreeTypars.IsEmpty) + // Direct-calling an SRTP callee is only safe when every tyarg is a bare typar: then the + // callee's SRTP constraints land on the caller's own typars and IlxGen rewrites the + // call to the $W variant inside the caller's $W compilation context. Non-typar tyargs + // (e.g. MyBuilder<'T>) require static resolution of the trait, which the callee's + // non-$W stub cannot do, so those must go through the specialization path. + let allTyargsAreBareTypars = + tyargs |> List.forall (isTyparTy g) // When inside an inline function body being prepared for export (!cenv.optimizing), // only emit a direct call if the callee is publicly accessible. Non-public vals @@ -3469,7 +3474,7 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let isHiddenBySignature = cenv.signatureHidingInfo.HiddenVals.Contains vref.Deref let canCallDirectly = (cenv.optimizing || (vref.Accessibility.IsPublic && not isHiddenBySignature)) && - (hasNoTraits || (allTyargsAreGeneric && vref.ValReprInfo.IsSome)) + (hasNoTraits || (allTyargsAreBareTypars && vref.ValReprInfo.IsSome)) let argsR = args |> List.map (OptimizeExpr cenv env >> fst) let info = { TotalSize = 1; FunctionSize = 1; HasEffect = true; MightMakeCriticalTailcall = false; Info = UnknownValue } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index b9139021e0d..1641f84312a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -1035,6 +1035,59 @@ let main _ = |> verifyILContains ["call void Test::'__debug@12'(class Test/MyBuilder`1,"] |> shouldSucceed + [] + let ``SRTP 27 - non-typar tyarg to SRTP callee - non-inline caller`` () = + // Non-typar tyargs (MyBuilder<'T>) cannot satisfy the callee's SRTP via witness + // propagation; they must go through the specialization path so the trait resolves + // statically to MyBuilder.M. + FSharp """ +type MyBuilder<'T>() = + member _.M() = () + +let inline callMember<'Builder when 'Builder: (member M: unit -> unit)> (builder: 'Builder) = + builder.M() + +let runDynamic (builder: MyBuilder<'T>) = + callMember builder + +[] +let main _ = + runDynamic (MyBuilder()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call void Test::'__debug@9'(class Test/MyBuilder`1)"] + |> shouldSucceed + + [] + let ``SRTP 28 - non-typar tyarg to SRTP callee - inline caller`` () = + // Same pattern as SRTP 27 but the caller is itself inline. The non-$W variant of the + // inline caller would otherwise contain a direct call to the SRTP callee's non-$W + // stub and throw at runtime when invoked from non-inline code. + FSharp """ +type MyBuilder<'T>() = + member _.M() = () + +let inline callMember<'Builder when 'Builder: (member M: unit -> unit)> (builder: 'Builder) = + builder.M() + +let inline outerInline<'T> (builder: MyBuilder<'T>) = + callMember builder + +[] +let main _ = + outerInline (MyBuilder()) + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> shouldSucceed + [] let ``Member 01 - Non-generic`` () = FSharp """ From e546cd21d349e2ed431920ecdee05251350225c3 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 20 Apr 2026 14:56:03 +0200 Subject: [PATCH 36/50] Another byref fix --- src/Compiler/Optimize/Optimizer.fs | 22 ++++++++- .../EmittedIL/DebugInlineAsCall.fs | 46 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 632b7b41cd8..f33fc6803a3 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3536,7 +3536,27 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let debugValName = $"<{vref.LogicalName}>__debug" - if not freeTyparsNeedWitnesses then + // The closure form wraps tupled args in a reference Tuple<> and cannot hold byrefs. + // When byrefs appear in the specialized call shape and the closure path is our only + // option (witnesses required), skip specialization entirely and let the outer pass + // emit a regular call - IlxGen handles $W witness rewriting inside inline callers. + let specArgsHaveByref = + let rec check ty = + match tryDestFunTy g ty with + | ValueSome(argTy, retTy) -> + let argHasByref = + if isRefTupleTy g argTy then + destRefTupleTy g argTy |> List.exists (isByrefTy g) + else + isByrefTy g argTy + argHasByref || check retTy + | ValueNone -> false + + check specLambdaTy + + if freeTyparsNeedWitnesses && specArgsHaveByref then + None + elif not freeTyparsNeedWitnesses then let debugValTy = mkForallTyIfNeeded freeTypars specLambdaTy let debugValBody = mkTypeLambda m freeTypars (specLambdaR, specLambdaTy) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index 1641f84312a..f1ef78da738 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -1088,6 +1088,52 @@ let main _ = |> compileAndRun |> shouldSucceed + [] + let ``SRTP 29 - byref callee under SRTP witnesses, nested in delegate bodies`` () = + // The specialized callee shape has byref in a tupled-arg position and the enclosing + // scope needs a trait witness. Neither a byref-bearing closure (invalid System.Tuple + // instantiation) nor a non-$W stub method works here, so the optimizer must leave the + // call as-is and let IlxGen's $W rewriting pick up the witness from the inline caller. + FSharp """ +type Aw(value: int) = + member _.GetResult() = value + +type Code<'T> = delegate of byref<'T> -> unit + +let inline bindDynamic<'TResult1, 'TOverall, 'Awaiter + when 'Awaiter: (member GetResult: unit -> 'TResult1)> + (d: byref<'TOverall>, awaiter: 'Awaiter, continuation: 'TResult1 -> Code<'TOverall>) = + (continuation (awaiter.GetResult())).Invoke(&d) + +let inline wrap<'T1, 'T2, 'Awaiter1, 'Awaiter2 + when 'Awaiter1: (member GetResult: unit -> 'T1) + and 'Awaiter2: (member GetResult: unit -> 'T2)> + (left: 'Awaiter1) (right: 'Awaiter2) : Code<'T1 * 'T2> = + Code<'T1 * 'T2>(fun d -> + bindDynamic (&d, left, fun leftR -> + Code<'T1 * 'T2>(fun d2 -> + bindDynamic (&d2, right, fun rightR -> + Code<'T1 * 'T2>(fun d3 -> d3 <- (leftR, rightR)))))) + +[] +let main _ = + let code = wrap (Aw(1)) (Aw(2)) + let mutable result = (0, 0) + code.Invoke(&result) + printfn "Result = %A" result + 0 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains + [ "call void Test::'__debug@17'(class [runtime]System.Tuple`2&," + "call void Test::'__debug@19-1'(class [runtime]System.Tuple`2&," + "call class Test/Code`1> Test::'__debug@24'(class Test/Aw," ] + |> shouldSucceed + |> withStdOutContains "Result = (1, 2)" + [] let ``Member 01 - Non-generic`` () = FSharp """ From 83e64bd39c45f1e5d71b6b3b6274199ad8ef9a6d Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 21 Apr 2026 13:07:44 +0200 Subject: [PATCH 37/50] Cleanup --- src/Compiler/Optimize/Optimizer.fs | 61 ++++++++++++++++-------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index f33fc6803a3..f7eec1d6978 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -1705,7 +1705,7 @@ let TryEliminateBinding cenv _env bind e2 _m = not vspec1.IsCompilerGenerated then None elif vspec1.IsFixed then None - elif not cenv.settings.inlineNamedFunctions && vspec1.InlineInfo = ValInline.InlinedDefinition then None + elif vspec1.InlineInfo = ValInline.InlinedDefinition then None elif vspec1.LogicalName.StartsWithOrdinal stackVarPrefix || vspec1.LogicalName.Contains suffixForVariablesThatMayNotBeEliminated then None else @@ -3499,15 +3499,19 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let allTyargsAreConcrete = List.isEmpty freeTypars - // For concrete type args, only block the exact same (stamp, type) pair, allowing different - // type instantiations to proceed (e.g. sumint> calling sum in its body). - // For non-concrete type args, block unconditionally. - let shouldInline = + // Proceed with specialization only if this (stamp, type) pair isn't already being + // processed. For concrete type args, allow different type instantiations of the same + // function (e.g. sumint> can call sum in its body). For + // non-concrete type args, never specialize recursively. + let canSpecialize = match Map.tryFind origLambdaId env.dontInline with - | Some tys -> not allTyargsAreConcrete || tys.IsEmpty || tys |> List.exists (typeEquiv g specLambdaTy) - | None -> false + | Some tys -> + allTyargsAreConcrete && + not tys.IsEmpty && + not (tys |> List.exists (typeEquiv g specLambdaTy)) + | None -> true - if shouldInline then + if not canSpecialize then None else let specLambdaR = @@ -3532,7 +3536,7 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg // needs runtime witnesses from the enclosing scope; those only flow through the // closure path, so keep the closure compilation for that case. let freeTyparsNeedWitnesses = - not (GetTraitWitnessInfosOfTypars g 0 freeTypars |> List.isEmpty) + GetTraitWitnessInfosOfTypars g 0 freeTypars |> List.isEmpty |> not let debugValName = $"<{vref.LogicalName}>__debug" @@ -3555,12 +3559,16 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg check specLambdaTy if freeTyparsNeedWitnesses && specArgsHaveByref then - None - elif not freeTyparsNeedWitnesses then - let debugValTy = mkForallTyIfNeeded freeTypars specLambdaTy - let debugValBody = mkTypeLambda m freeTypars (specLambdaR, specLambdaTy) + None else - let debugVal = + // Static method path (no witnesses needed): abstract over free typars so IlxGen emits + // a method with flattened arguments rather than a closure that wraps args in Tuple<>. + // Closure path (witnesses needed, no byref): keep the body as-is; witnesses from the + // enclosing scope flow through the closure, so no typar abstraction is needed. + let debugValTy, debugValBody, valReprInfo, typeInstForCall = + if not freeTyparsNeedWitnesses then + let ty = mkForallTyIfNeeded freeTypars specLambdaTy + let body = mkTypeLambda m freeTypars (specLambdaR, specLambdaTy) let argInfos, retInfo = match vref.ValReprInfo with | Some(ValReprInfo(_, argInfos, retInfo)) -> argInfos, retInfo @@ -3568,23 +3576,18 @@ and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, arg let (ValReprInfo(_, a, r)) = InferValReprInfoOfExpr g AllowTypeDirectedDetupling.No specLambdaTy [] [] specLambdaR a, r - let valReprInfo = ValReprInfo(ValReprInfo.InferTyparInfo freeTypars, argInfos, retInfo) - - Construct.NewVal(debugValName, m, None, debugValTy, Immutable, true, Some valReprInfo, taccessPublic, ValNotInRecScope, None, - NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, - ParentNone) + let reprInfo = ValReprInfo(ValReprInfo.InferTyparInfo freeTypars, argInfos, retInfo) + ty, body, Some reprInfo, [List.map mkTyparTy freeTypars] + else + specLambdaTy, specLambdaR, None, [] - let callTyargs = freeTypars |> List.map mkTyparTy - let callExpr = mkApps g ((exprForVal m debugVal, debugValTy), [callTyargs], argsR, m) - Some(mkCompGenLet m debugVal debugValBody callExpr, info) - else - let debugVal = - Construct.NewVal(debugValName, m, None, specLambdaTy, Immutable, true, None, taccessPublic, ValNotInRecScope, None, - NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, - ParentNone) + let debugVal = + Construct.NewVal(debugValName, m, None, debugValTy, Immutable, true, valReprInfo, taccessPublic, ValNotInRecScope, None, + NormalVal, [], ValInline.InlinedDefinition, XmlDoc.Empty, false, false, false, false, false, false, None, + ParentNone) - let callExpr = mkApps g ((exprForVal m debugVal, specLambdaTy), [], argsR, m) - Some(mkCompGenLet m debugVal specLambdaR callExpr, info) + let callExpr = mkApps g ((exprForVal m debugVal, debugValTy), typeInstForCall, argsR, m) + Some(mkCompGenLet m debugVal debugValBody callExpr, info) | _ -> None | _ -> From a192cb0a2f1094eceb0b2b97fde04129a946dae1 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 21 Apr 2026 13:47:26 +0200 Subject: [PATCH 38/50] Add MSBuild property --- src/FSharp.Build/Fsc.fs | 12 ++++++++++++ src/FSharp.Build/Microsoft.FSharp.Targets | 1 + 2 files changed, 13 insertions(+) diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs index 90793f3e430..c67f56defa9 100644 --- a/src/FSharp.Build/Fsc.fs +++ b/src/FSharp.Build/Fsc.fs @@ -58,6 +58,7 @@ type public Fsc() as this = let mutable preferredUILang: string | null = null let mutable publicSign: bool = false let mutable provideCommandLineArgs: bool = false + let mutable inlineNamedFunctions: bool option = None let mutable realsig: bool option = None let mutable references: ITaskItem[] = [||] let mutable referencePath: string | null = null @@ -200,6 +201,9 @@ type public Fsc() as this = else builder.AppendSwitch("--optimize-") + // InlineNamedFunctions + builder.AppendOptionalSwitch("--inline-named-functions", inlineNamedFunctions) + // realsig builder.AppendOptionalSwitch("--realsig", realsig) @@ -560,6 +564,14 @@ type public Fsc() as this = with get () = publicSign and set (s) = publicSign <- s + // --inline-named-functions[+-] + member _.InlineNamedFunctions + with get () = + match inlineNamedFunctions with + | Some true -> true + | _ -> false + and set (b) = inlineNamedFunctions <- Some b + // --realsig[+-] member _.RealSig with get () = diff --git a/src/FSharp.Build/Microsoft.FSharp.Targets b/src/FSharp.Build/Microsoft.FSharp.Targets index 9049f2f7118..1ad7c6fac63 100644 --- a/src/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/FSharp.Build/Microsoft.FSharp.Targets @@ -389,6 +389,7 @@ this file. PreferredUILang="$(PreferredUILang)" ProvideCommandLineArgs="$(ProvideCommandLineArgs)" PublicSign="$(PublicSign)" + InlineNamedFunctions="$(InlineNamedFunctions)" RealSig="$(RealSig)" References="@(ReferencePathWithRefAssemblies)" ReferencePath="$(ReferencePathWithRefAssemblies)" From 4551a810539e38b1017b9527fc5ac9704f04cf44 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 21 Apr 2026 16:51:50 +0200 Subject: [PATCH 39/50] Don't inline lambdas --- src/Compiler/Optimize/Optimizer.fs | 21 ++--- .../EmittedIL/DebugInlineAsCall.fs | 34 ++++++++ ...ealInternalSignatureOff.OptimizeOff.il.bsl | 70 ++++++++++++---- ....fs.RealInternalSignatureOff.il.net472.bsl | 81 +++++++++++++------ ...RealInternalSignatureOn.OptimizeOff.il.bsl | 70 ++++++++++++---- ...1.fs.RealInternalSignatureOn.il.net472.bsl | 81 +++++++++++++------ 6 files changed, 267 insertions(+), 90 deletions(-) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index f7eec1d6978..1b3d5b98b13 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -3100,7 +3100,7 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, | CurriedLambdaValue (_, _, _, expr, _) when shouldInline && (cenv.settings.inlineNamedFunctions || Option.exists (shouldForceInlineInDebug cenv.g) vOpt) || - inlineIfLambda -> + inlineIfLambda && cenv.settings.inlineNamedFunctions -> let fvs = freeInExpr CollectLocals expr if fvs.UsesMethodLocalConstructs then // Discarding lambda for binding because uses protected members --- TBD: Should we warn or error here @@ -3112,9 +3112,8 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, | TupleValue _ | UnionCaseValue _ | RecdValue _ when shouldInline -> failwith "tuple, union and record values cannot be marked 'inline'" - | UnknownValue when shouldInline -> - if cenv.settings.inlineNamedFunctions then - warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)) + | UnknownValue when shouldInline && cenv.settings.inlineNamedFunctions -> + warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)) None | _ when shouldInline && cenv.settings.inlineNamedFunctions -> @@ -3163,12 +3162,14 @@ and OptimizeVal cenv env expr (v: ValRef, m) = e, AddValEqualityInfo g m v einfo | None -> - if v.ShouldInline && cenv.settings.inlineNamedFunctions then - match valInfoForVal.ValExprInfo with - | UnknownValue -> error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) - | _ -> warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) - if v.InlineIfLambda then - warning(Error(FSComp.SR.optFailedToInlineSuggestedValue(v.DisplayName), m)) + if cenv.settings.inlineNamedFunctions then + if v.ShouldInline then + match valInfoForVal.ValExprInfo with + | UnknownValue -> error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) + | _ -> warning(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) + + if v.InlineIfLambda then + warning(Error(FSComp.SR.optFailedToInlineSuggestedValue(v.DisplayName), m)) expr, (AddValEqualityInfo g m v { Info=valInfoForVal.ValExprInfo diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index f1ef78da738..a8184b562f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -1532,3 +1532,37 @@ let main _ = |> asExe |> compileAndRun |> shouldSucceed + + [] + let ``InlineIfLambda 01 - Debug`` () = + FSharp """ +let inline apply ([] f: int -> int) (x: int) : int = + f x + +[] +let main _ = + let result = apply (fun i -> i + 1) 5 + if result = 6 then 0 else 1 +""" + |> withDebug + |> withNoOptimize + |> asExe + |> compileAndRun + |> verifyILContains ["call int32 Test::apply(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,"] + |> shouldSucceed + + [] + let ``InlineIfLambda 02 - Release`` () = + FSharp """ +let inline apply ([] f: int -> int) (x: int) : int = + f x + +[] +let main _ = + let result = apply (fun i -> i + 1) 5 + if result = 6 then 0 else 1 +""" + |> asExe + |> compile + |> shouldSucceed + |> verifyILNotPresent ["call int32 Test::apply(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,"] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 1e2b6f38e6e..c6dff60aed2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -38,6 +38,40 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit clo@20 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@20 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@20::.ctor() + IL_0005: stsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_000a: ret + } + + } + .method public specialname static object get_o() cil managed { @@ -69,35 +103,42 @@ .maxstack 4 .locals init (object V_0, object V_1, - bool V_2) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_2, + bool V_3) IL_0000: newobj instance void [runtime]System.Object::.ctor() IL_0005: dup IL_0006: stsfld object ''.$assembly::o@19 IL_000b: stloc.0 IL_000c: call object assembly::get_o() IL_0011: stloc.1 - IL_0012: ldc.i4.0 - IL_0013: stloc.2 + IL_0012: ldsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_0017: stloc.2 + IL_0018: ldc.i4.0 + IL_0019: stloc.3 .try { - IL_0014: ldloc.1 - IL_0015: ldloca.s V_2 - IL_0017: call void [netstandard]System.Threading.Monitor::Enter(object, + IL_001a: ldloc.1 + IL_001b: ldloca.s V_3 + IL_001d: call void [netstandard]System.Threading.Monitor::Enter(object, bool&) - IL_001c: leave.s IL_0029 + IL_0022: ldloc.2 + IL_0023: ldnull + IL_0024: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0029: pop + IL_002a: leave.s IL_0037 } finally { - IL_001e: ldloc.2 - IL_001f: brfalse.s IL_0028 + IL_002c: ldloc.3 + IL_002d: brfalse.s IL_0036 - IL_0021: ldloc.1 - IL_0022: call void [netstandard]System.Threading.Monitor::Exit(object) - IL_0027: endfinally - IL_0028: endfinally + IL_002f: ldloc.1 + IL_0030: call void [netstandard]System.Threading.Monitor::Exit(object) + IL_0035: endfinally + IL_0036: endfinally } - IL_0029: ret + IL_0037: ret } } @@ -106,4 +147,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl index 804af13e153..1a3d83b9c45 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOff.il.net472.bsl @@ -8,7 +8,7 @@ .assembly extern netstandard { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) - .ver 2:0:0:0 + .ver 2:1:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -48,6 +38,40 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit clo@20 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@20 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@20::.ctor() + IL_0005: stsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_000a: ret + } + + } + .method public specialname static object get_o() cil managed { @@ -79,35 +103,42 @@ .maxstack 4 .locals init (object V_0, object V_1, - bool V_2) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_2, + bool V_3) IL_0000: newobj instance void [runtime]System.Object::.ctor() IL_0005: dup IL_0006: stsfld object ''.$assembly::o@19 IL_000b: stloc.0 IL_000c: call object assembly::get_o() IL_0011: stloc.1 - IL_0012: ldc.i4.0 - IL_0013: stloc.2 + IL_0012: ldsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_0017: stloc.2 + IL_0018: ldc.i4.0 + IL_0019: stloc.3 .try { - IL_0014: ldloc.1 - IL_0015: ldloca.s V_2 - IL_0017: call void [netstandard]System.Threading.Monitor::Enter(object, + IL_001a: ldloc.1 + IL_001b: ldloca.s V_3 + IL_001d: call void [netstandard]System.Threading.Monitor::Enter(object, bool&) - IL_001c: leave.s IL_0029 + IL_0022: ldloc.2 + IL_0023: ldnull + IL_0024: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0029: pop + IL_002a: leave.s IL_0037 } finally { - IL_001e: ldloc.2 - IL_001f: brfalse.s IL_0028 + IL_002c: ldloc.3 + IL_002d: brfalse.s IL_0036 - IL_0021: ldloc.1 - IL_0022: call void [netstandard]System.Threading.Monitor::Exit(object) - IL_0027: endfinally - IL_0028: endfinally + IL_002f: ldloc.1 + IL_0030: call void [netstandard]System.Threading.Monitor::Exit(object) + IL_0035: endfinally + IL_0036: endfinally } - IL_0029: ret + IL_0037: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index f108d21da06..4bda3dfab02 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -38,6 +38,40 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit clo@20 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@20 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@20::.ctor() + IL_0005: stsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_000a: ret + } + + } + .field static assembly object o@19 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public specialname static object get_o() cil managed @@ -64,33 +98,40 @@ .maxstack 4 .locals init (object V_0, - bool V_1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_1, + bool V_2) IL_0000: newobj instance void [runtime]System.Object::.ctor() IL_0005: stsfld object assembly::o@19 IL_000a: call object assembly::get_o() IL_000f: stloc.0 - IL_0010: ldc.i4.0 - IL_0011: stloc.1 + IL_0010: ldsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_0015: stloc.1 + IL_0016: ldc.i4.0 + IL_0017: stloc.2 .try { - IL_0012: ldloc.0 - IL_0013: ldloca.s V_1 - IL_0015: call void [netstandard]System.Threading.Monitor::Enter(object, + IL_0018: ldloc.0 + IL_0019: ldloca.s V_2 + IL_001b: call void [netstandard]System.Threading.Monitor::Enter(object, bool&) - IL_001a: leave.s IL_0027 + IL_0020: ldloc.1 + IL_0021: ldnull + IL_0022: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0027: pop + IL_0028: leave.s IL_0035 } finally { - IL_001c: ldloc.1 - IL_001d: brfalse.s IL_0026 + IL_002a: ldloc.2 + IL_002b: brfalse.s IL_0034 - IL_001f: ldloc.0 - IL_0020: call void [netstandard]System.Threading.Monitor::Exit(object) - IL_0025: endfinally - IL_0026: endfinally + IL_002d: ldloc.0 + IL_002e: call void [netstandard]System.Threading.Monitor::Exit(object) + IL_0033: endfinally + IL_0034: endfinally } - IL_0027: ret + IL_0035: ret } .property object o() @@ -122,4 +163,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl index 2e8764d5c4e..683e5e3ae72 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.il.net472.bsl @@ -8,7 +8,7 @@ .assembly extern netstandard { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) - .ver 2:0:0:0 + .ver 2:1:0:0 } .assembly assembly { @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -48,6 +38,40 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit clo@20 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class assembly/clo@20 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/clo@20::.ctor() + IL_0005: stsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_000a: ret + } + + } + .field static assembly object o@19 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .method public specialname static object get_o() cil managed @@ -74,33 +98,40 @@ .maxstack 4 .locals init (object V_0, - bool V_1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_1, + bool V_2) IL_0000: newobj instance void [runtime]System.Object::.ctor() IL_0005: stsfld object assembly::o@19 IL_000a: call object assembly::get_o() IL_000f: stloc.0 - IL_0010: ldc.i4.0 - IL_0011: stloc.1 + IL_0010: ldsfld class assembly/clo@20 assembly/clo@20::@_instance + IL_0015: stloc.1 + IL_0016: ldc.i4.0 + IL_0017: stloc.2 .try { - IL_0012: ldloc.0 - IL_0013: ldloca.s V_1 - IL_0015: call void [netstandard]System.Threading.Monitor::Enter(object, + IL_0018: ldloc.0 + IL_0019: ldloca.s V_2 + IL_001b: call void [netstandard]System.Threading.Monitor::Enter(object, bool&) - IL_001a: leave.s IL_0027 + IL_0020: ldloc.1 + IL_0021: ldnull + IL_0022: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0027: pop + IL_0028: leave.s IL_0035 } finally { - IL_001c: ldloc.1 - IL_001d: brfalse.s IL_0026 + IL_002a: ldloc.2 + IL_002b: brfalse.s IL_0034 - IL_001f: ldloc.0 - IL_0020: call void [netstandard]System.Threading.Monitor::Exit(object) - IL_0025: endfinally - IL_0026: endfinally + IL_002d: ldloc.0 + IL_002e: call void [netstandard]System.Threading.Monitor::Exit(object) + IL_0033: endfinally + IL_0034: endfinally } - IL_0027: ret + IL_0035: ret } .property object o() From 85ac7180d3ef776fe76afc4c2f38bf4dbc357646 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 21 Apr 2026 17:14:07 +0200 Subject: [PATCH 40/50] Rename inlineNamedFunctions to alwaysInline --- src/Compiler/CodeGen/IlxGen.fs | 8 ++-- src/Compiler/CodeGen/IlxGen.fsi | 4 +- src/Compiler/Driver/CompilerConfig.fs | 8 ++-- src/Compiler/Driver/CompilerConfig.fsi | 4 +- src/Compiler/Driver/CompilerOptions.fs | 6 +-- src/Compiler/Driver/OptimizeInputs.fs | 4 +- src/Compiler/FSComp.txt | 2 +- src/Compiler/Optimize/Optimizer.fs | 22 +++++----- src/Compiler/Optimize/Optimizer.fsi | 2 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.de.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.es.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.fr.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.it.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.ja.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.ko.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.pl.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.ru.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.tr.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 40 +++++++++---------- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 40 +++++++++---------- src/FSharp.Build/Fsc.fs | 14 +++---- src/FSharp.Build/Microsoft.FSharp.Targets | 2 +- .../fsc/misc/compiler_help_output.bsl | 1 + .../expected-help-output.bsl | 1 + 26 files changed, 300 insertions(+), 298 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index f64d8bcf7c4..3dd1bf62723 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -270,7 +270,7 @@ type IlxGenOptions = /// When set to true, the IlxGen will delay generation of method bodies and generated them later in parallel (parallelized across files) parallelIlxGenEnabled: bool - inlineNamedFunctions: bool + alwaysInline: bool } /// Compilation environment for compiling a fragment of an assembly @@ -5762,13 +5762,13 @@ and GenTraitCall (cenv: cenv) cgbuf eenv (traitInfo: TraitConstraintInfo, argExp | None -> - // When inlineNamedFunctions is true, all trait calls should be resolved via witnesses in scope. - // When inlineNamedFunctions is false, inline functions are kept as calls rather than inlined. + // When alwaysInline is true, all trait calls should be resolved via witnesses in scope. + // When alwaysInline is false, inline functions are kept as calls rather than inlined. // Their witness arguments may contain TraitCall operations for constraints that were resolved // without a witness (e.g., when the constraint is satisfied by a known concrete type). // In such cases, generateWitnesses can be true (because other witnesses are in scope) but // the specific trait's witness is not found. Fall through to the constraint solver to resolve it. - assert (not generateWitnesses || not cenv.options.inlineNamedFunctions) + assert (not generateWitnesses || not cenv.options.alwaysInline) let exprOpt = CommitOperationResult(ConstraintSolver.CodegenWitnessExprForTraitConstraint cenv.tcVal g cenv.amap m traitInfo argExprs) diff --git a/src/Compiler/CodeGen/IlxGen.fsi b/src/Compiler/CodeGen/IlxGen.fsi index abf5320b697..74cbe72d3fe 100644 --- a/src/Compiler/CodeGen/IlxGen.fsi +++ b/src/Compiler/CodeGen/IlxGen.fsi @@ -62,8 +62,8 @@ type internal IlxGenOptions = /// When set to true, the IlxGen will delay generation of method bodies and generate them later in parallel (parallelized across files) parallelIlxGenEnabled: bool - /// Indicates if inline named functions are being inlined or emitted as calls - inlineNamedFunctions: bool + /// Indicates if inline functions are being inlined or emitted as calls + alwaysInline: bool } /// The results of the ILX compilation of one fragment of an assembly diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index ed8d7914497..ccf0c1fa4f1 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -600,7 +600,7 @@ type TcConfigBuilder = mutable strictIndentation: bool option - mutable inlineNamedFunctions: bool option + mutable alwaysInline: bool option mutable exename: string option @@ -855,7 +855,7 @@ type TcConfigBuilder = dumpSignatureData = false realsig = false strictIndentation = None - inlineNamedFunctions = None + alwaysInline = None compilationMode = TcGlobals.CompilationMode.Unset } @@ -1257,8 +1257,8 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member _.FxResolver = data.FxResolver member _.strictIndentation = data.strictIndentation - member _.inlineNamedFunctions = - data.inlineNamedFunctions + member _.alwaysInline = + data.alwaysInline |> Option.defaultValue ( not data.debuginfo || data.optSettings.LocalOptimizationsEnabled diff --git a/src/Compiler/Driver/CompilerConfig.fsi b/src/Compiler/Driver/CompilerConfig.fsi index b81a37917c5..9f19b8e59ba 100644 --- a/src/Compiler/Driver/CompilerConfig.fsi +++ b/src/Compiler/Driver/CompilerConfig.fsi @@ -472,7 +472,7 @@ type TcConfigBuilder = mutable strictIndentation: bool option - mutable inlineNamedFunctions: bool option + mutable alwaysInline: bool option mutable exename: string option @@ -816,7 +816,7 @@ type TcConfig = member strictIndentation: bool option - member inlineNamedFunctions: bool + member alwaysInline: bool member GetTargetFrameworkDirectories: unit -> string list diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 0ba0afb60ca..f54f36fa7f9 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -1209,11 +1209,11 @@ let languageFlags tcConfigB = ) CompilerOption( - "inline-named-functions", + "always-inline", tagNone, - OptionSwitch(fun switch -> tcConfigB.inlineNamedFunctions <- Some(switch = OptionSwitch.On)), + OptionSwitch(fun switch -> tcConfigB.alwaysInline <- Some(switch = OptionSwitch.On)), None, - Some(FSComp.SR.optsInlineNamedFunctions ()) + Some(FSComp.SR.optsAlwaysInline ()) ) ] diff --git a/src/Compiler/Driver/OptimizeInputs.fs b/src/Compiler/Driver/OptimizeInputs.fs index 120285358a3..d04ae06be01 100644 --- a/src/Compiler/Driver/OptimizeInputs.fs +++ b/src/Compiler/Driver/OptimizeInputs.fs @@ -327,7 +327,7 @@ let ApplyAllOptimizations // Only do abstractBigTargets in the first phase, and only when TLR is on. abstractBigTargets = tcConfig.doTLR reportingPhase = true - inlineNamedFunctions = tcConfig.inlineNamedFunctions + alwaysInline = tcConfig.alwaysInline } // Only do these two steps in the first phase. @@ -579,7 +579,7 @@ let GenerateIlxCode isInteractiveItExpr = isInteractiveItExpr alwaysCallVirt = tcConfig.alwaysCallVirt parallelIlxGenEnabled = tcConfig.parallelIlxGen - inlineNamedFunctions = tcConfig.inlineNamedFunctions + alwaysInline = tcConfig.alwaysInline } ilxGenerator.GenerateCode(ilxGenOpts, optimizedImpls, topAttrs.assemblyAttrs, topAttrs.netModuleAttrs) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index c5d4948db0a..6ac9df087e2 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1561,7 +1561,7 @@ optsSetLangVersion,"Specify language version such as 'latest' or 'preview'." optsDisableLanguageFeature,"Disable a specific language feature by name." optsSupportedLangVersions,"Supported language versions:" optsStrictIndentation,"Override indentation rules implied by the language version (%s by default)" -optsInlineNamedFunctions,"Inline named 'inline' functions" +optsAlwaysInline,"Always inline 'inline' functions" nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format." nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malformed." formatDashItem," - %s" diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index 1b3d5b98b13..b4ca59cffb4 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -329,7 +329,7 @@ type OptimizationSettings = processingMode : OptimizationProcessingMode - inlineNamedFunctions: bool + alwaysInline: bool } static member Defaults = @@ -347,7 +347,7 @@ type OptimizationSettings = reportHasEffect = false reportTotalSizes = false processingMode = OptimizationProcessingMode.Parallel - inlineNamedFunctions = false + alwaysInline = false } /// Determines if JIT optimizations are enabled @@ -510,7 +510,7 @@ let CheckInlineValueIsComplete (v: Val) res = //System.Diagnostics.Debug.Assert(false, sprintf "Break for incomplete inline value %s" v.DisplayName) let check (cenv: cenv) (vref: ValRef) (res: ValInfo) = - if cenv.settings.inlineNamedFunctions then + if cenv.settings.alwaysInline then CheckInlineValueIsComplete vref.Deref res.ValExprInfo (vref, res) @@ -1367,7 +1367,7 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary (cenv: cenv) mhi = Zset.exists hiddenTyconRepr fvs.FreeLocalTyconReprs || Zset.exists hiddenRecdField fvs.FreeRecdFields || Zset.exists hiddenUnionCase fvs.FreeUnionCases || - (cenv.settings.inlineNamedFunctions && + (cenv.settings.alwaysInline && ((isAssemblyBoundary && not (freeVarsAllPublic fvs)) || Zset.exists hiddenVal fvs.FreeLocals || Zset.exists hiddenTycon fvs.FreeTyvars.FreeTycons))) -> @@ -1412,7 +1412,7 @@ let AbstractLazyModulInfoByHiding isAssemblyBoundary (cenv: cenv) mhi = ValInfos(ss.ValInfos.Entries |> Seq.filter (fun (vref, _) -> not (hiddenVal vref.Deref) || - (not cenv.settings.inlineNamedFunctions && vref.Deref.ShouldInline)) + (not cenv.settings.alwaysInline && vref.Deref.ShouldInline)) |> Seq.map (fun (vref, e) -> check cenv vref (abstractValInfo e) )) } and abstractLazyModulInfo (ss: LazyModuleInfo) = @@ -3099,8 +3099,8 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, Some (remarkExpr m (copyExpr g CloneAllAndMarkExprValsAsCompilerGenerated expr)) | CurriedLambdaValue (_, _, _, expr, _) when - shouldInline && (cenv.settings.inlineNamedFunctions || Option.exists (shouldForceInlineInDebug cenv.g) vOpt) || - inlineIfLambda && cenv.settings.inlineNamedFunctions -> + shouldInline && (cenv.settings.alwaysInline || Option.exists (shouldForceInlineInDebug cenv.g) vOpt) || + inlineIfLambda && cenv.settings.alwaysInline -> let fvs = freeInExpr CollectLocals expr if fvs.UsesMethodLocalConstructs then // Discarding lambda for binding because uses protected members --- TBD: Should we warn or error here @@ -3112,11 +3112,11 @@ and TryOptimizeVal cenv env (vOpt: ValRef option, shouldInline, inlineIfLambda, | TupleValue _ | UnionCaseValue _ | RecdValue _ when shouldInline -> failwith "tuple, union and record values cannot be marked 'inline'" - | UnknownValue when shouldInline && cenv.settings.inlineNamedFunctions -> + | UnknownValue when shouldInline && cenv.settings.alwaysInline -> warning(Error(FSComp.SR.optValueMarkedInlineHasUnexpectedValue(), m)) None - | _ when shouldInline && cenv.settings.inlineNamedFunctions -> + | _ when shouldInline && cenv.settings.alwaysInline -> warning(Error(FSComp.SR.optValueMarkedInlineCouldNotBeInlined(), m)) None @@ -3162,7 +3162,7 @@ and OptimizeVal cenv env expr (v: ValRef, m) = e, AddValEqualityInfo g m v einfo | None -> - if cenv.settings.inlineNamedFunctions then + if cenv.settings.alwaysInline then if v.ShouldInline then match valInfoForVal.ValExprInfo with | UnknownValue -> error(Error(FSComp.SR.optFailedToInlineValue(v.DisplayName), m)) @@ -3454,7 +3454,7 @@ and TryDevirtualizeApplication cenv env (f, tyargs, args, m) = and TryInlineApplication cenv env finfo (valExpr: Expr) (tyargs: TType list, args: Expr list, m) = let g = cenv.g - match cenv.settings.inlineNamedFunctions, stripExpr valExpr with + match cenv.settings.alwaysInline, stripExpr valExpr with | false, Expr.Val(vref, _, _) when vref.ShouldInline && not (shouldForceInlineInDebug cenv.g vref) -> let hasNoTraits = let tps, _ = tryDestForallTy g vref.Type diff --git a/src/Compiler/Optimize/Optimizer.fsi b/src/Compiler/Optimize/Optimizer.fsi index 10335e93a64..1458f5a41b0 100644 --- a/src/Compiler/Optimize/Optimizer.fsi +++ b/src/Compiler/Optimize/Optimizer.fsi @@ -52,7 +52,7 @@ type OptimizationSettings = processingMode: OptimizationProcessingMode - inlineNamedFunctions: bool + alwaysInline: bool } member JitOptimizationsEnabled: bool diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 99b7b5ca382..24cfc34eccf 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1012,6 +1012,11 @@ Vytiskněte odvozená rozhraní všech kompilovaných souborů do přidružených souborů podpisu. + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Zobrazí povolené hodnoty pro jazykovou verzi. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Neplatné použití generování referenčního sestavení, nepoužívejte --standalone ani --staticlink s --refonly nebo --refout. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index b87eec33dca..6da75a58893 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1012,6 +1012,11 @@ Drucken der abgeleiteten Schnittstellen aller Dateien an zugehörige Signaturdateien + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Anzeigen der zulässigen Werte für die Sprachversion. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Ungültige Verwendung der Ausgabe einer Referenzassembly. Verwenden Sie nicht „--standalone“ oder „--staticlink“ mit „--refonly“ oder „--refout“. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 10b2a2b4c4f..8e6bde51a0b 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1012,6 +1012,11 @@ Imprimir las interfaces deducidas de todos los archivos de compilación en los archivos de signatura asociados + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Muestra los valores permitidos para la versión del lenguaje. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Uso no válido de emisión de un ensamblado de referencia, no use '--standalone or --staticlink' con '--refonly or --refout'. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 05725c185ca..249b361a71d 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1012,6 +1012,11 @@ Imprimer les interfaces inférées de tous les fichiers de compilation sur les fichiers de signature associés + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Affichez les valeurs autorisées pour la version du langage. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Utilisation non valide de l’émission d’un assembly de référence, n’utilisez pas '--standalone ou --staticlink' avec '--refonly ou --refout'. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 9d9298b1b18..34d9800b371 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1012,6 +1012,11 @@ Stampare le interfacce derivate di tutti i file di compilazione nei file di firma associati + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Visualizzare i valori consentiti per la versione della lingua. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Utilizzo non valido della creazione di un assembly di riferimento. Non usare insieme '--standalone o --staticlink' con '--refonly o --refout'.. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index ab93720911b..1e5f4351c9f 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1012,6 +1012,11 @@ すべてのコンパイル ファイルの推定されたインターフェイスを関連する署名ファイルに印刷します + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ 言語バージョンで許可されている値を表示します。 - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 参照アセンブリの出力の使用が無効です。'--standalone または --staticlink' を '--relabelly または --refout' と共に使用しないでください。 @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 864f828d8fc..a679ff3f4a8 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1012,6 +1012,11 @@ 모든 컴파일 파일의 유추된 인터페이스를 관련 서명 파일로 인쇄합니다. + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ 언어 버전에 허용되는 값을 표시합니다. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 참조 어셈블리 내보내기를 잘못 사용했습니다. '--refonly 또는 --refout'과 함께 '--standalone 또는 --staticlink'를 사용하지 마세요. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 2cd04f84bda..d664038a437 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1012,6 +1012,11 @@ Drukowanie wywnioskowanych interfejsów wszystkich plików kompilacji do skojarzonych plików sygnatur + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Wyświetl dozwolone wartości dla wersji językowej. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Nieprawidłowe użycie emitowania zestawu odwołania. Nie używaj elementu „--standalone ani --staticlink” z elementem „--refonly lub --refout”. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index c1cac06ba19..83761bf0c44 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1012,6 +1012,11 @@ Imprimir as interfaces inferidas de todos os arquivos de compilação para os arquivos de assinatura associados + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Exiba os valores permitidos para a versão do idioma. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Uso inválido da emissão de um assembly de referência, não use '--standalone ou --staticlink' com '--refonly ou --refout'. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 5cc075702f9..a70866a1169 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1012,6 +1012,11 @@ Печать определяемых интерфейсов всех файлов компиляции в связанные файлы подписей + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Отображение допустимых значений для версии языка. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Недопустимое использование при создании базовой сборки. Не используйте "--standalone or --staticlink" с "--refonly or --refout". @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index ee548521e6d..8d61d3db885 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1012,6 +1012,11 @@ Tüm derleme dosyalarının çıkarsanan arabirimlerini ilişkili imza dosyalarına yazdır + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ Dil sürümü için izin verilen değerleri görüntüleyin. - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. Başvuru bütünleştirilmiş kodu oluşturmanın geçersiz kullanımı; '--standalone’ veya ‘--staticlink' seçeneğini '--refonly’ veya ‘--refout' ile birlikte kullanmayın. @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 9b89af11acd..3bec4708bc0 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1012,6 +1012,11 @@ 将所有编译文件的推断接口打印到关联的签名文件 + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ 显示语言版本的允许值。 - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 发出引用程序集的使用无效,请勿将 '--standalone 或 --staticlink' 与 '--refonly 或 --refout' 一起使用。 @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index b54c21177df..f36decd2a92 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1012,6 +1012,11 @@ 將所有編譯檔案的推斷介面列印至相關聯的簽章檔案 + + Always inline 'inline' functions + Always inline 'inline' functions + + Enable nullness declarations and checks ({0} by default) Enable nullness declarations and checks ({0} by default) @@ -1037,11 +1042,6 @@ 顯示語言版本的允許值。 - - Inline named 'inline' functions - Inline named 'inline' functions - - Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'. 發出參考組件的使用無效,請勿同時使用 '--standalone 或 '--refonly' 和 '--refout'。 @@ -8977,21 +8977,21 @@ This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments. - - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. - - - - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? - - - - emit GetObjectData and field-restoring deserialization constructor for exception types - emit GetObjectData and field-restoring deserialization constructor for exception types - - + + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + '{0}' cannot be the final expression in a computation expression. Finish with 'return', 'return!', or a simple expression. + + + + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + This list expression contains a single tuple element. Did you mean to use ';' instead of ',' to separate list elements? + + + + emit GetObjectData and field-restoring deserialization constructor for exception types + emit GetObjectData and field-restoring deserialization constructor for exception types + + \ No newline at end of file diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs index c67f56defa9..173792f0711 100644 --- a/src/FSharp.Build/Fsc.fs +++ b/src/FSharp.Build/Fsc.fs @@ -58,7 +58,7 @@ type public Fsc() as this = let mutable preferredUILang: string | null = null let mutable publicSign: bool = false let mutable provideCommandLineArgs: bool = false - let mutable inlineNamedFunctions: bool option = None + let mutable alwaysInline: bool option = None let mutable realsig: bool option = None let mutable references: ITaskItem[] = [||] let mutable referencePath: string | null = null @@ -201,8 +201,8 @@ type public Fsc() as this = else builder.AppendSwitch("--optimize-") - // InlineNamedFunctions - builder.AppendOptionalSwitch("--inline-named-functions", inlineNamedFunctions) + // AlwaysInline + builder.AppendOptionalSwitch("--always-inline", alwaysInline) // realsig builder.AppendOptionalSwitch("--realsig", realsig) @@ -564,13 +564,13 @@ type public Fsc() as this = with get () = publicSign and set (s) = publicSign <- s - // --inline-named-functions[+-] - member _.InlineNamedFunctions + // --always-inline[+-] + member _.AlwaysInline with get () = - match inlineNamedFunctions with + match alwaysInline with | Some true -> true | _ -> false - and set (b) = inlineNamedFunctions <- Some b + and set (b) = alwaysInline <- Some b // --realsig[+-] member _.RealSig diff --git a/src/FSharp.Build/Microsoft.FSharp.Targets b/src/FSharp.Build/Microsoft.FSharp.Targets index 1ad7c6fac63..eeda4889aaf 100644 --- a/src/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/FSharp.Build/Microsoft.FSharp.Targets @@ -389,7 +389,7 @@ this file. PreferredUILang="$(PreferredUILang)" ProvideCommandLineArgs="$(ProvideCommandLineArgs)" PublicSign="$(PublicSign)" - InlineNamedFunctions="$(InlineNamedFunctions)" + AlwaysInline="$(AlwaysInline)" RealSig="$(RealSig)" References="@(ReferencePathWithRefAssemblies)" ReferencePath="$(ReferencePathWithRefAssemblies)" diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl index 3cfd389dc8a..56df6419a54 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/misc/compiler_help_output.bsl @@ -84,6 +84,7 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. --checked[+|-] Generate overflow checks (off by default) --define: Define conditional compilation symbols (Short form: -d) --strict-indentation[+|-] Override indentation rules implied by the language version (off by default) +--always-inline[+|-] Always inline 'inline' functions - MISCELLANEOUS - diff --git a/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl b/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl index 8b112b0dadc..bbcf59bb8f5 100644 --- a/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl +++ b/tests/FSharp.Compiler.Service.Tests/expected-help-output.bsl @@ -131,6 +131,7 @@ --strict-indentation[+|-] Override indentation rules implied by the language version (off by default) +--always-inline[+|-] Always inline 'inline' functions - MISCELLANEOUS - From da63fe7b5a6c87db4841555738ef5660d7722877 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 13 May 2026 13:00:56 +0200 Subject: [PATCH 41/50] Check optimize- only --- src/Compiler/Driver/CompilerConfig.fs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CompilerConfig.fs b/src/Compiler/Driver/CompilerConfig.fs index ccf0c1fa4f1..c9203390de4 100644 --- a/src/Compiler/Driver/CompilerConfig.fs +++ b/src/Compiler/Driver/CompilerConfig.fs @@ -1260,8 +1260,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member _.alwaysInline = data.alwaysInline |> Option.defaultValue ( - not data.debuginfo - || data.optSettings.LocalOptimizationsEnabled + data.optSettings.LocalOptimizationsEnabled || data.extraOptimizationIterations > 0 ) From 0e371f485f97e628ef42887e6e5d515bc68091d4 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Wed, 13 May 2026 18:10:35 +0200 Subject: [PATCH 42/50] Update baselines --- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 52 +-- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 52 +-- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 145 +----- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 145 +----- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 127 +----- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 127 +----- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 414 +++--------------- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 414 +++--------------- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 3 +- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 2 +- ...ptionalArg01.fs.OptimizeOff.il.netcore.bsl | 404 +---------------- .../ExprTests.fs | 4 +- 12 files changed, 230 insertions(+), 1659 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 3cd259184db..b95c997fd11 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -37,42 +37,6 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@10-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f3@10-1'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f3@10-1'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f3@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -100,9 +64,7 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, - int32 V_4) + int32 V_2) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -131,14 +93,10 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@5::builder@ - IL_0040: stloc.3 - IL_0041: ldloc.2 - IL_0042: stloc.s V_4 - IL_0044: ldloc.s V_4 - IL_0046: newobj instance void assembly/assembly/'f3@10-1'::.ctor(int32) - IL_004b: tail. - IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0052: ret + IL_0040: ldloc.2 + IL_0041: tail. + IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0048: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 1f5c0f27046..e71ecaac097 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -37,42 +37,6 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@10-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f3@10-1'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f3@10-1'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f3@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -100,9 +64,7 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, - int32 V_4) + int32 V_2) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -131,14 +93,10 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@5::builder@ - IL_0040: stloc.3 - IL_0041: ldloc.2 - IL_0042: stloc.s V_4 - IL_0044: ldloc.s V_4 - IL_0046: newobj instance void assembly/assembly/'f3@10-1'::.ctor(int32) - IL_004b: tail. - IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0052: ret + IL_0040: ldloc.2 + IL_0041: tail. + IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0048: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 348b1d1471d..c6dc4802db1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -37,42 +37,6 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@10-2' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f4@10-2'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f4@10-2'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@7-1' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -103,9 +67,7 @@ .maxstack 6 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, - int32 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, - int32 V_3) + int32 V_1) IL_0000: nop IL_0001: ldc.i4.0 IL_0002: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) @@ -124,19 +86,15 @@ IL_0027: stloc.1 IL_0028: ldarg.0 IL_0029: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f4@7-1'::builder@ - IL_002e: stloc.2 - IL_002f: ldloc.1 - IL_0030: stloc.3 - IL_0031: ldloc.3 - IL_0032: newobj instance void assembly/assembly/'f4@10-2'::.ctor(int32) - IL_0037: tail. - IL_0039: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_003e: ret + IL_002e: ldloc.1 + IL_002f: tail. + IL_0031: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0036: ret } } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-3' + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-2' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x @@ -150,7 +108,7 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x IL_000d: ret } @@ -160,9 +118,9 @@ .maxstack 8 IL_0000: nop IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x IL_000d: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value() IL_0012: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_Value(!0) IL_0017: nop @@ -175,52 +133,6 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@6-4' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::TryFinally(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0014: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f4@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -245,36 +157,27 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 7 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_3) + .maxstack 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_000d: stloc.1 - IL_000e: ldarg.0 - IL_000f: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_0014: ldarg.0 - IL_0015: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_001a: ldloc.0 - IL_001b: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_000d: ldarg.0 + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_0013: ldarg.0 + IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_0019: ldloc.0 + IL_001a: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0025: stloc.2 - IL_0026: ldloc.0 - IL_0027: newobj instance void assembly/assembly/'f4@12-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_002c: stloc.3 - IL_002d: ldloc.2 - IL_002e: ldloc.3 - IL_002f: newobj instance void assembly/assembly/'f4@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0034: tail. - IL_0036: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_003b: ret + IL_001f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0024: ldloc.0 + IL_0025: newobj instance void assembly/assembly/'f4@12-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002a: tail. + IL_002c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::TryFinally(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0031: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 143ba00c7de..0f4b2257cbb 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -37,42 +37,6 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@10-2' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f4@10-2'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f4@10-2'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@7-1' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -103,9 +67,7 @@ .maxstack 6 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, - int32 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, - int32 V_3) + int32 V_1) IL_0000: nop IL_0001: ldc.i4.0 IL_0002: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) @@ -124,19 +86,15 @@ IL_0027: stloc.1 IL_0028: ldarg.0 IL_0029: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f4@7-1'::builder@ - IL_002e: stloc.2 - IL_002f: ldloc.1 - IL_0030: stloc.3 - IL_0031: ldloc.3 - IL_0032: newobj instance void assembly/assembly/'f4@10-2'::.ctor(int32) - IL_0037: tail. - IL_0039: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_003e: ret + IL_002e: ldloc.1 + IL_002f: tail. + IL_0031: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0036: ret } } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-3' + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-2' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x @@ -150,7 +108,7 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x IL_000d: ret } @@ -160,9 +118,9 @@ .maxstack 8 IL_0000: nop IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x IL_000d: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value() IL_0012: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_Value(!0) IL_0017: nop @@ -175,52 +133,6 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@6-4' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::TryFinally(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0014: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f4@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -245,36 +157,27 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 7 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_3) + .maxstack 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_000d: stloc.1 - IL_000e: ldarg.0 - IL_000f: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_0014: ldarg.0 - IL_0015: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_001a: ldloc.0 - IL_001b: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_000d: ldarg.0 + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_0013: ldarg.0 + IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_0019: ldloc.0 + IL_001a: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0025: stloc.2 - IL_0026: ldloc.0 - IL_0027: newobj instance void assembly/assembly/'f4@12-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_002c: stloc.3 - IL_002d: ldloc.2 - IL_002e: ldloc.3 - IL_002f: newobj instance void assembly/assembly/'f4@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0034: tail. - IL_0036: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_003b: ret + IL_001f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0024: ldloc.0 + IL_0025: newobj instance void assembly/assembly/'f4@12-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002a: tail. + IL_002c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::TryFinally(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0031: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 1c4d13e1c30..e9d89b5a241 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -166,84 +166,6 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-4' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 - IL_0006: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-5' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f7@6 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -268,40 +190,27 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 7 - .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0006: stloc.0 - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() - IL_0012: ldarg.0 - IL_0013: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0018: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_001d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_000c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() + IL_0011: ldarg.0 + IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0017: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_001c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0022: stloc.1 - IL_0023: ldarg.0 - IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0029: ldarg.0 - IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_002f: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0039: stloc.2 - IL_003a: ldloc.2 - IL_003b: newobj instance void assembly/assembly/'f7@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) - IL_0040: stloc.3 - IL_0041: ldloc.1 - IL_0042: ldloc.3 - IL_0043: newobj instance void assembly/assembly/'f7@6-5'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0048: tail. - IL_004a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_004f: ret + IL_0021: ldarg.0 + IL_0022: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0027: ldarg.0 + IL_0028: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_002d: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0032: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0037: tail. + IL_0039: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) + IL_003e: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index f2f84fbd489..abc834a81f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -166,84 +166,6 @@ } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-4' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 - IL_0006: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-5' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f7@6 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -268,40 +190,27 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 7 - .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0006: stloc.0 - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() - IL_0012: ldarg.0 - IL_0013: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0018: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_001d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_000c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() + IL_0011: ldarg.0 + IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0017: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_001c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0022: stloc.1 - IL_0023: ldarg.0 - IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0029: ldarg.0 - IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_002f: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0039: stloc.2 - IL_003a: ldloc.2 - IL_003b: newobj instance void assembly/assembly/'f7@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) - IL_0040: stloc.3 - IL_0041: ldloc.1 - IL_0042: ldloc.3 - IL_0043: newobj instance void assembly/assembly/'f7@6-5'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0048: tail. - IL_004a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_004f: ret + IL_0021: ldarg.0 + IL_0022: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0027: ldarg.0 + IL_0028: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_002d: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0032: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0037: tail. + IL_0039: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) + IL_003e: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 791fe74ed50..05684073110 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -37,42 +37,6 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@10-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f2@10-1'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f2@10-1'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f2@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -100,9 +64,7 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, - int32 V_4) + int32 V_2) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -131,50 +93,10 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@5::builder@ - IL_0040: stloc.3 - IL_0041: ldloc.2 - IL_0042: stloc.s V_4 - IL_0044: ldloc.s V_4 - IL_0046: newobj instance void assembly/assembly/'f2@10-1'::.ctor(int32) - IL_004b: tail. - IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0052: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@20-5' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f3@20-5'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f3@20-5'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret + IL_0040: ldloc.2 + IL_0041: tail. + IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0048: ret } } @@ -216,9 +138,7 @@ .maxstack 6 .locals init (int32 V_0, - int32 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, - int32 V_3) + int32 V_1) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 @@ -232,60 +152,10 @@ IL_0016: stloc.1 IL_0017: ldarg.0 IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@19-4'::builder@ - IL_001d: stloc.2 - IL_001e: ldloc.1 - IL_001f: stloc.3 - IL_0020: ldloc.3 - IL_0021: newobj instance void assembly/assembly/'f3@20-5'::.ctor(int32) - IL_0026: tail. - IL_0028: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_002d: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@19-6' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_001d: ldloc.1 + IL_001e: tail. + IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0025: ret } } @@ -318,12 +188,9 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg3) cil managed { - .maxstack 7 + .maxstack 9 .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_4) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldc.i4.0 @@ -338,71 +205,19 @@ IL_0017: nop IL_0018: ldarg.0 IL_0019: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_001e: stloc.2 - IL_001f: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_0024: stloc.3 - IL_0025: ldarg.0 - IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_002b: ldarg.0 - IL_002c: ldfld int32 assembly/assembly/'f3@16-3'::x1 - IL_0031: ldloc.1 - IL_0032: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_001e: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_0023: ldarg.0 + IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ + IL_0029: ldarg.0 + IL_002a: ldfld int32 assembly/assembly/'f3@16-3'::x1 + IL_002f: ldloc.1 + IL_0030: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0037: stloc.s V_4 - IL_0039: ldloc.3 - IL_003a: ldloc.s V_4 - IL_003c: newobj instance void assembly/assembly/'f3@19-6'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0041: tail. - IL_0043: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0048: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-7' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_0035: tail. + IL_0037: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_003c: ret } } @@ -435,78 +250,23 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg2) cil managed { - .maxstack 6 - .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) + .maxstack 8 + .locals init (int32 V_0) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0008: stloc.1 - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000e: stloc.2 - IL_000f: ldarg.0 - IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0015: ldarg.0 - IL_0016: ldfld int32 assembly/assembly/'f3@15-2'::x1 - IL_001b: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, - int32) - IL_0020: stloc.3 - IL_0021: ldloc.2 - IL_0022: ldloc.3 - IL_0023: newobj instance void assembly/assembly/'f3@16-7'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0028: tail. - IL_002a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_002f: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-8' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation + IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ + IL_0013: ldarg.0 + IL_0014: ldfld int32 assembly/assembly/'f3@15-2'::x1 + IL_0019: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + int32) + IL_001e: tail. + IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0025: ret } } @@ -535,77 +295,22 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg1) cil managed { - .maxstack 6 - .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) + .maxstack 8 + .locals init (int32 V_0) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0008: stloc.1 - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000e: stloc.2 - IL_000f: ldarg.0 - IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0015: ldloc.0 - IL_0016: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, - int32) - IL_001b: stloc.3 - IL_001c: ldloc.2 - IL_001d: ldloc.3 - IL_001e: newobj instance void assembly/assembly/'f3@16-8'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0023: tail. - IL_0025: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_002a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-9' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation + IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ + IL_0013: ldloc.0 + IL_0014: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + int32) + IL_0019: tail. + IL_001b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0020: ret } } @@ -634,26 +339,17 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 6 - .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_2) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0006: stloc.0 - IL_0007: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000c: stloc.1 - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0013: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0018: stloc.2 - IL_0019: ldloc.1 - IL_001a: ldloc.2 - IL_001b: newobj instance void assembly/assembly/'f3@16-9'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0020: tail. - IL_0022: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0027: ret + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000b: ldarg.0 + IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ + IL_0011: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0016: tail. + IL_0018: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_001d: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 8afb27a6f74..22e4769fcca 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -37,42 +37,6 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@10-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f2@10-1'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f2@10-1'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret - } - - } - .class auto ansi serializable sealed nested assembly beforefieldinit f2@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -100,9 +64,7 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, - int32 V_4) + int32 V_2) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -131,50 +93,10 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@5::builder@ - IL_0040: stloc.3 - IL_0041: ldloc.2 - IL_0042: stloc.s V_4 - IL_0044: ldloc.s V_4 - IL_0046: newobj instance void assembly/assembly/'f2@10-1'::.ctor(int32) - IL_004b: tail. - IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0052: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@20-5' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public int32 'value' - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld int32 assembly/assembly/'f3@20-5'::'value' - IL_000d: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld int32 assembly/assembly/'f3@20-5'::'value' - IL_0007: tail. - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - !0) - IL_000e: ret + IL_0040: ldloc.2 + IL_0041: tail. + IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0048: ret } } @@ -216,9 +138,7 @@ .maxstack 6 .locals init (int32 V_0, - int32 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, - int32 V_3) + int32 V_1) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 @@ -232,60 +152,10 @@ IL_0016: stloc.1 IL_0017: ldarg.0 IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@19-4'::builder@ - IL_001d: stloc.2 - IL_001e: ldloc.1 - IL_001f: stloc.3 - IL_0020: ldloc.3 - IL_0021: newobj instance void assembly/assembly/'f3@20-5'::.ctor(int32) - IL_0026: tail. - IL_0028: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_002d: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@19-6' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_001d: ldloc.1 + IL_001e: tail. + IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) + IL_0025: ret } } @@ -318,12 +188,9 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg3) cil managed { - .maxstack 7 + .maxstack 9 .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_4) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldc.i4.0 @@ -338,71 +205,19 @@ IL_0017: nop IL_0018: ldarg.0 IL_0019: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_001e: stloc.2 - IL_001f: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_0024: stloc.3 - IL_0025: ldarg.0 - IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_002b: ldarg.0 - IL_002c: ldfld int32 assembly/assembly/'f3@16-3'::x1 - IL_0031: ldloc.1 - IL_0032: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_001e: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_0023: ldarg.0 + IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ + IL_0029: ldarg.0 + IL_002a: ldfld int32 assembly/assembly/'f3@16-3'::x1 + IL_002f: ldloc.1 + IL_0030: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0037: stloc.s V_4 - IL_0039: ldloc.3 - IL_003a: ldloc.s V_4 - IL_003c: newobj instance void assembly/assembly/'f3@19-6'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0041: tail. - IL_0043: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0048: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-7' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_0035: tail. + IL_0037: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_003c: ret } } @@ -435,78 +250,23 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg2) cil managed { - .maxstack 6 - .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) + .maxstack 8 + .locals init (int32 V_0) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0008: stloc.1 - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000e: stloc.2 - IL_000f: ldarg.0 - IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0015: ldarg.0 - IL_0016: ldfld int32 assembly/assembly/'f3@15-2'::x1 - IL_001b: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, - int32) - IL_0020: stloc.3 - IL_0021: ldloc.2 - IL_0022: ldloc.3 - IL_0023: newobj instance void assembly/assembly/'f3@16-7'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0028: tail. - IL_002a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_002f: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-8' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation + IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ + IL_0013: ldarg.0 + IL_0014: ldfld int32 assembly/assembly/'f3@15-2'::x1 + IL_0019: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + int32) + IL_001e: tail. + IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0025: ret } } @@ -535,77 +295,22 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg1) cil managed { - .maxstack 6 - .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) + .maxstack 8 + .locals init (int32 V_0) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0008: stloc.1 - IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000e: stloc.2 - IL_000f: ldarg.0 - IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0015: ldloc.0 - IL_0016: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, - int32) - IL_001b: stloc.3 - IL_001c: ldloc.2 - IL_001d: ldloc.3 - IL_001e: newobj instance void assembly/assembly/'f3@16-8'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0023: tail. - IL_0025: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_002a: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-9' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> - { - .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation + IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder - IL_0014: ret - } - - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed - { - - .maxstack 8 - IL_0000: ldarg.1 - IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation - IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder - IL_000d: tail. - IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0014: ret + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ + IL_0013: ldloc.0 + IL_0014: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + int32) + IL_0019: tail. + IL_001b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0020: ret } } @@ -634,26 +339,17 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 6 - .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_2) + .maxstack 8 IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0006: stloc.0 - IL_0007: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000c: stloc.1 - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0013: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0018: stloc.2 - IL_0019: ldloc.1 - IL_001a: ldloc.2 - IL_001b: newobj instance void assembly/assembly/'f3@16-9'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0020: tail. - IL_0022: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) - IL_0027: ret + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000b: ldarg.0 + IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ + IL_0011: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0016: tail. + IL_0018: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_001d: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 0168c04c588..5090f0e752e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -67,7 +67,7 @@ .entrypoint .maxstack 8 - IL_0000: call void assembly::g() + IL_0000: call void assembly::f() IL_0005: nop IL_0006: ret } @@ -78,4 +78,3 @@ - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 170b3c6df09..7d67a6cf637 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/MethodImplNoInline02.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -68,7 +68,7 @@ { .maxstack 8 - IL_0000: call void assembly::g() + IL_0000: call void assembly::f() IL_0005: nop IL_0006: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.netcore.bsl index bfce2457d09..85086b6d488 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.netcore.bsl @@ -177,409 +177,49 @@ .method public static class [runtime]System.Collections.Generic.List`1 test() cil managed { - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + .maxstack 8 IL_0000: ldnull - IL_0001: stloc.0 - IL_0002: ldnull - IL_0003: stloc.1 - IL_0004: ldc.i4.0 - IL_0005: stloc.2 - IL_0006: ldloc.0 - IL_0007: stloc.s V_4 - IL_0009: ldloc.s V_4 - IL_000b: brfalse.s IL_000f - - IL_000d: br.s IL_0013 - - IL_000f: ldloc.2 - IL_0010: nop - IL_0011: br.s IL_001b - - IL_0013: ldloc.s V_4 - IL_0015: stloc.s V_5 - IL_0017: ldloc.2 - IL_0018: ldc.i4.1 - IL_0019: add - IL_001a: nop - IL_001b: stloc.3 - IL_001c: ldloc.1 - IL_001d: stloc.s V_7 - IL_001f: ldloc.s V_7 - IL_0021: brfalse.s IL_0025 - - IL_0023: br.s IL_0029 - - IL_0025: ldloc.3 - IL_0026: nop - IL_0027: br.s IL_0031 - - IL_0029: ldloc.s V_7 - IL_002b: stloc.s V_8 - IL_002d: ldloc.3 - IL_002e: ldc.i4.1 - IL_002f: add - IL_0030: nop - IL_0031: stloc.s V_6 - IL_0033: ldloc.s V_6 - IL_0035: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_003a: stloc.s V_9 - IL_003c: ldloc.0 - IL_003d: stloc.s V_10 - IL_003f: ldloc.s V_10 - IL_0041: brfalse.s IL_0045 - - IL_0043: br.s IL_0048 - - IL_0045: nop - IL_0046: br.s IL_005b - - IL_0048: ldloc.s V_10 - IL_004a: stloc.s V_11 - IL_004c: ldloc.s V_9 - IL_004e: ldloc.s V_11 - IL_0050: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0055: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_005a: nop - IL_005b: ldloc.1 - IL_005c: stloc.s V_12 - IL_005e: ldloc.s V_12 - IL_0060: brfalse.s IL_0064 - - IL_0062: br.s IL_0067 - - IL_0064: nop - IL_0065: br.s IL_007a - - IL_0067: ldloc.s V_12 - IL_0069: stloc.s V_13 - IL_006b: ldloc.s V_9 - IL_006d: ldloc.s V_13 - IL_006f: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0074: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0079: nop - IL_007a: ldloc.s V_9 - IL_007c: ret + IL_0001: ldnull + IL_0002: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0007: ret } .method public static class [runtime]System.Collections.Generic.List`1 test2() cil managed { - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + .maxstack 8 IL_0000: newobj instance void assembly/A::.ctor() IL_0005: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_000a: stloc.0 - IL_000b: ldnull - IL_000c: stloc.1 - IL_000d: ldc.i4.0 - IL_000e: stloc.2 - IL_000f: ldloc.0 - IL_0010: stloc.s V_4 - IL_0012: ldloc.s V_4 - IL_0014: brfalse.s IL_0018 - - IL_0016: br.s IL_001c - - IL_0018: ldloc.2 - IL_0019: nop - IL_001a: br.s IL_0024 - - IL_001c: ldloc.s V_4 - IL_001e: stloc.s V_5 - IL_0020: ldloc.2 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: nop - IL_0024: stloc.3 - IL_0025: ldloc.1 - IL_0026: stloc.s V_7 - IL_0028: ldloc.s V_7 - IL_002a: brfalse.s IL_002e - - IL_002c: br.s IL_0032 - - IL_002e: ldloc.3 - IL_002f: nop - IL_0030: br.s IL_003a - - IL_0032: ldloc.s V_7 - IL_0034: stloc.s V_8 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: nop - IL_003a: stloc.s V_6 - IL_003c: ldloc.s V_6 - IL_003e: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_0043: stloc.s V_9 - IL_0045: ldloc.0 - IL_0046: stloc.s V_10 - IL_0048: ldloc.s V_10 - IL_004a: brfalse.s IL_004e - - IL_004c: br.s IL_0051 - - IL_004e: nop - IL_004f: br.s IL_0064 - - IL_0051: ldloc.s V_10 - IL_0053: stloc.s V_11 - IL_0055: ldloc.s V_9 - IL_0057: ldloc.s V_11 - IL_0059: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_005e: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0063: nop - IL_0064: ldloc.1 - IL_0065: stloc.s V_12 - IL_0067: ldloc.s V_12 - IL_0069: brfalse.s IL_006d - - IL_006b: br.s IL_0070 - - IL_006d: nop - IL_006e: br.s IL_0083 - - IL_0070: ldloc.s V_12 - IL_0072: stloc.s V_13 - IL_0074: ldloc.s V_9 - IL_0076: ldloc.s V_13 - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_007d: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0082: nop - IL_0083: ldloc.s V_9 - IL_0085: ret + IL_000a: ldnull + IL_000b: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0010: ret } .method public static class [runtime]System.Collections.Generic.List`1 test3() cil managed { - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + .maxstack 8 IL_0000: ldnull - IL_0001: stloc.0 - IL_0002: newobj instance void assembly/A::.ctor() - IL_0007: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_000c: stloc.1 - IL_000d: ldc.i4.0 - IL_000e: stloc.2 - IL_000f: ldloc.0 - IL_0010: stloc.s V_4 - IL_0012: ldloc.s V_4 - IL_0014: brfalse.s IL_0018 - - IL_0016: br.s IL_001c - - IL_0018: ldloc.2 - IL_0019: nop - IL_001a: br.s IL_0024 - - IL_001c: ldloc.s V_4 - IL_001e: stloc.s V_5 - IL_0020: ldloc.2 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: nop - IL_0024: stloc.3 - IL_0025: ldloc.1 - IL_0026: stloc.s V_7 - IL_0028: ldloc.s V_7 - IL_002a: brfalse.s IL_002e - - IL_002c: br.s IL_0032 - - IL_002e: ldloc.3 - IL_002f: nop - IL_0030: br.s IL_003a - - IL_0032: ldloc.s V_7 - IL_0034: stloc.s V_8 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: nop - IL_003a: stloc.s V_6 - IL_003c: ldloc.s V_6 - IL_003e: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_0043: stloc.s V_9 - IL_0045: ldloc.0 - IL_0046: stloc.s V_10 - IL_0048: ldloc.s V_10 - IL_004a: brfalse.s IL_004e - - IL_004c: br.s IL_0051 - - IL_004e: nop - IL_004f: br.s IL_0064 - - IL_0051: ldloc.s V_10 - IL_0053: stloc.s V_11 - IL_0055: ldloc.s V_9 - IL_0057: ldloc.s V_11 - IL_0059: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_005e: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0063: nop - IL_0064: ldloc.1 - IL_0065: stloc.s V_12 - IL_0067: ldloc.s V_12 - IL_0069: brfalse.s IL_006d - - IL_006b: br.s IL_0070 - - IL_006d: nop - IL_006e: br.s IL_0083 - - IL_0070: ldloc.s V_12 - IL_0072: stloc.s V_13 - IL_0074: ldloc.s V_9 - IL_0076: ldloc.s V_13 - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_007d: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0082: nop - IL_0083: ldloc.s V_9 - IL_0085: ret + IL_0001: newobj instance void assembly/A::.ctor() + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_000b: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0010: ret } .method public static class [runtime]System.Collections.Generic.List`1 test4() cil managed { - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + .maxstack 8 IL_0000: newobj instance void assembly/A::.ctor() IL_0005: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_000a: stloc.0 - IL_000b: newobj instance void assembly/A::.ctor() - IL_0010: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: stloc.2 - IL_0018: ldloc.0 - IL_0019: stloc.s V_4 - IL_001b: ldloc.s V_4 - IL_001d: brfalse.s IL_0021 - - IL_001f: br.s IL_0025 - - IL_0021: ldloc.2 - IL_0022: nop - IL_0023: br.s IL_002d - - IL_0025: ldloc.s V_4 - IL_0027: stloc.s V_5 - IL_0029: ldloc.2 - IL_002a: ldc.i4.1 - IL_002b: add - IL_002c: nop - IL_002d: stloc.3 - IL_002e: ldloc.1 - IL_002f: stloc.s V_7 - IL_0031: ldloc.s V_7 - IL_0033: brfalse.s IL_0037 - - IL_0035: br.s IL_003b - - IL_0037: ldloc.3 - IL_0038: nop - IL_0039: br.s IL_0043 - - IL_003b: ldloc.s V_7 - IL_003d: stloc.s V_8 - IL_003f: ldloc.3 - IL_0040: ldc.i4.1 - IL_0041: add - IL_0042: nop - IL_0043: stloc.s V_6 - IL_0045: ldloc.s V_6 - IL_0047: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_004c: stloc.s V_9 - IL_004e: ldloc.0 - IL_004f: stloc.s V_10 - IL_0051: ldloc.s V_10 - IL_0053: brfalse.s IL_0057 - - IL_0055: br.s IL_005a - - IL_0057: nop - IL_0058: br.s IL_006d - - IL_005a: ldloc.s V_10 - IL_005c: stloc.s V_11 - IL_005e: ldloc.s V_9 - IL_0060: ldloc.s V_11 - IL_0062: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0067: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_006c: nop - IL_006d: ldloc.1 - IL_006e: stloc.s V_12 - IL_0070: ldloc.s V_12 - IL_0072: brfalse.s IL_0076 - - IL_0074: br.s IL_0079 - - IL_0076: nop - IL_0077: br.s IL_008c - - IL_0079: ldloc.s V_12 - IL_007b: stloc.s V_13 - IL_007d: ldloc.s V_9 - IL_007f: ldloc.s V_13 - IL_0081: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0086: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_008b: nop - IL_008c: ldloc.s V_9 - IL_008e: ret + IL_000a: newobj instance void assembly/A::.ctor() + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0014: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0019: ret } } diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs index 2aab772a121..b950e249a99 100644 --- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs @@ -917,8 +917,8 @@ let ``Test Optimized Declarations Project1`` () = "let testTypeOf(x) = Operators.TypeOf<'T> () @ (17,24--17,30)"; "let mutableVar(x) = (if Operators.op_GreaterThan (x,0) then let mutable acc: Microsoft.FSharp.Core.int = x in acc <- x else ()) @ (20,4--22,16)"; "let mutableConst(unitVar0) = let mutable acc: Microsoft.FSharp.Core.unit = () in acc <- () @ (25,16--25,19)"; - "let testMutableVar = let x: Microsoft.FSharp.Core.int = 1 in (if Operators.op_GreaterThan (x,0) then let mutable acc: Microsoft.FSharp.Core.int = x in acc <- x else ()) @ (28,21--28,33)"; - "let testMutableConst = let mutable acc: Microsoft.FSharp.Core.unit = () in acc <- () @ (29,23--29,38)"] + "let testMutableVar = N.mutableVar (1) @ (28,21--28,33)"; + "let testMutableConst = N.mutableConst (()) @ (29,23--29,38)"] // printFSharpDecls "" file2.Declarations |> Seq.iter (printfn "%s") printfn "// optimized" From a2cf8d58534cd8aacb3b9320ee54ca263defc190 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 14 May 2026 11:50:00 +0200 Subject: [PATCH 43/50] Update baselines --- ...OptionalArg01.fs.OptimizeOff.il.net472.bsl | 430 ++---------------- 1 file changed, 35 insertions(+), 395 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl index 1db5018d510..46e66821bf5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl @@ -188,417 +188,57 @@ } - .method public static class [runtime]System.Collections.Generic.List`1 + .method public static class [runtime]System.Collections.Generic.List`1 test() cil managed { - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + + .maxstack 8 IL_0000: ldnull - IL_0001: stloc.0 - IL_0002: ldnull - IL_0003: stloc.1 - IL_0004: ldc.i4.0 - IL_0005: stloc.2 - IL_0006: ldloc.0 - IL_0007: stloc.s V_4 - IL_0009: ldloc.s V_4 - IL_000b: brfalse.s IL_000f - - IL_000d: br.s IL_0013 - - IL_000f: ldloc.2 - IL_0010: nop - IL_0011: br.s IL_001b - - IL_0013: ldloc.s V_4 - IL_0015: stloc.s V_5 - IL_0017: ldloc.2 - IL_0018: ldc.i4.1 - IL_0019: add - IL_001a: nop - IL_001b: stloc.3 - IL_001c: ldloc.1 - IL_001d: stloc.s V_7 - IL_001f: ldloc.s V_7 - IL_0021: brfalse.s IL_0025 - - IL_0023: br.s IL_0029 - - IL_0025: ldloc.3 - IL_0026: nop - IL_0027: br.s IL_0031 - - IL_0029: ldloc.s V_7 - IL_002b: stloc.s V_8 - IL_002d: ldloc.3 - IL_002e: ldc.i4.1 - IL_002f: add - IL_0030: nop - IL_0031: stloc.s V_6 - IL_0033: ldloc.s V_6 - IL_0035: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_003a: stloc.s V_9 - IL_003c: ldloc.0 - IL_003d: stloc.s V_10 - IL_003f: ldloc.s V_10 - IL_0041: brfalse.s IL_0045 - - IL_0043: br.s IL_0048 - - IL_0045: nop - IL_0046: br.s IL_005b - - IL_0048: ldloc.s V_10 - IL_004a: stloc.s V_11 - IL_004c: ldloc.s V_9 - IL_004e: ldloc.s V_11 - IL_0050: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0055: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_005a: nop - IL_005b: ldloc.1 - IL_005c: stloc.s V_12 - IL_005e: ldloc.s V_12 - IL_0060: brfalse.s IL_0064 - - IL_0062: br.s IL_0067 - - IL_0064: nop - IL_0065: br.s IL_007a - - IL_0067: ldloc.s V_12 - IL_0069: stloc.s V_13 - IL_006b: ldloc.s V_9 - IL_006d: ldloc.s V_13 - IL_006f: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0074: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0079: nop - IL_007a: ldloc.s V_9 - IL_007c: ret - } + IL_0001: ldnull + IL_0002: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0007: ret + } - .method public static class [runtime]System.Collections.Generic.List`1 + .method public static class [runtime]System.Collections.Generic.List`1 test2() cil managed { - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + + .maxstack 8 IL_0000: newobj instance void assembly/A::.ctor() IL_0005: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_000a: stloc.0 - IL_000b: ldnull - IL_000c: stloc.1 - IL_000d: ldc.i4.0 - IL_000e: stloc.2 - IL_000f: ldloc.0 - IL_0010: stloc.s V_4 - IL_0012: ldloc.s V_4 - IL_0014: brfalse.s IL_0018 - - IL_0016: br.s IL_001c - - IL_0018: ldloc.2 - IL_0019: nop - IL_001a: br.s IL_0024 - - IL_001c: ldloc.s V_4 - IL_001e: stloc.s V_5 - IL_0020: ldloc.2 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: nop - IL_0024: stloc.3 - IL_0025: ldloc.1 - IL_0026: stloc.s V_7 - IL_0028: ldloc.s V_7 - IL_002a: brfalse.s IL_002e - - IL_002c: br.s IL_0032 - - IL_002e: ldloc.3 - IL_002f: nop - IL_0030: br.s IL_003a - - IL_0032: ldloc.s V_7 - IL_0034: stloc.s V_8 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: nop - IL_003a: stloc.s V_6 - IL_003c: ldloc.s V_6 - IL_003e: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_0043: stloc.s V_9 - IL_0045: ldloc.0 - IL_0046: stloc.s V_10 - IL_0048: ldloc.s V_10 - IL_004a: brfalse.s IL_004e - - IL_004c: br.s IL_0051 - - IL_004e: nop - IL_004f: br.s IL_0064 - - IL_0051: ldloc.s V_10 - IL_0053: stloc.s V_11 - IL_0055: ldloc.s V_9 - IL_0057: ldloc.s V_11 - IL_0059: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_005e: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0063: nop - IL_0064: ldloc.1 - IL_0065: stloc.s V_12 - IL_0067: ldloc.s V_12 - IL_0069: brfalse.s IL_006d - - IL_006b: br.s IL_0070 - - IL_006d: nop - IL_006e: br.s IL_0083 - - IL_0070: ldloc.s V_12 - IL_0072: stloc.s V_13 - IL_0074: ldloc.s V_9 - IL_0076: ldloc.s V_13 - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_007d: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0082: nop - IL_0083: ldloc.s V_9 - IL_0085: ret - } + IL_000a: ldnull + IL_000b: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0010: ret + } - .method public static class [runtime]System.Collections.Generic.List`1 + .method public static class [runtime]System.Collections.Generic.List`1 test3() cil managed { - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) - IL_0000: ldnull - IL_0001: stloc.0 - IL_0002: newobj instance void assembly/A::.ctor() - IL_0007: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_000c: stloc.1 - IL_000d: ldc.i4.0 - IL_000e: stloc.2 - IL_000f: ldloc.0 - IL_0010: stloc.s V_4 - IL_0012: ldloc.s V_4 - IL_0014: brfalse.s IL_0018 - - IL_0016: br.s IL_001c - - IL_0018: ldloc.2 - IL_0019: nop - IL_001a: br.s IL_0024 - - IL_001c: ldloc.s V_4 - IL_001e: stloc.s V_5 - IL_0020: ldloc.2 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: nop - IL_0024: stloc.3 - IL_0025: ldloc.1 - IL_0026: stloc.s V_7 - IL_0028: ldloc.s V_7 - IL_002a: brfalse.s IL_002e - - IL_002c: br.s IL_0032 - - IL_002e: ldloc.3 - IL_002f: nop - IL_0030: br.s IL_003a - - IL_0032: ldloc.s V_7 - IL_0034: stloc.s V_8 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: nop - IL_003a: stloc.s V_6 - IL_003c: ldloc.s V_6 - IL_003e: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_0043: stloc.s V_9 - IL_0045: ldloc.0 - IL_0046: stloc.s V_10 - IL_0048: ldloc.s V_10 - IL_004a: brfalse.s IL_004e - - IL_004c: br.s IL_0051 - - IL_004e: nop - IL_004f: br.s IL_0064 - - IL_0051: ldloc.s V_10 - IL_0053: stloc.s V_11 - IL_0055: ldloc.s V_9 - IL_0057: ldloc.s V_11 - IL_0059: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_005e: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0063: nop - IL_0064: ldloc.1 - IL_0065: stloc.s V_12 - IL_0067: ldloc.s V_12 - IL_0069: brfalse.s IL_006d - - IL_006b: br.s IL_0070 - - IL_006d: nop - IL_006e: br.s IL_0083 - - IL_0070: ldloc.s V_12 - IL_0072: stloc.s V_13 - IL_0074: ldloc.s V_9 - IL_0076: ldloc.s V_13 - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_007d: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_0082: nop - IL_0083: ldloc.s V_9 - IL_0085: ret - } - .method public static class [runtime]System.Collections.Generic.List`1 + .maxstack 8 + IL_0000: ldnull + IL_0001: newobj instance void assembly/A::.ctor() + IL_0006: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_000b: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0010: ret + } + + .method public static class [runtime]System.Collections.Generic.List`1 test4() cil managed { - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_1, - int32 V_2, - int32 V_3, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_4, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_5, - int32 V_6, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_8, - class [runtime]System.Collections.Generic.List`1 V_9, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_10, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_11, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_12, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 V_13) + + .maxstack 8 IL_0000: newobj instance void assembly/A::.ctor() IL_0005: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_000a: stloc.0 - IL_000b: newobj instance void assembly/A::.ctor() - IL_0010: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: stloc.2 - IL_0018: ldloc.0 - IL_0019: stloc.s V_4 - IL_001b: ldloc.s V_4 - IL_001d: brfalse.s IL_0021 - - IL_001f: br.s IL_0025 - - IL_0021: ldloc.2 - IL_0022: nop - IL_0023: br.s IL_002d - - IL_0025: ldloc.s V_4 - IL_0027: stloc.s V_5 - IL_0029: ldloc.2 - IL_002a: ldc.i4.1 - IL_002b: add - IL_002c: nop - IL_002d: stloc.3 - IL_002e: ldloc.1 - IL_002f: stloc.s V_7 - IL_0031: ldloc.s V_7 - IL_0033: brfalse.s IL_0037 - - IL_0035: br.s IL_003b - - IL_0037: ldloc.3 - IL_0038: nop - IL_0039: br.s IL_0043 - - IL_003b: ldloc.s V_7 - IL_003d: stloc.s V_8 - IL_003f: ldloc.3 - IL_0040: ldc.i4.1 - IL_0041: add - IL_0042: nop - IL_0043: stloc.s V_6 - IL_0045: ldloc.s V_6 - IL_0047: newobj instance void class [runtime]System.Collections.Generic.List`1::.ctor(int32) - IL_004c: stloc.s V_9 - IL_004e: ldloc.0 - IL_004f: stloc.s V_10 - IL_0051: ldloc.s V_10 - IL_0053: brfalse.s IL_0057 - - IL_0055: br.s IL_005a - - IL_0057: nop - IL_0058: br.s IL_006d - - IL_005a: ldloc.s V_10 - IL_005c: stloc.s V_11 - IL_005e: ldloc.s V_9 - IL_0060: ldloc.s V_11 - IL_0062: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0067: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_006c: nop - IL_006d: ldloc.1 - IL_006e: stloc.s V_12 - IL_0070: ldloc.s V_12 - IL_0072: brfalse.s IL_0076 - - IL_0074: br.s IL_0079 - - IL_0076: nop - IL_0077: br.s IL_008c - - IL_0079: ldloc.s V_12 - IL_007b: stloc.s V_13 - IL_007d: ldloc.s V_9 - IL_007f: ldloc.s V_13 - IL_0081: call instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::get_Value() - IL_0086: callvirt instance void class [runtime]System.Collections.Generic.List`1::Add(!0) - IL_008b: nop - IL_008c: ldloc.s V_9 - IL_008e: ret - } + IL_000a: newobj instance void assembly/A::.ctor() + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) + IL_0014: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + IL_0019: ret + } } From 5e967fff1722e8e02bc67f8495bc63ba2e0d3f88 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 1 Jun 2026 13:00:49 +0200 Subject: [PATCH 44/50] StateMachineTests: enable optimizations --- .../Language/StateMachineTests.fs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs index 36c49541af6..dc929dea744 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fs @@ -8,17 +8,9 @@ open FSharp.Test.Compiler module StateMachineTests = - let verify3511AndRun code = + let verifyOptimizedAndRun code = Fsx code - |> withNoOptimize - |> compile - |> shouldFail - |> withWarningCode 3511 - |> ignore - - Fsx code - |> withNoOptimize - |> withOptions ["--nowarn:3511"] + |> withOptimize |> compileExeAndRun // Inlined helper containing a "if __useResumableCode ..." construct failed to expand correctly, @@ -76,7 +68,7 @@ task { } |> fun f -> f.Wait() """ - |> verify3511AndRun + |> verifyOptimizedAndRun |> shouldSucceed [] // https://github.com/dotnet/fsharp/issues/14806 @@ -100,7 +92,7 @@ let run() = run() |> fun f -> f.Wait() """ - |> verify3511AndRun + |> verifyOptimizedAndRun |> shouldSucceed @@ -122,7 +114,7 @@ let foo() = task { foo() |> fun f -> f.Wait() """ - |> verify3511AndRun + |> verifyOptimizedAndRun |> shouldSucceed [] // https://github.com/dotnet/fsharp/issues/13386 From c0b36da06d073cbabf7ffd9fd7c55802a42914e9 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 1 Jun 2026 13:27:59 +0200 Subject: [PATCH 45/50] Update debug baselines --- .../CodeGen/EmittedIL/TaskGeneratedCode.fs | 1370 ++++++++--------- 1 file changed, 639 insertions(+), 731 deletions(-) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs index 04c97034dbf..4280ebf4f7a 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs @@ -2,12 +2,11 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL +open System.Threading.Tasks open FSharp.Test +open FSharp.Test.Compiler open Xunit -open System -open System.Threading.Tasks - // These tests are sensitive to the fact that FSharp.Core is compiled release, not debug // The code generated changes slightly in debug mode #if !DEBUG @@ -37,67 +36,60 @@ let testTask() = task { return 1 } """, (fun verifier -> verifier.VerifyIL [ """ -.method public strict virtual instance void MoveNext() cil managed +.class public abstract auto ansi sealed Test + extends [runtime]System.Object { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext - - .maxstack 4 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - int32 V_3, - class [runtime]System.Exception V_4, - class [runtime]System.Exception V_5) - IL_0000: ldarg.0 - IL_0001: ldfld int32 Test/testTask@4::ResumptionPoint - IL_0006: stloc.0 - .try + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit testTask@4 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed { - IL_0007: ldc.i4.1 - IL_0008: stloc.3 - IL_0009: ldarg.0 - IL_000a: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_000f: ldloc.3 - IL_0010: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_0015: ldc.i4.1 - IL_0016: stloc.2 - IL_0017: ldloc.2 - IL_0018: brfalse.s IL_0037 - - IL_001a: ldarg.0 - IL_001b: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0020: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0025: ldarg.0 - IL_0026: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_002b: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_0030: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_0035: leave.s IL_0045 - - IL_0037: leave.s IL_0045 - - } - catch [runtime]System.Object + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,int32> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - IL_0039: castclass [runtime]System.Exception - IL_003e: stloc.s V_4 - IL_0040: ldloc.s V_4 - IL_0042: stloc.1 - IL_0043: leave.s IL_0045 - - } - IL_0045: ldloc.1 - IL_0046: stloc.s V_5 - IL_0048: ldloc.s V_5 - IL_004a: brtrue.s IL_004d - - IL_004c: ret + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0006: ldc.i4.1 + IL_0007: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Return(!!0) + IL_000c: ret + } + + } + + .method public static class [runtime]System.Threading.Tasks.Task`1 testTask() cil managed + { - IL_004d: ldarg.0 - IL_004e: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0053: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0058: ldloc.s V_5 - IL_005a: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_005f: ret + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldloc.0 + IL_0008: ldloc.0 + IL_0009: newobj instance void Test/testTask@4::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_000e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0013: callvirt instance class [runtime]System.Threading.Tasks.Task`1 [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder::Run(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0>) + IL_0018: ret + } + } """ ])) @@ -198,174 +190,112 @@ let testTask(t: Task) = task { let! res = t in return res+1 } """, (fun verifier -> verifier.VerifyIL [ """ - .method public strict virtual instance void - MoveNext() cil managed - { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext - - .maxstack 5 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - class [runtime]System.Threading.Tasks.Task`1 V_3, - bool V_4, - bool V_5, - int32 V_6, - int32 V_7, - int32 V_8, - int32 V_9, - valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 V_10, - class [runtime]System.Exception V_11, - class [runtime]System.Exception V_12) - IL_0000: ldarg.0 - IL_0001: ldfld int32 Test/testTask@4::ResumptionPoint - IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: ldc.i4.1 - IL_0009: sub - IL_000a: switch ( - IL_0015) - IL_0013: br.s IL_0018 - - IL_0015: nop - IL_0016: br.s IL_001b - - IL_0018: nop - IL_0019: br.s IL_001b - - .try - { - IL_001b: ldloc.0 - IL_001c: ldc.i4.1 - IL_001d: sub - IL_001e: switch ( - IL_0029) - IL_0027: br.s IL_002c - - IL_0029: nop - IL_002a: br.s IL_0057 - - IL_002c: nop - IL_002d: br.s IL_002f - - IL_002f: ldarg.0 - IL_0030: ldfld class [runtime]System.Threading.Tasks.Task`1 Test/testTask@4::t - IL_0035: stloc.3 - IL_0036: ldarg.0 - IL_0037: ldloc.3 - IL_0038: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() - IL_003d: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 Test/testTask@4::awaiter - IL_0042: ldc.i4.1 - IL_0043: stloc.s V_4 - IL_0045: ldarg.0 - IL_0046: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 Test/testTask@4::awaiter - IL_004b: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() - IL_0050: brfalse.s IL_0054 - - IL_0052: br.s IL_006d - - IL_0054: ldc.i4.0 - IL_0055: brfalse.s IL_005b - - IL_0057: ldc.i4.1 - IL_0058: nop - IL_0059: br.s IL_0064 - - IL_005b: ldarg.0 - IL_005c: ldc.i4.1 - IL_005d: stfld int32 Test/testTask@4::ResumptionPoint - IL_0062: ldc.i4.0 - IL_0063: nop - IL_0064: stloc.s V_5 - IL_0066: ldloc.s V_5 - IL_0068: stloc.s V_4 - IL_006a: nop - IL_006b: br.s IL_006e - - IL_006d: nop - IL_006e: ldloc.s V_4 - IL_0070: brfalse.s IL_009e - - IL_0072: ldarg.0 - IL_0073: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 Test/testTask@4::awaiter - IL_0078: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() - IL_007d: stloc.s V_6 - IL_007f: ldloc.s V_6 - IL_0081: stloc.s V_7 - IL_0083: ldloc.s V_7 - IL_0085: stloc.s V_8 - IL_0087: ldloc.s V_8 - IL_0089: ldc.i4.1 - IL_008a: add - IL_008b: stloc.s V_9 - IL_008d: ldarg.0 - IL_008e: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0093: ldloc.s V_9 - IL_0095: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_009a: ldc.i4.1 - IL_009b: nop - IL_009c: br.s IL_00b7 - - IL_009e: ldarg.0 - IL_009f: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_00a4: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00a9: ldarg.0 - IL_00aa: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 Test/testTask@4::awaiter - IL_00af: ldarg.0 - IL_00b0: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/testTask@4>(!!0&, - !!1&) - IL_00b5: ldc.i4.0 - IL_00b6: nop - IL_00b7: brfalse.s IL_00c5 - - IL_00b9: ldarg.0 - IL_00ba: ldloc.s V_10 - IL_00bc: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 Test/testTask@4::awaiter - IL_00c1: ldc.i4.1 - IL_00c2: nop - IL_00c3: br.s IL_00c7 - - IL_00c5: ldc.i4.0 - IL_00c6: nop - IL_00c7: stloc.2 - IL_00c8: ldloc.2 - IL_00c9: brfalse.s IL_00e8 - - IL_00cb: ldarg.0 - IL_00cc: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_00d1: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00d6: ldarg.0 - IL_00d7: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_00dc: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_00e1: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_00e6: leave.s IL_00f6 - - IL_00e8: leave.s IL_00f6 - - } - catch [runtime]System.Object - { - IL_00ea: castclass [runtime]System.Exception - IL_00ef: stloc.s V_11 - IL_00f1: ldloc.s V_11 - IL_00f3: stloc.1 - IL_00f4: leave.s IL_00f6 - - } - IL_00f6: ldloc.1 - IL_00f7: stloc.s V_12 - IL_00f9: ldloc.s V_12 - IL_00fb: brtrue.s IL_00fe - - IL_00fd: ret +.class public abstract auto ansi sealed Test + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@4-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-1'::builder@ + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,int32> Invoke(int32 _arg1) cil managed + { + + .maxstack 7 + .locals init (int32 V_0) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldarg.0 + IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-1'::builder@ + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: add + IL_000b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Return(!!0) + IL_0010: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit testTask@4 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>> + { + .field public class [runtime]System.Threading.Tasks.Task`1 t + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [runtime]System.Threading.Tasks.Task`1 t, class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [runtime]System.Threading.Tasks.Task`1 Test/testTask@4::t + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,int32> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0006: ldarg.0 + IL_0007: ldfld class [runtime]System.Threading.Tasks.Task`1 Test/testTask@4::t + IL_000c: ldarg.0 + IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0012: newobj instance void Test/'testTask@4-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_0017: call class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!2> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderExtensions.HighPriority::TaskBuilderBase.Bind(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase, + class [runtime]System.Threading.Tasks.Task`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!2>>) + IL_001c: ret + } + + } + + .method public static class [runtime]System.Threading.Tasks.Task`1 testTask(class [runtime]System.Threading.Tasks.Task`1 t) cil managed + { - IL_00fe: ldarg.0 - IL_00ff: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0104: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0109: ldloc.s V_12 - IL_010b: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_0110: ret - } + .maxstack 6 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldloc.0 + IL_0008: ldarg.0 + IL_0009: ldloc.0 + IL_000a: newobj instance void Test/testTask@4::.ctor(class [runtime]System.Threading.Tasks.Task`1, + class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_000f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0014: callvirt instance class [runtime]System.Threading.Tasks.Task`1 [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder::Run(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0>) + IL_0019: ret + } + +} """ ])) @@ -491,107 +421,139 @@ let testTask() = task { try 1+1 finally System.Console.WriteLine("finally") } """, (fun verifier -> verifier.VerifyIL [ """ - .method public strict virtual instance void - MoveNext() cil managed +.class public abstract auto ansi sealed Test + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@4-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - bool V_3, - bool V_4, - class [runtime]System.Exception V_5, - bool V_6, - bool V_7, - class [runtime]System.Exception V_8, - class [runtime]System.Exception V_9) + .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld int32 Test/testTask@4::ResumptionPoint - IL_0006: stloc.0 - .try - { - IL_0007: ldc.i4.0 - IL_0008: stloc.3 - .try - { - IL_0009: nop - IL_000a: ldc.i4.1 - IL_000b: stloc.s V_4 - IL_000d: ldloc.s V_4 - IL_000f: stloc.3 - IL_0010: leave.s IL_0032 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-1'::builder@ + IL_000d: ret + } - } - catch [runtime]System.Object - { - IL_0012: castclass [runtime]System.Exception - IL_0017: stloc.s V_5 - IL_0019: nop - IL_001a: ldstr "finally" - IL_001f: call void [runtime]System.Console::WriteLine(string) - IL_0024: ldc.i4.1 - IL_0025: stloc.s V_6 - IL_0027: rethrow - IL_0029: ldnull - IL_002a: unbox.any [FSharp.Core]Microsoft.FSharp.Core.Unit - IL_002f: pop - IL_0030: leave.s IL_0032 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-1'::builder@ + IL_0007: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Zero() + IL_000c: ret + } - } - IL_0032: ldloc.3 - IL_0033: brfalse.s IL_0046 - - IL_0035: nop - IL_0036: ldstr "finally" - IL_003b: call void [runtime]System.Console::WriteLine(string) - IL_0040: ldc.i4.1 - IL_0041: stloc.s V_7 - IL_0043: nop - IL_0044: br.s IL_0047 + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@4-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class Test/'testTask@4-2' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } - IL_0046: nop - IL_0047: ldloc.3 - IL_0048: stloc.2 - IL_0049: ldloc.2 - IL_004a: brfalse.s IL_0069 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldstr "finally" + IL_0006: call void [runtime]System.Console::WriteLine(string) + IL_000b: ldnull + IL_000c: ret + } - IL_004c: ldarg.0 - IL_004d: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0052: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0057: ldarg.0 - IL_0058: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_005d: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_0062: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_0067: leave.s IL_0077 + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Test/'testTask@4-2'::.ctor() + IL_0005: stsfld class Test/'testTask@4-2' Test/'testTask@4-2'::@_instance + IL_000a: ret + } - IL_0069: leave.s IL_0077 + } - } - catch [runtime]System.Object - { - IL_006b: castclass [runtime]System.Exception - IL_0070: stloc.s V_8 - IL_0072: ldloc.s V_8 - IL_0074: stloc.1 - IL_0075: leave.s IL_0077 + .class auto ansi serializable sealed nested assembly beforefieldinit testTask@4 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_000d: ret + } - } - IL_0077: ldloc.1 - IL_0078: stloc.s V_9 - IL_007a: ldloc.s V_9 - IL_007c: brtrue.s IL_007f - - IL_007e: ret - - IL_007f: ldarg.0 - IL_0080: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0085: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_008a: ldloc.s V_9 - IL_008c: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_0091: ret + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_000c: ldarg.0 + IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0012: newobj instance void Test/'testTask@4-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_0017: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_001c: ldsfld class Test/'testTask@4-2' Test/'testTask@4-2'::@_instance + IL_0021: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::TryFinally(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1>, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0026: ret } + + } + + .method public static class [runtime]System.Threading.Tasks.Task`1 testTask() cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldloc.0 + IL_0008: ldloc.0 + IL_0009: newobj instance void Test/testTask@4::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_000e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0013: callvirt instance class [runtime]System.Threading.Tasks.Task`1 [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder::Run(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0>) + IL_0018: ret + } + +} """ ])) @@ -721,110 +683,142 @@ let testTask() = task { try 1 with e -> System.Console.WriteLine("with"); 2 } """, (fun verifier -> verifier.VerifyIL [ """ - .method public strict virtual instance void - MoveNext() cil managed +.class public abstract auto ansi sealed Test + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@4-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - bool V_3, - bool V_4, - class [runtime]System.Exception V_5, - bool V_6, - class [runtime]System.Exception V_7, - class [runtime]System.Exception V_8, - class [runtime]System.Exception V_9, - class [runtime]System.Exception V_10, - class [runtime]System.Exception V_11) + .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld int32 Test/testTask@4::ResumptionPoint - IL_0006: stloc.0 - .try - { - IL_0007: ldc.i4.0 - IL_0008: stloc.3 - IL_0009: ldc.i4.0 - IL_000a: stloc.s V_4 - IL_000c: ldnull - IL_000d: stloc.s V_5 - .try - { - IL_000f: nop - IL_0010: ldc.i4.1 - IL_0011: stloc.s V_6 - IL_0013: ldloc.s V_6 - IL_0015: stloc.3 - IL_0016: leave.s IL_0028 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-1'::builder@ + IL_000d: ret + } - } - catch [runtime]System.Object - { - IL_0018: castclass [runtime]System.Exception - IL_001d: stloc.s V_7 - IL_001f: ldc.i4.1 - IL_0020: stloc.s V_4 - IL_0022: ldloc.s V_7 - IL_0024: stloc.s V_5 - IL_0026: leave.s IL_0028 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-1'::builder@ + IL_0007: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Zero() + IL_000c: ret + } - } - IL_0028: ldloc.s V_4 - IL_002a: brfalse.s IL_0042 - - IL_002c: ldloc.s V_5 - IL_002e: stloc.s V_8 - IL_0030: ldloc.s V_8 - IL_0032: stloc.s V_9 - IL_0034: ldstr "with" - IL_0039: call void [runtime]System.Console::WriteLine(string) - IL_003e: ldc.i4.1 - IL_003f: nop - IL_0040: br.s IL_0044 + } - IL_0042: ldloc.3 - IL_0043: nop - IL_0044: stloc.2 - IL_0045: ldloc.2 - IL_0046: brfalse.s IL_0065 + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@4-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-2'::builder@ + IL_000d: ret + } - IL_0048: ldarg.0 - IL_0049: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_004e: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0053: ldarg.0 - IL_0054: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0059: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_005e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_0063: leave.s IL_0073 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [runtime]System.Exception _arg1) cil managed + { + + .maxstack 5 + .locals init (class [runtime]System.Exception V_0) + IL_0000: ldarg.1 + IL_0001: stloc.0 + IL_0002: ldstr "with" + IL_0007: call void [runtime]System.Console::WriteLine(string) + IL_000c: ldarg.0 + IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@4-2'::builder@ + IL_0012: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Zero() + IL_0017: ret + } - IL_0065: leave.s IL_0073 + } - } - catch [runtime]System.Object - { - IL_0067: castclass [runtime]System.Exception - IL_006c: stloc.s V_10 - IL_006e: ldloc.s V_10 - IL_0070: stloc.1 - IL_0071: leave.s IL_0073 + .class auto ansi serializable sealed nested assembly beforefieldinit testTask@4 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_000d: ret + } - } - IL_0073: ldloc.1 - IL_0074: stloc.s V_11 - IL_0076: ldloc.s V_11 - IL_0078: brtrue.s IL_007b - - IL_007a: ret - - IL_007b: ldarg.0 - IL_007c: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@4::Data - IL_0081: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0086: ldloc.s V_11 - IL_0088: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_008d: ret + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0006: ldarg.0 + IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_000c: ldarg.0 + IL_000d: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0012: newobj instance void Test/'testTask@4-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_0017: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_001c: ldarg.0 + IL_001d: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@4::builder@ + IL_0022: newobj instance void Test/'testTask@4-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_0027: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::TryWith(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1>, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_002c: ret } + + } + + .method public static class [runtime]System.Threading.Tasks.Task`1 testTask() cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldloc.0 + IL_0008: ldloc.0 + IL_0009: newobj instance void Test/testTask@4::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_000e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0013: callvirt instance class [runtime]System.Threading.Tasks.Task`1 [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder::Run(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0>) + IL_0018: ret + } + +} """ ])) @@ -940,89 +934,184 @@ let testTask() = task { while x > 4 do System.Console.WriteLine("loop") } """, (fun verifier -> verifier.VerifyIL [ """ - .method public strict virtual instance void - MoveNext() cil managed +.class public abstract auto ansi sealed Test + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@5-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field static assembly initonly class Test/'testTask@5-1' @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - bool V_3, - bool V_4, - class [runtime]System.Exception V_5, - class [runtime]System.Exception V_6) + .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld int32 Test/testTask@5::ResumptionPoint - IL_0006: stloc.0 - .try - { - IL_0007: ldc.i4.1 - IL_0008: stloc.3 - IL_0009: br.s IL_001d + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ret + } - IL_000b: ldstr "loop" - IL_0010: call void [runtime]System.Console::WriteLine(string) - IL_0015: ldc.i4.1 - IL_0016: stloc.s V_4 - IL_0018: ldloc.s V_4 - IL_001a: stloc.3 - IL_001b: ldc.i4.0 - IL_001c: stloc.0 - IL_001d: ldloc.3 - IL_001e: brfalse.s IL_002b + .method public strict virtual instance bool Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: call int32 Test::get_x() + IL_0005: ldc.i4.4 + IL_0006: cgt + IL_0008: ret + } - IL_0020: call int32 Test::get_x() - IL_0025: ldc.i4.4 - IL_0026: cgt - IL_0028: nop - IL_0029: br.s IL_002d + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void Test/'testTask@5-1'::.ctor() + IL_0005: stsfld class Test/'testTask@5-1' Test/'testTask@5-1'::@_instance + IL_000a: ret + } - IL_002b: ldc.i4.0 - IL_002c: nop - IL_002d: brtrue.s IL_000b + } - IL_002f: ldloc.3 - IL_0030: stloc.2 - IL_0031: ldloc.2 - IL_0032: brfalse.s IL_0051 + .class auto ansi serializable sealed nested assembly beforefieldinit 'testTask@5-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@5-2'::builder@ + IL_000d: ret + } - IL_0034: ldarg.0 - IL_0035: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@5::Data - IL_003a: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_003f: ldarg.0 - IL_0040: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@5::Data - IL_0045: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_004a: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_004f: leave.s IL_005f + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: ldstr "loop" + IL_0005: call void [runtime]System.Console::WriteLine(string) + IL_000a: ldarg.0 + IL_000b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/'testTask@5-2'::builder@ + IL_0010: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Zero() + IL_0015: ret + } - IL_0051: leave.s IL_005f + } - } - catch [runtime]System.Object - { - IL_0053: castclass [runtime]System.Exception - IL_0058: stloc.s V_5 - IL_005a: ldloc.s V_5 - IL_005c: stloc.1 - IL_005d: leave.s IL_005f + .class auto ansi serializable sealed nested assembly beforefieldinit testTask@5 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@5::builder@ + IL_000d: ret + } - } - IL_005f: ldloc.1 - IL_0060: stloc.s V_6 - IL_0062: ldloc.s V_6 - IL_0064: brtrue.s IL_0067 + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@5::builder@ + IL_0006: ldsfld class Test/'testTask@5-1' Test/'testTask@5-1'::@_instance + IL_000b: ldarg.0 + IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@5::builder@ + IL_0011: ldarg.0 + IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder Test/testTask@5::builder@ + IL_0017: newobj instance void Test/'testTask@5-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_001c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0021: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::While(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,class [FSharp.Core]Microsoft.FSharp.Core.Unit>) + IL_0026: ret + } - IL_0066: ret + } - IL_0067: ldarg.0 - IL_0068: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Test/testTask@5::Data - IL_006d: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0072: ldloc.s V_6 - IL_0074: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_0079: ret - } + .field static assembly int32 x@4 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int32 get_x() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 Test::x@4 + IL_0005: ret + } + + .method public specialname static void set_x(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 Test::x@4 + IL_0006: ret + } + + .method public static class [runtime]System.Threading.Tasks.Task`1 testTask() cil managed + { + + .maxstack 5 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldloc.0 + IL_0008: ldloc.0 + IL_0009: newobj instance void Test/testTask@5::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_000e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0013: callvirt instance class [runtime]System.Threading.Tasks.Task`1 [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder::Run(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0>) + IL_0018: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$Test::init@ + IL_0006: ldsfld int32 ''.$Test::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld int32 Test::x@4 + IL_0006: ret + } + + .property int32 x() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void Test::set_x(int32) + .get int32 Test::get_x() + } +} """ ])) #endif @@ -1108,223 +1197,42 @@ type Generic1InGeneric1<'T>() = extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .class auto autochar sealed nested assembly beforefieldinit specialname clo@7 - extends [runtime]System.ValueType - implements [runtime]System.Runtime.CompilerServices.IAsyncStateMachine, - class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1> + .class auto ansi serializable sealed nested assembly beforefieldinit clo@7 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!A>> { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 06 00 00 00 00 00 ) - .field public valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 Data - .field public int32 ResumptionPoint .field public class [runtime]System.Threading.Tasks.Task`1 computation - .field public valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 awaiter - .method public strict virtual instance void MoveNext() cil managed - { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::MoveNext - - .maxstack 5 - .locals init (int32 V_0, - class [runtime]System.Exception V_1, - bool V_2, - class [runtime]System.Threading.Tasks.Task`1 V_3, - bool V_4, - bool V_5, - !A V_6, - !A V_7, - valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 V_8, - class [runtime]System.Exception V_9, - class [runtime]System.Exception V_10) - IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint - IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: ldc.i4.1 - IL_0009: sub - IL_000a: switch ( - IL_0015) - IL_0013: br.s IL_0018 - - IL_0015: nop - IL_0016: br.s IL_001d - - IL_0018: nop - IL_0019: br.s IL_001b - - IL_001b: ldnull - IL_001c: stloc.1 - .try - { - IL_001d: ldloc.0 - IL_001e: ldc.i4.1 - IL_001f: sub - IL_0020: switch ( - IL_002b) - IL_0029: br.s IL_002e - - IL_002b: nop - IL_002c: br.s IL_0059 - - IL_002e: nop - IL_002f: br.s IL_0031 - - IL_0031: ldarg.0 - IL_0032: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation - IL_0037: stloc.3 - IL_0038: ldarg.0 - IL_0039: ldloc.3 - IL_003a: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() - IL_003f: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_0044: ldc.i4.1 - IL_0045: stloc.s V_4 - IL_0047: ldarg.0 - IL_0048: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_004d: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() - IL_0052: brfalse.s IL_0056 - - IL_0054: br.s IL_006f - - IL_0056: ldc.i4.0 - IL_0057: brfalse.s IL_005d - - IL_0059: ldc.i4.1 - IL_005a: nop - IL_005b: br.s IL_0066 - - IL_005d: ldarg.0 - IL_005e: ldc.i4.1 - IL_005f: stfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint - IL_0064: ldc.i4.0 - IL_0065: nop - IL_0066: stloc.s V_5 - IL_0068: ldloc.s V_5 - IL_006a: stloc.s V_4 - IL_006c: nop - IL_006d: br.s IL_0070 - - IL_006f: nop - IL_0070: ldloc.s V_4 - IL_0072: brfalse.s IL_0096 - - IL_0074: ldarg.0 - IL_0075: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_007a: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() - IL_007f: stloc.s V_6 - IL_0081: ldloc.s V_6 - IL_0083: stloc.s V_7 - IL_0085: ldarg.0 - IL_0086: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_008b: ldloc.s V_7 - IL_008d: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_0092: ldc.i4.1 - IL_0093: nop - IL_0094: br.s IL_00af - - IL_0096: ldarg.0 - IL_0097: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_009c: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00a1: ldarg.0 - IL_00a2: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_00a7: ldarg.0 - IL_00a8: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/Generic1InGeneric1`1/clo@7>(!!0&, - !!1&) - IL_00ad: ldc.i4.0 - IL_00ae: nop - IL_00af: brfalse.s IL_00c5 - - IL_00b1: ldarg.0 - IL_00b2: ldloca.s V_8 - IL_00b4: initobj valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 - IL_00ba: ldloc.s V_8 - IL_00bc: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter - IL_00c1: ldc.i4.1 - IL_00c2: nop - IL_00c3: br.s IL_00c7 - - IL_00c5: ldc.i4.0 - IL_00c6: nop - IL_00c7: stloc.2 - IL_00c8: ldloc.2 - IL_00c9: brfalse.s IL_00e8 - - IL_00cb: ldarg.0 - IL_00cc: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_00d1: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_00d6: ldarg.0 - IL_00d7: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_00dc: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result - IL_00e1: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) - IL_00e6: leave.s IL_00f6 - - IL_00e8: leave.s IL_00f6 - - } - catch [runtime]System.Object - { - IL_00ea: castclass [runtime]System.Exception - IL_00ef: stloc.s V_9 - IL_00f1: ldloc.s V_9 - IL_00f3: stloc.1 - IL_00f4: leave.s IL_00f6 - - } - IL_00f6: ldloc.1 - IL_00f7: stloc.s V_10 - IL_00f9: ldloc.s V_10 - IL_00fb: brtrue.s IL_00fe - - IL_00fd: ret - - IL_00fe: ldarg.0 - IL_00ff: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0104: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0109: ldloc.s V_10 - IL_010b: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) - IL_0110: ret - } - - .method public strict virtual instance void SetStateMachine(class [runtime]System.Runtime.CompilerServices.IAsyncStateMachine state) cil managed - { - .override [runtime]System.Runtime.CompilerServices.IAsyncStateMachine::SetStateMachine - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0006: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_000b: ldarg.1 - IL_000c: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetStateMachine(class [netstandard]System.Runtime.CompilerServices.IAsyncStateMachine) - IL_0011: ret - } - - .method public strict virtual instance int32 get_ResumptionPoint() cil managed - { - .override method instance int32 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_ResumptionPoint() - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint - IL_0006: ret - } - - .method public strict virtual instance valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 get_Data() cil managed + .field public class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [runtime]System.Threading.Tasks.Task`1 computation, class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder builder@) cil managed { - .override method instance !0 class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::get_Data() + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0006: ret + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!A>>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [runtime]System.Threading.Tasks.Task`1 class Test/Generic1InGeneric1`1/clo@7::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder class Test/Generic1InGeneric1`1/clo@7::builder@ + IL_0014: ret } - .method public strict virtual instance void set_Data(valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 'value') cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!A> Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .override method instance void class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1>::set_Data(!0) .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: stfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0007: ret + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder class Test/Generic1InGeneric1`1/clo@7::builder@ + IL_0006: ldarg.0 + IL_0007: ldfld class [runtime]System.Threading.Tasks.Task`1 class Test/Generic1InGeneric1`1/clo@7::computation + IL_000c: call class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderExtensions.HighPriority::TaskBuilderBase.ReturnFrom(class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase, + class [runtime]System.Threading.Tasks.Task`1) + IL_0011: ret } } @@ -1355,67 +1263,67 @@ type Generic1InGeneric1<'T>() = { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (valuetype Test/Generic1InGeneric1`1/clo@7 V_0, - valuetype Test/Generic1InGeneric1`1/clo@7& V_1) - IL_0000: ldloca.s V_0 - IL_0002: initobj valuetype Test/Generic1InGeneric1`1/clo@7 - IL_0008: ldloca.s V_0 - IL_000a: stloc.1 - IL_000b: ldloc.1 - IL_000c: ldarg.1 - IL_000d: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation - IL_0012: ldloc.1 - IL_0013: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0018: call valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() - IL_001d: stfld valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_0022: ldloc.1 - IL_0023: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0028: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_002d: ldloc.1 - IL_002e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) - IL_0033: ldloc.1 - IL_0034: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data - IL_0039: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder - IL_003e: call instance class [netstandard]System.Threading.Tasks.Task`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::get_Task() - IL_0043: ret + .maxstack 6 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder V_0) + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderModule::get_task() + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldloc.0 + IL_0008: ldarg.1 + IL_0009: ldloc.0 + IL_000a: newobj instance void class Test/Generic1InGeneric1`1/clo@7::.ctor(class [runtime]System.Threading.Tasks.Task`1, + class [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder) + IL_000f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!1> [FSharp.Core]Microsoft.FSharp.Control.TaskBuilderBase::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!1>>) + IL_0014: callvirt instance class [runtime]System.Threading.Tasks.Task`1 [FSharp.Core]Microsoft.FSharp.Control.TaskBuilder::Run(class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ResumableCode`2,!!0>) + IL_0019: ret } } } - """ + """ ])) #endif #if NETCOREAPP -module ``Check stack traces`` = +module ``Check stack traces`` = [] let ``check stack trace of async exception from task``() = - let t() = - task { - let! throws = task { - do! System.Threading.Tasks.Task.Yield() - failwith "Inner task exception" - return () - } - return throws - } - - let f() = t().Wait() - - let stackTrace = try f(); failwith "huh?" with e -> e.ToString() + FSharp """ +module Test - if stackTrace.Contains("huh?") then - failwith "unexpected - inner exception not generated correctly" - - if not (stackTrace.Contains("MoveNext()")) then - failwith "expected MoveNext() on stack trace" +let t() = + task { + let! throws = task { + do! System.Threading.Tasks.Task.Yield() + failwith "Inner task exception" + return () + } + return throws + } + +let f() = t().Wait() + +[] +let main _ = + let stackTrace = try f(); failwith "huh?" with e -> e.ToString() + + if stackTrace.Contains("huh?") then + failwith "unexpected - inner exception not generated correctly" + + if not (stackTrace.Contains("MoveNext()")) then + failwith "expected MoveNext() on stack trace" - if stackTrace.Contains("End of stack trace from previous location") then - failwith "expected emit of CompilerGeneratedAttribute to suppress message in .NET Core stack walking " + if stackTrace.Contains("End of stack trace from previous location") then + failwith "expected emit of CompilerGeneratedAttribute to suppress message in .NET Core stack walking " + 0 +""" + |> withOptimize + |> asExe + |> compileExeAndRun + |> shouldSucceed #endif From 827475b4a269b69f26f079741cf30410717552d2 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 1 Jun 2026 15:09:09 +0200 Subject: [PATCH 46/50] Update baselines --- .../CodeGen/EmittedIL/BooleanLogic.fs | 82 +++++++------------ 1 file changed, 29 insertions(+), 53 deletions(-) diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs index 7d7ebba13fb..97cc692d7eb 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/BooleanLogic.fs @@ -78,59 +78,35 @@ let ApplyDefaults () = """, (fun verifier -> verifier.VerifyIL [ """ - -.method public static void ApplyDefaults() cil managed -{ - - .maxstack 5 - .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_3, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_4, - bool V_5, - bool V_6) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: br.s IL_003c - - IL_0004: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 DontEliminateForLoops::get_unsolved() - IL_0009: stloc.1 - IL_000a: ldloc.1 - IL_000b: stloc.2 - IL_000c: ldloc.2 - IL_000d: stloc.3 - IL_000e: ldloc.3 - IL_000f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0014: stloc.s V_4 - IL_0016: br.s IL_0034 - - IL_0018: ldloc.3 - IL_0019: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_001e: stloc.s V_5 - IL_0020: ldloc.s V_5 - IL_0022: stloc.s V_6 - IL_0024: call void [runtime]System.Console::WriteLine() - IL_0029: ldloc.s V_4 - IL_002b: stloc.3 - IL_002c: ldloc.3 - IL_002d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0032: stloc.s V_4 - IL_0034: ldloc.s V_4 - IL_0036: brtrue.s IL_0018 - - IL_0038: ldloc.0 - IL_0039: ldc.i4.1 - IL_003a: add - IL_003b: stloc.0 - IL_003c: ldloc.0 - IL_003d: ldc.i4.1 - IL_003e: ldc.i4.s 10 - IL_0040: add - IL_0041: blt.s IL_0004 - -IL_0043: ret -} + .method public static void ApplyDefaults() cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: br.s IL_001a + + IL_0004: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 DontEliminateForLoops::get_unsolved() + IL_0009: stloc.1 + IL_000a: ldsfld class DontEliminateForLoops/ApplyDefaults@8 DontEliminateForLoops/ApplyDefaults@8::@_instance + IL_000f: ldloc.1 + IL_0010: call void [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Iterate(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0015: nop + IL_0016: ldloc.0 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.0 + IL_001a: ldloc.0 + IL_001b: ldc.i4.1 + IL_001c: ldc.i4.s 10 + IL_001e: add + IL_001f: blt.s IL_0004 + + IL_0021: ret + } """ ])) From 9c3f44911ba3a55df8305023988d2c265ffb606a Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 1 Jun 2026 17:18:24 +0200 Subject: [PATCH 47/50] Update baselines --- ...OptionalArg01.fs.OptimizeOff.il.net472.bsl | 56 +++++++------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl index 46e66821bf5..b9f30b1ca2e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Tuples/OptionalArg01.fs.OptimizeOff.il.net472.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -47,8 +37,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -65,8 +54,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -77,9 +65,7 @@ IL_0008: ret } - .method public static class [runtime]System.Collections.Generic.List`1 - F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 x1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 x2) cil managed + .method public static class [runtime]System.Collections.Generic.List`1 F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 x1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 x2) cil managed { .param [1] .custom instance void [FSharp.Core]Microsoft.FSharp.Core.OptionalArgumentAttribute::.ctor() = ( 01 00 00 00 ) @@ -188,57 +174,53 @@ } - .method public static class [runtime]System.Collections.Generic.List`1 - test() cil managed + .method public static class [runtime]System.Collections.Generic.List`1 test() cil managed { - + .maxstack 8 IL_0000: ldnull IL_0001: ldnull IL_0002: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) IL_0007: ret - } + } - .method public static class [runtime]System.Collections.Generic.List`1 - test2() cil managed + .method public static class [runtime]System.Collections.Generic.List`1 test2() cil managed { - + .maxstack 8 IL_0000: newobj instance void assembly/A::.ctor() IL_0005: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) IL_000a: ldnull IL_000b: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) IL_0010: ret - } + } - .method public static class [runtime]System.Collections.Generic.List`1 - test3() cil managed + .method public static class [runtime]System.Collections.Generic.List`1 test3() cil managed { - + .maxstack 8 IL_0000: ldnull IL_0001: newobj instance void assembly/A::.ctor() IL_0006: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) IL_000b: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) IL_0010: ret - } + } - .method public static class [runtime]System.Collections.Generic.List`1 - test4() cil managed + .method public static class [runtime]System.Collections.Generic.List`1 test4() cil managed { - + .maxstack 8 IL_0000: newobj instance void assembly/A::.ctor() IL_0005: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) IL_000a: newobj instance void assembly/A::.ctor() IL_000f: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1::Some(!0) IL_0014: call class [runtime]System.Collections.Generic.List`1 assembly/C::F(class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpOption`1) IL_0019: ret - } + } } From 0d732699c486e95080c1cdf1276977d811d7f107 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 6 Jun 2026 01:25:10 +0200 Subject: [PATCH 48/50] Update baselines --- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 35 ++++++++++--------- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 35 ++++++++++--------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index e9d89b5a241..0a18918d875 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -191,26 +191,29 @@ { .maxstack 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0) IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_000c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() - IL_0011: ldarg.0 - IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0017: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_001c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldarg.0 + IL_0009: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() + IL_0013: ldarg.0 + IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0019: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_001e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0021: ldarg.0 - IL_0022: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0027: ldarg.0 - IL_0028: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_002d: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0032: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0037: tail. - IL_0039: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + IL_0023: ldarg.0 + IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0029: ldarg.0 + IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_002f: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0039: tail. + IL_003b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) - IL_003e: ret + IL_0040: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index abc834a81f4..692ecc2aaa9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -191,26 +191,29 @@ { .maxstack 8 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0) IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0006: ldarg.0 - IL_0007: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_000c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() - IL_0011: ldarg.0 - IL_0012: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0017: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_001c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: ldarg.0 + IL_0009: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() + IL_0013: ldarg.0 + IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0019: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_001e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0021: ldarg.0 - IL_0022: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0027: ldarg.0 - IL_0028: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_002d: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0032: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0037: tail. - IL_0039: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + IL_0023: ldarg.0 + IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0029: ldarg.0 + IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_002f: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0039: tail. + IL_003b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) - IL_003e: ret + IL_0040: ret } } From 765d43510784d7e18c337cf68d092734a1cab8dc Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 6 Jun 2026 11:46:37 +0200 Subject: [PATCH 49/50] Allow inlining async --- src/Compiler/TypedTree/TcGlobals.fs | 4 +- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 52 ++- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 52 ++- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 145 +++++- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 145 +++++- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 116 ++++- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 116 ++++- ...ealInternalSignatureOff.OptimizeOff.il.bsl | 414 +++++++++++++++--- ...RealInternalSignatureOn.OptimizeOff.il.bsl | 414 +++++++++++++++--- 9 files changed, 1261 insertions(+), 197 deletions(-) diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index d3ee0083fb9..237ec492651 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -558,6 +558,7 @@ type TcGlobals( let fslib_MFOperatorsUnchecked_nleref = mkNestedNonLocalEntityRef fslib_MFOperators_nleref "Unchecked" let fslib_MFOperatorsChecked_nleref = mkNestedNonLocalEntityRef fslib_MFOperators_nleref "Checked" let fslib_MFExtraTopLevelOperators_nleref = mkNestedNonLocalEntityRef fslib_MFCore_nleref "ExtraTopLevelOperators" + let fslib_MFAsyncBuilder_nleref = mkNestedNonLocalEntityRef fslib_MFControl_nleref "AsyncBuilder" let fslib_MFNullableOperators_nleref = mkNestedNonLocalEntityRef fslib_MFLinq_nleref "NullableOperators" let fslib_MFQueryRunExtensions_nleref = mkNestedNonLocalEntityRef fslib_MFLinq_nleref "QueryRunExtensions" let fslib_MFQueryRunExtensionsLowPriority_nleref = mkNestedNonLocalEntityRef fslib_MFQueryRunExtensions_nleref "LowPriority" @@ -654,7 +655,8 @@ type TcGlobals( fslib_MFOperatorIntrinsics_nleref fslib_MFOperatorsChecked_nleref fslib_MFOperatorsUnchecked_nleref - fslib_MFNativePtrModule_nleref ] do + fslib_MFNativePtrModule_nleref + fslib_MFAsyncBuilder_nleref ] do yield nleref.LastItemMangledName, ERefNonLocal nleref ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index b95c997fd11..3cd259184db 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -37,6 +37,42 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@10-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f3@10-1'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f3@10-1'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f3@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -64,7 +100,9 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2) + int32 V_2, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, + int32 V_4) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -93,10 +131,14 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@5::builder@ - IL_0040: ldloc.2 - IL_0041: tail. - IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0048: ret + IL_0040: stloc.3 + IL_0041: ldloc.2 + IL_0042: stloc.s V_4 + IL_0044: ldloc.s V_4 + IL_0046: newobj instance void assembly/assembly/'f3@10-1'::.ctor(int32) + IL_004b: tail. + IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0052: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index e71ecaac097..1f5c0f27046 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -37,6 +37,42 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@10-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f3@10-1'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f3@10-1'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f3@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -64,7 +100,9 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2) + int32 V_2, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, + int32 V_4) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -93,10 +131,14 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@5::builder@ - IL_0040: ldloc.2 - IL_0041: tail. - IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0048: ret + IL_0040: stloc.3 + IL_0041: ldloc.2 + IL_0042: stloc.s V_4 + IL_0044: ldloc.s V_4 + IL_0046: newobj instance void assembly/assembly/'f3@10-1'::.ctor(int32) + IL_004b: tail. + IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0052: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index c6dc4802db1..348b1d1471d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -37,6 +37,42 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@10-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f4@10-2'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f4@10-2'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@7-1' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -67,7 +103,9 @@ .maxstack 6 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, - int32 V_1) + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, + int32 V_3) IL_0000: nop IL_0001: ldc.i4.0 IL_0002: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) @@ -86,15 +124,19 @@ IL_0027: stloc.1 IL_0028: ldarg.0 IL_0029: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f4@7-1'::builder@ - IL_002e: ldloc.1 - IL_002f: tail. - IL_0031: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0036: ret + IL_002e: stloc.2 + IL_002f: ldloc.1 + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: newobj instance void assembly/assembly/'f4@10-2'::.ctor(int32) + IL_0037: tail. + IL_0039: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_003e: ret } } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-2' + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-3' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x @@ -108,7 +150,7 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x IL_000d: ret } @@ -118,9 +160,9 @@ .maxstack 8 IL_0000: nop IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x IL_000d: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value() IL_0012: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_Value(!0) IL_0017: nop @@ -133,6 +175,52 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@6-4' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::TryFinally(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0014: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f4@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -157,27 +245,36 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 8 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) + .maxstack 7 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_3) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_0013: ldarg.0 - IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_0019: ldloc.0 - IL_001a: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_000d: stloc.1 + IL_000e: ldarg.0 + IL_000f: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_0014: ldarg.0 + IL_0015: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_001a: ldloc.0 + IL_001b: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_001f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0024: ldloc.0 - IL_0025: newobj instance void assembly/assembly/'f4@12-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_002a: tail. - IL_002c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::TryFinally(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0031: ret + IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0025: stloc.2 + IL_0026: ldloc.0 + IL_0027: newobj instance void assembly/assembly/'f4@12-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002c: stloc.3 + IL_002d: ldloc.2 + IL_002e: ldloc.3 + IL_002f: newobj instance void assembly/assembly/'f4@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0034: tail. + IL_0036: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_003b: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 0f4b2257cbb..143ba00c7de 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -37,6 +37,42 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@10-2' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f4@10-2'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f4@10-2'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@7-1' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -67,7 +103,9 @@ .maxstack 6 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, - int32 V_1) + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, + int32 V_3) IL_0000: nop IL_0001: ldc.i4.0 IL_0002: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) @@ -86,15 +124,19 @@ IL_0027: stloc.1 IL_0028: ldarg.0 IL_0029: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f4@7-1'::builder@ - IL_002e: ldloc.1 - IL_002f: tail. - IL_0031: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0036: ret + IL_002e: stloc.2 + IL_002f: ldloc.1 + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: newobj instance void assembly/assembly/'f4@10-2'::.ctor(int32) + IL_0037: tail. + IL_0039: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_003e: ret } } - .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-2' + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@12-3' extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 x @@ -108,7 +150,7 @@ IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x IL_000d: ret } @@ -118,9 +160,9 @@ .maxstack 8 IL_0000: nop IL_0001: ldarg.0 - IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x IL_0007: ldarg.0 - IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-2'::x + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 assembly/assembly/'f4@12-3'::x IL_000d: callvirt instance !0 class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::get_Value() IL_0012: callvirt instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::set_Value(!0) IL_0017: nop @@ -133,6 +175,52 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit 'f4@6-4' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 compensation) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f4@6-4'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 assembly/assembly/'f4@6-4'::compensation + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::TryFinally(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0014: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f4@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -157,27 +245,36 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 8 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) + .maxstack 7 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_3) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 IL_0007: ldarg.0 IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_0013: ldarg.0 - IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ - IL_0019: ldloc.0 - IL_001a: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_000d: stloc.1 + IL_000e: ldarg.0 + IL_000f: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_0014: ldarg.0 + IL_0015: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f4@5::builder@ + IL_001a: ldloc.0 + IL_001b: newobj instance void assembly/assembly/'f4@7-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_001f: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0024: ldloc.0 - IL_0025: newobj instance void assembly/assembly/'f4@12-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_002a: tail. - IL_002c: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::TryFinally(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) - IL_0031: ret + IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0025: stloc.2 + IL_0026: ldloc.0 + IL_0027: newobj instance void assembly/assembly/'f4@12-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) + IL_002c: stloc.3 + IL_002d: ldloc.2 + IL_002e: ldloc.3 + IL_002f: newobj instance void assembly/assembly/'f4@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2) + IL_0034: tail. + IL_0036: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_003b: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 0a18918d875..1c4d13e1c30 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -166,6 +166,84 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-4' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 + IL_0006: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f7@6 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -190,30 +268,40 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 8 - .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0) + .maxstack 7 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: ldarg.0 - IL_0009: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() - IL_0013: ldarg.0 - IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0019: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_001e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() + IL_0012: ldarg.0 + IL_0013: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0018: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_001d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0022: stloc.1 IL_0023: ldarg.0 IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ IL_0029: ldarg.0 IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ IL_002f: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0039: tail. - IL_003b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) - IL_0040: ret + IL_0039: stloc.2 + IL_003a: ldloc.2 + IL_003b: newobj instance void assembly/assembly/'f7@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) + IL_0040: stloc.3 + IL_0041: ldloc.1 + IL_0042: ldloc.3 + IL_0043: newobj instance void assembly/assembly/'f7@6-5'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0048: tail. + IL_004a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_004f: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 692ecc2aaa9..f2f84fbd489 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -166,6 +166,84 @@ } + .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-4' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation2) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-4'::computation2 + IL_0006: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f7@6-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> part2) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f7@6-5'::computation1 + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f7@6-5'::part2 + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f7@6 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -190,30 +268,40 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 8 - .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0) + .maxstack 7 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ IL_0006: stloc.0 - IL_0007: ldloc.0 - IL_0008: ldarg.0 - IL_0009: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() - IL_0013: ldarg.0 - IL_0014: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ - IL_0019: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_001e: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly/assembly::get_es() + IL_0012: ldarg.0 + IL_0013: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ + IL_0018: newobj instance void assembly/assembly/'f7@6-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_001d: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0022: stloc.1 IL_0023: ldarg.0 IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ IL_0029: ldarg.0 IL_002a: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f7@6::builder@ IL_002f: newobj instance void assembly/assembly/'f7@9-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) IL_0034: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0039: tail. - IL_003b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Combine(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) - IL_0040: ret + IL_0039: stloc.2 + IL_003a: ldloc.2 + IL_003b: newobj instance void assembly/assembly/'f7@6-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1) + IL_0040: stloc.3 + IL_0041: ldloc.1 + IL_0042: ldloc.3 + IL_0043: newobj instance void assembly/assembly/'f7@6-5'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0048: tail. + IL_004a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_004f: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl index 05684073110..791fe74ed50 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOff.OptimizeOff.il.bsl @@ -37,6 +37,42 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@10-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f2@10-1'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f2@10-1'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f2@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -64,7 +100,9 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2) + int32 V_2, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, + int32 V_4) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -93,10 +131,50 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@5::builder@ - IL_0040: ldloc.2 - IL_0041: tail. - IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0048: ret + IL_0040: stloc.3 + IL_0041: ldloc.2 + IL_0042: stloc.s V_4 + IL_0044: ldloc.s V_4 + IL_0046: newobj instance void assembly/assembly/'f2@10-1'::.ctor(int32) + IL_004b: tail. + IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0052: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@20-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f3@20-5'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f3@20-5'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret } } @@ -138,7 +216,9 @@ .maxstack 6 .locals init (int32 V_0, - int32 V_1) + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, + int32 V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 @@ -152,10 +232,60 @@ IL_0016: stloc.1 IL_0017: ldarg.0 IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@19-4'::builder@ - IL_001d: ldloc.1 - IL_001e: tail. - IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0025: ret + IL_001d: stloc.2 + IL_001e: ldloc.1 + IL_001f: stloc.3 + IL_0020: ldloc.3 + IL_0021: newobj instance void assembly/assembly/'f3@20-5'::.ctor(int32) + IL_0026: tail. + IL_0028: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_002d: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@19-6' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -188,9 +318,12 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg3) cil managed { - .maxstack 9 + .maxstack 7 .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_3, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_4) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldc.i4.0 @@ -205,19 +338,71 @@ IL_0017: nop IL_0018: ldarg.0 IL_0019: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_001e: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_0023: ldarg.0 - IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_0029: ldarg.0 - IL_002a: ldfld int32 assembly/assembly/'f3@16-3'::x1 - IL_002f: ldloc.1 - IL_0030: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_001e: stloc.2 + IL_001f: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_0024: stloc.3 + IL_0025: ldarg.0 + IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ + IL_002b: ldarg.0 + IL_002c: ldfld int32 assembly/assembly/'f3@16-3'::x1 + IL_0031: ldloc.1 + IL_0032: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0035: tail. - IL_0037: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_003c: ret + IL_0037: stloc.s V_4 + IL_0039: ldloc.3 + IL_003a: ldloc.s V_4 + IL_003c: newobj instance void assembly/assembly/'f3@19-6'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0041: tail. + IL_0043: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0048: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-7' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -250,23 +435,78 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg2) cil managed { - .maxstack 8 - .locals init (int32 V_0) + .maxstack 6 + .locals init (int32 V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0013: ldarg.0 - IL_0014: ldfld int32 assembly/assembly/'f3@15-2'::x1 - IL_0019: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_0008: stloc.1 + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000e: stloc.2 + IL_000f: ldarg.0 + IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ + IL_0015: ldarg.0 + IL_0016: ldfld int32 assembly/assembly/'f3@15-2'::x1 + IL_001b: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32) - IL_001e: tail. - IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0025: ret + IL_0020: stloc.3 + IL_0021: ldloc.2 + IL_0022: ldloc.3 + IL_0023: newobj instance void assembly/assembly/'f3@16-7'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0028: tail. + IL_002a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_002f: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-8' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -295,22 +535,77 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg1) cil managed { - .maxstack 8 - .locals init (int32 V_0) + .maxstack 6 + .locals init (int32 V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0013: ldloc.0 - IL_0014: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_0008: stloc.1 + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000e: stloc.2 + IL_000f: ldarg.0 + IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ + IL_0015: ldloc.0 + IL_0016: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32) - IL_0019: tail. - IL_001b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0020: ret + IL_001b: stloc.3 + IL_001c: ldloc.2 + IL_001d: ldloc.3 + IL_001e: newobj instance void assembly/assembly/'f3@16-8'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0023: tail. + IL_0025: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_002a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-9' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -339,17 +634,26 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 8 + .maxstack 6 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_2) IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0006: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000b: ldarg.0 - IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0011: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0016: tail. - IL_0018: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_001d: ret + IL_0006: stloc.0 + IL_0007: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ + IL_0013: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0018: stloc.2 + IL_0019: ldloc.1 + IL_001a: ldloc.2 + IL_001b: newobj instance void assembly/assembly/'f3@16-9'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0020: tail. + IL_0022: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0027: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl index 22e4769fcca..8afb27a6f74 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOff.il.bsl @@ -37,6 +37,42 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit 'f2@10-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f2@10-1'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f2@10-1'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret + } + + } + .class auto ansi serializable sealed nested assembly beforefieldinit f2@5 extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> { @@ -64,7 +100,9 @@ .maxstack 7 .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, - int32 V_2) + int32 V_2, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_3, + int32 V_4) IL_0000: ldc.i4.0 IL_0001: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::Ref(!!0) IL_0006: stloc.0 @@ -93,10 +131,50 @@ IL_0039: stloc.2 IL_003a: ldarg.0 IL_003b: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f2@5::builder@ - IL_0040: ldloc.2 - IL_0041: tail. - IL_0043: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0048: ret + IL_0040: stloc.3 + IL_0041: ldloc.2 + IL_0042: stloc.s V_4 + IL_0044: ldloc.s V_4 + IL_0046: newobj instance void assembly/assembly/'f2@10-1'::.ctor(int32) + IL_004b: tail. + IL_004d: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0052: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@20-5' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public int32 'value' + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 'value') cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 assembly/assembly/'f3@20-5'::'value' + IL_000d: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld int32 assembly/assembly/'f3@20-5'::'value' + IL_0007: tail. + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1::Success(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + !0) + IL_000e: ret } } @@ -138,7 +216,9 @@ .maxstack 6 .locals init (int32 V_0, - int32 V_1) + int32 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, + int32 V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 @@ -152,10 +232,60 @@ IL_0016: stloc.1 IL_0017: ldarg.0 IL_0018: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@19-4'::builder@ - IL_001d: ldloc.1 - IL_001e: tail. - IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Return(!!0) - IL_0025: ret + IL_001d: stloc.2 + IL_001e: ldloc.1 + IL_001f: stloc.3 + IL_0020: ldloc.3 + IL_0021: newobj instance void assembly/assembly/'f3@20-5'::.ctor(int32) + IL_0026: tail. + IL_0028: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_002d: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@19-6' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@19-6'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@19-6'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -188,9 +318,12 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg3) cil managed { - .maxstack 9 + .maxstack 7 .locals init (int32 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1) + class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_2, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_3, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_4) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldc.i4.0 @@ -205,19 +338,71 @@ IL_0017: nop IL_0018: ldarg.0 IL_0019: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_001e: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_0023: ldarg.0 - IL_0024: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ - IL_0029: ldarg.0 - IL_002a: ldfld int32 assembly/assembly/'f3@16-3'::x1 - IL_002f: ldloc.1 - IL_0030: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_001e: stloc.2 + IL_001f: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_0024: stloc.3 + IL_0025: ldarg.0 + IL_0026: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@16-3'::builder@ + IL_002b: ldarg.0 + IL_002c: ldfld int32 assembly/assembly/'f3@16-3'::x1 + IL_0031: ldloc.1 + IL_0032: newobj instance void assembly/assembly/'f3@19-4'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0035: tail. - IL_0037: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_003c: ret + IL_0037: stloc.s V_4 + IL_0039: ldloc.3 + IL_003a: ldloc.s V_4 + IL_003c: newobj instance void assembly/assembly/'f3@19-6'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0041: tail. + IL_0043: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0048: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-7' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-7'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-7'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -250,23 +435,78 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg2) cil managed { - .maxstack 8 - .locals init (int32 V_0) + .maxstack 6 + .locals init (int32 V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ - IL_0013: ldarg.0 - IL_0014: ldfld int32 assembly/assembly/'f3@15-2'::x1 - IL_0019: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_0008: stloc.1 + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000e: stloc.2 + IL_000f: ldarg.0 + IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@15-2'::builder@ + IL_0015: ldarg.0 + IL_0016: ldfld int32 assembly/assembly/'f3@15-2'::x1 + IL_001b: newobj instance void assembly/assembly/'f3@16-3'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32) - IL_001e: tail. - IL_0020: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0025: ret + IL_0020: stloc.3 + IL_0021: ldloc.2 + IL_0022: ldloc.3 + IL_0023: newobj instance void assembly/assembly/'f3@16-7'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0028: tail. + IL_002a: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_002f: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-8' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-8'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-8'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -295,22 +535,77 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(int32 _arg1) cil managed { - .maxstack 8 - .locals init (int32 V_0) + .maxstack 6 + .locals init (int32 V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_2, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_3) IL_0000: ldarg.1 IL_0001: stloc.0 IL_0002: ldarg.0 IL_0003: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0008: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000d: ldarg.0 - IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ - IL_0013: ldloc.0 - IL_0014: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, + IL_0008: stloc.1 + IL_0009: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000e: stloc.2 + IL_000f: ldarg.0 + IL_0010: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/'f3@14-1'::builder@ + IL_0015: ldloc.0 + IL_0016: newobj instance void assembly/assembly/'f3@15-2'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder, int32) - IL_0019: tail. - IL_001b: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0020: ret + IL_001b: stloc.3 + IL_001c: ldloc.2 + IL_001d: ldloc.3 + IL_001e: newobj instance void assembly/assembly/'f3@16-8'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0023: tail. + IL_0025: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_002a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'f3@16-9' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn> + { + .field public class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 computation, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> binder) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder + IL_0014: ret + } + + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn Invoke(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1 ctxt) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly/'f3@16-9'::computation + IL_0007: ldarg.0 + IL_0008: ldfld class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> assembly/assembly/'f3@16-9'::binder + IL_000d: tail. + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::Bind(valuetype [FSharp.Core]Microsoft.FSharp.Control.AsyncActivation`1, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0014: ret } } @@ -339,17 +634,26 @@ .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { - .maxstack 8 + .maxstack 6 + .locals init (class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder V_0, + class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 V_1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2> V_2) IL_0000: ldarg.0 IL_0001: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0006: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() - IL_000b: ldarg.0 - IL_000c: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ - IL_0011: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) - IL_0016: tail. - IL_0018: callvirt instance class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder::Bind(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_001d: ret + IL_0006: stloc.0 + IL_0007: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 assembly/assembly::f2() + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: ldfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder assembly/assembly/f3@16::builder@ + IL_0013: newobj instance void assembly/assembly/'f3@14-1'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsyncBuilder) + IL_0018: stloc.2 + IL_0019: ldloc.1 + IL_001a: ldloc.2 + IL_001b: newobj instance void assembly/assembly/'f3@16-9'::.ctor(class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0020: tail. + IL_0022: call class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 [FSharp.Core]Microsoft.FSharp.Control.AsyncPrimitives::MakeAsync(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [FSharp.Core]Microsoft.FSharp.Control.AsyncReturn>) + IL_0027: ret } } From c0168aa10ff9ceee97c075f9769445ce9da46426 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Sat, 6 Jun 2026 11:46:44 +0200 Subject: [PATCH 50/50] Update baselines --- .../EmittedIL/DebugInlineAsCall.fs | 1 + tests/fsharp/tests.fs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs index a8184b562f5..60af260a98c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall.fs @@ -297,6 +297,7 @@ let inline quadruple (x: int) = double (double x) |> withDebug |> withNoOptimize |> asLibrary + |> withName "Lib" lib |> compile diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 330ffe93590..10a99ee04ab 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -128,12 +128,12 @@ module CoreTests = [] - let ``state-machines-non-optimized`` () = + let ``state-machines-optimized-no-tailcalls`` () = let cfg = testConfig "core/state-machines" - - fsc cfg "%s -o:test.exe -g --tailcalls- --optimize-" cfg.fsc_flags ["test.fsx"] + + fsc cfg "%s -o:test.exe -g --tailcalls- --optimize+" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe"