From 54b06ad5417af24b6a529419b1e5387893594653 Mon Sep 17 00:00:00 2001 From: Jakub Majocha <1760221+majocha@users.noreply.github.com> Date: Tue, 2 Jun 2026 23:52:57 +0200 Subject: [PATCH] Remove duplicate and unused file SkipLocalsInit.fs file exisits in two different folders and only one of the copies is actually included in the project. --- .../SkipLocalsInit.fs | 182 ------------------ 1 file changed, 182 deletions(-) delete mode 100644 tests/FSharp.Compiler.ComponentTests/SkipLocalsInit.fs diff --git a/tests/FSharp.Compiler.ComponentTests/SkipLocalsInit.fs b/tests/FSharp.Compiler.ComponentTests/SkipLocalsInit.fs deleted file mode 100644 index 4f58983e533..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/SkipLocalsInit.fs +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace EmittedIL - -open Xunit -open FSharp.Test.Compiler - -module ``SkipLocalsInit`` = - [] - let ``Init in function and closure not emitted when applied on function``() = - FSharp """ -module SkipLocalsInit - -[] -let x () = - [||] |> Array.filter (fun x -> let y = "".Length in y + y = x) |> ignore -""" - |> compile - |> shouldSucceed - |> verifyIL [""" -.method public static void x() cil managed -{ - .custom instance void [runtime]System.Runtime.CompilerServices.SkipLocalsInitAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 4 - .locals (int32[] V_0) -""" - - """ -.method public strict virtual instance bool - Invoke(int32 x) cil managed -{ - - .maxstack 6 - .locals (int32 V_0)"""] - - [] - let ``Init in static method not emitted when applied on class``() = - FSharp """ -module SkipLocalsInit - -[] -type X () = - static member Y () = - let x = "ssa".Length - x + x - """ - |> compile - |> shouldSucceed - |> verifyIL [""" -.custom instance void [runtime]System.Runtime.CompilerServices.SkipLocalsInitAttribute::.ctor() = ( 01 00 00 00 ) -.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 static int32 Y() cil managed -{ - - .maxstack 4 - .locals (int32 V_0)"""] - - [] - let ``Init in static method and function not emitted when applied on module``() = - FSharp """ -[] -module SkipLocalsInit - -let x () = - let x = "ssa".Length - x + x - -type X () = - static member Y () = - let x = "ssa".Length - x + x - """ - |> compile - |> shouldSucceed - |> verifyIL [""" -.custom instance void [runtime]System.Runtime.CompilerServices.SkipLocalsInitAttribute::.ctor() = ( 01 00 00 00 ) -.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 public static int32 x() cil managed -{ - - .maxstack 4 - .locals (int32 V_0) -""" - - """ -.method public static int32 Y() cil managed -{ - - .maxstack 4 - .locals (int32 V_0)"""] - - [] - let ``Init in method and closure not emitted when applied on method``() = - FSharp """ -module SkipLocalsInit - -type X () = - [] - member _.Y () = - [||] |> Array.filter (fun x -> let y = "".Length in y + y = x) |> ignore - let x = "ssa".Length - x + x - """ - |> compile - |> shouldSucceed - |> verifyIL [""" -.method public hidebysig instance int32 - Y() cil managed -{ - .custom instance void [runtime]System.Runtime.CompilerServices.SkipLocalsInitAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 4 - .locals (int32[] V_0, - int32 V_1) -""" - - """ -.method public strict virtual instance bool - Invoke(int32 x) cil managed -{ - - .maxstack 6 - .locals (int32 V_0) -""" ] - - [] - let ``Zero init performed to get defaults despite the attribute``() = - FSharp """ -module SkipLocalsInit -open System - -[] -let z () = - let mutable a = Unchecked.defaultof - a - -[] -let x f = - let a = if 1 / 1 = 1 then Nullable () else Nullable 5L - f a |> ignore - """ - |> compile - |> shouldSucceed - |> verifyIL [""" -.locals (valuetype [runtime]System.DateTime V_0) -IL_0000: ldloca.s V_0 -IL_0002: initobj [runtime]System.DateTime -IL_0008: ldloc.0 -IL_0009: ret - """ - - """ -.locals (valuetype [runtime]System.Nullable`1 V_0, - valuetype [runtime]System.Nullable`1 V_1, - !!a V_2) -IL_0000: ldc.i4.1 -IL_0001: ldc.i4.1 -IL_0002: div -IL_0003: ldc.i4.1 -IL_0004: bne.un.s IL_0011 - -IL_0006: ldloca.s V_1 -IL_0008: initobj valuetype [runtime]System.Nullable`1 -IL_000e: ldloc.1 -IL_000f: br.s IL_0018 - -IL_0011: ldc.i4.5 -IL_0012: conv.i8 -IL_0013: newobj instance void valuetype [runtime]System.Nullable`1::.ctor(!0) -IL_0018: stloc.0 -IL_0019: ldarg.0 -IL_001a: ldloc.0 -IL_001b: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,!!a>::Invoke(!0) -IL_0020: stloc.2 -IL_0021: ret"""] \ No newline at end of file