diff --git a/src/fsharp/CompilerDiagnostics.fs b/src/fsharp/CompilerDiagnostics.fs index a990d849a41..249d880e1bc 100644 --- a/src/fsharp/CompilerDiagnostics.fs +++ b/src/fsharp/CompilerDiagnostics.fs @@ -372,8 +372,7 @@ let warningOn err level specificWarnOn = let n = GetDiagnosticNumber err List.contains n specificWarnOn || // Some specific warnings are never on by default, i.e. unused variable warnings - match n with - | 1182 -> false // chkUnusedValue - off by default + match n with | 3180 -> false // abImplicitHeapAllocation - off by default | _ -> level >= GetWarningLevel err diff --git a/src/fsharp/FSharp.Build/CreateFSharpManifestResourceName.fs b/src/fsharp/FSharp.Build/CreateFSharpManifestResourceName.fs index e4defc092e6..3a9cbac63c7 100644 --- a/src/fsharp/FSharp.Build/CreateFSharpManifestResourceName.fs +++ b/src/fsharp/FSharp.Build/CreateFSharpManifestResourceName.fs @@ -19,7 +19,7 @@ type CreateFSharpManifestResourceName public () = (linkFileName:string), (rootNamespace:string), (* may be null *) (dependentUponFileName:string), (* may be null *) - (binaryStream:System.IO.Stream) (* may be null *)) : string = + (_:System.IO.Stream) (* may be null *)) : string = // The Visual CSharp and XBuild CSharp toolchains transform resource names like this: // SubDir\abc.resx --> SubDir.abc.resources diff --git a/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs b/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs index 3428d60ad8f..f0abd155b95 100644 --- a/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/fsharp/FSharp.Build/FSharpEmbedResourceText.fs @@ -356,7 +356,7 @@ open Printf printMessage (sprintf "Reading %s" filename) let lines = File.ReadAllLines(filename) |> Array.mapi (fun i s -> i,s) // keep line numbers - |> Array.filter (fun (i,s) -> not(s.StartsWith "#")) // filter out comments + |> Array.filter (fun (_,s) -> not(s.StartsWith "#")) // filter out comments printMessage (sprintf "Parsing %s" filename) let stringInfos = lines |> Array.map (fun (i,s) -> ParseLine filename i s) @@ -391,7 +391,7 @@ open Printf printMessage (sprintf "Generating resource methods for %s" outFilename) // gen each resource method - stringInfos |> Seq.iter (fun (lineNum, (optErrNum,ident), str, holes, netFormatString) -> + stringInfos |> Seq.iter (fun (lineNum, (optErrNum,ident), str, holes, _) -> let formalArgs = new System.Text.StringBuilder() let actualArgs = new System.Text.StringBuilder() let mutable firstTime = true @@ -428,14 +428,14 @@ open Printf // gen validation method fprintfn out " /// Call this method once to validate that all known resources are valid; throws if not" fprintfn out " static member RunStartupValidation() =" - stringInfos |> Seq.iter (fun (lineNum, (optErrNum,ident), str, holes, netFormatString) -> + stringInfos |> Seq.iter (fun (_, (_,ident), _, _, _) -> fprintfn out " ignore(GetString(\"%s\"))" ident ) fprintfn out " ()" // in case there are 0 strings, we need the generated code to parse // gen to resx let xd = new System.Xml.XmlDocument() xd.LoadXml(xmlBoilerPlateString) - stringInfos |> Seq.iter (fun (lineNum, (optErrNum,ident), str, holes, netFormatString) -> + stringInfos |> Seq.iter (fun (_, (_,ident), _, _, netFormatString) -> let xn = xd.CreateElement("data") xn.SetAttribute("name",ident) |> ignore xn.SetAttribute("xml:space","preserve") |> ignore diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index d2156a2ebb1..0a1938aa6bd 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -63,7 +63,6 @@ type public Fsc () as this = let mutable tailcalls : bool = true let mutable targetProfile : string = null let mutable targetType : string = null - let mutable toolExe : string = "fsc.exe" let defaultToolPath = let locationOfThisDll = try Some(Path.GetDirectoryName(typeof.Assembly.Location)) @@ -556,7 +555,6 @@ type public Fsc () as this = match host with | null -> base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands) | _ -> - let sources = sources|>Array.map(fun i->i.ItemSpec) let invokeCompiler baseCallDelegate = try let ret = @@ -568,7 +566,7 @@ type public Fsc () as this = | :? TargetInvocationException as tie when (match tie.InnerException with | :? Microsoft.Build.Exceptions.BuildAbortedException -> true | _ -> false) -> fsc.Log.LogError(tie.InnerException.Message, [| |]) -1 // ok, this is what happens when VS IDE cancels the build, no need to assert, just log the build-canceled error and return -1 to denote task failed - | e -> reraise() + | _ -> reraise() let baseCallDelegate = Func(fun () -> fsc.BaseExecuteTool(pathToTool, responseFileCommands, commandLineCommands) ) try diff --git a/src/fsharp/FSharp.Build/Fsi.fs b/src/fsharp/FSharp.Build/Fsi.fs index 1b893cbac60..a8646cea044 100644 --- a/src/fsharp/FSharp.Build/Fsi.fs +++ b/src/fsharp/FSharp.Build/Fsi.fs @@ -37,15 +37,12 @@ type public Fsi () as this = let mutable provideCommandLineArgs = false let mutable references : ITaskItem[] = [||] let mutable referencePath : string = null - let mutable resources : ITaskItem[] = [||] let mutable skipCompilerExecution = false let mutable sources : ITaskItem[] = [||] let mutable loadSources : ITaskItem[] = [||] let mutable useSources : ITaskItem[] = [||] let mutable tailcalls : bool = true let mutable targetProfile : string = null - let mutable targetType : string = null - let mutable toolExe : string = "fsi.exe" let mutable toolPath : string = let locationOfThisDll = try Some(Path.GetDirectoryName(typeof.Assembly.Location)) @@ -85,11 +82,6 @@ type public Fsi () as this = for item in references do builder.AppendSwitchIfNotNull("-r:", item.ItemSpec) - let referencePathArray = // create a array of strings - match referencePath with - | null -> null - | _ -> referencePath.Split([|';'; ','|], StringSplitOptions.RemoveEmptyEntries) - // NoWarn match disabledWarnings with | null -> () @@ -293,7 +285,6 @@ type public Fsi () as this = match host with | null -> base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands) | _ -> - let sources = sources|>Array.map(fun i->i.ItemSpec) let invokeCompiler baseCallDelegate = try let ret = @@ -305,7 +296,7 @@ type public Fsi () as this = | :? TargetInvocationException as tie when (match tie.InnerException with | :? Microsoft.Build.Exceptions.BuildAbortedException -> true | _ -> false) -> fsi.Log.LogError(tie.InnerException.Message, [| |]) -1 // ok, this is what happens when VS IDE cancels the build, no need to assert, just log the build-canceled error and return -1 to denote task failed - | e -> reraise() + | _ -> reraise() let baseCallDelegate = Func(fun () -> fsi.BaseExecuteTool(pathToTool, responseFileCommands, commandLineCommands) ) try diff --git a/src/fsharp/FSharp.Build/MapSourceRoots.fs b/src/fsharp/FSharp.Build/MapSourceRoots.fs index 84310352b8d..2d1b671bf54 100644 --- a/src/fsharp/FSharp.Build/MapSourceRoots.fs +++ b/src/fsharp/FSharp.Build/MapSourceRoots.fs @@ -122,7 +122,7 @@ type MapSourceRoots () = for root in mappedSourceRoots do match root.GetMetadata SourceControl with - | HasValue v when isSourceControlled -> mapNestedRootIfEmpty root + | HasValue _ when isSourceControlled -> mapNestedRootIfEmpty root | NullOrEmpty when not isSourceControlled -> mapNestedRootIfEmpty root | _ -> () diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj index 75af428f4f1..7d8f600d8e3 100644 --- a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj +++ b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj @@ -9,7 +9,7 @@ FSharp.Compiler.Interactive.Settings $(NoWarn);45;55;62;75;1182;1204 true - $(OtherFlags) --maxerrors:20 --extraoptimizationloops:1 + $(OtherFlags) --maxerrors:20 --extraoptimizationloops:1 --warnaserror-:1182 true diff --git a/src/fsharp/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs b/src/fsharp/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs index 60da7a58c0f..d6402a2bf21 100644 --- a/src/fsharp/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs +++ b/src/fsharp/FSharp.Compiler.Server.Shared/FSharpInteractiveServer.fs @@ -41,7 +41,7 @@ type internal FSharpInteractiveServer() = LifetimeServices.RenewOnCallTime <- TimeSpan(7,0,0,0); LifetimeServices.SponsorshipTimeout <- TimeSpan(7,0,0,0); ChannelServices.RegisterChannel(chan,false); - let objRef = RemotingServices.Marshal(server,"FSIServer") + RemotingServices.Marshal(server,"FSIServer") |> ignore () static member StartClient(channelName) = diff --git a/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs b/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs index a5d852b2625..48e49a3d4f6 100644 --- a/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs +++ b/tests/FSharp.Build.UnitTests/MapSourceRootsTests.fs @@ -14,7 +14,7 @@ type MockEngine() = member val Messages = ResizeArray() with get interface IBuildEngine with - member this.BuildProjectFile(projectFileName: string, targetNames: string [], globalProperties: System.Collections.IDictionary, targetOutputs: System.Collections.IDictionary): bool = + member this.BuildProjectFile(_: string, _: string [], _: System.Collections.IDictionary, _: System.Collections.IDictionary): bool = failwith "Not Implemented" member this.ColumnNumberOfTaskNode: int = 0 member this.ContinueOnError: bool = true @@ -141,7 +141,7 @@ type MapSourceRootsTests() = Assert.IsTrue(errorMessages |> Seq.exists (fun err -> err.EndsWith expectedErrorPath), sprintf "expected an error to end with '%s', none did.\nMessages were:\n%A" expectedErrorPath errorMessages) ) - | Some mappings -> + | Some _ -> Assert.Fail("Expected to fail on the inputs") [] @@ -219,7 +219,7 @@ type MapSourceRootsTests() = |> Seq.iter (fun expectedErrorPath -> Assert.IsTrue(errorMessages |> Seq.exists (fun err -> err.EndsWith expectedErrorPath), sprintf "expected an error to end with '%s', none did.\nMessages were:\n%A" expectedErrorPath errorMessages) ) - | Some mappings -> + | Some _ -> Assert.Fail("Expected to fail on the inputs") [] @@ -348,7 +348,7 @@ type MapSourceRootsTests() = |> Seq.iter (fun expectedErrorPath -> Assert.IsTrue(errorMessages |> Seq.exists (fun err -> err.EndsWith expectedErrorPath), sprintf "expected an error to end with '%s', none did.\nMessages were:\n%A" expectedErrorPath errorMessages) ) - | Some mappings -> + | Some _ -> Assert.Fail("Expected to fail on the inputs") [] @@ -379,7 +379,7 @@ type MapSourceRootsTests() = |> Seq.iter (fun expectedErrorPath -> Assert.IsTrue(errorMessages |> Seq.exists (fun err -> err.EndsWith expectedErrorPath), sprintf "expected an error to end with '%s', none did.\nMessages were:\n%A" expectedErrorPath errorMessages) ) - | Some mappings -> + | Some _ -> Assert.Fail("Expected to fail on the inputs") [] diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/WarnExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/WarnExpressionTests.fs index 1380869d383..4e8398b8c4b 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/WarnExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/WarnExpressionTests.fs @@ -82,8 +82,9 @@ let changeProperty() = """ |> typecheck |> shouldFail - |> withSingleDiagnostic (Warning 20, Line 9, Col 5, Line 9, Col 23, - "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.") + |> withDiagnostics [ + (Warning 20, Line 9, Col 5, Line 9, Col 23, "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.") + (Warning 1182, Line 2, Col 14, Line 2, Col 23, "The value 'property1' is unused")] [] let ``Warn If Implicitly Discarded``() = diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 440a4e8cf94..31c67d43a64 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -18,6 +18,10 @@ + + + + @@ -57,8 +61,4 @@ - - - - diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index 192b12d0411..48e9f3a15db 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -34,11 +34,6 @@ type DependencyManagerInteractiveTests() = | Ok(value) -> value | Error ex -> raise ex - let getErrors ((_value: Result), (errors: FSharpErrorInfo[])) = - errors - - let ignoreValue = getValue >> ignore - [] member __.``SmokeTest - #r nuget``() = let text = """ @@ -56,7 +51,7 @@ type DependencyManagerInteractiveTests() = #r @"nuget:System.Collections.Immutable.DoesNotExist, version=1.5.0" 0""" use script = new scriptHost() - let opt, errors = script.Eval(text) + let _, errors = script.Eval(text) Assert.Equal(errors.Length, 1) (* @@ -151,8 +146,6 @@ type DependencyManagerInteractiveTests() = [] member __.``Multiple Instances of DependencyProvider should be isolated``() = - - let assemblyProbingPaths () = Seq.empty let nativeProbingRoots () = Seq.empty use dp1 = new DependencyProvider(NativeResolutionProbe(nativeProbingRoots)) @@ -277,7 +270,6 @@ TorchSharp.Tensor.LongTensor.From([| 0L .. 100L |]).Device | ErrorReportType.Warning -> printfn "PackageManagementWarning %d : %s" code message ResolvingErrorReport (report) - let mutable resolverPackageRoots = Seq.empty let mutable resolverPackageRoots = Seq.empty let mutable resolverReferences = Seq.empty @@ -374,11 +366,9 @@ printfn ""%A"" result ResolvingErrorReport (report) let mutable resolverPackageRoots = Seq.empty - let mutable resolverPackageRoots = Seq.empty let mutable resolverReferences = Seq.empty let nativeProbingRoots () = resolverPackageRoots - let assemblyPaths () = resolverReferences // Restore packages, Get Reference dll paths and package roots let result = @@ -513,10 +503,8 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let mutable resolverPackageRoots = Seq.empty - let mutable resolverReferences = Seq.empty let nativeProbingRoots () = resolverPackageRoots - let assemblyProbingPaths () = resolverReferences // Restore packages, Get Reference dll paths and package roots let result = @@ -539,10 +527,8 @@ x |> Seq.iter(fun r -> ResolvingErrorReport (report) let mutable resolverPackageRoots = Seq.empty - let mutable resolverReferences = Seq.empty let nativeProbingRoots () = resolverPackageRoots - let assemblyProbingPaths () = resolverReferences // Restore packages, Get Reference dll paths and package roots let result = @@ -645,7 +631,7 @@ x |> Seq.iter(fun r -> // Set up AssemblyResolver to resolve dll's do - use dp = new AssemblyResolveHandler(AssemblyResolutionProbe(assemblyProbingPaths)) + use __ = new AssemblyResolveHandler(AssemblyResolutionProbe(assemblyProbingPaths)) // Invoking a non-existent assembly causes a probe. which should invoke the call back try Assembly.Load("NoneSuchAssembly") |> ignore with _ -> () @@ -741,16 +727,15 @@ x |> Seq.iter(fun r -> lines.Add(line) match expected |> Array.tryFind(compareLine) with | None -> () - | Some t -> + | Some _ -> found <- found + 1 if found = expected.Length then sawExpectedOutput.Set() |> ignore let text = "#help" use output = new RedirectConsoleOutput() use script = new FSharpScript(quiet = false, langVersion = LangVersion.V47) - let mutable found = 0 output.OutputProduced.Add (fun line -> verifyOutput line) - let opt = script.Eval(text) |> getValue + let _ = script.Eval(text) |> getValue Assert.True(sawExpectedOutput.WaitOne(TimeSpan.FromSeconds(5.0)), sprintf "Expected to see error sentinel value written\nexpected:%A\nactual:%A" expected lines) @@ -790,14 +775,13 @@ x |> Seq.iter(fun r -> lines.Add(line) match expected |> Array.tryFind(compareLine) with | None -> () - | Some t -> + | Some _ -> found <- found + 1 if found = expected.Length then sawExpectedOutput.Set() |> ignore let text = "#help" use output = new RedirectConsoleOutput() use script = new FSharpScript(quiet = false, langVersion = LangVersion.Preview) - let mutable found = 0 output.OutputProduced.Add (fun line -> verifyOutput line) - let opt = script.Eval(text) |> getValue + let _ = script.Eval(text) |> getValue Assert.True(sawExpectedOutput.WaitOne(TimeSpan.FromSeconds(5.0)), sprintf "Expected to see error sentinel value written\nexpected:%A\nactual:%A" expected lines) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index aacbdb2be56..dc7aeaeddef 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -123,7 +123,7 @@ stacktype.Name = "Stack" [] // whitespace only argument member _.``Script with #i syntax errors fail``(code, error0) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(errors.[0].ToString(), error0) @@ -133,7 +133,7 @@ stacktype.Name = "Stack" "input.fsx (1,1)-(1,6) interactive warning Invalid directive '#i '")>] member _.``Script with more #i syntax errors fail``(code, error0, error1) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(errors.Length, 2) Assert.Equal(error0, errors.[0].ToString()) @@ -144,7 +144,7 @@ stacktype.Name = "Stack" "input.fsx (1,1)-(1,42) interactive error #i is not supported by the registered PackageManagers")>] member _.``Script with #i and no package manager specified``(code, error0) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(errors.Length, 1) Assert.Equal(errors.[0].ToString(), error0) @@ -154,7 +154,7 @@ stacktype.Name = "Stack" "input.fsx (1,1)-(1,15) interactive error Invalid URI: The format of the URI could not be determined.")>] member _.``Script with #i and forgot to add quotes``(code, error) = use script = new FSharpScript() - let result, errors = script.Eval(code) + let _, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(1, errors.Length) Assert.Equal(error, errors.[0].ToString()) @@ -164,7 +164,7 @@ stacktype.Name = "Stack" let path = Path.GetTempPath() let code = sprintf "#i @\"nuget:%s\" " path use script = new FSharpScript() - let result, errors = script.Eval(code) + let _, errors = script.Eval(code) Assert.Empty(errors) Assert.Equal(0, errors.Length) @@ -176,7 +176,7 @@ stacktype.Name = "Stack" let code = sprintf "#i @\"nuget:%s\"" path let error = sprintf "interactive error The source directory '%s' not found" path use script = new FSharpScript() - let result, errors = script.Eval(code) + let _, errors = script.Eval(code) Assert.NotEmpty(errors) Assert.Equal(1, errors.Length) Assert.True(errors.[0].ToString().EndsWith(error)) @@ -248,7 +248,7 @@ printfn ""%A"" result if line.Contains("error NU1101:") && line.Contains("FSharp.Really.Not.A.Package") then found <- found + 1 outp.Add(line)) - let result, errors = script.Eval("""#r "nuget:FSharp.Really.Not.A.Package" """) + let _, errors = script.Eval("""#r "nuget:FSharp.Really.Not.A.Package" """) Assert.True( (found = 0), "Did not expect to see output contains 'error NU1101:' and 'FSharp.Really.Not.A.Package'") Assert.True( errors |> Seq.exists (fun error -> error.Message.Contains("error NU1101:")), "Expect to error containing 'error NU1101:'") Assert.True( errors |> Seq.exists (fun error -> error.Message.Contains("FSharp.Really.Not.A.Package")), "Expect to error containing 'FSharp.Really.Not.A.Package'") @@ -259,7 +259,7 @@ printfn ""%A"" result use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|]) let mutable foundResolve = 0 output.OutputProduced.Add (fun line -> if line.Contains("error NU1101:") then foundResolve <- foundResolve + 1) - let result, errors = + let _, errors = script.Eval(""" #r "nuget:FSharp.Really.Not.A.Package" #r "nuget:FSharp.Really.Not.Another.Package" diff --git a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs index 705ce465b1d..ca1ae1a9ce9 100644 --- a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs +++ b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs @@ -149,7 +149,7 @@ type public HashIfExpression() = [] member this.NegativeParserTestCases()= - let errors, warnings, parser = createParser () + let errors, _, parser = createParser () let negativeTests = [| diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs index 7e64d56f512..e2431a7c04b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs @@ -46,8 +46,7 @@ type UseUnionsAsFlags() = Assert.AreEqual(int unknown, 99) [] - member this.CanParseViaBCL() = - let values = System.Enum.GetValues(typeof) + member this.CanParseViaBCL() = let fourFromString = System.Enum.Parse(typeof, "Four", false) :?> FlagsUnion // downcast needed Assert.AreEqual(fourFromString, FlagsUnion.Four) @@ -157,8 +156,8 @@ let [] ``struct unions support function argument bindings`` () = [] type ComparisonStructUnion = | SU2 of int * int - member x.C1 = (match x with SU2(a,b) -> a) - member x.C2 = (match x with SU2(a,b) -> b) + member x.C1 = (match x with SU2(a,_) -> a) + member x.C2 = (match x with SU2(_,b) -> b) override self.Equals other = match other with | :? ComparisonStructUnion as o -> (self.C1 + self.C2) = (o.C1 + o.C2) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs index f602dfc0d7e..cc0bdf84f12 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array2Module.fs @@ -94,20 +94,20 @@ type Array2Module() = let arg = (System.Math.PI / 10.0) * float j if i = 0 then System.Math.Sin(arg) else System.Math.Cos(arg)) let intArr2 = Array2D.create 2 3 8.8 - let resultInt = Array2D.blit intArr 0 0 intArr2 0 0 2 2 + Array2D.blit intArr 0 0 intArr2 0 0 2 2 if intArr2.[1,1] <> 0.95105651629515353 then Assert.Fail() // string array let strArr = Array2D.init 2 3 (fun i j -> i.ToString() + "-" + j.ToString()) let strArr2 = Array2D.create 2 3 "" - let resultStr = Array2D.blit strArr 0 0 strArr2 0 0 2 3 + Array2D.blit strArr 0 0 strArr2 0 0 2 3 if strArr2.[1,1] <> "1-1" then Assert.Fail() // empty array let eptArr = Array2D.create 0 0 1 let eptArr2 = Array2D.create 0 0 1 - let resultEpt = Array2D.blit eptArr 0 0 eptArr2 0 0 0 0 + Array2D.blit eptArr 0 0 eptArr2 0 0 0 0 if eptArr2 <> eptArr then Assert.Fail() // null array @@ -211,13 +211,13 @@ type Array2Module() = [] member this.Create() = // integer array - let intArr = Array2D.init 2 3 (fun i j -> 100) + let intArr = Array2D.init 2 3 (fun _ _ -> 100) let resultInt = Array2D.create 2 3 100 if resultInt <> intArr then Assert.Fail() // string array - let strArr = Array2D.init 2 3 (fun i j -> "goodboy") + let strArr = Array2D.init 2 3 (fun _ _ -> "goodboy") let resultStr = Array2D.create 2 3 "goodboy" if resultStr <> strArr then Assert.Fail() @@ -416,7 +416,7 @@ type Array2Module() = // string array - let strArr = Array2D.init 2 3 (fun i j -> "goodboy") + let strArr = Array2D.init 2 3 (fun _ _ -> "goodboy") let funStr (x:string) = x.ToUpper() let resultStr = Array2D.map funStr strArr if resultStr <> Array2D.create 2 3 "GOODBOY" then Assert.Fail() @@ -442,7 +442,7 @@ type Array2Module() = // string array - let strArr = Array2D.init 2 3 (fun i j -> "goodboy") + let strArr = Array2D.init 2 3 (fun _ _ -> "goodboy") let funStr (x:int) (y:int) (z:string) = x.ToString() + y.ToString() + z.ToUpper() let resultStr = Array2D.mapi funStr strArr if resultStr <> Array2D.init 2 3 (fun i j -> i.ToString() + j.ToString() + "GOODBOY") then Assert.Fail() @@ -555,11 +555,6 @@ type Array2Module() = if m6lislis <> m6arrarr then Assert.Fail() if m6lislis <> m6arrlis then Assert.Fail() if m6lislis <> m6lisarr then Assert.Fail() - - let m7 = array2D [for i in 0..1000 do - yield [for j in 0..1000 do - yield i*j] ] - let matrix :int[,] = array2D [[1;2;3]; [2;3;4]] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs index 604fc67fe7b..0a9385396c1 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array3Module.fs @@ -95,7 +95,7 @@ type Array3Module() = CheckThrowsIndexOutRangException(fun () -> Array3D.get strArr 0 0 2 |> ignore) // empty array - let emptyArray = Array3D.init 0 0 0 (fun i j k -> Assert.Fail()) + let emptyArray = Array3D.init 0 0 0 (fun _ _ _ -> Assert.Fail()) CheckThrowsIndexOutRangException (fun () -> Array3D.get emptyArray 1 0 0 |> ignore) CheckThrowsIndexOutRangException (fun () -> Array3D.get emptyArray 0 1 0 |> ignore) CheckThrowsIndexOutRangException (fun () -> Array3D.get emptyArray 0 0 1 |> ignore) @@ -128,11 +128,11 @@ type Array3Module() = // empty array let emptyArray = Array3D.create 0 0 0 0 - Array3D.iter (fun x -> Assert.Fail()) emptyArray + Array3D.iter (fun _ -> Assert.Fail()) emptyArray // null array let nullArr : string[,,] = null - CheckThrowsArgumentNullException(fun () -> Array3D.iter (fun x -> Assert.Fail("Souldn't be called")) nullArr) + CheckThrowsArgumentNullException(fun () -> Array3D.iter (fun _ -> Assert.Fail("Souldn't be called")) nullArr) () [] @@ -159,7 +159,7 @@ type Array3Module() = // empty array let emptyArray = Array3D.create 0 0 0 0 - Array3D.iter (fun x -> Assert.Fail()) emptyArray + Array3D.iter (fun _ -> Assert.Fail()) emptyArray // null array let nullArr = null:string[,,] @@ -252,10 +252,6 @@ type Array3Module() = let resultStr = Array3D.map funStr strArr resultStr |> Array3D.iter (fun x -> if x <> "VALUE" then Assert.Fail()) - - // empty array - let eptArr = Array3D.create 0 0 0 1 - let resultEpt = Array3D.map (fun x -> Assert.Fail()) eptArr // null array let nullArr = null : string[,,] @@ -274,19 +270,15 @@ type Array3Module() = // string array - let strArr = Array3D.init 2 3 2(fun i j k-> "goodboy") + let strArr = Array3D.init 2 3 2(fun _ _ _ -> "goodboy") let funStr (x:int) (y:int) (z:int) (a:string) = x.ToString() + y.ToString() + z.ToString() + a.ToUpper() let resultStr = Array3D.mapi funStr strArr if resultStr <> Array3D.init 2 3 2(fun i j k-> i.ToString() + j.ToString() + k.ToString() + "GOODBOY") then Assert.Fail() - // empty array - let eptArr = Array3D.create 0 0 0 1 - let resultEpt = Array3D.mapi (fun i j k x -> Assert.Fail()) eptArr - // null array let nullArr = null : string[,,] - CheckThrowsArgumentNullException (fun () -> Array3D.mapi (fun i j k x -> Assert.Fail("shouldn't execute this")) nullArr |> ignore) + CheckThrowsArgumentNullException (fun () -> Array3D.mapi (fun _ _ _ _ -> Assert.Fail("shouldn't execute this")) nullArr |> ignore) () diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs index 1d6276e4259..14953283bc3 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/Array4Module.fs @@ -107,7 +107,7 @@ type Array4Module() = CheckThrowsIndexOutRangException(fun () -> Array4D.get strArr 0 0 0 2 |> ignore) // empty array - let emptyArray = Array4D.init 0 0 0 0 (fun i j k l -> Assert.Fail()) + let emptyArray = Array4D.init 0 0 0 0 (fun _ _ _ _ -> Assert.Fail()) CheckThrowsIndexOutRangException (fun () -> Array4D.get emptyArray 1 0 0 0 |> ignore) CheckThrowsIndexOutRangException (fun () -> Array4D.get emptyArray 0 1 0 0 |> ignore) CheckThrowsIndexOutRangException (fun () -> Array4D.get emptyArray 0 0 1 0 |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs index de85233a39b..875740e0df8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs @@ -303,7 +303,7 @@ type ArrayModule() = [] member this.takeWhile() = - Assert.AreEqual([||],Array.takeWhile (fun x -> failwith "should not be used") [||]) + Assert.AreEqual([||],Array.takeWhile (fun _ -> failwith "should not be used") [||]) Assert.AreEqual([|1;2;4;5|],Array.takeWhile (fun x -> x < 6) [|1;2;4;5;6;7|]) Assert.AreEqual([|"a"; "ab"; "abc"|],Array.takeWhile (fun (x:string) -> x.Length < 4) [|"a"; "ab"; "abc"; "abcd"; "abcde"|]) Assert.AreEqual([|"a"; "ab"; "abc"; "abcd"; "abcde"|],Array.takeWhile (fun _ -> true) [|"a"; "ab"; "abc"; "abcd"; "abcde"|]) @@ -482,9 +482,9 @@ type ArrayModule() = Assert.AreEqual(-1,Array.compareWith compare [|1;2;2|] [|1;2;3;4|]) // compareWith should use the comparer - Assert.AreEqual(0,Array.compareWith (fun x y -> 0) [|"1";"2"|] [|"1";"3"|]) - Assert.AreEqual(1,Array.compareWith (fun x y -> 1) [|"1";"2"|] [|"1";"3"|]) - Assert.AreEqual(-1,Array.compareWith (fun x y -> -1) [|"1";"2"|] [|"1";"3"|]) + Assert.AreEqual(0,Array.compareWith (fun _ _ -> 0) [|"1";"2"|] [|"1";"3"|]) + Assert.AreEqual(1,Array.compareWith (fun _ _ -> 1) [|"1";"2"|] [|"1";"3"|]) + Assert.AreEqual(-1,Array.compareWith (fun _ _ -> -1) [|"1";"2"|] [|"1";"3"|]) [] member this.Concat() = @@ -915,7 +915,7 @@ type ArrayModule() = Assert.AreEqual("3", resultInt) // make it not found - CheckThrowsKeyNotFoundException (fun () -> Array.pick (fun n -> None) intArr |> ignore) + CheckThrowsKeyNotFoundException (fun () -> Array.pick (fun _ -> None) intArr |> ignore) [] member this.last() = @@ -1112,7 +1112,7 @@ type ArrayModule() = // null array let nullArr = null:string[] - CheckThrowsArgumentNullException (fun () -> Array.forall (fun x -> true) nullArr |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.forall (fun _ -> true) nullArr |> ignore) () @@ -1133,8 +1133,8 @@ type ArrayModule() = // null array let nullArr = null:string[] let validArray = [| "a" |] - CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun x y-> true) nullArr validArray |> ignore) - CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun x y-> true) validArray nullArr |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun _ _ -> true) nullArr validArray |> ignore) + CheckThrowsArgumentNullException (fun () -> Array.forall2 (fun _ _ -> true) validArray nullArr |> ignore) // len1 <> len2 CheckThrowsArgumentException(fun () -> Array.forall2 (fun x y -> x < y) [|1..10|] [|2..20|] |> ignore) @@ -1229,7 +1229,6 @@ type ArrayModule() = // Empty array let emptyArray = [||] - let group_byEmpty = Array.groupBy funcInt emptyArray let expectedEmptyArray = [||] if emptyArray <> expectedEmptyArray then Assert.Fail() diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs index 57347f90f6f..e406c27dcc9 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs @@ -61,7 +61,6 @@ type ArrayModule2() = Assert.AreEqual([|(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)|], resultInt) // string array - let funcStr (x:int) (y:string) = x+ y.Length let resultStr = Array.indexed [| "Lists"; "Are"; "Commonly"; "List" |] Assert.AreEqual([| (0,"Lists");(1,"Are");(2,"Commonly");(3,"List") |], resultStr) @@ -1086,7 +1085,6 @@ type ArrayModule2() = // string array let resultStr = Array.unzip [|("A","a");("B","b");("C","c");("D","d")|] - let str = resultStr.ToString() if resultStr <> ([|"A"; "B"; "C" ; "D" |],[|"a";"b";"c";"d"|]) then Assert.Fail() // empty array @@ -1261,7 +1259,6 @@ type ArrayModule2() = // string array let resultStr = Array.zip3 [|"A"; "B"; "C" ; "D" |] [|"1";"2";"3";"4"|] [|"a"; "b"; "c"; "d"|] - let str = resultStr.ToString() if resultStr <> [|("A","1","a");("B","2","b");("C","3","c");("D","4","d")|] then Assert.Fail() // empty array diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs index 951f9711d68..f5fb9e3cc71 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs @@ -464,16 +464,8 @@ let ``item is consistent`` () = smallerSizeCheck item smallerSizeCheck item -let iter<'a when 'a : equality> (xs : 'a []) f' = +let iter<'a when 'a : equality> (xs : 'a []) = let list = System.Collections.Generic.List<'a>() - let f x = - list.Add x - f' x - - let s = xs |> Seq.iter f - let l = xs |> List.ofArray |> List.iter f - let a = xs |> Array.iter f - let xs = Seq.toList xs list |> Seq.toList = (xs @ xs @ xs) @@ -483,18 +475,8 @@ let ``iter looks at every element exactly once and in order - consistenly over a smallerSizeCheck iter smallerSizeCheck iter -let iter2<'a when 'a : equality> (xs' : ('a*'a) []) f' = - let xs = xs' |> Array.map fst - let xs2 = xs' |> Array.map snd +let iter2<'a when 'a : equality> (xs' : ('a*'a) []) = let list = System.Collections.Generic.List<'a*'a>() - let f x y = - list.Add <| (x,y) - f' x y - - let s = Seq.iter2 f xs xs2 - let l = List.iter2 f (xs |> List.ofArray) (xs2 |> List.ofArray) - let a = Array.iter2 f xs xs2 - let xs = Seq.toList xs' list |> Seq.toList = (xs @ xs @ xs) @@ -504,18 +486,9 @@ let ``iter2 looks at every element exactly once and in order - consistenly over smallerSizeCheck iter2 smallerSizeCheck iter2 -let iteri<'a when 'a : equality> (xs : 'a []) f' = +let iteri<'a when 'a : equality> (xs : 'a []) = let list = System.Collections.Generic.List<'a>() let indices = System.Collections.Generic.List() - let f i x = - list.Add x - indices.Add i - f' i x - - let s = xs |> Seq.iteri f - let l = xs |> List.ofArray |> List.iteri f - let a = xs |> Array.iteri f - let xs = Seq.toList xs list |> Seq.toList = (xs @ xs @ xs) && indices |> Seq.toList = ([0..xs.Length-1] @ [0..xs.Length-1] @ [0..xs.Length-1]) @@ -526,19 +499,9 @@ let ``iteri looks at every element exactly once and in order - consistenly over smallerSizeCheck iteri smallerSizeCheck iteri -let iteri2<'a when 'a : equality> (xs' : ('a*'a) []) f' = - let xs = xs' |> Array.map fst - let xs2 = xs' |> Array.map snd +let iteri2<'a when 'a : equality> (xs' : ('a*'a) []) = let list = System.Collections.Generic.List<'a*'a>() let indices = System.Collections.Generic.List() - let f i x y = - list.Add <| (x,y) - indices.Add i - f' x y - - let s = Seq.iteri2 f xs xs2 - let l = List.iteri2 f (xs |> List.ofArray) (xs2 |> List.ofArray) - let a = Array.iteri2 f xs xs2 let xs = Seq.toList xs' list |> Seq.toList = (xs @ xs @ xs) && @@ -609,9 +572,9 @@ let ``map2 looks at every element exactly once and in order - consistenly over a smallerSizeCheck map2 let map3<'a when 'a : equality> (xs' : ('a*'a*'a) []) f' = - let xs = xs' |> Array.map (fun (x,y,z) -> x) - let xs2 = xs' |> Array.map (fun (x,y,z) -> y) - let xs3 = xs' |> Array.map (fun (x,y,z) -> z) + let xs = xs' |> Array.map (fun (x,_,_) -> x) + let xs2 = xs' |> Array.map (fun (_,y,_) -> y) + let xs3 = xs' |> Array.map (fun (_,_,z) -> z) let list = System.Collections.Generic.List<'a*'a*'a>() let f x y z = list.Add <| (x,y,z) @@ -1291,9 +1254,9 @@ let ``zip is consistent for collections with equal length`` () = smallerSizeCheck zip let zip3<'a when 'a : equality> (xs':('a*'a*'a) []) = - let xs = Array.map (fun (x,y,z) -> x) xs' - let xs2 = Array.map (fun (x,y,z) -> y) xs' - let xs3 = Array.map (fun (x,y,z) -> z) xs' + let xs = Array.map (fun (x,_,_) -> x) xs' + let xs2 = Array.map (fun (_,y,_) -> y) xs' + let xs3 = Array.map (fun (_,_,z) -> z) xs' let s = runAndCheckErrorType (fun () -> Seq.zip3 xs xs2 xs3 |> Seq.toArray) let l = runAndCheckErrorType (fun () -> List.zip3 (List.ofSeq xs) (List.ofSeq xs2) (List.ofSeq xs3) |> List.toArray) let a = runAndCheckErrorType (fun () -> Array.zip3 (Array.ofSeq xs) (Array.ofSeq xs2) (Array.ofSeq xs3)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs index c00a9a3af8b..bea0f461de4 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/HashIdentityModule.fs @@ -62,21 +62,21 @@ type HashIdentityModule() = member this.FromFunctions() = // value type - let valueDict = new Dictionary(HashIdentity.FromFunctions (fun x -> 1) (fun x y -> x > y)) + let valueDict = new Dictionary(HashIdentity.FromFunctions (fun _ -> 1) (fun x y -> x > y)) Assert.AreEqual(0,valueDict.Count) valueDict.Add(3,"C") Assert.AreEqual(1,valueDict.Count) Assert.True(valueDict.ContainsValue("C")) // reference type - let refDict = new Dictionary(HashIdentity.FromFunctions (fun x -> 1) (fun x y -> x > y)) + let refDict = new Dictionary(HashIdentity.FromFunctions (fun _ -> 1) (fun x y -> x > y)) Assert.AreEqual(0,refDict.Count) refDict.Add("...",3) Assert.AreEqual(1,refDict.Count) Assert.True(refDict.ContainsValue(3)) // empty type - let eptDict = new Dictionary(HashIdentity.FromFunctions (fun x -> 1) (fun x y -> x > y)) + let eptDict = new Dictionary(HashIdentity.FromFunctions (fun _ -> 1) (fun x y -> x > y)) Assert.AreEqual(0,eptDict.Count) Assert.False(eptDict.ContainsKey(3)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs index eed54c3ad77..23c6c98e524 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs @@ -22,11 +22,7 @@ type ListModule() = member this.Empty() = let emptyList = List.empty let resultEpt = List.length emptyList - Assert.AreEqual(0, resultEpt) - - let c : int list = List.empty - let d : string list = List.empty - + Assert.AreEqual(0, resultEpt) () [] @@ -241,7 +237,7 @@ type ListModule() = // always None let emptySrc :int list = [ ] - let emptyChosen = List.choose (fun i -> Option.None) intSrc + let emptyChosen = List.choose (fun _ -> Option.None) intSrc Assert.AreEqual(emptySrc, emptyChosen) // empty List @@ -268,13 +264,13 @@ type ListModule() = Assert.AreEqual(-1,List.compareWith compare [1;2;2] [1;2;3;4]) // compareWith should use the comparer - Assert.AreEqual(0,List.compareWith (fun x y -> 0) ["1";"2"] ["1";"3"]) - Assert.AreEqual(1,List.compareWith (fun x y -> 1) ["1";"2"] ["1";"3"]) - Assert.AreEqual(-1,List.compareWith (fun x y -> -1) ["1";"2"] ["1";"3"]) + Assert.AreEqual(0,List.compareWith (fun _ _ -> 0) ["1";"2"] ["1";"3"]) + Assert.AreEqual(1,List.compareWith (fun _ _ -> 1) ["1";"2"] ["1";"3"]) + Assert.AreEqual(-1,List.compareWith (fun _ _ -> -1) ["1";"2"] ["1";"3"]) [] member this.takeWhile() = - Assert.AreEqual(([] : int list),List.takeWhile (fun x -> failwith "should not be used") ([] : int list)) + Assert.AreEqual(([] : int list),List.takeWhile (fun _ -> failwith "should not be used") ([] : int list)) Assert.AreEqual([1;2;4;5],List.takeWhile (fun x -> x < 6) [1;2;4;5;6;7]) Assert.AreEqual(["a"; "ab"; "abc"],List.takeWhile (fun (x:string) -> x.Length < 4) ["a"; "ab"; "abc"; "abcd"; "abcde"]) Assert.AreEqual(["a"; "ab"; "abc"; "abcd"; "abcde"],List.takeWhile (fun _ -> true) ["a"; "ab"; "abc"; "abcd"; "abcde"]) @@ -707,7 +703,7 @@ type ListModule() = () //unequal length list - let funcUnequal x y () = () + let funcUnequal _ _ () = () CheckThrowsArgumentException( fun () -> (List.foldBack2 funcUnequal [ 1..10 ] [1..9] ())) () diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs index c5c690f1f09..811c2db1ce8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs @@ -88,7 +88,7 @@ type ListModule02() = // integer List let funcInt x y z = (x + y) / z let resultInt = List.map3 funcInt [ 1..10 ] [2..2..20] [3..3..30] - let expectedInt = List.init 10 (fun x -> 1) + let expectedInt = List.init 10 (fun _ -> 1) Assert.AreEqual(expectedInt, resultInt) // string List @@ -114,7 +114,6 @@ type ListModule02() = | _ when x % 3 = 0 -> [999;999] | _ -> [168;168] let resultInt = List.collect funcInt [ 1..5 ] - let resultList = List.toArray resultInt Assert.AreEqual([168;168;168;168;999;999;168;168;168;168;], resultInt ) // string List @@ -954,7 +953,6 @@ type ListModule02() = // string List let resultStr = List.unzip [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let str = resultStr.ToString() Assert.AreEqual(([2;3;4;5],["b";"c";"d";"e"]) , resultStr) // empty List diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs index 81a0fafc0fe..4663ca4934d 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListProperties.fs @@ -126,9 +126,9 @@ let ``indexed is adding correct indexes`` () = Check.QuickThrowOnFailure indexed_and_zip let zip_and_zip3<'a when 'a : equality> (xs' : ('a*'a*'a) list) = - let xs = List.map (fun (x,y,z) -> x) xs' - let xs2 = List.map (fun (x,y,z) -> y) xs' - let xs3 = List.map (fun (x,y,z) -> z) xs' + let xs = List.map (fun (x,_,_) -> x) xs' + let xs2 = List.map (fun (_,y,_) -> y) xs' + let xs3 = List.map (fun (_,_,z) -> z) xs' let a = List.zip3 xs xs2 xs3 let b = List.zip (List.zip xs xs2) xs3 |> List.map (fun ((a,b),c) -> a,b,c) @@ -177,7 +177,7 @@ let ``splitInto produces chunks exactly `count` chunks with equal size (+/- 1)`` Check.QuickThrowOnFailure prop -let sort_and_sortby (xs : list) (xs2 : list) = +let sort_and_sortby (xs : list) (_ : list) = let a = List.sortBy id xs |> Seq.toArray let b = List.sort xs |> Seq.toArray let result = ref true @@ -607,7 +607,7 @@ let ``replicate creates n instances of the given element`` () = let singleton_and_replicate<'a when 'a : comparison> (x:'a) (count:NonNegativeInt) = let count = int count let xs = List.replicate count x - let ys = [for i in 1..count -> List.singleton x] |> List.concat + let ys = [for _ in 1..count -> List.singleton x] |> List.concat xs = ys [] @@ -846,7 +846,7 @@ let ``List.allPairs first elements are correct`` () = let allPairsSnd<'a, 'b when 'b : equality> (xs : 'a list) (ys : 'b list) = let pairsSnd = List.allPairs xs ys |> List.map snd - let check = [ for i in 1 .. xs.Length do yield! ys ] + let check = [ for _ in 1 .. xs.Length do yield! ys ] pairsSnd = check [] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs index e78b1b3abc5..0994272dd16 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapModule.fs @@ -25,11 +25,6 @@ type MapModule() = member this.Empty() = let emptyMap = Map.empty Assert.True(Map.isEmpty emptyMap) - - let a:Map = Map.empty - let b : Map = Map.empty - let c : Map = Map.empty - () [] @@ -100,13 +95,13 @@ type MapModule() = member this.Exists() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.exists (fun x y -> x > 3) valueKeyMap + let resultValueMap = Map.exists (fun x _ -> x > 3) valueKeyMap Assert.True(resultValueMap) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.exists (fun x y -> y>2 ) + let resultRefMap = refMap |> Map.exists (fun _ y -> y>2 ) Assert.True(resultRefMap) // One-element Map @@ -116,7 +111,7 @@ type MapModule() = // empty Map let eptMap = Map.empty - let resultEpt = Map.exists (fun x y -> false) eptMap + let resultEpt = Map.exists (fun _ _ -> false) eptMap Assert.False(resultEpt) () @@ -125,22 +120,22 @@ type MapModule() = member this.Filter() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap =valueKeyMap |> Map.filter (fun x y -> x % 3 = 0) + let resultValueMap =valueKeyMap |> Map.filter (fun x _ -> x % 3 = 0) Assert.AreEqual(resultValueMap,[3,"c"] |> Map.ofList) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.filter (fun x y -> y > 3 ) + let resultRefMap = refMap |> Map.filter (fun _ y -> y > 3 ) Assert.AreEqual(resultRefMap,["....",4] |> Map.ofList) // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.filter (fun x y -> x<3 ) + let resultOele = oeleMap |> Map.filter (fun x _ -> x<3 ) Assert.AreEqual(resultOele,oeleMap) // empty Map let eptMap = Map.empty - let resultEpt = Map.filter (fun x y -> true) eptMap + let resultEpt = Map.filter (fun _ _ -> true) eptMap Assert.AreEqual(resultEpt,eptMap) () @@ -173,22 +168,22 @@ type MapModule() = member this.FindIndex() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap =valueKeyMap |> Map.findKey (fun x y -> x % 3 = 0) + let resultValueMap =valueKeyMap |> Map.findKey (fun x _ -> x % 3 = 0) Assert.AreEqual(resultValueMap,3) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.findKey (fun x y -> y % 3 = 0 ) + let resultRefMap = refMap |> Map.findKey (fun _ y -> y % 3 = 0 ) Assert.AreEqual(resultRefMap,"...") // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.findKey (fun x y -> x = 1 ) + let resultOele = oeleMap |> Map.findKey (fun x _ -> x = 1 ) Assert.AreEqual(resultOele,1) // empty Map let eptMap = Map.empty - CheckThrowsKeyNotFoundException (fun () -> Map.findKey (fun x y -> true) eptMap |> ignore) + CheckThrowsKeyNotFoundException (fun () -> Map.findKey (fun _ _ -> true) eptMap |> ignore) () @@ -196,12 +191,12 @@ type MapModule() = member this.TryPick() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.tryPick (fun x y -> if x % 3 = 0 then Some (x) else None) + let resultValueMap = valueKeyMap |> Map.tryPick (fun x _ -> if x % 3 = 0 then Some (x) else None) Assert.AreEqual(resultValueMap,Some 3) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.tryPick (fun x y -> if (y % 3 = 0 ) then Some y else None ) + let resultRefMap = refMap |> Map.tryPick (fun _ y -> if (y % 3 = 0 ) then Some y else None ) Assert.AreEqual(resultRefMap,Some 3) @@ -212,7 +207,7 @@ type MapModule() = // empty Map let eptMap = Map.empty - let resultEpt = Map.tryPick (fun x y -> Some x) eptMap + let resultEpt = Map.tryPick (fun x _ -> Some x) eptMap Assert.AreEqual(resultEpt,None) () @@ -226,7 +221,7 @@ type MapModule() = // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let result = refMap |> Map.pick (fun x y -> if (y % 3 = 0 ) then Some y else None ) + let result = refMap |> Map.pick (fun _ y -> if (y % 3 = 0 ) then Some y else None ) Assert.AreEqual(result, 3) // One-element Map @@ -238,7 +233,7 @@ type MapModule() = let eptMap = Map.empty let resultEpt = try - Map.pick (fun x y -> Some x) eptMap + Map.pick (fun x _ -> Some x) eptMap with :? System.Collections.Generic.KeyNotFoundException -> Some 0 Assert.AreEqual(resultEpt, Some 0) @@ -263,7 +258,7 @@ type MapModule() = // empty Map let eptMap = Map.empty - let resultEpt = eptMap |> Map.fold (fun x y z -> 1) 1 + let resultEpt = eptMap |> Map.fold (fun _ _ _ -> 1) 1 Assert.AreEqual(resultEpt,1) () @@ -287,7 +282,7 @@ type MapModule() = // empty Map let eptMap = Map.empty - let resultEpt = Map.foldBack (fun x y z -> 1) eptMap 1 + let resultEpt = Map.foldBack (fun _ _ _ -> 1) eptMap 1 Assert.AreEqual(resultEpt,1) () @@ -296,22 +291,22 @@ type MapModule() = member this.ForAll() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = valueKeyMap |> Map.forall (fun x y -> x % 3 = 0) + let resultValueMap = valueKeyMap |> Map.forall (fun x _ -> x % 3 = 0) Assert.False(resultValueMap) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.forall (fun x y -> x.Length > 4 ) + let resultRefMap = refMap |> Map.forall (fun x _ -> x.Length > 4 ) Assert.False(resultRefMap) // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.forall (fun x y -> x<3 ) + let resultOele = oeleMap |> Map.forall (fun x _ -> x<3 ) Assert.True(resultOele) // empty Map let eptMap = Map.empty - let resultEpt =eptMap |> Map.forall (fun x y -> true) + let resultEpt =eptMap |> Map.forall (fun _ _ -> true) Assert.True(resultEpt) () @@ -465,28 +460,28 @@ type MapModule() = member this.Partition() = // value keys let valueKeyMap = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] - let resultValueMap = Map.partition (fun x y -> x%2 = 0) valueKeyMap + let resultValueMap = Map.partition (fun x _ -> x%2 = 0) valueKeyMap let choosed = [(2,"b"); (4,"d")] |> Map.ofList let notChoosed = [(3,"c"); (5,"e")] |> Map.ofList Assert.AreEqual(resultValueMap,(choosed,notChoosed)) // reference keys let refMap = Map.ofSeq [for c in ["."; ".."; "..."; "...."] do yield (c, c.Length) ] - let resultRefMap = refMap |> Map.partition (fun x y -> x.Length >2 ) + let resultRefMap = refMap |> Map.partition (fun x _ -> x.Length >2 ) let choosed = [( "...",3); ("....",4)] |> Map.ofList let notChoosed = [(".",1); ("..",2)] |> Map.ofList Assert.AreEqual(resultRefMap,(choosed,notChoosed)) // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = Map.partition (fun x y -> x<4) oeleMap + let resultOele = Map.partition (fun x _ -> x<4) oeleMap let choosed = [(1,"one")] |> Map.ofList let notChoosed = Map.empty Assert.AreEqual(resultOele,(choosed,notChoosed)) // empty Map let eptMap = Map.empty - let resultEpt = Map.partition (fun x y -> true) eptMap + let resultEpt = Map.partition (fun _ _ -> true) eptMap Assert.AreEqual(resultEpt,(eptMap,eptMap)) () @@ -577,21 +572,18 @@ type MapModule() = // value keys let valueKeyMapOfArr = Map.ofSeq [(2,"b"); (3,"c"); (4,"d"); (5,"e")] let resultValueMap = Map.toSeq valueKeyMapOfArr - let originInt = seq { for i in 1..3 do yield (i,i*i)} VerifySeqsEqual resultValueMap [(2,"b"); (3,"c"); (4,"d"); (5,"e")] // reference keys let refMapOfArr = Map.ofSeq [(".",1); ("..",2);( "...",3); ("....",4)] let resultRefMap = Map.toSeq refMapOfArr - let originStr = seq { for x in [ "is" ;"lists";"str"; "this"] do yield (x,x.ToUpper())} VerifySeqsEqual resultRefMap [(".",1); ("..",2);( "...",3); ("....",4)] // One-element Map let oeleMapOfArr = Map.ofSeq [(1,"one")] let resultOele = Map.toSeq oeleMapOfArr - let originMix = seq { for x in [ "is" ;"str"; "this" ;"lists"] do yield (x.Length,x.ToUpper())} VerifySeqsEqual resultOele [(1,"one")] @@ -635,7 +627,7 @@ type MapModule() = // One-element Map let oeleMap = Map.ofSeq [(1, "one")] - let resultOele = oeleMap |> Map.tryFindKey (fun x y -> y.Contains("o")) + let resultOele = oeleMap |> Map.tryFindKey (fun _ y -> y.Contains("o")) Assert.AreEqual(resultOele,Some 1) // empty Map diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs index 16bbdc87be7..ccc682a8a6b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/MapType.fs @@ -349,7 +349,7 @@ type MapType() = member this.TryFind() = let l = (Map.ofArray [|(1,1);(2,4);(3,9)|]) - let rem = l.TryFind(2) + Assert.AreEqual(l.TryFind(2),Some 4) let e = Map.empty diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs index 1e63a7f26d7..889653cf08c 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule.fs @@ -275,7 +275,6 @@ type SeqModule() = VerifySeqsEqual expectedStringSeq stringSeq // empty Seq - let emptySeq = Seq.cast Seq.empty let expectedEmptySeq = Seq.empty VerifySeqsEqual expectedEmptySeq Seq.empty @@ -291,14 +290,14 @@ type SeqModule() = let strings = integerArray |> Seq.cast - for o in strings do ()) + for _ in strings do ()) CheckThrowsExn(fun () -> let strings = integerArray |> Seq.cast :> System.Collections.IEnumerable // without this upcast the for loop throws, so it should with this upcast too - for o in strings do ()) + for _ in strings do ()) () @@ -328,7 +327,6 @@ type SeqModule() = // empty Seq let emptySeq = Seq.empty - let emptyChoosed = Seq.choose funcInt emptySeq let expectedEmptyChoose = Seq.empty @@ -469,7 +467,7 @@ type SeqModule() = // Empty Seq let emptySeqs = seq [seq[ Seq.empty;Seq.empty];seq[ Seq.empty;Seq.empty]] let conEmptySeq = Seq.concat emptySeqs - let expectedEmptySeq =seq { for i in 1..4 do yield Seq.empty} + let expectedEmptySeq =seq { for _ in 1..4 do yield Seq.empty} VerifySeqsEqual expectedEmptySeq conEmptySeq @@ -772,7 +770,6 @@ type SeqModule() = CheckThrowsKeyNotFoundException(fun () -> Seq.findBack funcInt emptySeq |> ignore) // Not found - let emptySeq = Seq.empty CheckThrowsKeyNotFoundException(fun () -> seq { 1..20 } |> Seq.findBack (fun _ -> false) |> ignore) // null Seq @@ -789,10 +786,10 @@ type SeqModule() = Assert.AreEqual(idx, 9) // empty Seq - CheckThrowsKeyNotFoundException(fun () -> Seq.findIndex (fun i -> true) Seq.empty |> ignore) + CheckThrowsKeyNotFoundException(fun () -> Seq.findIndex (fun _ -> true) Seq.empty |> ignore) // null Seq - CheckThrowsArgumentNullException(fun() -> Seq.findIndex (fun i -> true) null |> ignore) + CheckThrowsArgumentNullException(fun() -> Seq.findIndex (fun _ -> true) null |> ignore) () [] @@ -835,10 +832,10 @@ type SeqModule() = Assert.AreEqual(1, findStr) // empty Seq - CheckThrowsKeyNotFoundException(fun () -> Seq.findIndexBack (fun i -> true) Seq.empty |> ignore) + CheckThrowsKeyNotFoundException(fun () -> Seq.findIndexBack (fun _ -> true) Seq.empty |> ignore) // null Seq - CheckThrowsArgumentNullException(fun() -> Seq.findIndexBack (fun i -> true) null |> ignore) + CheckThrowsArgumentNullException(fun() -> Seq.findIndexBack (fun _ -> true) null |> ignore) () [] @@ -849,7 +846,7 @@ type SeqModule() = Assert.AreEqual(result, "6") // Empty seq (Bugged, 4173) - CheckThrowsKeyNotFoundException (fun () -> Seq.pick (fun i -> Some('a')) ([| |] : int[]) |> ignore) + CheckThrowsKeyNotFoundException (fun () -> Seq.pick (fun _ -> Some('a')) ([| |] : int[]) |> ignore) // Null CheckThrowsArgumentNullException (fun () -> Seq.pick (fun i -> Some(i + 0)) null |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs index caf6e1978e8..7dded0c1c08 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs @@ -41,12 +41,6 @@ type SeqModule2() = [] member this.TryHead() = - // int Seq - let IntSeq = - seq { for i in 0 .. 9 -> i } - - let intResult = Seq.tryHead IntSeq - // string Seq let strResult = Seq.tryHead (seq ["first"; "second"; "third"]) Assert.AreEqual("first", strResult.Value) @@ -296,7 +290,7 @@ type SeqModule2() = VerifySeqsEqual expectedStrSeq init_finiteStr // null Seq - let funcNull x = null + let funcNull _ = null let init_finiteNull = Seq.init 3 funcNull let expectedNullSeq = seq [ null;null;null] @@ -328,12 +322,6 @@ type SeqModule2() = let seqint = seq [1;2;3] let is_emptyInt = Seq.isEmpty seqint - Assert.False(is_emptyInt) - - //seq str - let seqStr = seq["first";"second"] - let is_emptyStr = Seq.isEmpty seqStr - Assert.False(is_emptyInt) //seq empty @@ -366,8 +354,7 @@ type SeqModule2() = // empty array let emptyseq = Seq.empty - let resultEpt = ref 0 - Seq.iter (fun x -> Assert.Fail()) emptyseq + Seq.iter (fun _ -> Assert.Fail()) emptyseq // null seqay let nullseq:seq<'a> = null @@ -396,8 +383,7 @@ type SeqModule2() = // empty array let emptyseq = Seq.empty - let resultEpt = ref 0 - Seq.iter2 (fun x y-> Assert.Fail()) emptyseq emptyseq + Seq.iter2 (fun _ _ -> Assert.Fail()) emptyseq emptyseq // null seqay let nullseq:seq<'a> = null @@ -456,8 +442,7 @@ type SeqModule2() = // empty seq let emptyseq = Seq.empty - let resultEpt = ref 0 - Seq.iteri2 (fun x y z -> Assert.Fail()) emptyseq emptyseq + Seq.iteri2 (fun _ _ _ -> Assert.Fail()) emptyseq emptyseq // null seq let nullseq:seq<'a> = null @@ -746,7 +731,7 @@ type SeqModule2() = [] member this.Map2WithSideEffects () = let i = ref 0 - let f x y = i := !i + 1; x*x + let f x _ = i := !i + 1; x*x let e = (Seq.map2 f [1;2] [1;2]).GetEnumerator() CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) @@ -780,7 +765,7 @@ type SeqModule2() = [] member this.Mapi2WithSideEffects () = let i = ref 0 - let f _ x y = i := !i + 1; x*x + let f _ x _ = i := !i + 1; x*x let e = (Seq.mapi2 f [1;2] [1;2]).GetEnumerator() CheckThrowsInvalidOperationExn (fun _ -> e.Current|>ignore) @@ -1230,7 +1215,7 @@ type SeqModule2() = CheckThrowsArgumentNullException(fun() -> Seq.scanBack funcInt seqNull 5 |> ignore) // exception cases - let funcEx x (s:'State) = raise <| new System.FormatException() : 'State + let funcEx _ (_:'State) = raise <| new System.FormatException() : 'State // calling scanBack with funcEx does not throw let resultEx = Seq.scanBack funcEx (seq {1..10}) 0 // reading from resultEx throws @@ -1954,7 +1939,7 @@ type SeqModule2() = // null Seq let nullSeq : seq<'a> = null - let funcNull x = Some(1) + let funcNull _ = Some(1) CheckThrowsArgumentNullException(fun () -> Seq.tryPick funcNull nullSeq |> ignore) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqMultipleIteration.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqMultipleIteration.fs index 906e5dab9de..25d62648b72 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqMultipleIteration.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SeqMultipleIteration.fs @@ -30,10 +30,8 @@ module SeqMultipleIteration = [] let ``Seq.groupBy only evaluates the seq once`` () = - let s, haveCalled = makeNewSeq () - let groups : seq> = Seq.groupBy id s + let _, haveCalled = makeNewSeq () Assert.False !haveCalled - let groups : list> = Seq.toList groups // Seq.groupBy iterates the entire sequence as soon as it begins iteration. Assert.True !haveCalled diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs index 4011d63a52f..4f668dd69a9 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetModule.fs @@ -22,10 +22,7 @@ type SetModule() = [] member this.Empty() = let emptySet = Set.empty - if Set.count emptySet <> 0 then Assert.Fail() - - let c : Set = Set.empty - let d : Set = Set.empty + if Set.count emptySet <> 0 then Assert.Fail() () [] @@ -162,7 +159,7 @@ type SetModule() = let letNumPairs = new Set([("one", 1); ("two", 2); ("three", 3)]) if Set.exists (fun (text, num) -> text = "one" && num = 1) letNumPairs <> true then Assert.Fail() - if Set.exists (fun (text, num) -> text = "four") letNumPairs <> false then Assert.Fail() + if Set.exists (fun (text, _) -> text = "four") letNumPairs <> false then Assert.Fail() () [] @@ -237,7 +234,7 @@ type SetModule() = member this.ForAll() = let emptySet : Set = Set.empty - let result = Set.forall (fun x -> Assert.Fail(); false) emptySet + let result = Set.forall (fun _ -> Assert.Fail(); false) emptySet if result <> true then Assert.Fail() let seta = new Set<_>( [1 .. 99] |> List.map (fun i -> i.ToString()) ) @@ -392,7 +389,7 @@ type SetModule() = Set.empty |> Set.iter (fun _ -> Assert.Fail()) // Full set - let elements = [| for i = 0 to 9 do yield false |] + let elements = [| for _ = 0 to 9 do yield false |] let set = new Set<_>(['0' .. '9']) Set.iter (fun c -> let i = int c - int '0' @@ -404,7 +401,7 @@ type SetModule() = member this.Parition() = // Empty - let resulta, resultb = Set.partition (fun (x : int) -> Assert.Fail(); false) Set.empty + let resulta, resultb = Set.partition (fun (_ : int) -> Assert.Fail(); false) Set.empty Assert.True(resulta.Count = 0 && resultb.Count = 0) // One diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs index ac3c213be80..3b543f5a0b5 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/SetType.fs @@ -86,7 +86,6 @@ type SetType() = member this.ICollection() = // Legit IC let ic = (new Set([1;2;3;4])) :> ICollection - let st = new Set([1;2;3;4]) Assert.True(ic.Contains(3)) let newArr = Array.create 5 0 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs index 67b0adee0aa..d089ff51a17 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/StringModule.fs @@ -130,10 +130,10 @@ type StringModule() = [] member this.Filter() = - let e1 = String.filter (fun c -> true) "Taradiddle" + let e1 = String.filter (fun _ -> true) "Taradiddle" Assert.AreEqual("Taradiddle", e1) - let e2 = String.filter (fun c -> true) null + let e2 = String.filter (fun _ -> true) null Assert.AreEqual("", e2) let e3 = String.filter Char.IsUpper "How Vexingly Quick Daft Zebras Jump!" @@ -154,24 +154,24 @@ type StringModule() = let e1 = String.collect (fun c -> "a"+string c) "foo" Assert.AreEqual("afaoao", e1) - let e2 = String.collect (fun c -> null) "hello" + let e2 = String.collect (fun _ -> null) "hello" Assert.AreEqual("", e2) - let e3 = String.collect (fun c -> "") null + let e3 = String.collect (fun _ -> "") null Assert.AreEqual("", e3) [] member this.Init() = - let e1 = String.init 0 (fun i -> "foo") + let e1 = String.init 0 (fun _ -> "foo") Assert.AreEqual("", e1) let e2 = String.init 2 (fun i -> "foo"+string(i)) Assert.AreEqual("foo0foo1", e2) - let e3 = String.init 2 (fun i -> null) + let e3 = String.init 2 (fun _ -> null) Assert.AreEqual("", e3) - CheckThrowsArgumentException(fun () -> String.init -1 (fun c -> "") |> ignore) + CheckThrowsArgumentException(fun () -> String.init -1 (fun _ -> "") |> ignore) [] member this.Replicate() = @@ -215,39 +215,39 @@ type StringModule() = [] member this.Forall() = - let e1 = String.forall (fun c -> true) "" + let e1 = String.forall (fun _ -> true) "" Assert.AreEqual(true, e1) let e2 = String.forall (fun c -> c='o') "foo" Assert.AreEqual(false, e2) - let e3 = String.forall (fun c -> true) "foo" + let e3 = String.forall (fun _ -> true) "foo" Assert.AreEqual(true, e3) - let e4 = String.forall (fun c -> false) "foo" + let e4 = String.forall (fun _ -> false) "foo" Assert.AreEqual(false, e4) - let e5 = String.forall (fun c -> true) (String.replicate 1000000 "x") + let e5 = String.forall (fun _ -> true) (String.replicate 1000000 "x") Assert.AreEqual(true, e5) - let e6 = String.forall (fun c -> false) null + let e6 = String.forall (fun _ -> false) null Assert.AreEqual(true, e6) [] member this.Exists() = - let e1 = String.exists (fun c -> true) "" + let e1 = String.exists (fun _ -> true) "" Assert.AreEqual(false, e1) let e2 = String.exists (fun c -> c='o') "foo" Assert.AreEqual(true, e2) - let e3 = String.exists (fun c -> true) "foo" + let e3 = String.exists (fun _ -> true) "foo" Assert.AreEqual(true, e3) - let e4 = String.exists (fun c -> false) "foo" + let e4 = String.exists (fun _ -> false) "foo" Assert.AreEqual(false, e4) - let e5 = String.exists (fun c -> false) (String.replicate 1000000 "x") + let e5 = String.exists (fun _ -> false) (String.replicate 1000000 "x") Assert.AreEqual(false, e5) [] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index ffe4f00df16..d40c93cb309 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -155,7 +155,7 @@ type AsyncModule() = do! Async.SwitchToThreadPool() let tickstamps = ref [] // like timestamps but for ticks :) - for i = 1 to 10 do + for _ = 1 to 10 do tickstamps := DateTime.UtcNow.Ticks :: !tickstamps do! Async.Sleep(20) @@ -192,7 +192,7 @@ type AsyncModule() = [] member this.AwaitIAsyncResult() = - let beginOp, endOp, cancelOp = Async.AsBeginEnd(fun() -> getTicksTask) + let beginOp, _, _ = Async.AsBeginEnd(fun() -> getTicksTask) // Begin the async operation and wait let operationIAR = beginOp ((), new AsyncCallback(fun iar -> ()), null) @@ -280,7 +280,7 @@ type AsyncModule() = use cancelHandlerRegistered = new ManualResetEvent(false) let cts = new System.Threading.CancellationTokenSource() let go = async { - use! holder = Async.OnCancel(fun() -> lock flag (fun() -> flag.Set()) |> ignore) + use! __ = Async.OnCancel(fun() -> lock flag (fun() -> flag.Set()) |> ignore) let _ = cancelHandlerRegistered.Set() while true do do! Async.Sleep 50 @@ -301,7 +301,7 @@ type AsyncModule() = let flag = ref 0 let cts = new System.Threading.CancellationTokenSource() let go = async { - use disp = + use __ = cts.Cancel() { new IDisposable with override __.Dispose() = incr flag } @@ -443,13 +443,13 @@ type AsyncModule() = [] member this.``dispose should not throw when called on null``() = - let result = async { use x = null in return () } |> Async.RunSynchronously + let result = async { use _ = null in return () } |> Async.RunSynchronously Assert.AreEqual((), result) [] member this.``dispose should not throw when called on null struct``() = - let result = async { use x = new Dummy(1) in return () } |> Async.RunSynchronously + let result = async { use _ = new Dummy(1) in return () } |> Async.RunSynchronously Assert.AreEqual((), result) @@ -477,7 +477,7 @@ type AsyncModule() = let wh = new System.Threading.ManualResetEvent(false) let test = async { try - let! timeout = Async.AwaitWaitHandle(wh, 1000) + let! _ = Async.AwaitWaitHandle(wh, 1000) do! Async.Sleep 500 raise (new InvalidOperationException("EXPECTED")) return Assert.Fail("Should not get here") @@ -548,13 +548,13 @@ type AsyncModule() = // case 2 r := "" try - Async.StartWithContinuations(Async.FromContinuations(fun (s, _, _) -> s()), (fun () -> failwith "boom"), (fun e -> r := e.Message), (fun oce -> ())) + Async.StartWithContinuations(Async.FromContinuations(fun (s, _, _) -> s()), (fun () -> failwith "boom"), (fun e -> r := e.Message), (fun _ -> ())) with e -> r := "EX: " + e.Message Assert.AreEqual("EX: boom", !r) // case 3 r := "" - Async.StartWithContinuations(async { return! failwith "boom" }, (fun x -> ()), (fun e -> r := e.Message), (fun oce -> ())) + Async.StartWithContinuations(async { return! failwith "boom" }, (fun _ -> ()), (fun e -> r := e.Message), (fun _ -> ())) Assert.AreEqual("boom", !r) @@ -664,13 +664,13 @@ type AsyncModule() = [] member this.``RaceBetweenCancellationAndError.Parallel(maxDegreeOfParallelism)``() = - [| for i in 1 .. 1000 -> async { failwith "boom" } |] + [| for _ in 1 .. 1000 -> async { failwith "boom" } |] |> fun cs -> Async.Parallel(cs, 1) |> testErrorAndCancelRace "RaceBetweenCancellationAndError.Parallel(maxDegreeOfParallelism)" [] member this.``RaceBetweenCancellationAndError.Parallel``() = - [| for i in 1 .. 1000 -> async { failwith "boom" } |] + [| for _ in 1 .. 1000 -> async { failwith "boom" } |] |> fun cs -> Async.Parallel(cs) |> testErrorAndCancelRace "RaceBetweenCancellationAndError.Parallel" diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs index c89f5913c1f..ff1593af903 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs @@ -43,20 +43,20 @@ type AsyncType() = return result } - let onSuccess x = + let onSuccess _ = match !whatToDo with | Cancel | Throw -> Assert.Fail("Expected onSuccess but whatToDo was not Exit", [| whatToDo |]) | Exit -> () - let onException x = + let onException _ = match !whatToDo with | Exit | Cancel -> Assert.Fail("Expected onException but whatToDo was not Throw", [| whatToDo |]) | Throw -> () - let onCancel x = + let onCancel _ = match !whatToDo with | Exit | Throw -> Assert.Fail("Expected onCancel but whatToDo was not Cancel", [| whatToDo |]) @@ -78,7 +78,7 @@ type AsyncType() = member this.AsyncRunSynchronouslyReusesThreadPoolThread() = let action = async { async { () } |> Async.RunSynchronously } let computation = - [| for i in 1 .. 1000 -> action |] + [| for _ in 1 .. 1000 -> action |] |> Async.Parallel // This test needs approximately 1000 ThreadPool threads // if Async.RunSynchronously doesn't reuse them. @@ -211,7 +211,7 @@ type AsyncType() = this.WaitASec t with :? AggregateException as a -> match a.InnerException with - | :? TaskCanceledException as t -> () + | :? TaskCanceledException -> () | _ -> reraise() Assert.True (t.IsCompleted, "Task is not completed") @@ -253,7 +253,7 @@ type AsyncType() = try Async.RunSynchronously(a, cancellationToken = cts.Token) |> ignore - with :? OperationCanceledException as o -> () + with :? OperationCanceledException -> () [] member this.ExceptionPropagatesToTask () = @@ -298,7 +298,7 @@ type AsyncType() = let ewh = new ManualResetEvent(false) let cancelled = ref false let a = async { - use! holder = Async.OnCancel (fun _ -> cancelled := true) + use! __ = Async.OnCancel (fun _ -> cancelled := true) ewh.Set() |> Assert.True while true do () } @@ -471,9 +471,9 @@ type AsyncType() = Task.Factory.StartNew(Func(fun () -> raise <| Exception())) let a = async { try - let! v = Async.AwaitTask(t) + let! _ = Async.AwaitTask(t) return false - with e -> return true + with _ -> return true } Async.RunSynchronously(a, 1000) |> Assert.True @@ -488,7 +488,6 @@ type AsyncType() = use t : Task= #endif Task.Factory.StartNew(Func(fun () -> while not token.IsCancellationRequested do ()), token) - let cancelled = ref true let a = async { use! _holder = Async.OnCancel(fun _ -> ewh.Set() |> ignore) let! v = Async.AwaitTask(t) @@ -524,9 +523,9 @@ type AsyncType() = Task.Factory.StartNew(Action(fun () -> raise <| Exception())) let a = async { try - let! v = Async.AwaitTask(t) + let! _ = Async.AwaitTask(t) return false - with e -> return true + with _ -> return true } Async.RunSynchronously(a, 3000) |> Assert.True diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs index 63e5025f105..6b95b88793e 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/Cancellation.fs @@ -44,7 +44,7 @@ type CancellationType() = let is2Called = ref false let is3Called = ref false let assertAndOff (expected:bool) (r:bool ref) = Assert.AreEqual(expected,!r); r := false - let r1 = cts1.Token.Register(Action(fun _ -> is1Called := true), null) + let _ = cts1.Token.Register(Action(fun _ -> is1Called := true), null) let r2 = cts1.Token.Register(Action(fun _ -> is2Called := true), null) let r3 = cts2.Token.Register(Action(fun _ -> is3Called := true), null) Assert.False(!is1Called) @@ -188,14 +188,14 @@ type CancellationType() = use cts = new CancellationTokenSource() let token = cts.Token let callbackRun = ref false - let reg = token.Register(Action(fun _ -> + let _ = token.Register(Action(fun _ -> lock callbackRun (fun() -> Assert.False(!callbackRun, "Callback should run only once") callbackRun := true ) ), null) Assert.False(!callbackRun) - let asyncs = seq { for i in 1..1000 do yield async { cts.Cancel() } } + let asyncs = seq { for _ in 1..1000 do yield async { cts.Cancel() } } asyncs |> Async.Parallel |> Async.RunSynchronously |> ignore Assert.True(!callbackRun, "Callback should run at least once") @@ -281,7 +281,7 @@ type CancellationType() = let msg = sprintf "Excepted TimeoutException wrapped in an AggregateException, but got %A" res printfn "failure msg: %s" msg Assert.Fail (msg) - with :? AggregateException as agg -> () + with :? AggregateException -> () [] member this.Equality() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs index 5f135ec22b6..15e206eb37b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/EventModule.fs @@ -96,7 +96,7 @@ type EventModule() = let timesListened = ref 0 kqfc.BroadcastSignal - |> Event.add(fun rbEventArgs -> incr timesListened) + |> Event.add(fun _ -> incr timesListened) kqfc.BeginBroadcasting( [ diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs index 30643db5499..9e679254e6c 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/LazyType.fs @@ -80,20 +80,20 @@ type LazyType() = // int let intLazy = Lazy<_>.Create( fun () -> 1) Assert.AreEqual(not intLazy.IsValueCreated,true) - let resultIsDelayed = intLazy.Force() + let _ = intLazy.Force() Assert.AreEqual(not intLazy.IsValueCreated,false) // string let stringLazy = Lazy<_>.Create( fun () -> "string") Assert.AreEqual(not stringLazy.IsValueCreated,true) - let resultIsDelayed = stringLazy.Force() + let _ = stringLazy.Force() Assert.AreEqual(not stringLazy.IsValueCreated,false) //null let nullLazy = Lazy<_>.Create(fun () -> null) Assert.AreEqual(not nullLazy.IsValueCreated,true) - let resultIsDelayed = nullLazy.Force() + let _ = nullLazy.Force() Assert.AreEqual(not nullLazy.IsValueCreated,false) [] @@ -102,20 +102,20 @@ type LazyType() = // int let intLazy = Lazy<_>.Create( fun () -> 1) Assert.AreEqual( intLazy.IsValueCreated,false) - let resultIsForced = intLazy.Force() + let _ = intLazy.Force() Assert.AreEqual( intLazy.IsValueCreated,true) // string let stringLazy = Lazy<_>.Create( fun () -> "string") Assert.AreEqual( stringLazy.IsValueCreated,false) - let resultIsForced = stringLazy.Force() + let _ = stringLazy.Force() Assert.AreEqual( stringLazy.IsValueCreated,true) //null let nullLazy = Lazy<_>.Create(fun () -> null) Assert.AreEqual( nullLazy.IsValueCreated,false) - let resultIsForced = nullLazy.Force() + let _ = nullLazy.Force() Assert.AreEqual( nullLazy.IsValueCreated,true) [] diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs index 9edfbcf410c..d5d7f498db5 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs @@ -83,7 +83,7 @@ type MailboxProcessorType() = let mb = MailboxProcessor.Start ( fun inbox -> async { - use disp = + use __ = { new IDisposable with member this.Dispose () = addMsg "Disposed" @@ -116,7 +116,7 @@ type MailboxProcessorType() = let mb = MailboxProcessor.Start ( fun inbox -> async { - use disp = + use __ = { new IDisposable with member this.Dispose () = addMsg "Disposed" @@ -149,7 +149,7 @@ type MailboxProcessorType() = let mb = MailboxProcessor.Start ( fun inbox -> async { - use disp = + use _ = { new IDisposable with member this.Dispose () = addMsg "Disposed" @@ -176,15 +176,15 @@ type MailboxProcessorType() = MailboxProcessor.Start ( fun inbox -> async { while true do - let w = receiveEv.WaitOne() + let _ = receiveEv.WaitOne() receiveEv.Reset() |> ignore - let! (msg) = inbox.Receive () + let! (_) = inbox.Receive () finishedEv.Set() |> ignore }) - let post = + let _ = async { while true do - let r = postEv.WaitOne() + let _ = postEv.WaitOne() postEv.Reset() |> ignore mb.Post(fun () -> ()) } |> Async.Start @@ -208,18 +208,18 @@ type MailboxProcessorType() = MailboxProcessor.Start ( fun inbox -> async { while true do - let w = receiveEv.WaitOne() + let _ = receiveEv.WaitOne() receiveEv.Reset() |> ignore - let! (msg) = inbox.Receive (5000) + let! (_) = inbox.Receive (5000) finishedEv.Set() |> ignore }) let isErrored = mb.Error |> Async.AwaitEvent |> Async.StartAsTask - let post = + let _ = async { while true do - let r = postEv.WaitOne() + let _ = postEv.WaitOne() postEv.Reset() |> ignore mb.Post(fun () -> ()) } |> Async.Start @@ -247,18 +247,18 @@ type MailboxProcessorType() = MailboxProcessor.Start ( fun inbox -> async { while true do - let w = receiveEv.WaitOne() + let _ = receiveEv.WaitOne() receiveEv.Reset() |> ignore - let! (msg) = inbox.TryReceive (5000) + let! (_) = inbox.TryReceive (5000) finishedEv.Set() |> ignore }) let isErrored = mb.Error |> Async.AwaitEvent |> Async.StartAsTask - let post = + let _ = async { while true do - let r = postEv.WaitOne() + let _ = postEv.WaitOne() postEv.Reset() |> ignore mb.Post(fun () -> ()) } |> Async.Start diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs index 3280e565f32..24a713b37af 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/ObservableModule.fs @@ -143,7 +143,7 @@ type ObservableModule() = let timesListened = ref 0 kqfc.BroadcastSignal - |> Observable.add(fun rbEventArgs -> incr timesListened) + |> Observable.add(fun _ -> incr timesListened) kqfc.BeginBroadcasting( [ diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs index 6a4eb596d14..6f7a32d3eba 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/BigIntType.fs @@ -519,17 +519,12 @@ type BigIntType() = -100I ] VerifySeqsEqual resultNeg seqNeg - - let resultSmall1 = [0I..3I..9I] -#if CROSS_PLATFORM_COMPILER // see https://bugzilla.xamarin.com/show_bug.cgi?id=22591 -#else + let resultSmall1 = [BigInteger()..3I..9I] let seqSmall = [0I;3I;6I;9I] VerifySeqsEqual resultSmall1 seqSmall CheckThrowsArgumentException(fun () -> [0I .. BigInteger() .. 3I] |> ignore) - -#endif VerifySeqsEqual [0I .. -2I .. 10I] [] () @@ -538,11 +533,8 @@ type BigIntType() = member this.Subtraction() = Assert.AreEqual((100I - 123I),-23I) Assert.AreEqual((0I - bigPositiveB),bigNegativeB) -#if CROSS_PLATFORM_COMPILER // see https://bugzilla.xamarin.com/show_bug.cgi?id=22591 -#else Assert.AreEqual((BigInteger() - bigPositiveB),bigNegativeB) Assert.AreEqual((bigPositiveB - BigInteger()),bigPositiveB) -#endif Assert.AreEqual((bigPositiveB - 0I),bigPositiveB) Assert.AreEqual((-100I - (-123I)),23I) Assert.AreEqual((100I - (-123I)),223I) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs index adc300ba498..3fc39b5eeb6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/ResultTests.fs @@ -33,9 +33,9 @@ type ResultTests() = let toUpper (v:string) = v.ToUpper() - let shouldBeOkWithValue expected maybeOk = match maybeOk with | Error e-> failwith "Expected Ok, got Error!" | Ok v->Assert.AreEqual(expected, v) + let shouldBeOkWithValue expected maybeOk = match maybeOk with | Error _ -> failwith "Expected Ok, got Error!" | Ok v->Assert.AreEqual(expected, v) - let shouldBeErrorWithValue expected maybeError = match maybeError with | Error e-> Assert.AreEqual(expected, e) | Ok v-> failwith "Expected Error, got Ok!" + let shouldBeErrorWithValue expected maybeError = match maybeError with | Error e-> Assert.AreEqual(expected, e) | Ok _ -> failwith "Expected Error, got Ok!" let addOneOk (v:int) = Ok (v+1) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs index 02a3070d497..722557a285b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Quotations/FSharpQuotations.fs @@ -61,13 +61,13 @@ type FSharpQuotationsTests() = member x.ReShapeTypechecking_Let() = let q0 = <@ let a = 1 in a @> match q0 with - | ExprShape.ShapeCombination(shape, [value;lambda]) -> + | ExprShape.ShapeCombination(shape, [_;lambda]) -> let goodValue = <@ 2 @> ExprShape.RebuildShapeCombination(shape, [goodValue;lambda]) |> ignore | _ -> Assert.Fail() let q1 = <@ let a = 1 in a @> match q1 with - | ExprShape.ShapeCombination(shape, [value;lambda]) -> + | ExprShape.ShapeCombination(shape, [_;lambda]) -> let wrongValue = <@ "!" @> Check.argumentException(fun () -> ExprShape.RebuildShapeCombination(shape, [wrongValue;lambda])) | _ -> Assert.Fail() diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs index abba3681220..3c894c26aa9 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs @@ -123,9 +123,6 @@ type FSharpValueTests() = let structTuple2 = struct ( 2, "tuple2", (fun x -> x + 1)) let structTuple3 = struct ( 1, struct ( 2, "tuple")) - let func1 param = param + 1 - let func2 param = param + "" - let exInt = ExceptionInt(1) let exDataless = DatalessException @@ -270,11 +267,9 @@ type FSharpValueTests() = [] member __.GetRecordFields() = // Record - let propertyinfo1 = (typeof).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordFields(record1)).[0], "field1") // Generic Record value - let propertyinfo2 = (typeof>).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordFields(genericRecordType1)).[0], "field1") // null value @@ -286,7 +281,6 @@ type FSharpValueTests() = [] member __.GetStructRecordFields() = - let propertyinfo1 = (typeof).GetProperty("field1") Assert.AreEqual((FSharpValue.GetRecordFields(structRecord1)).[0], "field1") [] @@ -344,11 +338,11 @@ type FSharpValueTests() = [] member __.GetUnionFields() = // single case union - let (singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) + let (_, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) Assert.AreEqual(singlevaluearray, ([|1.0;2.0;3.0|] : obj [])) // DiscUnionType - let (duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) + let (_, duValueArray) = FSharpValue.GetUnionFields(discUnionCaseB, typeof>) Assert.AreEqual(duValueArray.[0], 1) // null value @@ -453,7 +447,7 @@ type FSharpValueTests() = Assert.AreEqual(resultSingleCaseUnion, singleCaseStructUnion1) // DiscUnionType - let (duCaseinfo, duValueArray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) + let (duCaseinfo, _) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) FSharpValue.MakeUnion(duCaseinfo, [| box 1|]) |> ignore [] @@ -738,12 +732,12 @@ type FSharpValueTests() = member __.PreComputeUnionReader() = // SingleCaseUnion - let (singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) + let (singlecaseinfo, _) = FSharpValue.GetUnionFields(singleCaseUnion1, typeof) let singlecaseUnionReader = FSharpValue.PreComputeUnionReader(singlecaseinfo) Assert.AreEqual(singlecaseUnionReader(box(singleCaseUnion1)), [| box 1.0; box 2.0; box 3.0|]) // DiscUnion - let (discUnionInfo, discvaluearray) = FSharpValue.GetUnionFields(discUnionRecCaseB, typeof>) + let (discUnionInfo, _) = FSharpValue.GetUnionFields(discUnionRecCaseB, typeof>) let discUnionReader = FSharpValue.PreComputeUnionReader(discUnionInfo) Assert.AreEqual(discUnionReader(box(discUnionRecCaseB)) , [| box 1; box(Some(discUnionCaseB)) |]) @@ -769,12 +763,12 @@ type FSharpValueTests() = member __.PreComputeStructUnionReader() = // SingleCaseUnion - let (singlecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) + let (singlecaseinfo, _) = FSharpValue.GetUnionFields(singleCaseStructUnion1, typeof) let singlecaseUnionReader = FSharpValue.PreComputeUnionReader(singlecaseinfo) Assert.AreEqual(singlecaseUnionReader(box(singleCaseStructUnion1)), [| box 1.0; box 2.0; box 3.0|]) // DiscUnion - let (discUnionInfo, discvaluearray) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) + let (discUnionInfo, _) = FSharpValue.GetUnionFields(discStructUnionCaseB, typeof>) let discUnionReader = FSharpValue.PreComputeUnionReader(discUnionInfo) Assert.AreEqual(discUnionReader(box(discStructUnionCaseB)) , [| box 1|]) @@ -874,13 +868,9 @@ type FSharpTypeTests() = let fsharpdelegate1 = new FSharpDelegate(fun (x:int) -> "delegate1") let fsharpdelegate2 = new FSharpDelegate(fun (x:int) -> "delegate2") - let tuple1 = ( 1, "tuple1") let tuple2 = ( 2, "tuple2") - let func1 param = param + 1 - let func2 param = param + "" - let exInt = ExceptionInt(1) let exDataless = DatalessException @@ -988,12 +978,12 @@ type FSharpTypeTests() = member __.GetUnionCases() = // SingleCaseUnion let singlecaseUnionCaseInfoArray = FSharpType.GetUnionCases(typeof) - let (expectedSinglecaseinfo, singlevaluearray) = FSharpValue.GetUnionFields(singlecaseunion1, typeof) + let (expectedSinglecaseinfo, _) = FSharpValue.GetUnionFields(singlecaseunion1, typeof) Assert.AreEqual(singlecaseUnionCaseInfoArray.[0], expectedSinglecaseinfo) // DiscUnionType let discunionCaseInfoArray = FSharpType.GetUnionCases(typeof>) - let (expectedDuCaseinfoArray, duValueArray) = FSharpValue.GetUnionFields(discUniontypeB, typeof>) + let (expectedDuCaseinfoArray, _) = FSharpValue.GetUnionFields(discUniontypeB, typeof>) Assert.AreEqual(discunionCaseInfoArray.[1], expectedDuCaseinfoArray) // null value @@ -1155,7 +1145,7 @@ type UnionCaseInfoTests() = let singlenullarycaseunion = SingleNullaryCaseDiscUnion.SingleNullaryCaseTag let singlecaseunion1 = SingleCaseDiscUnion.SingleCaseTag(1.0, 2.0, 3.0) - let singlecaseunion2 = SingleCaseDiscUnion.SingleCaseTag(4.0, 5.0, 6.0) + let _ = SingleCaseDiscUnion.SingleCaseTag(4.0, 5.0, 6.0) let discUniontypeA = DiscUnionType.A let discUniontypeB = DiscUnionType.B(1, Some(discUniontypeA)) @@ -1163,15 +1153,15 @@ type UnionCaseInfoTests() = let recDiscUniontypeB = DiscUnionType.B(1, Some(discUniontypeB)) - let ((singlenullarycaseinfo:UnionCaseInfo), singlenullaryvaluearray) = FSharpValue.GetUnionFields(singlenullarycaseunion, typeof) + let ((singlenullarycaseinfo:UnionCaseInfo), _) = FSharpValue.GetUnionFields(singlenullarycaseunion, typeof) - let ((singlecaseinfo:UnionCaseInfo), singlevaluearray) = FSharpValue.GetUnionFields(singlecaseunion1, typeof) + let ((singlecaseinfo:UnionCaseInfo), _) = FSharpValue.GetUnionFields(singlecaseunion1, typeof) - let ((discUnionInfoA:UnionCaseInfo), discvaluearray) = FSharpValue.GetUnionFields(discUniontypeA, typeof>) - let ((discUnionInfoB:UnionCaseInfo), discvaluearray) = FSharpValue.GetUnionFields(discUniontypeB, typeof>) - let ((discUnionInfoC:UnionCaseInfo), discvaluearray) = FSharpValue.GetUnionFields(discUniontypeC, typeof>) + let ((discUnionInfoA:UnionCaseInfo), _) = FSharpValue.GetUnionFields(discUniontypeA, typeof>) + let ((discUnionInfoB:UnionCaseInfo), _) = FSharpValue.GetUnionFields(discUniontypeB, typeof>) + let ((_:UnionCaseInfo), _) = FSharpValue.GetUnionFields(discUniontypeC, typeof>) - let ((recDiscCaseinfo:UnionCaseInfo), recDiscCasevaluearray) = FSharpValue.GetUnionFields(recDiscUniontypeB, typeof>) + let ((recDiscCaseinfo:UnionCaseInfo), _) = FSharpValue.GetUnionFields(recDiscUniontypeB, typeof>) [] member __.Equals() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs index 62db48e2ec9..3aa0ef6580b 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule1.fs @@ -28,7 +28,7 @@ type OperatorsModule1() = // null let nullresult = funcKeyValue ( new System.Collections.Generic.KeyValuePair(null,' ')) - let (nullstring:string,blankchar:char) = nullresult + let (nullstring:string,_:char) = nullresult CheckThrowsNullRefException(fun () -> nullstring.ToString() |> ignore) @@ -70,7 +70,7 @@ type OperatorsModule1() = Assert.AreEqual((101).ToString(), stringslice.[1,1]) // null - let nullArray2D = Array2D.init 2 3 (fun i j -> null) + let nullArray2D = Array2D.init 2 3 (fun _ _ -> null) let nullslice = Operators.OperatorIntrinsics.GetArraySlice2D nullArray2D param1D1 param1D2 param2D1 param2D2 Assert.AreEqual(null, nullslice.[1,1]) @@ -129,22 +129,22 @@ type OperatorsModule1() = Assert.AreEqual((101).ToString(), stringArray2D1.[1,1]) // null - let nullArray2D1 = Array2D.init 2 3 (fun i j -> null) - let nullArray2D2 = Array2D.init 2 3 (fun i j -> null) + let nullArray2D1 = Array2D.init 2 3 (fun _ _ -> null) + let nullArray2D2 = Array2D.init 2 3 (fun _ _ -> null) Operators.OperatorIntrinsics.SetArraySlice2D nullArray2D1 param1D1 param1D2 param2D1 param2D2 nullArray2D2 CheckThrowsNullRefException(fun () -> nullArray2D1.[0,0].ToString() |> ignore) [] member _.OptimizedRangesSetArraySlice3D() = - let intArray1 = Array3D.init 2 3 4 (fun i j k -> i*10+j) - let intArray2 = Array3D.init 2 3 4 (fun i j k -> i*100+j) + let intArray1 = Array3D.init 2 3 4 (fun i j _ -> i*10+j) + let intArray2 = Array3D.init 2 3 4 (fun i j _ -> i*100+j) Operators.OperatorIntrinsics.SetArraySlice3D intArray1 (Some 0) (Some 1) (Some 0) (Some 1) (Some 0) (Some 1) intArray2 Assert.AreEqual(101, intArray1.[1,1,1]) [] member _.OptimizedRangesSetArraySlice4D() = - let intArray1 = Array4D.init 2 3 4 5 (fun i j k l -> i*10+j) - let intArray2 = Array4D.init 2 3 4 5 (fun i j k l -> i*100+j) + let intArray1 = Array4D.init 2 3 4 5 (fun i j _ _ -> i*10+j) + let intArray2 = Array4D.init 2 3 4 5 (fun i j _ _ -> i*100+j) Operators.OperatorIntrinsics.SetArraySlice4D intArray1 (Some 0) (Some 1) (Some 0) (Some 1) (Some 0) (Some 1) (Some 0) (Some 1) intArray2 Assert.AreEqual(101, intArray1.[1,1,1,1]) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs index e821b4b8835..3ae62333e05 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/OperatorsModule2.fs @@ -220,7 +220,6 @@ type OperatorsModule2() = Assert.AreEqual([|1..50|], Array.sort arr) // without lock - let syncRoot = System.Object() let k = ref 0 let comp _ = async { do incr k do! Async.Sleep (10) @@ -295,7 +294,6 @@ type OperatorsModule2() = [] member _.nan() = // value type - let result = Operators.nan Assert.AreEqual(System.Double.NaN, nan) [] @@ -962,7 +960,6 @@ type OperatorsModule2() = member _.unativeint() = // int let result = Operators.unativeint 100 - let x: unativeint = 12un Assert.AreEqual(100un, result) // double diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs index c186eaf675d..661a17353e8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs @@ -349,7 +349,6 @@ let [] ``inline constraints resolve correctly`` () = Third = 100.32M Fourth = 0xbaad4 } - let v3 = CX_set_First (m,1) Assert.AreEqual (1, m.First) let [] ``member setters resolve correctly`` () = diff --git a/tests/service/AssemblyContentProviderTests.fs b/tests/service/AssemblyContentProviderTests.fs index c80842d9f87..6a4d82082fa 100644 --- a/tests/service/AssemblyContentProviderTests.fs +++ b/tests/service/AssemblyContentProviderTests.fs @@ -32,17 +32,6 @@ let private projectOptions : FSharpProjectOptions = let private checker = FSharpChecker.Create() let (=>) (source: string) (expected: string list) = - let lines = - use reader = new StringReader(source) - [| let line = ref (reader.ReadLine()) - while not (isNull !line) do - yield !line - line := reader.ReadLine() - if source.EndsWith "\n" then - // last trailing space not returned - // http://stackoverflow.com/questions/19365404/stringreader-omits-trailing-linebreak - yield "" |] - let _, checkFileAnswer = checker.ParseAndCheckFileInProject(filePath, 0, FSharp.Compiler.Text.SourceText.ofString source, projectOptions) |> Async.RunSynchronously let checkFileResults = diff --git a/tests/service/AssemblyReaderShim.fs b/tests/service/AssemblyReaderShim.fs index 71ad67809db..4130238b5fd 100644 --- a/tests/service/AssemblyReaderShim.fs +++ b/tests/service/AssemblyReaderShim.fs @@ -27,6 +27,6 @@ module M let x = 123 """ - let fileName, options = Common.mkTestFileAndOptions source [| |] + let fileName, options = Common.mkTestFileAndOptions [| |] Common.checker.ParseAndCheckFileInProject(fileName, 0, FSharp.Compiler.Text.SourceText.ofString source, options) |> Async.RunSynchronously |> ignore gotRequest |> should be True diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 6e6d8e46269..fadb02f7844 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -153,7 +153,7 @@ let mkProjectCommandLineArgsForScript (dllName, fileNames) = |] #endif -let mkTestFileAndOptions source additionalArgs = +let mkTestFileAndOptions additionalArgs = let fileName = Path.ChangeExtension(Path.GetTempFileName(), ".fs") let project = Path.GetTempFileName() let dllName = Path.ChangeExtension(project, ".dll") @@ -214,7 +214,7 @@ let parseSourceCode (name: string, code: string) = let filePath = Path.Combine(location, name + ".fs") let dllPath = Path.Combine(location, name + ".dll") let args = mkProjectCommandLineArgs(dllPath, [filePath]) - let options, errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) + let options, _ = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) let parseResults = checker.ParseFile(filePath, FSharp.Compiler.Text.SourceText.ofString code, options) |> Async.RunSynchronously parseResults.ParseTree @@ -224,7 +224,7 @@ let matchBraces (name: string, code: string) = let filePath = Path.Combine(location, name + ".fs") let dllPath = Path.Combine(location, name + ".dll") let args = mkProjectCommandLineArgs(dllPath, [filePath]) - let options, errors = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) + let options, _ = checker.GetParsingOptionsFromCommandLineArgs(List.ofArray args) let braces = checker.MatchBraces(filePath, FSharp.Compiler.Text.SourceText.ofString code, options) |> Async.RunSynchronously braces @@ -263,7 +263,7 @@ let attribsOfSymbol (s:FSharpSymbol) = if v.IsStatic then yield "static" if v.IsLiteral then yield sprintf "%A" v.LiteralValue.Value if v.IsAnonRecordField then - let info, tys, i = v.AnonRecordFieldDetails + let info, _, i = v.AnonRecordFieldDetails yield "anon(" + string i + ", [" + info.Assembly.QualifiedName + "/" + String.concat "+" info.EnclosingCompiledTypeNames + "/" + info.CompiledName + "]" + String.concat "," info.SortedFieldNames + ")" diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index 0c43499b396..ad421164e79 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -1,4 +1,5 @@  + // To run the tests in this file: // // Technique 1: Compile VisualFSharp.UnitTests.dll and run it as a set of unit tests @@ -62,7 +63,6 @@ let ``Intro test`` () = let inputLines = input.Split('\n') let file = "/home/user/Test.fsx" let parseResult, typeCheckResults = parseAndCheckScript(file, input) - let identToken = FSharpTokenTag.IDENT // let projectOptions = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously // So we check that the messages are the same @@ -81,9 +81,6 @@ let ``Intro test`` () = printfn "Good! got an error, hopefully with the right text: %A" msg msg.Message.Contains("Missing qualification after '.'") |> shouldEqual true - // Get tool tip at the specified location - let tip = typeCheckResults.GetToolTipText(4, 7, inputLines.[1], ["foo"], identToken) - // (sprintf "%A" tip).Replace("\n","") |> shouldEqual """FSharpToolTipText [Single ("val foo : unit -> unitFull name: Test.foo",None)]""" // Get declarations (autocomplete) for a location let partialName = { QualifyingIdents = []; PartialIdent = "msg"; EndColumn = 22; LastDotPos = None } let decls = typeCheckResults.GetDeclarationListInfo(Some parseResult, 7, inputLines.[6], partialName, (fun _ -> [])) @@ -120,7 +117,6 @@ let ``Basic cancellation test`` () = use _holder = IncrementalBuild.LocallyInjectCancellationFault() // Split the input & define file name - let inputLines = input.Split('\n') let file = "/home/user/Test.fsx" async { checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() @@ -147,7 +143,7 @@ let ``GetMethodsAsSymbols should return all overloads of a method as FSharpSymbo // Split the input & define file name let inputLines = input.Split('\n') let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) let methodsSymbols = typeCheckResults.GetMethodsAsSymbols(5, 27, inputLines.[4], ["String"; "Concat"]) match methodsSymbols with | Some methods -> @@ -188,7 +184,7 @@ type C() = let ``Symbols basic test`` () = let file = "/home/user/Test.fsx" - let untyped2, typeCheckResults2 = parseAndCheckScript(file, input2) + let _, typeCheckResults2 = parseAndCheckScript(file, input2) let partialAssemblySignature = typeCheckResults2.PartialAssemblySignature @@ -198,7 +194,7 @@ let ``Symbols basic test`` () = let ``Symbols many tests`` () = let file = "/home/user/Test.fsx" - let untyped2, typeCheckResults2 = parseAndCheckScript(file, input2) + let _, typeCheckResults2 = parseAndCheckScript(file, input2) let partialAssemblySignature = typeCheckResults2.PartialAssemblySignature @@ -207,8 +203,6 @@ let ``Symbols many tests`` () = moduleEntity.DisplayName |> shouldEqual "Test" - let classEntity = moduleEntity.NestedEntities.[0] - let fnVal = moduleEntity.MembersFunctionsAndValues.[0] fnVal.Accessibility.IsPublic |> shouldEqual true @@ -276,7 +270,6 @@ let ``Expression typing test`` () = let inputLines = input3.Split('\n') let file = "/home/user/Test.fsx" let parseResult, typeCheckResults = parseAndCheckScript(file, input3) - let identToken = FSharpTokenTag.IDENT for msg in typeCheckResults.Errors do printfn "***Expression typing test: Unexpected error: %A" msg.Message @@ -311,7 +304,6 @@ type Test() = let parseResult, typeCheckResults = parseAndCheckScript(file, input) let decls = typeCheckResults.GetDeclarationListInfo(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(20), (fun _ -> [])) - let item = decls.Items |> Array.tryFind (fun d -> d.Name = "abc") decls.Items |> Seq.exists (fun d -> d.Name = "abc") |> shouldEqual true [] @@ -328,7 +320,6 @@ type Test() = let parseResult, typeCheckResults = parseAndCheckScript(file, input) let decls = typeCheckResults.GetDeclarationListInfo(Some parseResult, 4, inputLines.[3], PartialLongName.Empty(21), (fun _ -> [])) - let item = decls.Items |> Array.tryFind (fun d -> d.Name = "abc") decls.Items |> Seq.exists (fun d -> d.Name = "abc") |> shouldEqual true [] @@ -482,7 +473,7 @@ let _ = printf " %*a" 3 (fun _ _ -> ()) 2 """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) typeCheckResults.Errors |> shouldEqual [||] typeCheckResults.GetFormatSpecifierLocationsAndArity() @@ -512,7 +503,7 @@ let _ = List.iter(printfn \"\"\"%-A \"\"\" 1 2)" let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) typeCheckResults.Errors |> shouldEqual [||] typeCheckResults.GetFormatSpecifierLocationsAndArity() @@ -533,7 +524,7 @@ let _ = debug "[LanguageService] Type checking fails for '%s' with content=%A an """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) typeCheckResults.Errors |> shouldEqual [||] typeCheckResults.GetFormatSpecifierLocationsAndArity() @@ -573,7 +564,7 @@ let s3 = $"abc %d{s.Length} """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScriptWithOptions(file, input, [| "/langversion:preview" |]) + let _, typeCheckResults = parseAndCheckScriptWithOptions(file, input, [| "/langversion:preview" |]) typeCheckResults.Errors |> shouldEqual [||] typeCheckResults.GetFormatSpecifierLocationsAndArity() @@ -591,7 +582,7 @@ let ``Printf specifiers for triple quote interpolated strings`` () = "let _ = $\"\"\"abc %d{1} and %d{2+3}def\"\"\" " let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScriptWithOptions(file, input, [| "/langversion:preview" |]) + let _, typeCheckResults = parseAndCheckScriptWithOptions(file, input, [| "/langversion:preview" |]) typeCheckResults.Errors |> shouldEqual [||] typeCheckResults.GetFormatSpecifierLocationsAndArity() @@ -610,7 +601,7 @@ let _ = sprintf "ABCDE" """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) typeCheckResults.GetFormatSpecifierLocationsAndArity() |> Array.map (fun (range, numArgs) -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn, numArgs) |> shouldEqual [||] @@ -623,7 +614,7 @@ type DU = Case1 """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) typeCheckResults.GetAllUsesOfAllSymbolsInFile() |> Array.ofSeq |> Array.map (fun su -> @@ -642,7 +633,7 @@ let _ = arr.[..number2] """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) typeCheckResults.GetAllUsesOfAllSymbolsInFile() |> Array.ofSeq |> Array.map (fun su -> @@ -677,7 +668,7 @@ let test2 = System.StringComparison.CurrentCulture let test3 = System.Text.RegularExpressions.RegexOptions.Compiled """ let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let _, typeCheckResults = parseAndCheckScript(file, input) let allSymbols = typeCheckResults.GetAllUsesOfAllSymbolsInFile() let enums = allSymbols @@ -858,9 +849,9 @@ let f x = y + y )""" let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let parseResult, _ = parseAndCheckScript(file, input) let lines = input.Replace("\r", "").Split( [| '\n' |]) - let positions = [ for (i,line) in Seq.indexed lines do for (j, c) in Seq.indexed line do yield Range.mkPos (Range.Line.fromZ i) j, line ] + let positions = [ for (i,line) in Seq.indexed lines do for (j, _) in Seq.indexed line do yield Range.mkPos (Range.Line.fromZ i) j, line ] let results = [ for pos, line in positions do match parseResult.ValidateBreakpointLocation pos with | Some r -> yield ((line, pos.Line, pos.Column), (r.StartLine, r.StartColumn, r.EndLine, r.EndColumn)) @@ -912,9 +903,9 @@ type FooImpl() = } )""" let file = "/home/user/Test.fsx" - let parseResult, typeCheckResults = parseAndCheckScript(file, input) + let parseResult, _ = parseAndCheckScript(file, input) let lines = input.Replace("\r", "").Split( [| '\n' |]) - let positions = [ for (i,line) in Seq.indexed lines do for (j, c) in Seq.indexed line do yield Range.mkPos (Range.Line.fromZ i) j, line ] + let positions = [ for (i,line) in Seq.indexed lines do for (j, _) in Seq.indexed line do yield Range.mkPos (Range.Line.fromZ i) j, line ] let results = [ for pos, line in positions do match parseResult.ValidateBreakpointLocation pos with | Some r -> yield ((line, pos.Line, pos.Column), (r.StartLine, r.StartColumn, r.EndLine, r.EndColumn)) diff --git a/tests/service/ExprTests.fs b/tests/service/ExprTests.fs index 05164371137..7bb900b1551 100644 --- a/tests/service/ExprTests.fs +++ b/tests/service/ExprTests.fs @@ -99,51 +99,51 @@ module internal Utils = | BasicPatterns.AddressSet(e1,e2) -> printExpr 0 e1 + " <- " + printExpr 0 e2 | BasicPatterns.Application(f,tyargs,args) -> quote low (printExpr 10 f + printTyargs tyargs + " " + printCurriedArgs args) | BasicPatterns.BaseValue(_) -> "base" - | BasicPatterns.CallWithWitnesses(Some obj,v,tyargs1,tyargs2,witnessL,argsL) -> printObjOpt (Some obj) + v.CompiledName + printTyargs tyargs2 + printTupledArgs (witnessL @ argsL) + | BasicPatterns.CallWithWitnesses(Some obj,v,_,tyargs2,witnessL,argsL) -> printObjOpt (Some obj) + v.CompiledName + printTyargs tyargs2 + printTupledArgs (witnessL @ argsL) | BasicPatterns.CallWithWitnesses(None,v,tyargs1,tyargs2,witnessL,argsL) -> v.DeclaringEntity.Value.CompiledName + printTyargs tyargs1 + "." + v.CompiledName + printTyargs tyargs2 + " " + printTupledArgs (witnessL @ argsL) - | BasicPatterns.Call(Some obj,v,tyargs1,tyargs2,argsL) -> printObjOpt (Some obj) + v.CompiledName + printTyargs tyargs2 + printTupledArgs argsL + | BasicPatterns.Call(Some obj,v,_,tyargs2,argsL) -> printObjOpt (Some obj) + v.CompiledName + printTyargs tyargs2 + printTupledArgs argsL | BasicPatterns.Call(None,v,tyargs1,tyargs2,argsL) -> v.DeclaringEntity.Value.CompiledName + printTyargs tyargs1 + "." + v.CompiledName + printTyargs tyargs2 + " " + printTupledArgs argsL | BasicPatterns.Coerce(ty1,e1) -> quote low (printExpr 10 e1 + " :> " + printTy ty1) - | BasicPatterns.DefaultValue(ty1) -> "dflt" + | BasicPatterns.DefaultValue(_) -> "dflt" | BasicPatterns.FastIntegerForLoop _ -> "for-loop" - | BasicPatterns.ILAsm(s,tyargs,args) -> s + printTupledArgs args + | BasicPatterns.ILAsm(s,_,args) -> s + printTupledArgs args | BasicPatterns.ILFieldGet _ -> "ILFieldGet" | BasicPatterns.ILFieldSet _ -> "ILFieldSet" | BasicPatterns.IfThenElse (a,b,c) -> "(if " + printExpr 0 a + " then " + printExpr 0 b + " else " + printExpr 0 c + ")" | BasicPatterns.Lambda(v,e1) -> "fun " + v.CompiledName + " -> " + printExpr 0 e1 | BasicPatterns.Let((v,e1),b) -> "let " + (if v.IsMutable then "mutable " else "") + v.CompiledName + ": " + printTy v.FullType + " = " + printExpr 0 e1 + " in " + printExpr 0 b - | BasicPatterns.LetRec(vse,b) -> "let rec ... in " + printExpr 0 b - | BasicPatterns.NewArray(ty,es) -> "[|" + (es |> Seq.map (printExpr 0) |> String.concat "; ") + "|]" - | BasicPatterns.NewDelegate(ty,es) -> "new-delegate" - | BasicPatterns.NewObject(v,tys,args) -> "new " + v.DeclaringEntity.Value.CompiledName + printTupledArgs args + | BasicPatterns.LetRec(_,b) -> "let rec ... in " + printExpr 0 b + | BasicPatterns.NewArray(_,es) -> "[|" + (es |> Seq.map (printExpr 0) |> String.concat "; ") + "|]" + | BasicPatterns.NewDelegate(_,_) -> "new-delegate" + | BasicPatterns.NewObject(v,_,args) -> "new " + v.DeclaringEntity.Value.CompiledName + printTupledArgs args | BasicPatterns.NewRecord(v,args) -> let fields = v.TypeDefinition.FSharpFields "{" + ((fields, args) ||> Seq.map2 (fun f a -> f.Name + " = " + printExpr 0 a) |> String.concat "; ") + "}" | BasicPatterns.NewAnonRecord(v,args) -> let fields = v.AnonRecordTypeDetails.SortedFieldNames "{" + ((fields, args) ||> Seq.map2 (fun f a -> f+ " = " + printExpr 0 a) |> String.concat "; ") + "}" - | BasicPatterns.NewTuple(v,args) -> printTupledArgs args - | BasicPatterns.NewUnionCase(ty,uc,args) -> uc.CompiledName + printTupledArgs args + | BasicPatterns.NewTuple(_,args) -> printTupledArgs args + | BasicPatterns.NewUnionCase(_,uc,args) -> uc.CompiledName + printTupledArgs args | BasicPatterns.Quote(e1) -> "quote" + printTupledArgs [e1] - | BasicPatterns.FSharpFieldGet(obj, ty,f) -> printObjOpt obj + f.Name + | BasicPatterns.FSharpFieldGet(obj, _,f) -> printObjOpt obj + f.Name | BasicPatterns.AnonRecordGet(obj, ty, n) -> printExpr 0 obj + "." + ty.AnonRecordTypeDetails.SortedFieldNames.[n] - | BasicPatterns.FSharpFieldSet(obj, ty,f,arg) -> printObjOpt obj + f.Name + " <- " + printExpr 0 arg + | BasicPatterns.FSharpFieldSet(obj, _,f,arg) -> printObjOpt obj + f.Name + " <- " + printExpr 0 arg | BasicPatterns.Sequential(e1,e2) -> "(" + printExpr 0 e1 + "; " + printExpr 0 e2 + ")" | BasicPatterns.ThisValue _ -> "this" | BasicPatterns.TryFinally(e1,e2) -> "try " + printExpr 0 e1 + " finally " + printExpr 0 e2 | BasicPatterns.TryWith(e1,_,_,vC,eC) -> "try " + printExpr 0 e1 + " with " + vC.CompiledName + " -> " + printExpr 0 eC - | BasicPatterns.TupleGet(ty,n,e1) -> printExpr 10 e1 + ".Item" + string n - | BasicPatterns.DecisionTree(dtree,targets) -> "match " + printExpr 10 dtree + " targets ..." - | BasicPatterns.DecisionTreeSuccess (tg,es) -> "$" + string tg - | BasicPatterns.TypeLambda(gp1,e1) -> "FUN ... -> " + printExpr 0 e1 + | BasicPatterns.TupleGet(_,n,e1) -> printExpr 10 e1 + ".Item" + string n + | BasicPatterns.DecisionTree(dtree,_) -> "match " + printExpr 10 dtree + " targets ..." + | BasicPatterns.DecisionTreeSuccess (tg,_) -> "$" + string tg + | BasicPatterns.TypeLambda(_,e1) -> "FUN ... -> " + printExpr 0 e1 | BasicPatterns.TypeTest(ty,e1) -> printExpr 10 e1 + " :? " + printTy ty - | BasicPatterns.UnionCaseSet(obj,ty,uc,f1,e1) -> printExpr 10 obj + "." + f1.Name + " <- " + printExpr 0 e1 - | BasicPatterns.UnionCaseGet(obj,ty,uc,f1) -> printExpr 10 obj + "." + f1.Name - | BasicPatterns.UnionCaseTest(obj,ty,f1) -> printExpr 10 obj + ".Is" + f1.Name - | BasicPatterns.UnionCaseTag(obj,ty) -> printExpr 10 obj + ".Tag" - | BasicPatterns.ObjectExpr(ty,basecall,overrides,iimpls) -> "{ " + printExpr 10 basecall + " with " + printOverrides overrides + " " + printIimpls iimpls + " }" - | BasicPatterns.TraitCall(tys,nm,_,argtys,tinst,args) -> "trait call " + nm + printTupledArgs args - | BasicPatterns.Const(obj,ty) -> + | BasicPatterns.UnionCaseSet(obj,_,_,f1,e1) -> printExpr 10 obj + "." + f1.Name + " <- " + printExpr 0 e1 + | BasicPatterns.UnionCaseGet(obj,_,_,f1) -> printExpr 10 obj + "." + f1.Name + | BasicPatterns.UnionCaseTest(obj,_,f1) -> printExpr 10 obj + ".Is" + f1.Name + | BasicPatterns.UnionCaseTag(obj,_) -> printExpr 10 obj + ".Tag" + | BasicPatterns.ObjectExpr(_,basecall,overrides,iimpls) -> "{ " + printExpr 10 basecall + " with " + printOverrides overrides + " " + printIimpls iimpls + " }" + | BasicPatterns.TraitCall(_,nm,_,_,_,args) -> "trait call " + nm + printTupledArgs args + | BasicPatterns.Const(obj,_) -> match obj with | :? string as s -> "\"" + s + "\"" | null -> "()" @@ -160,7 +160,7 @@ module internal Utils = and printParams (vs: FSharpMemberOrFunctionOrValue list) = "(" + String.concat "," (vs |> List.map (fun v -> v.CompiledName)) + ")" and printCurriedParams (vs: FSharpMemberOrFunctionOrValue list list) = String.concat " " (List.map printParams vs) and printTy ty = ty.Format(FSharpDisplayContext.Empty) - and printTyargs tyargs = match tyargs with [] -> "" | args -> "<" + String.concat "," (List.map printTy tyargs) + ">" + and printTyargs tyargs = match tyargs with [] -> "" | _ -> "<" + String.concat "," (List.map printTy tyargs) + ">" and printOverrides ors = String.concat ";" (List.map printOverride ors) and printOverride o = match o.CurriedParameterGroups with @@ -228,9 +228,9 @@ module internal Utils = let rec exprsOfDecl (d: FSharpImplementationFileDeclaration) = seq { match d with - | FSharpImplementationFileDeclaration.Entity(e,ds) -> + | FSharpImplementationFileDeclaration.Entity(_,ds) -> yield! exprsOfDecls ds - | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(v,vs,e) -> + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(v,_,e) -> if not v.IsCompilerGenerated then yield e, e.Range | FSharpImplementationFileDeclaration.InitAction(e) -> @@ -292,15 +292,15 @@ module internal Utils = | BasicPatterns.ILFieldSet (Some e,_,_,v) -> Seq.append (collectMembers e) (collectMembers v) | BasicPatterns.ILFieldSet _ -> Seq.empty | BasicPatterns.IfThenElse (a,b,c) -> Seq.collect collectMembers [ a; b; c ] - | BasicPatterns.Lambda(v,e1) -> collectMembers e1 - | BasicPatterns.Let((v,e1),b) -> Seq.append (collectMembers e1) (collectMembers b) + | BasicPatterns.Lambda(_,e1) -> collectMembers e1 + | BasicPatterns.Let((_,e1),b) -> Seq.append (collectMembers e1) (collectMembers b) | BasicPatterns.LetRec(vse,b) -> Seq.append (vse |> Seq.collect (snd >> collectMembers)) (collectMembers b) | BasicPatterns.NewArray(_,es) -> Seq.collect collectMembers es - | BasicPatterns.NewDelegate(ty,es) -> collectMembers es - | BasicPatterns.NewObject(v,tys,args) -> Seq.append (Seq.singleton v) (Seq.collect collectMembers args) - | BasicPatterns.NewRecord(v,args) -> Seq.collect collectMembers args - | BasicPatterns.NewTuple(v,args) -> Seq.collect collectMembers args - | BasicPatterns.NewUnionCase(ty,uc,args) -> Seq.collect collectMembers args + | BasicPatterns.NewDelegate(_,es) -> collectMembers es + | BasicPatterns.NewObject(v,_,args) -> Seq.append (Seq.singleton v) (Seq.collect collectMembers args) + | BasicPatterns.NewRecord(_,args) -> Seq.collect collectMembers args + | BasicPatterns.NewTuple(_,args) -> Seq.collect collectMembers args + | BasicPatterns.NewUnionCase(_,_,args) -> Seq.collect collectMembers args | BasicPatterns.Quote(e1) -> collectMembers e1 | BasicPatterns.FSharpFieldGet(Some obj, _,_) -> collectMembers obj | BasicPatterns.FSharpFieldGet _ -> Seq.empty @@ -310,16 +310,16 @@ module internal Utils = | BasicPatterns.ThisValue _ -> Seq.empty | BasicPatterns.TryFinally(e1,e2) -> Seq.append (collectMembers e1) (collectMembers e2) | BasicPatterns.TryWith(e1,_,f,_,eC) -> Seq.collect collectMembers [ e1; f; eC ] - | BasicPatterns.TupleGet(ty,n,e1) -> collectMembers e1 + | BasicPatterns.TupleGet(_,_,e1) -> collectMembers e1 | BasicPatterns.DecisionTree(dtree,targets) -> Seq.append (collectMembers dtree) (targets |> Seq.collect (snd >> collectMembers)) - | BasicPatterns.DecisionTreeSuccess (tg,es) -> Seq.collect collectMembers es - | BasicPatterns.TypeLambda(gp1,e1) -> collectMembers e1 - | BasicPatterns.TypeTest(ty,e1) -> collectMembers e1 - | BasicPatterns.UnionCaseSet(obj,ty,uc,f1,e1) -> Seq.append (collectMembers obj) (collectMembers e1) - | BasicPatterns.UnionCaseGet(obj,ty,uc,f1) -> collectMembers obj - | BasicPatterns.UnionCaseTest(obj,ty,f1) -> collectMembers obj - | BasicPatterns.UnionCaseTag(obj,ty) -> collectMembers obj - | BasicPatterns.ObjectExpr(ty,basecall,overrides,iimpls) -> + | BasicPatterns.DecisionTreeSuccess (_,es) -> Seq.collect collectMembers es + | BasicPatterns.TypeLambda(_,e1) -> collectMembers e1 + | BasicPatterns.TypeTest(_,e1) -> collectMembers e1 + | BasicPatterns.UnionCaseSet(obj,_,_,_,e1) -> Seq.append (collectMembers obj) (collectMembers e1) + | BasicPatterns.UnionCaseGet(obj,_,_,_) -> collectMembers obj + | BasicPatterns.UnionCaseTest(obj,_,_) -> collectMembers obj + | BasicPatterns.UnionCaseTag(obj,_) -> collectMembers obj + | BasicPatterns.ObjectExpr(_,basecall,overrides,iimpls) -> seq { yield! collectMembers basecall for o in overrides do @@ -328,8 +328,8 @@ module internal Utils = for o in i do yield! collectMembers o.Body } - | BasicPatterns.TraitCall(tys,nm,_,argtys,tinst,args) -> Seq.collect collectMembers args - | BasicPatterns.Const(obj,ty) -> Seq.empty + | BasicPatterns.TraitCall(_,_,_,_,_,args) -> Seq.collect collectMembers args + | BasicPatterns.Const(_,_) -> Seq.empty | BasicPatterns.Value(v) -> Seq.singleton v | BasicPatterns.ValueSet(v,e1) -> Seq.append (Seq.singleton v) (collectMembers e1) | BasicPatterns.WhileLoop(e1,e2) -> Seq.append (collectMembers e1) (collectMembers e2) @@ -341,7 +341,7 @@ module internal Utils = match d with | FSharpImplementationFileDeclaration.Entity(_,ds) -> yield! printMembersOfDeclatations ds - | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(v,vs,e) -> + | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(v,_,e) -> yield printMemberSignature v yield! collectMembers e |> Seq.map printMemberSignature | FSharpImplementationFileDeclaration.InitAction(e) -> @@ -3158,9 +3158,7 @@ let ``Test ProjectForWitnesses1 GetWitnessPassingInfo`` () = | Some (nm, argTypes) -> nm |> shouldEqual "callXY$W" argTypes.Count |> shouldEqual 2 - let argName1 = argTypes.[0].Name let argText1 = argTypes.[0].Type.ToString() - let argName2 = argTypes.[1].Name let argText2 = argTypes.[1].Type.ToString() argText1 |> shouldEqual "type ^T -> ^U -> Microsoft.FSharp.Core.unit" argText2 |> shouldEqual "type ^T -> ^U -> Microsoft.FSharp.Core.unit" diff --git a/tests/service/FileSystemTests.fs b/tests/service/FileSystemTests.fs index 59bb29f0553..85707fc7395 100644 --- a/tests/service/FileSystemTests.fs +++ b/tests/service/FileSystemTests.fs @@ -80,7 +80,6 @@ let UseMyFileSystem() = let ``FileSystem compilation test``() = if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows use myFileSystem = UseMyFileSystem() - let programFilesx86Folder = System.Environment.GetEnvironmentVariable("PROGRAMFILES(X86)") let projectOptions = let allFlags = diff --git a/tests/service/MultiProjectAnalysisTests.fs b/tests/service/MultiProjectAnalysisTests.fs index a5863d15cba..ab692b864aa 100644 --- a/tests/service/MultiProjectAnalysisTests.fs +++ b/tests/service/MultiProjectAnalysisTests.fs @@ -145,7 +145,6 @@ let ``Test multi project 1 basic`` () = let ``Test multi project 1 all symbols`` () = let p1A = checker.ParseAndCheckProject(Project1A.options) |> Async.RunSynchronously - let p1B = checker.ParseAndCheckProject(Project1B.options) |> Async.RunSynchronously let mp = checker.ParseAndCheckProject(MultiProject1.options) |> Async.RunSynchronously let x1FromProject1A = @@ -183,7 +182,6 @@ let ``Test multi project 1 all symbols`` () = let ``Test multi project 1 xmldoc`` () = let p1A = checker.ParseAndCheckProject(Project1A.options) |> Async.RunSynchronously - let p1B = checker.ParseAndCheckProject(Project1B.options) |> Async.RunSynchronously let mp = checker.ParseAndCheckProject(MultiProject1.options) |> Async.RunSynchronously let symbolFromProject1A sym = @@ -344,11 +342,6 @@ let ``Test ManyProjectsStressTest all symbols`` () = let projectsResults = [ for p in ManyProjectsStressTest.projects -> p, checker.ParseAndCheckProject(p.Options) |> Async.RunSynchronously ] let jointProjectResults = checker.ParseAndCheckProject(ManyProjectsStressTest.jointProject.Options) |> Async.RunSynchronously - let vsFromJointProject = - [ for s in jointProjectResults.GetAllUsesOfAllSymbols() do - if s.Symbol.DisplayName = "v" then - yield s.Symbol ] - for (p,pResults) in projectsResults do let vFromProject = [ for s in pResults.GetAllUsesOfAllSymbols() do @@ -430,7 +423,7 @@ let ``Test multi project symbols should pick up changes in dependent projects`` count.Value |> shouldEqual 1 - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(MultiProjectDirty1.fileName1, proj1options) |> Async.RunSynchronously @@ -488,7 +481,7 @@ let ``Test multi project symbols should pick up changes in dependent projects`` let wholeProjectResults1AfterChange1 = checker.ParseAndCheckProject(proj1options) |> Async.RunSynchronously count.Value |> shouldEqual 3 - let backgroundParseResults1AfterChange1, backgroundTypedParse1AfterChange1 = + let _, backgroundTypedParse1AfterChange1 = checker.GetBackgroundCheckResultsForFileInProject(MultiProjectDirty1.fileName1, proj1options) |> Async.RunSynchronously @@ -545,7 +538,7 @@ let ``Test multi project symbols should pick up changes in dependent projects`` count.Value |> shouldEqual 6 // the project is already checked - let backgroundParseResults1AfterChange2, backgroundTypedParse1AfterChange2 = + let _, backgroundTypedParse1AfterChange2 = checker.GetBackgroundCheckResultsForFileInProject(MultiProjectDirty1.fileName1, proj1options) |> Async.RunSynchronously @@ -755,9 +748,7 @@ let ``Test multi project 3 whole project errors`` () = [] let ``Test active patterns' XmlDocSig declared in referenced projects`` () = - - let wholeProjectResults = checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(MultiProject3.fileName1, MultiProject3.options) |> Async.RunSynchronously @@ -786,12 +777,12 @@ let ``Test max memory gets triggered`` () = let checker = FSharpChecker.Create() let reached = ref false checker.MaxMemoryReached.Add (fun () -> reached := true) - let wholeProjectResults = checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously + checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously |> ignore reached.Value |> shouldEqual false checker.MaxMemory <- 0 - let wholeProjectResults2 = checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously + checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously |> ignore reached.Value |> shouldEqual true - let wholeProjectResults3 = checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously + checker.ParseAndCheckProject(MultiProject3.options) |> Async.RunSynchronously |> ignore reached.Value |> shouldEqual true diff --git a/tests/service/PerfTests.fs b/tests/service/PerfTests.fs index ffffa412a36..868241f5331 100644 --- a/tests/service/PerfTests.fs +++ b/tests/service/PerfTests.fs @@ -27,7 +27,7 @@ module internal Project1 = let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSources = [ for (i,f) in fileNamesI -> (f, "module M" + string i) ] for (f,text) in fileSources do File.WriteAllText(f, text) - let fileSources2 = [ for (i,f) in fileSources -> FSharp.Compiler.Text.SourceText.ofString f ] + let fileSources2 = [ for (_,f) in fileSources -> FSharp.Compiler.Text.SourceText.ofString f ] let fileNames = [ for (_,f) in fileNamesI -> f ] let args = mkProjectCommandLineArgs (dllName, fileNames) @@ -41,8 +41,8 @@ let ``Test request for parse and check doesn't check whole project`` () = printfn "starting test..." let backgroundParseCount = ref 0 let backgroundCheckCount = ref 0 - checker.FileChecked.Add (fun x -> incr backgroundCheckCount) - checker.FileParsed.Add (fun x -> incr backgroundParseCount) + checker.FileChecked.Add (fun _ -> incr backgroundCheckCount) + checker.FileParsed.Add (fun _ -> incr backgroundParseCount) checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() let pB, tB = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic @@ -58,7 +58,7 @@ let ``Test request for parse and check doesn't check whole project`` () = backgroundCheckCount.Value |> shouldEqual 0 printfn "CheckFileInProject()..." - let checkResults1 = checker.CheckFileInProject(parseResults1, Project1.fileNames.[5], 0, Project1.fileSources2.[5], Project1.options) |> Async.RunSynchronously + let _ = checker.CheckFileInProject(parseResults1, Project1.fileNames.[5], 0, Project1.fileSources2.[5], Project1.options) |> Async.RunSynchronously let pD, tD = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic printfn "checking background parsing happened...., backgroundParseCount.Value = %d" backgroundParseCount.Value @@ -77,7 +77,7 @@ let ``Test request for parse and check doesn't check whole project`` () = (tD - tC) |> shouldEqual 1 printfn "CheckFileInProject()..." - let checkResults2 = checker.CheckFileInProject(parseResults1, Project1.fileNames.[7], 0, Project1.fileSources2.[7], Project1.options) |> Async.RunSynchronously + let _ = checker.CheckFileInProject(parseResults1, Project1.fileNames.[7], 0, Project1.fileSources2.[7], Project1.options) |> Async.RunSynchronously let pE, tE = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic printfn "checking no extra foreground parsing...., (pE - pD) = %d" (pE - pD) (pE - pD) |> shouldEqual 0 @@ -90,7 +90,7 @@ let ``Test request for parse and check doesn't check whole project`` () = printfn "ParseAndCheckFileInProject()..." // A subsequent ParseAndCheck of identical source code doesn't do any more anything - let checkResults2 = checker.ParseAndCheckFileInProject(Project1.fileNames.[7], 0, Project1.fileSources2.[7], Project1.options) |> Async.RunSynchronously + let _ = checker.ParseAndCheckFileInProject(Project1.fileNames.[7], 0, Project1.fileSources2.[7], Project1.options) |> Async.RunSynchronously let pF, tF = FSharpChecker.GlobalForegroundParseCountStatistic, FSharpChecker.GlobalForegroundTypeCheckCountStatistic printfn "checking no extra foreground parsing...." (pF - pE) |> shouldEqual 0 // note, no new parse of the file diff --git a/tests/service/Program.fs b/tests/service/Program.fs index c94e2a49931..9ac7e520f1f 100644 --- a/tests/service/Program.fs +++ b/tests/service/Program.fs @@ -1,6 +1,4 @@ -open System - -[] -let main argv = +[] +let main _ = printfn "Dotnet Core NUnit Tests..." 0 \ No newline at end of file diff --git a/tests/service/ProjectAnalysisTests.fs b/tests/service/ProjectAnalysisTests.fs index 09b360b66ee..b57ed3c0bb2 100644 --- a/tests/service/ProjectAnalysisTests.fs +++ b/tests/service/ProjectAnalysisTests.fs @@ -320,7 +320,7 @@ let ``Test project1 xxx symbols`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project1.fileName1, Project1.options) |> Async.RunSynchronously @@ -593,23 +593,14 @@ let ``Test file explicit parse symbols`` () = [] -let ``Test file explicit parse all symbols`` () = - - - let wholeProjectResults = checker.ParseAndCheckProject(Project1.options) |> Async.RunSynchronously +let ``Test file explicit parse all symbols`` () = let parseResults1 = checker.ParseFile(Project1.fileName1, Project1.fileSource1, Project1.parsingOptions) |> Async.RunSynchronously - let parseResults2 = checker.ParseFile(Project1.fileName2, Project1.fileSource2, Project1.parsingOptions) |> Async.RunSynchronously let checkResults1 = checker.CheckFileInProject(parseResults1, Project1.fileName1, 0, Project1.fileSource1, Project1.options) |> Async.RunSynchronously |> function FSharpCheckFileAnswer.Succeeded x -> x | _ -> failwith "unexpected aborted" - let checkResults2 = - checker.CheckFileInProject(parseResults2, Project1.fileName2, 0, Project1.fileSource2, Project1.options) - |> Async.RunSynchronously - |> function FSharpCheckFileAnswer.Succeeded x -> x | _ -> failwith "unexpected aborted" - let usesOfSymbols = checkResults1.GetAllUsesOfAllSymbolsInFile() let cleanedUsesOfSymbols = [ for s in usesOfSymbols -> s.Symbol.DisplayName, Project1.cleanFileName s.FileName, tupsZ s.RangeAlternate, attribsOfSymbol s.Symbol ] @@ -1345,7 +1336,7 @@ let ``Test project4 all uses of all signature symbols`` () = let ``Test project4 T symbols`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project4.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project4.fileName1, Project4.options) |> Async.RunSynchronously @@ -1540,7 +1531,7 @@ let ``Test project 5 all symbols`` () = let ``Test complete active patterns' exact ranges from uses of symbols`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project5.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project5.fileName1, Project5.options) |> Async.RunSynchronously @@ -1600,7 +1591,7 @@ let ``Test complete active patterns' exact ranges from uses of symbols`` () = let ``Test partial active patterns' exact ranges from uses of symbols`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project5.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project5.fileName1, Project5.options) |> Async.RunSynchronously @@ -1730,12 +1721,6 @@ let ``Test project7 whole project errors`` () = let ``Test project 7 all symbols`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project7.options) |> Async.RunSynchronously - - let allUsesOfAllSymbols = - wholeProjectResults.GetAllUsesOfAllSymbols() - - |> Array.map (fun su -> su.Symbol.ToString(), su.Symbol.DisplayName, Project7.cleanFileName su.FileName, tups su.RangeAlternate) - let arg1symbol = wholeProjectResults.GetAllUsesOfAllSymbols() @@ -1972,7 +1957,7 @@ let ``Test Project10 all symbols`` () = ("parameter query", "query", "file1", ((7, 18), (7, 23)), []); ("NamedArgs", "NamedArgs", "file1", ((2, 7), (2, 16)), ["module"])|] - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project10.fileName1, Project10.options) |> Async.RunSynchronously @@ -2604,7 +2589,7 @@ let ``Test Project16 sig symbols are equal to impl symbols`` () = match ok with | [] -> failwith (sprintf "Didn't find symbol equivalent to %s symbol '%A' in %s" tag1 symUse1.Symbol tag2) - | [sym] -> () + | [_sym] -> () | [sym1;sym2] when sym1.Symbol.DisplayName = sym2.Symbol.DisplayName -> () // constructor and type | syms -> failwith (sprintf "Found multiple symbols for %s '%A' in %s: '%A'" tag1 symUse1.Symbol tag2 [for sym in syms -> sym.Symbol ] ) @@ -3407,8 +3392,7 @@ let ``Test Project24 whole project errors`` () = [] let ``Test Project24 all symbols`` () = - let wholeProjectResults = checker.ParseAndCheckProject(Project24.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project24.fileName1, Project24.options) |> Async.RunSynchronously @@ -3514,8 +3498,7 @@ let ``Test Project24 all symbols`` () = [] let ``Test symbol uses of properties with both getters and setters`` () = - let wholeProjectResults = checker.ParseAndCheckProject(Project24.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project24.fileName1, Project24.options) |> Async.RunSynchronously @@ -3662,8 +3645,7 @@ let ``Test Project25 whole project errors`` () = [] #endif let ``Test Project25 symbol uses of type-provided members`` () = - let wholeProjectResults = checker.ParseAndCheckProject(Project25.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project25.fileName1, Project25.options) |> Async.RunSynchronously @@ -3721,8 +3703,7 @@ let ``Test Project25 symbol uses of type-provided members`` () = [] #endif let ``Test symbol uses of type-provided types`` () = - let wholeProjectResults = checker.ParseAndCheckProject(Project25.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project25.fileName1, Project25.options) |> Async.RunSynchronously @@ -3741,8 +3722,7 @@ let ``Test symbol uses of type-provided types`` () = [] let ``Test symbol uses of fully-qualified records`` () = - let wholeProjectResults = checker.ParseAndCheckProject(Project25.options) |> Async.RunSynchronously - let backgroundParseResults1, backgroundTypedParse1 = + let _, backgroundTypedParse1 = checker.GetBackgroundCheckResultsForFileInProject(Project25.fileName1, Project25.options) |> Async.RunSynchronously @@ -3797,13 +3777,6 @@ let ``Test Project26 whole project errors`` () = [] let ``Test Project26 parameter symbols`` () = let wholeProjectResults = checker.ParseAndCheckProject(Project26.options) |> Async.RunSynchronously - - let allUsesOfAllSymbols = - wholeProjectResults.GetAllUsesOfAllSymbols() - - |> Array.map (fun su -> su.Symbol.ToString(), su.Symbol.DisplayName, Project13.cleanFileName su.FileName, tups su.RangeAlternate, attribsOfSymbolUse su, attribsOfSymbol su.Symbol) - - let objSymbol = wholeProjectResults.GetAllUsesOfAllSymbols() |> Array.find (fun su -> su.Symbol.DisplayName = "Class") let objEntity = objSymbol.Symbol :?> FSharpEntity @@ -4599,17 +4572,6 @@ let ``Test project36 FSharpMemberOrFunctionOrValue.IsBaseValue`` () = [] let ``Test project36 FSharpMemberOrFunctionOrValue.IsConstructorThisValue & IsMemberThisValue`` () = - let wholeProjectResults = Project36.keepAssemblyContentsChecker.ParseAndCheckProject(Project36.options) |> Async.RunSynchronously - let declarations = - let checkedFile = wholeProjectResults.AssemblyContents.ImplementationFiles.[0] - match checkedFile.Declarations.[0] with - | FSharpImplementationFileDeclaration.Entity (_, subDecls) -> subDecls - | _ -> failwith "unexpected declaration" - let getExpr exprIndex = - match declarations.[exprIndex] with - | FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(_,_,e) -> e - | FSharpImplementationFileDeclaration.InitAction e -> e - | _ -> failwith "unexpected declaration" // Instead of checking the symbol uses directly, walk the typed tree to check // the correct values are also visible from there. Also note you cannot use // BasicPatterns.ThisValue in these cases, this is only used when the symbol @@ -5140,7 +5102,7 @@ module internal ProjectBig = let projFileName = Path.ChangeExtension(base2, ".fsproj") let fileSources = [ for (i,f) in fileNamesI -> (f, "module M" + string i) ] for (f,text) in fileSources do File.WriteAllText(f, text) - let fileSources2 = [ for (i,f) in fileSources -> FSharp.Compiler.Text.SourceText.ofString f ] + let fileSources2 = [ for (_,f) in fileSources -> FSharp.Compiler.Text.SourceText.ofString f ] let fileNames = [ for (_,f) in fileNamesI -> f ] let args = mkProjectCommandLineArgs (dllName, fileNames) @@ -5306,7 +5268,7 @@ type A(i:int) = [] let ``#4030, Incremental builder creation warnings`` (args, errorSeverities) = let source = "module M" - let fileName, options = mkTestFileAndOptions source args + let fileName, options = mkTestFileAndOptions args let _, checkResults = parseAndCheckFile fileName source options checkResults.Errors |> Array.map (fun e -> e.Severity = FSharpErrorSeverity.Error) |> shouldEqual errorSeverities diff --git a/tests/service/Symbols.fs b/tests/service/Symbols.fs index 5b4c3e86198..9d2a2128a29 100644 --- a/tests/service/Symbols.fs +++ b/tests/service/Symbols.fs @@ -35,7 +35,7 @@ match "foo" with """ let getCaseUsages source line = - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options checkResults.GetAllUsesOfAllSymbolsInFile() @@ -100,7 +100,7 @@ module Mod1 = module Mod2 = let func2 () = () """ - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options let mod1 = checkResults.PartialAssemblySignature.FindEntityByPath ["Ns1"; "Mod1"] |> Option.get @@ -120,7 +120,7 @@ let val1 = 1 module Mod2 = let func2 () = () """ - let fileName, options = mkTestFileAndOptions source [| |] + let fileName, options = mkTestFileAndOptions [| |] let _, checkResults = parseAndCheckFile fileName source options let mod1 = checkResults.PartialAssemblySignature.FindEntityByPath ["Mod1"] |> Option.get @@ -147,7 +147,7 @@ type FooAttribute() = [] let x = 123 """ - let fileName, options = mkTestFileAndOptions source [| "--noconditionalerasure" |] + let fileName, options = mkTestFileAndOptions [| "--noconditionalerasure" |] let _, checkResults = parseAndCheckFile fileName source options checkResults.GetAllUsesOfAllSymbolsInFile() diff --git a/tests/service/data/TestTP/Library.fs b/tests/service/data/TestTP/Library.fs index 3d5474e50bf..834c5a49df3 100644 --- a/tests/service/data/TestTP/Library.fs +++ b/tests/service/data/TestTP/Library.fs @@ -6,14 +6,14 @@ open System.Reflection module Helper = let doNothing() = () - let doNothingOneArg(x:int) = () - let doNothingTwoArg(x:int, y: int) = () - let doNothingTwoArgCurried(x:int) (y: int) = () + let doNothingOneArg(_:int) = () + let doNothingTwoArg(_:int, _: int) = () + let doNothingTwoArgCurried(_:int) (_: int) = () [] let doNothingWithCompiledName() = () - let doNothingGeneric(x:'T) = () - let doNothingGenericWithConstraint(x: 'T when 'T: equality) = () - let doNothingGenericWithTypeConstraint(x: 'T when 'T :> _ seq) = () + let doNothingGeneric(_:'T) = () + let doNothingGenericWithConstraint(_: 'T when 'T: equality) = () + let doNothingGenericWithTypeConstraint(_: 'T when 'T :> _ seq) = () let mutable moduleValue = 0 @@ -28,19 +28,19 @@ module Helper = inherit B() let mutable p = 0 static member DoNothing() = () - static member DoNothingOneArg(x:int) = () - static member DoNothingOneArg(x:string) = () - static member DoNothingTwoArg(c:C, x:int) = () - static member DoNothingTwoArgCurried (c:C) (x:int) = () - static member DoNothingGeneric(x:'T) = () + static member DoNothingOneArg(_:int) = () + static member DoNothingOneArg(_:string) = () + static member DoNothingTwoArg(_:C, _:int) = () + static member DoNothingTwoArgCurried (_:C) (_:int) = () + static member DoNothingGeneric(_:'T) = () [] static member DoNothingWithCompiledName() = () member __.InstanceDoNothing() = () - member __.InstanceDoNothingOneArg(x:int) = () - member __.InstanceDoNothingOneArg(x:string) = () - member __.InstanceDoNothingTwoArg(c:C, x:int) = () - member __.InstanceDoNothingTwoArgCurried(c:C) (x:int) = () - member __.InstanceDoNothingGeneric(x:'T) = () + member __.InstanceDoNothingOneArg(_:int) = () + member __.InstanceDoNothingOneArg(_:string) = () + member __.InstanceDoNothingTwoArg(_:C, _:int) = () + member __.InstanceDoNothingTwoArgCurried(_:C) (_:int) = () + member __.InstanceDoNothingGeneric(_:'T) = () [] member __.InstanceDoNothingWithCompiledName() = () override __.VirtualDoNothing() = () @@ -54,13 +54,13 @@ module Helper = type G<'U>() = static member DoNothing() = () - static member DoNothingOneArg(x:int) = () - static member DoNothingTwoArg(c:C, x:int) = () - static member DoNothingGeneric(x:'T) = () + static member DoNothingOneArg(_:int) = () + static member DoNothingTwoArg(_:C, _:int) = () + static member DoNothingGeneric(_:'T) = () member __.InstanceDoNothing() = () - member __.InstanceDoNothingOneArg(x:int) = () - member __.InstanceDoNothingTwoArg(c:C, x:int) = () - member __.InstanceDoNothingGeneric(x:'U) = () + member __.InstanceDoNothingOneArg(_:int) = () + member __.InstanceDoNothingTwoArg(_:C, _:int) = () + member __.InstanceDoNothingGeneric(_:'U) = () type R = { A : int; mutable B : int } @@ -88,7 +88,7 @@ type BasicProvider (config : TypeProviderConfig) as this = let createTypes () = let myType = ProvidedTypeDefinition(asm, ns, "MyType", Some typeof) - let ctor = ProvidedConstructor([], InvokeCode = fun args -> <@@ "My internal state" :> obj @@>) + let ctor = ProvidedConstructor([], InvokeCode = fun _ -> <@@ "My internal state" :> obj @@>) myType.AddMember(ctor) let ctor2 = ProvidedConstructor( @@ -101,97 +101,97 @@ type BasicProvider (config : TypeProviderConfig) as this = myType.AddMember(innerState) let someMethod = ProvidedMethod("DoNothing", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothing() @@>) + InvokeCode = fun _ -> <@@ Helper.doNothing() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingOneArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingOneArg(3) @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingOneArg(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingTwoArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingTwoArg(3, 4) @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingTwoArg(3, 4) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingTwoArgCurried", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingTwoArgCurried 3 4 @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingTwoArgCurried 3 4 @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingWithCompiledName", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingWithCompiledName() @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingWithCompiledName() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingGeneric", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingGeneric(3) @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingGeneric(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingGenericWithConstraint", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingGenericWithConstraint(3) @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingGenericWithConstraint(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("DoNothingGenericWithTypeConstraint", [], typeof, - InvokeCode = fun args -> <@@ Helper.doNothingGenericWithTypeConstraint([3]) @@>) + InvokeCode = fun _ -> <@@ Helper.doNothingGenericWithTypeConstraint([3]) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassDoNothing", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.DoNothing() @@>) + InvokeCode = fun _ -> <@@ Helper.C.DoNothing() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassDoNothingGeneric", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.DoNothingGeneric(3) @@>) + InvokeCode = fun _ -> <@@ Helper.C.DoNothingGeneric(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassDoNothingOneArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.DoNothingOneArg(3) @@>) + InvokeCode = fun _ -> <@@ Helper.C.DoNothingOneArg(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassDoNothingTwoArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.DoNothingTwoArg(Helper.C(), 3) @@>) + InvokeCode = fun _ -> <@@ Helper.C.DoNothingTwoArg(Helper.C(), 3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassDoNothingTwoArgCurried", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.DoNothingTwoArgCurried (Helper.C()) 3 @@>) + InvokeCode = fun _ -> <@@ Helper.C.DoNothingTwoArgCurried (Helper.C()) 3 @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassDoNothingWithCompiledName", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.DoNothingWithCompiledName() @@>) + InvokeCode = fun _ -> <@@ Helper.C.DoNothingWithCompiledName() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassInstanceDoNothing", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothing() @@>) + InvokeCode = fun _ -> <@@ Helper.C().InstanceDoNothing() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassInstanceDoNothingGeneric", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingGeneric(3) @@>) + InvokeCode = fun _ -> <@@ Helper.C().InstanceDoNothingGeneric(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassInstanceDoNothingOneArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingOneArg(3) @@>) + InvokeCode = fun _ -> <@@ Helper.C().InstanceDoNothingOneArg(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassInstanceDoNothingTwoArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingTwoArg(Helper.C(), 3) @@>) + InvokeCode = fun _ -> <@@ Helper.C().InstanceDoNothingTwoArg(Helper.C(), 3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassInstanceDoNothingTwoArgCurried", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingTwoArgCurried (Helper.C()) 3 @@>) + InvokeCode = fun _ -> <@@ Helper.C().InstanceDoNothingTwoArgCurried (Helper.C()) 3 @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassInstanceDoNothingWithCompiledName", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingWithCompiledName() @@>) + InvokeCode = fun _ -> <@@ Helper.C().InstanceDoNothingWithCompiledName() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("InterfaceDoNothing", [], typeof, - InvokeCode = fun args -> <@@ (Helper.C() :> Helper.I).DoNothing() @@>) + InvokeCode = fun _ -> <@@ (Helper.C() :> Helper.I).DoNothing() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("OverrideDoNothing", [], typeof, - InvokeCode = fun args -> <@@ Helper.C().VirtualDoNothing() @@>) + InvokeCode = fun _ -> <@@ Helper.C().VirtualDoNothing() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("GenericClassDoNothing", [], typeof, - InvokeCode = fun args -> <@@ Helper.G.DoNothing() @@>) + InvokeCode = fun _ -> <@@ Helper.G.DoNothing() @@>) myType.AddMember(someMethod) // These do not seem to compile correctly when used in provided expressions: @@ -201,85 +201,85 @@ type BasicProvider (config : TypeProviderConfig) as this = //Helper.G().InstanceDoNothingGeneric(3) let someMethod = ProvidedMethod("GenericClassDoNothingOneArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.G.DoNothingOneArg(3) @@>) + InvokeCode = fun _ -> <@@ Helper.G.DoNothingOneArg(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("GenericClassDoNothingTwoArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.G.DoNothingTwoArg(Helper.C(), 3) @@>) + InvokeCode = fun _ -> <@@ Helper.G.DoNothingTwoArg(Helper.C(), 3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("GenericClassInstanceDoNothing", [], typeof, - InvokeCode = fun args -> <@@ Helper.G().InstanceDoNothing() @@>) + InvokeCode = fun _ -> <@@ Helper.G().InstanceDoNothing() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("GenericClassInstanceDoNothingOneArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.G().InstanceDoNothingOneArg(3) @@>) + InvokeCode = fun _ -> <@@ Helper.G().InstanceDoNothingOneArg(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("GenericClassInstanceDoNothingTwoArg", [], typeof, - InvokeCode = fun args -> <@@ Helper.G().InstanceDoNothingTwoArg(Helper.C(), 3) @@>) + InvokeCode = fun _ -> <@@ Helper.G().InstanceDoNothingTwoArg(Helper.C(), 3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("OptionConstructionAndMatch", [], typeof, - InvokeCode = fun args -> <@@ match Some 1 with None -> 0 | Some x -> x @@>) + InvokeCode = fun _ -> <@@ match Some 1 with None -> 0 | Some x -> x @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ChoiceConstructionAndMatch", [], typeof, - InvokeCode = fun args -> <@@ match Choice1Of2 1 with Choice2Of2 _ -> 0 | Choice1Of2 _ -> 1 @@>) + InvokeCode = fun _ -> <@@ match Choice1Of2 1 with Choice2Of2 _ -> 0 | Choice1Of2 _ -> 1 @@>) // TODO: fix type checker to recognize union generated subclasses coming from TPs // InvokeCode = fun args -> <@@ match Choice1Of2 1 with Choice2Of2 _ -> 0 | Choice1Of2 x -> x @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("RecordConstructionAndFieldGetSet", [], typeof, - InvokeCode = fun args -> <@@ let r : Helper.R = { A = 1; B = 0 } in r.B <- 1; r.A @@>) + InvokeCode = fun _ -> <@@ let r : Helper.R = { A = 1; B = 0 } in r.B <- 1; r.A @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("TupleConstructionAndGet", [], typeof, - InvokeCode = fun args -> <@@ let t = (1, 2, 3) in (let (_, i, _) = t in i) @@>) + InvokeCode = fun _ -> <@@ let t = (1, 2, 3) in (let (_, i, _) = t in i) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpMethod", [], typeof, - InvokeCode = fun args -> <@@ CSharpClass(0).Method("x") @@>) + InvokeCode = fun _ -> <@@ CSharpClass(0).Method("x") @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpMethodOptionalParam", [], typeof, - InvokeCode = fun args -> <@@ CSharpClass(0).Method2("x") + CSharpClass(0).Method2() @@>) + InvokeCode = fun _ -> <@@ CSharpClass(0).Method2("x") + CSharpClass(0).Method2() @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpMethodParamArray", [], typeof, - InvokeCode = fun args -> <@@ CSharpClass(0).Method3("x", "y") @@>) + InvokeCode = fun _ -> <@@ CSharpClass(0).Method3("x", "y") @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpMethodGeneric", [], typeof, - InvokeCode = fun args -> <@@ CSharpClass(0).GenericMethod(2) @@>) + InvokeCode = fun _ -> <@@ CSharpClass(0).GenericMethod(2) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpMethodGenericWithConstraint", [], typeof, - InvokeCode = fun args -> <@@ CSharpClass(0).GenericMethod2(obj()) @@>) + InvokeCode = fun _ -> <@@ CSharpClass(0).GenericMethod2(obj()) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpMethodGenericWithTypeConstraint", [], typeof, - InvokeCode = fun args -> <@@ CSharpClass(0).GenericMethod3(3) @@>) + InvokeCode = fun _ -> <@@ CSharpClass(0).GenericMethod3(3) @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("CSharpExplicitImplementationMethod", [], typeof, - InvokeCode = fun args -> <@@ (CSharpClass(0) :> ICSharpExplicitInterface).ExplicitMethod("x") @@>) + InvokeCode = fun _ -> <@@ (CSharpClass(0) :> ICSharpExplicitInterface).ExplicitMethod("x") @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ModuleValue", [], typeof, - InvokeCode = fun args -> <@@ Helper.moduleValue <- 1; Helper.moduleValue @@>) + InvokeCode = fun _ -> <@@ Helper.moduleValue <- 1; Helper.moduleValue @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassProperty", [], typeof, - InvokeCode = fun args -> <@@ let x = Helper.C() in x.Property <- 1; x.Property @@>) + InvokeCode = fun _ -> <@@ let x = Helper.C() in x.Property <- 1; x.Property @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassAutoProperty", [], typeof, - InvokeCode = fun args -> <@@ let x = Helper.C() in x.AutoProperty <- 1; x.AutoProperty @@>) + InvokeCode = fun _ -> <@@ let x = Helper.C() in x.AutoProperty <- 1; x.AutoProperty @@>) myType.AddMember(someMethod) let someMethod = ProvidedMethod("ClassStaticAutoProperty", [], typeof, - InvokeCode = fun args -> <@@ Helper.C.StaticAutoProperty <- 1; Helper.C.StaticAutoProperty @@>) + InvokeCode = fun _ -> <@@ Helper.C.StaticAutoProperty <- 1; Helper.C.StaticAutoProperty @@>) myType.AddMember(someMethod) [myType] diff --git a/vsintegration/src/FSharp.VS.FSI/fsiBasis.fs b/vsintegration/src/FSharp.VS.FSI/fsiBasis.fs index ddff0481e7d..6ccae6e1921 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiBasis.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiBasis.fs @@ -165,12 +165,12 @@ type internal HistoryBuffer() = let lines = new System.Collections.Generic.List() let mutable pointer = 0 member this.Add(text:string) = lines.Add(text); pointer <- lines.Count - member this.CycleUp(text:string) = if pointer-1 >= 0 then + member this.CycleUp(_:string) = if pointer-1 >= 0 then pointer <- pointer - 1 Some lines.[pointer] else None - member this.CycleDown(text:string) = if pointer+1 < lines.Count then + member this.CycleDown(_:string) = if pointer+1 < lines.Count then pointer <- pointer + 1 Some lines.[pointer] else diff --git a/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs b/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs index 19f5489b51d..9b76fb68665 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiLanguageService.fs @@ -71,10 +71,10 @@ type internal FsiCompletionSet(imageList,source:Source) = type internal FsiDeclarations(items : (string*string*string*int)[] ) = inherit Declarations() override this.GetCount() = items.Length - override this.GetName(i) = items.[i] |> (fun (n,d,dsp,g) -> n) - override this.GetDescription(i) = items.[i] |> (fun (n,d,dsp,g) -> d) - override this.GetDisplayText(i) = items.[i] |> (fun (n,d,dsp,g) -> dsp) - override this.GetGlyph(i:int) = items.[i] |> (fun (n,d,dsp,g) -> g) + override this.GetName(i) = items.[i] |> (fun (n,_,_,_) -> n) + override this.GetDescription(i) = items.[i] |> (fun (_,d,_,_) -> d) + override this.GetDisplayText(i) = items.[i] |> (fun (_,_,dsp,_) -> dsp) + override this.GetGlyph(i:int) = items.[i] |> (fun (_,_,_,g) -> g) new() = new FsiDeclarations([||]) // Methods @@ -84,10 +84,10 @@ type internal FsiMethods() = override this.GetCount() = items.Length override this.GetDescription(i) = items.[i] override this.GetName(i) = items.[i] - override this.GetParameterCount(i:int) = 0 - override this.GetParameterInfo(i,param_i,name:byref,display:byref,description:byref) = + override this.GetParameterCount(_:int) = 0 + override this.GetParameterInfo(i,_,name:byref,display:byref,description:byref) = name <- items.[i]; display <- ""; description <- "" - override this.GetType(i:int) = null:string + override this.GetType(_:int) = null:string // FsiSource type internal FsiSource(service:LanguageService, textLines:IVsTextLines, colorizer:Colorizer) = @@ -106,22 +106,22 @@ type internal FsiSource(service:LanguageService, textLines:IVsTextLines, coloriz override this.Completion(textView:IVsTextView,info:TokenInfo,reason:ParseReason) = base.Completion(textView,info,reason) -type internal FsiScanner(buffer:IVsTextLines) = +type internal FsiScanner(_buffer:IVsTextLines) = interface Microsoft.VisualStudio.Package.IScanner with - override this.SetSource(source:string,offset:int) = () - override this.ScanTokenAndProvideInfoAboutIt(tokenInfo:TokenInfo,state:byref) = false + override this.SetSource(_:string,_:int) = () + override this.ScanTokenAndProvideInfoAboutIt(_:TokenInfo,_:byref) = false // Implementing a scanner with TokenTriggers could start intellisense calls, e.g. on DOT. -type internal FsiAuthoringScope(sessions:FsiSessions option,readOnlySpanGetter:unit -> TextSpan) = +type internal FsiAuthoringScope(sessions:FsiSessions option,_readOnlySpanGetter:unit -> TextSpan) = inherit AuthoringScope() - override this.GetDataTipText(line:int,col:int,span:byref) = + override this.GetDataTipText(_:int,_:int,span:byref) = span <- new TextSpan() null - override this.GetDeclarations(_snapshot,line:int,col:int,info:TokenInfo,reason:ParseReason) = + override this.GetDeclarations(_snapshot,_:int,_:int,_:TokenInfo,_:ParseReason) = match sessions with | None -> (new FsiDeclarations() :> Declarations) - | Some sessions -> + | Some _ -> #if FSI_SERVER_INTELLISENSE if Guids.enable_fsi_intellisense then let lines = view.GetBuffer() |> throwOnFailure1 @@ -140,13 +140,13 @@ type internal FsiAuthoringScope(sessions:FsiSessions option,readOnlySpanGetter:u #endif (new FsiDeclarations() :> Declarations) - override this.GetMethods(line:int,col:int,name:string) = + override this.GetMethods(_:int,_:int,_:string) = new FsiMethods() :> Methods - override this.Goto(cmd : VSConstants.VSStd97CmdID, - textView : IVsTextView, - line : int, - col : int, + override this.Goto(_ : VSConstants.VSStd97CmdID, + _ : IVsTextView, + _ : int, + _ : int, span : byref) = span <- new TextSpan() null : string @@ -164,14 +164,14 @@ type internal FsiViewFilter(mgr:CodeWindowManager,view:IVsTextView) = override this.HandlePreExec(guidCmdGroup:byref,nCmdId:uint32,nCmdexecopt:uint32,pvaIn:IntPtr,pvaOut:IntPtr) = if isShowMemberList guidCmdGroup nCmdId then // does it come through? - let line, col = view.GetCaretPos() |> throwOnFailure2 - let source = mgr.Source + let _line, _col = view.GetCaretPos() |> throwOnFailure2 + let _source = mgr.Source let tokenInfo = new TokenInfo() mgr.Source.Completion(view,tokenInfo,ParseReason.DisplayMemberList) true // handled here elif isCompleteWord guidCmdGroup nCmdId then - let line, col = view.GetCaretPos() |> throwOnFailure2 - let source = mgr.Source + let _line, _col = view.GetCaretPos() |> throwOnFailure2 + let _source = mgr.Source let tokenInfo = new TokenInfo() // Rather than MPFs source.GetTokenInfo(line,col) mgr.Source.Completion(view, tokenInfo, @@ -223,7 +223,7 @@ type internal FsiLanguageService() = scanner <- (new FsiScanner(buffer) :> IScanner) scanner - override this.ParseSource(req:ParseRequest) = + override this.ParseSource(_:ParseRequest) = (new FsiAuthoringScope(sessions,readOnlySpan) :> AuthoringScope) override this.Name = "FSharpInteractive" // LINK: see ProvidePackage attribute on the package. @@ -237,6 +237,6 @@ type internal FsiLanguageService() = count <- 1 VSConstants.S_OK - override this.GetColorableItem(index, colorableItem) = + override this.GetColorableItem(_, colorableItem) = colorableItem <- Helpers.FsiKeyword VSConstants.S_OK diff --git a/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs b/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs index bbe816faf91..7c9686ac87c 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiPackageHooks.fs @@ -37,7 +37,7 @@ module internal Hooks = () // Show the ToolWindow, e.g. as a result of the Menu button click. - let ShowToolWindow (this:Package) (sender:obj) (e:EventArgs) = + let ShowToolWindow (this:Package) (_:obj) (_:EventArgs) = try // Get the instance number 0 of this tool window. // The window is single instance so this instance will be the only one. @@ -81,10 +81,10 @@ module internal Hooks = queryFSIToolWindow false this (fun window -> window.GetDebuggerState()) FsiDebuggerState.AttachedNotToFSI // FxCop request this function not be public - let private supportWhenFSharpDocument (sender:obj) (e:EventArgs) = + let private supportWhenFSharpDocument (sender:obj) (_:EventArgs) = let command = sender :?> OleMenuCommand if command <> null then - let looksLikeFSharp,haveSelection = + let looksLikeFSharp,_ = try // catch all exceptions from this block let providerGlobal = Package.GetGlobalService(typeof) :?> IOleServiceProvider let provider = new ServiceProvider(providerGlobal) :> System.IServiceProvider diff --git a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs index eae479ef9e2..dec3fe9208c 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs @@ -62,7 +62,7 @@ module internal Locals = /// Complexity: this code is linear in (length kxs). let chunkKeyValues allEntries = allEntries - |> List.groupBy(fun (responseType, line) -> responseType) + |> List.groupBy(fun (responseType, _) -> responseType) |> List.map(fun (responseType, entries) -> (responseType, entries |> List.map(fun (_, line) -> line))) @@ -124,7 +124,7 @@ type internal FsiToolWindow() as this = // Create the stream on top of the text buffer. let textStream = new TextBufferStream(textViewAdapter.GetDataBuffer(textLines), contentTypeRegistry) let synchronizationContext = System.Threading.SynchronizationContext.Current - let win32win = { new System.Windows.Forms.IWin32Window with member this.Handle = textView.GetWindowHandle()} + let _ = { new System.Windows.Forms.IWin32Window with member this.Handle = textView.GetWindowHandle()} let mutable textView = textView let mutable textLines = textLines let mutable commandService = null @@ -173,9 +173,7 @@ type internal FsiToolWindow() as this = #endif let setScrollToEndOfBuffer() = - if null <> textView then - let horizontalScrollbar = 0 - let verticalScrollbar = 1 + if null <> textView then // Make sure that the last line of the buffer is visible. [ignore errors]. let buffer = textViewAdapter.GetDataBuffer(textLines) let lastLine = buffer.CurrentSnapshot.LineCount - 1 @@ -186,10 +184,9 @@ type internal FsiToolWindow() as this = let setScrollToStartOfLine() = if null <> textView then - let horizontalScrollbar = 0 - let verticalScrollbar = 1 + let horizontalScrollbar = 0 // Make sure that the text view is showing the beginning of the new line. - let res,minUnit,maxUnit,visibleUnits,firstVisibleUnit = textView.GetScrollInfo(horizontalScrollbar) + let res,minUnit,_,_,_ = textView.GetScrollInfo(horizontalScrollbar) if ErrorHandler.Succeeded(res) then textView.SetScrollPosition(horizontalScrollbar,minUnit) |> ignore (* ignore error *) @@ -295,12 +292,6 @@ type internal FsiToolWindow() as this = textStream.DirectWriteLine() sessions.SendInput(text) setCursorAtEndOfBuffer() - - let executeText (text:string) = - textStream.DirectWriteLine() - history.Add(text) - sessions.SendInput(text) - setCursorAtEndOfBuffer() let executeUserInput() = if isCurrentPositionInInputArea() then @@ -314,13 +305,13 @@ type internal FsiToolWindow() as this = // NOTE: SupportWhen* functions are guard conditions for command handlers /// Supported command when input is permitted. - let supportWhenInInputArea (sender:obj) (args:EventArgs) = + let supportWhenInInputArea (sender:obj) (_:EventArgs) = let command = sender :?> MenuCommand if null <> command then // are these null checks needed? command.Supported <- not source.IsCompletorActive && isCurrentPositionInInputArea() /// Support command except when completion is active. - let supportUnlessCompleting (sender:obj) (args:EventArgs) = + let supportUnlessCompleting (sender:obj) (_:EventArgs) = let command = sender :?> MenuCommand if null <> command then command.Supported <- not source.IsCompletorActive @@ -330,13 +321,13 @@ type internal FsiToolWindow() as this = (res = VSConstants.S_OK && text.Length>0) /// Support when at the start of the input area (e.g. to enable NoAction on LEFT). - let supportWhenAtStartOfInputArea (sender:obj) (e:EventArgs) = + let supportWhenAtStartOfInputArea (sender:obj) (_:EventArgs) = let command = sender :?> MenuCommand if command <> null then command.Supported <- isCurrentPositionAtStartOfInputArea() /// Support when at the start of the input area AND no-selection (e.g. to enable NoAction on BACKSPACE). - let supportWhenAtStartOfInputAreaAndNoSelection (sender:obj) (e:EventArgs) = + let supportWhenAtStartOfInputAreaAndNoSelection (sender:obj) (_:EventArgs) = let command = sender :?> MenuCommand if command <> null then command.Supported <- isCurrentPositionAtStartOfInputArea() && not (haveTextViewSelection()) @@ -349,8 +340,8 @@ type internal FsiToolWindow() as this = // NOTE: On* are command handlers. /// Handles HOME command, move to either start of line (or end of read only region is applicable). - let onHome (sender:obj) (e:EventArgs) = - let currentLine,currentColumn = textView.GetCaretPos() |> throwOnFailure2 + let onHome (_:obj) (_:EventArgs) = + let currentLine,_ = textView.GetCaretPos() |> throwOnFailure2 let span = textStream.ReadOnlyMarkerSpan if currentLine = span.iEndLine then textView.SetCaretPos(currentLine,span.iEndIndex) |> throwOnFailure0 @@ -358,7 +349,7 @@ type internal FsiToolWindow() as this = textView.SetCaretPos(currentLine,0) |> throwOnFailure0 /// Handle 'Shift' + 'HOME', move to start of line (or end or readonly area if applicable). - let onShiftHome (sender:obj) (args:EventArgs) = + let onShiftHome (_:obj) (_:EventArgs) = let line,endColumn = textView.GetCaretPos() |> throwOnFailure2 let span = textStream.ReadOnlyMarkerSpan let startColumn = @@ -369,11 +360,11 @@ type internal FsiToolWindow() as this = textView.SetSelection(line, endColumn, line, startColumn) |> throwOnFailure0 /// Hanlde no-op, used to overwrite some standard command with an empty action. - let onNoAction (sender:obj) (e:EventArgs) = () + let onNoAction (_:obj) (_:EventArgs) = () /// Handle "Clear Pane". Clear input and all but the last ReadOnly line (probably the prompt). - let onClearPane (sender:obj) (args:EventArgs) = + let onClearPane (_:obj) (_:EventArgs) = lock textLines (fun () -> // ReadOnly off, then upto the last line and then the input area, then ReadOnly on. let span = textStream.ReadOnlyMarkerSpan @@ -392,7 +383,7 @@ type internal FsiToolWindow() as this = clearUndoStack textLines // ClearPane should not be an undo-able operation ) - let showContextMenu (sender:obj) (args:EventArgs) = + let showContextMenu (_:obj) (_:EventArgs) = let uiShell = provider.GetService(typeof) :?> IVsUIShell if null <> uiShell then let pt = System.Windows.Forms.Cursor.Position @@ -400,10 +391,10 @@ type internal FsiToolWindow() as this = let mutable menuGuid = Guids.guidFsiConsoleCmdSet uiShell.ShowContextMenu(0u,&menuGuid, int32 Guids.cmdIDFsiConsoleContextMenu, pnts, (textView :?> IOleCommandTarget)) |> ignore // SDK doc says result is void not int? - let onInterrupt (sender:obj) (args:EventArgs) = + let onInterrupt (_:obj) (_:EventArgs) = sessions.Interrupt() |> ignore - let onRestart (sender:obj) (args:EventArgs) = + let onRestart (_:obj) (_:EventArgs) = sessions.Kill() // When Kill() returns there should be no more output/events from that session flushResponseBuffer() // flush output and errors from the killed session that have been buffered, but have not yet come through. lock textLines (fun () -> @@ -417,7 +408,7 @@ type internal FsiToolWindow() as this = sessions.Restart() /// Handle RETURN, unless Intelisense completion is in progress. - let onReturn (sender:obj) (e:EventArgs) = + let onReturn (_:obj) (_:EventArgs) = lock textLines (fun () -> if not sessions.Alive then sessions.Restart() @@ -506,12 +497,12 @@ type internal FsiToolWindow() as this = // if user picks YES, allow debugging anyways result = Microsoft.VisualStudio.PlatformUI.MessageDialogCommand.Yes - let onAttachDebugger (sender:obj) (args:EventArgs) = + let onAttachDebugger (_:obj) (_:EventArgs) = if checkDebuggability() then attachDebugger() showNoActivate() - let onDetachDebugger (sender:obj) (args:EventArgs) = + let onDetachDebugger (_:obj) (_:EventArgs) = detachDebugger() showNoActivate() @@ -564,19 +555,19 @@ type internal FsiToolWindow() as this = // REVIEW: log error into Trace. // Example errors include no active document. - let onMLSendSelection (sender:obj) (e:EventArgs) = + let onMLSendSelection (_:obj) (_:EventArgs) = sendSelectionToFSI ExecuteSelection - let onMLSendLine (sender:obj) (e:EventArgs) = + let onMLSendLine (_:obj) (_:EventArgs) = sendSelectionToFSI ExecuteLine - let onMLDebugSelection (sender:obj) (e:EventArgs) = + let onMLDebugSelection (_:obj) (_:EventArgs) = if checkDebuggability () then attachDebugger () sendSelectionToFSI DebugSelection /// Handle UP and DOWN. Cycle history. - let onHistory (sender:obj) (e:EventArgs) = + let onHistory (sender:obj) (_:EventArgs) = let command = sender :?> OleMenuCommand if null <> command && command.CommandID.Guid = typeof.GUID then // sanity check command and it's group @@ -728,7 +719,6 @@ type internal FsiToolWindow() as this = interface ITestVFSI with /// Send a string; the ';;' will be added to the end; does not interact with history member this.SendTextInteraction(s:string) = - let dummyLineNum = 1 executeInteraction false (System.IO.Path.GetTempPath()) "DummyTestFilename.fs" 1 s /// Returns the n most recent lines in the view. After SendTextInteraction, can poll for a prompt to know when interaction finished. member this.GetMostRecentLines(n:int) : string[] = diff --git a/vsintegration/src/FSharp.VS.FSI/fsiTextBufferStream.fs b/vsintegration/src/FSharp.VS.FSI/fsiTextBufferStream.fs index 6bcac8c608e..b2144fc1905 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiTextBufferStream.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiTextBufferStream.fs @@ -25,7 +25,7 @@ open Microsoft.VisualStudio.Utilities // It provides the API for writing directly to the read-only part of the buffer. // It extends the read-only marker on the buffer (making the written text read-only). // -type internal TextBufferStream(textLines:ITextBuffer, contentTypeRegistry: IContentTypeRegistryService) = +type internal TextBufferStream(textLines:ITextBuffer, _contentTypeRegistry: IContentTypeRegistryService) = do if null = textLines then raise (new ArgumentNullException("textLines")) // The following line causes unhandled excepiton on a background thread, see https://github.com/Microsoft/visualfsharp/issues/2318#issuecomment-279340343 // It seems we should provide a Quick Info Provider at the same time as uncommenting it. diff --git a/vsintegration/src/FSharp.VS.FSI/sessions.fs b/vsintegration/src/FSharp.VS.FSI/sessions.fs index 96585aafcc6..095d3d8bd27 100644 --- a/vsintegration/src/FSharp.VS.FSI/sessions.fs +++ b/vsintegration/src/FSharp.VS.FSI/sessions.fs @@ -25,13 +25,13 @@ type internal EventWrapper() = let mutable disposed = false - member this.Set() = + member _.Set() = lock guard (fun () -> if not disposed then waitHandle.Set() |> ignore) - member this.Dispose() = + member _.Dispose() = lock guard (fun () -> disposed <- true; (waitHandle :> IDisposable).Dispose()) - member this.WaitOne(timeout : int) = + member _.WaitOne(timeout : int) = waitHandle.WaitOne(timeout, true) interface IDisposable with @@ -40,7 +40,7 @@ type internal EventWrapper() = /// Run function application return Some (f x) or None if execution exceeds timeout (in ms). /// Exceptions raised by f x are caught and reported in DEBUG mode. -let timeoutApp descr timeoutMS (f : 'a -> 'b) (arg:'a) = +let timeoutApp _descr timeoutMS (f : 'a -> 'b) (arg:'a) = use ev = new EventWrapper() let mutable r = None System.Threading.ThreadPool.QueueUserWorkItem(fun _ -> @@ -56,7 +56,7 @@ let timeoutApp descr timeoutMS (f : 'a -> 'b) (arg:'a) = "fsi.exe starts the remoting server at the end of it's initialisation sequence.\n" + "The initialisation sequence takes an observable time (e.g. 2 seconds).\n" + "Remoting exceptions are to be expected on interupt/intelisense calls made before that point.\n" + - "Context: " + descr + "\n" + + "Context: " + _descr + "\n" + "Exception: " + e.ToString()) |> ignore #endif None @@ -255,7 +255,7 @@ let fsiStartInfo channelName = procInfo -let nonNull = function null -> false | (s:string) -> true +let nonNull = function null -> false | (_:string) -> true /// Represents an active F# Interactive process to which Visual Studio is connected via stdin/stdout/stderr and a remoting channel type FsiSession() = diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs index 7c36d8f37e1..6d5b00162a5 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs @@ -44,7 +44,7 @@ module internal TPModule = // THe instantiated type has a static property that evaluates to the param passed let instantiateParametricType (typeName:string) (args:System.Object[]) = match args with - [| :? string as value; :? int as ignoredvalue; |] -> + [| :? string as value; :? int |] -> let typeParam = ProvidedTypeDefinition(thisAssembly,namespaceName, typeName, Some typeof) let propParam = ProvidedProperty("Param1", typeof, IsStatic = true, @@ -212,7 +212,7 @@ module TypeProviderThatThrowsErrorsModule = let parameter = ProvidedStaticParameter("N", typeof) t.DefineStaticParameters( parameters = [parameter], - instantiationFunction = fun name args -> + instantiationFunction = fun _ args -> match args with | [|:? int as n|] when n > 0 -> let errors = Seq.init n (sprintf "Error %d" >> Failure) @@ -450,7 +450,7 @@ module RegexTypeProvider = // Declare a constructor let ctor = ProvidedConstructor( parameters = [], - InvokeCode = fun args -> <@@ Regex(pattern) :> obj @@>) + InvokeCode = fun _ -> <@@ Regex(pattern) :> obj @@>) // Add documentation to the constructor ctor.AddXmlDoc "Initializes a regular expression instance" @@ -484,13 +484,13 @@ module RegexTypeProviderUsingMethod = instantiationFunction=(fun methName parameterValues -> match parameterValues with - | [| :? string as pattern1 |] -> + | [| :? string |] -> let isMatch = ProvidedMethod( methodName = methName, parameters = [ProvidedParameter("input", typeof)], returnType = typeof, IsStaticMethod = true, - InvokeCode = fun args -> <@@ true @@>) + InvokeCode = fun _ -> <@@ true @@>) isMatch.AddXmlDoc "Indicates whether the regular expression finds a match in the specified input string" regexTyStatic.AddMember isMatch diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj index 5bdfd8af56f..ad160ce1946 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fsproj @@ -5,7 +5,7 @@ net472 true - --nowarn:3390 --nowarn:3218 + --nowarn:3390 --nowarn:3218 --nowarn:1182 diff --git a/vsintegration/tests/Salsa/VsMocks.fs b/vsintegration/tests/Salsa/VsMocks.fs index b97fd6a1e40..43299297eea 100644 --- a/vsintegration/tests/Salsa/VsMocks.fs +++ b/vsintegration/tests/Salsa/VsMocks.fs @@ -85,7 +85,7 @@ module internal VsMocks = | false, _ -> () interface IVsFileChangeEx with - member fc.AdviseFileChange(pszMkDocument,grfFilter,pFCE,vsCookie) = + member fc.AdviseFileChange(pszMkDocument,_,pFCE,vsCookie) = let pszMkDocument = Canonicalize pszMkDocument // printfn "VsMocks.VsFileChangeEx: Advise %s " pszMkDocument match fileToEvents.TryGetValue(pszMkDocument) with @@ -93,13 +93,13 @@ module internal VsMocks = | false, _ -> fileToEvents.Add(pszMkDocument, [pFCE]) vsCookie <- 0u ok - member fc.UnadviseFileChange(vsCookie) = + member fc.UnadviseFileChange(_) = // printfn "VsMocks.VsFileChangeEx: Unadvise %d " vsCookie ok - member fc.SyncFile(pszMkDocument) = notimpl() - member fc.IgnoreFile(vsCookie, pszMkDocument, fIgnore) = notimpl() - member fc.AdviseDirChange(pszDir, fWatchSubDir, pFCE,vsCookie) = notimpl() - member fc.UnadviseDirChange(vsCookie) = notimpl() + member fc.SyncFile(_) = notimpl() + member fc.IgnoreFile(_, _, _) = notimpl() + member fc.AdviseDirChange(_, _, _,_) = notimpl() + member fc.UnadviseDirChange(_) = notimpl() /// Mockable versions of various VS interfaces. Use optional function parameters /// so that we don't have to specify all of them. @@ -993,9 +993,9 @@ module internal VsMocks = member x.Shutdown() = innerLoggers |> List.iter (fun l -> l.Shutdown()) iEventSource <- null - member x.Parameters with get() = match innerLoggers with [] -> "" | h::t -> h.Parameters + member x.Parameters with get() = match innerLoggers with [] -> "" | h::_ -> h.Parameters and set(s) = innerLoggers |> List.iter (fun l -> l.Parameters <- s) - member x.Verbosity with get() = match innerLoggers with [] -> LoggerVerbosity.Normal | h::t -> h.Verbosity + member x.Verbosity with get() = match innerLoggers with [] -> LoggerVerbosity.Normal | h::_ -> h.Verbosity and set(s) = innerLoggers |> List.iter (fun l -> l.Verbosity <- s) ///////////////////////////////// diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index b4ca688c171..555408ed624 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -129,14 +129,14 @@ module internal Salsa = let oneItem (project:Project) name = match (items project name) with - head::tail -> head + head::_ -> head | _ -> "" let splitProperty (project:Project) propertyName = (prop project propertyName).Split([|';'|])|>Array.toList let boolProperty (project:Project) name = - let p = prop project name + let _ = prop project name true /// Build the given target on the given project. Return the name of the main output assembly. @@ -168,7 +168,7 @@ module internal Salsa = let project,_,_ = GetProject(projectFileName, configuration, platform) SetGlobalProperty(project, "CreateManifestResourceNamesDependsOn", "SplitResourcesByCulture") let projectInstance = project.CreateProjectInstance() - let buildResult = projectInstance.Build(targetName, project.ProjectCollection.Loggers) + let _ = projectInstance.Build(targetName, project.ProjectCollection.Loggers) let items = projectInstance.GetItems("EmbeddedResource") |> Seq.map (fun i -> i.EvaluatedInclude, i.GetMetadata("ManifestResourceName").EvaluatedValue) |> Seq.toList items @@ -251,7 +251,7 @@ module internal Salsa = timestamp <- newtimestamp prevConfig <- curConfig prevPlatform <- curPlatform - let projectObj, projectObjFlags = MSBuild.CrackProject(projectfile, prevConfig, prevPlatform) + let _, projectObjFlags = MSBuild.CrackProject(projectfile, prevConfig, prevPlatform) flags <- Some(projectObjFlags) match flags with | Some flags -> flags @@ -279,14 +279,14 @@ module internal Salsa = member this.BuildErrorReporter with get() = None and set _v = () member this.AdviseProjectSiteChanges(callbackOwnerKey,callback) = changeHandlers.[callbackOwnerKey] <- callback - member this.AdviseProjectSiteCleaned(callbackOwnerKey,callback) = () // no unit testing support here - member this.AdviseProjectSiteClosed(callbackOwnerKey,callback) = () // no unit testing support here + member this.AdviseProjectSiteCleaned(_,_) = () // no unit testing support here + member this.AdviseProjectSiteClosed(_,_) = () // no unit testing support here member this.IsIncompleteTypeCheckEnvironment = false member this.TargetFrameworkMoniker = "" member this.LoadTime = System.DateTime(2000,1,1) member this.ProjectGuid = - let projectObj, projectObjFlags = MSBuild.CrackProject(projectfile, configurationFunc(), platformFunc()) + let projectObj, _ = MSBuild.CrackProject(projectfile, configurationFunc(), platformFunc()) projectObj.GetProperty(ProjectFileConstants.ProjectGuid).EvaluatedValue member this.ProjectProvider = None @@ -612,7 +612,7 @@ module internal Salsa = versionFile, otherFlags:string, otherProjMisc:string, - targetFrameworkVersion:string) = + _:string) = // Determine which FSharp.targets file to use. If we use the installed // targets file then we check the registry for F#'s install path. Otherwise @@ -713,7 +713,7 @@ module internal Salsa = File.WriteAllText(projectName,text+"\r\n") member x.InitializeProjectHook op = openProject <- Some(op:?>IOpenProject) - member x.MakeHierarchyHook (projdir, fullname, projectname, configChangeNotifier, serviceProvider) = + member x.MakeHierarchyHook (projdir, fullname, projectname, _, _) = let projectSite = NewMSBuildProjectSite(Conf, Plat, fullname) let projectSiteFactory = { new IProvideProjectSite with member x.GetProjectSite() = (projectSite :> IProjectSite) } let hier = VsMocks.createHier(projectSiteFactory) @@ -722,7 +722,7 @@ module internal Salsa = member x.AddFileToHierarchyHook(filename, hier) = let itemid = nextItemId() VsMocks.addRootChild hier itemid filename - member x.BuildHook (baseName, target, outputWindowPane) = MSBuild.Build(baseName, (if target = null then "Build" else target), Conf(), Plat()) + member x.BuildHook (baseName, target, _) = MSBuild.Build(baseName, (if target = null then "Build" else target), Conf(), Plat()) member x.GetMainOutputAssemblyHook baseName = MSBuild.GetMainOutputAssembly(baseName, Conf(), Plat()) member x.SaveHook() = () member x.DestroyHook() = () @@ -891,7 +891,7 @@ module internal Salsa = member solution.CleanUp() = curProjects |> List.iter (fun (_,p) -> p.CleanUp()) prevProjects |> Map.toList |> List.iter (fun (_,p) -> p.CleanUp()) - member solution.OpenExistingProject behaviorHooks projdir projectname = + member solution.OpenExistingProject _ projdir projectname = let fullname = Path.Combine(projdir,projectname+".fsproj") match prevProjects.TryFind fullname with | Some(p) -> prevProjects <- prevProjects.Remove fullname @@ -1067,7 +1067,7 @@ module internal Salsa = let source = Source.CreateSourceTestable_DEPRECATED(file.RecolorizeWholeFile,file.RecolorizeLine,(fun () -> filename),file.IsClosed,project.Solution.Vs.FileChangeEx, solution.Vs.LanguageService :> IDependencyFileChangeNotify_DEPRECATED) let _,buf = view.GetBuffer() solution.Vs.AddSourceForBuffer(buf,source) - let source = solution.Vs.LanguageService.CreateSource_DEPRECATED(buf) + let _ = solution.Vs.LanguageService.CreateSource_DEPRECATED(buf) // Scan all lines with the colorizer let tcs:IVsTextColorState = downcast box(buf) @@ -1092,7 +1092,7 @@ module internal Salsa = interface File member file.DeleteFileFromDisk() = File.Delete(filename) - and internal SimpleOpenFile(project:SimpleOpenProject,filename:string,lines:string array,view:IVsTextView,scanlines:int[],rdtId) = + and internal SimpleOpenFile(project:SimpleOpenProject,filename:string,lines:string array,view:IVsTextView,scanlines:int[],_rdtId) = let mutable lines = lines let mutable scanlines = scanlines let mutable cursor:Point = {line=1;col=1} @@ -1146,7 +1146,7 @@ module internal Salsa = member file.OnIdleTypeCheck() = // Remove errors for this file only project.Errors <- project.Errors |> List.filter(fun err->err.Path <> file.Filename) - let ls = project.Solution.Vs.LanguageService + let _ = project.Solution.Vs.LanguageService // Full check. let sink = new AuthoringSink(BackgroundRequestReason.FullTypeCheck, 0, 0, maxErrors) @@ -1217,7 +1217,6 @@ module internal Salsa = member file.GetQuickInfoAndSpanAtCursor () = let currentAuthoringScope = file.DoIntellisenseRequest BackgroundRequestReason.QuickInfo - let textspan = new TextSpan () let result,textspan = currentAuthoringScope.GetDataTipText (cursor.line - 1, cursor.col - 1) let currentLineLength = lines.[cursor.line-1].Length // The new editor is less tolerant of values out of range. Enforce rigor in unittests here. @@ -1309,7 +1308,7 @@ module internal Salsa = member file.GetSquiggleAtCursor() = match file.GetSquigglesAtCursor() with | [] -> None - | h::t -> Some h // arbitrarily pick one + | h::_ -> Some h // arbitrarily pick one member file.AutoCompleteAtCursorImpl(reason, ?filterText) = let filterText = defaultArg filterText "" let currentAuthoringScope = file.DoIntellisenseRequest(reason) @@ -1342,7 +1341,7 @@ module internal Salsa = let (index, uniqueMatch, prefixMatch) = declarations.GetBestMatch(filterText, text) Some (declarations.GetName(filterText,index), uniqueMatch, prefixMatch) - member file.GotoDefinitionAtCursor (forceGen : bool) = + member file.GotoDefinitionAtCursor (_ : bool) = file.EnsureInitiallyFocusedInVs () let row = cursor.line - 1 let col = cursor.col - 1 diff --git a/vsintegration/tests/UnitTests/BraceMatchingServiceTests.fs b/vsintegration/tests/UnitTests/BraceMatchingServiceTests.fs index 67d8f88b882..3e1d4cfb3d9 100644 --- a/vsintegration/tests/UnitTests/BraceMatchingServiceTests.fs +++ b/vsintegration/tests/UnitTests/BraceMatchingServiceTests.fs @@ -40,7 +40,7 @@ type BraceMatchingServiceTests() = let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions projectOptions match FSharpBraceMatchingService.GetBraceMatchingResult(checker, sourceText, fileName, parsingOptions, position, "UnitTest") |> Async.RunSynchronously with | None -> () - | Some(left, right) -> Assert.Fail("Found match for brace '{0}'", marker) + | Some(_, _) -> Assert.Fail("Found match for brace '{0}'", marker) member private this.VerifyBraceMatch(fileContents: string, startMarker: string, endMarker: string) = let sourceText = SourceText.From(fileContents) diff --git a/vsintegration/tests/UnitTests/DocumentDiagnosticAnalyzerTests.fs b/vsintegration/tests/UnitTests/DocumentDiagnosticAnalyzerTests.fs index 6fb3909079a..c56d3ab1441 100644 --- a/vsintegration/tests/UnitTests/DocumentDiagnosticAnalyzerTests.fs +++ b/vsintegration/tests/UnitTests/DocumentDiagnosticAnalyzerTests.fs @@ -48,10 +48,11 @@ type DocumentDiagnosticAnalyzerTests() = } |> Async.RunSynchronously member private this.VerifyNoErrors(fileContents: string, ?additionalFlags: string[]) = - let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions projectOptions - let additionalOptions = match additionalFlags with - | None -> projectOptions - | Some(flags) -> {projectOptions with OtherOptions = Array.append projectOptions.OtherOptions flags} + let _, _ = checker.GetParsingOptionsFromProjectOptions projectOptions + let _ = + match additionalFlags with + | None -> projectOptions + | Some(flags) -> {projectOptions with OtherOptions = Array.append projectOptions.OtherOptions flags} let errors = getDiagnostics fileContents Assert.AreEqual(0, errors.Length, "There should be no errors generated") diff --git a/vsintegration/tests/UnitTests/DocumentHighlightsServiceTests.fs b/vsintegration/tests/UnitTests/DocumentHighlightsServiceTests.fs index 07d4eed0756..2e22c1805b9 100644 --- a/vsintegration/tests/UnitTests/DocumentHighlightsServiceTests.fs +++ b/vsintegration/tests/UnitTests/DocumentHighlightsServiceTests.fs @@ -88,7 +88,6 @@ let ShouldHighlightAllQualifiedSymbolReferences() = """ let sourceText = SourceText.From(fileContents) let caretPosition = fileContents.IndexOf("DateTime") + 1 - let documentId = DocumentId.CreateNewId(ProjectId.CreateNewId()) let spans = getSpans sourceText caretPosition @@ -99,7 +98,6 @@ let ShouldHighlightAllQualifiedSymbolReferences() = Assert.AreEqual(expected, spans) let caretPosition = fileContents.IndexOf("Now") + 1 - let documentId = DocumentId.CreateNewId(ProjectId.CreateNewId()) let spans = getSpans sourceText caretPosition let expected = [| span sourceText false (2, 28) (2, 31) |] diff --git a/vsintegration/tests/UnitTests/EditorFormattingServiceTests.fs b/vsintegration/tests/UnitTests/EditorFormattingServiceTests.fs index 3a5b70f2051..c58e195ffd0 100644 --- a/vsintegration/tests/UnitTests/EditorFormattingServiceTests.fs +++ b/vsintegration/tests/UnitTests/EditorFormattingServiceTests.fs @@ -52,18 +52,6 @@ let def = "hi" )marker4 """ - - let pasteTemplate = """ - -let foo = - printfn "Something here" - marker1 - -marker2 - - marker3 - -marker4""" [] [] diff --git a/vsintegration/tests/UnitTests/FsxCompletionProviderTests.fs b/vsintegration/tests/UnitTests/FsxCompletionProviderTests.fs index 468c916dc95..5ec3f0a8843 100644 --- a/vsintegration/tests/UnitTests/FsxCompletionProviderTests.fs +++ b/vsintegration/tests/UnitTests/FsxCompletionProviderTests.fs @@ -56,56 +56,6 @@ type Worker () = Stamp = None } - let formatCompletions(completions : string seq) = - "\n\t" + String.Join("\n\t", completions) - - let VerifyCompletionList(fileContents: string, marker: string, expected: string list, unexpected: string list) = - let caretPosition = fileContents.IndexOf(marker) + marker.Length - let results = - FSharpCompletionProvider.ProvideCompletionsAsyncAux(checker, SourceText.From(fileContents), caretPosition, projectOptions, filePath, 0, (fun _ -> []), LanguageServicePerformanceOptions.Default, IntelliSenseOptions.Default) - |> Async.RunSynchronously - |> Option.defaultValue (ResizeArray()) - |> Seq.map(fun result -> result.DisplayText) - - let expectedFound = - expected - |> Seq.filter results.Contains - - let expectedNotFound = - expected - |> Seq.filter (expectedFound.Contains >> not) - - let unexpectedNotFound = - unexpected - |> Seq.filter (results.Contains >> not) - - let unexpectedFound = - unexpected - |> Seq.filter (unexpectedNotFound.Contains >> not) - - // If either of these are true, then the test fails. - let hasExpectedNotFound = not (Seq.isEmpty expectedNotFound) - let hasUnexpectedFound = not (Seq.isEmpty unexpectedFound) - - if hasExpectedNotFound || hasUnexpectedFound then - let expectedNotFoundMsg = - if hasExpectedNotFound then - sprintf "\nExpected completions not found:%s\n" (formatCompletions expectedNotFound) - else - String.Empty - - let unexpectedFoundMsg = - if hasUnexpectedFound then - sprintf "\nUnexpected completions found:%s\n" (formatCompletions unexpectedFound) - else - String.Empty - - let completionsMsg = sprintf "\nin Completions:%s" (formatCompletions results) - - let msg = sprintf "%s%s%s" expectedNotFoundMsg unexpectedFoundMsg completionsMsg - - Assert.Fail(msg) - member __.VerifyCompletionListExactly(fileContents: string, marker: string, expected: List) = let caretPosition = fileContents.IndexOf(marker) + marker.Length diff --git a/vsintegration/tests/UnitTests/IndentationServiceTests.fs b/vsintegration/tests/UnitTests/IndentationServiceTests.fs index a1a8cb0943f..698fe42372f 100644 --- a/vsintegration/tests/UnitTests/IndentationServiceTests.fs +++ b/vsintegration/tests/UnitTests/IndentationServiceTests.fs @@ -179,7 +179,7 @@ while true do let actualIndentation = FSharpIndentationService.GetDesiredIndentation(documentId, sourceText, filePath, lineNumber, tabSize, indentStyle, parsingOptions) match expectedIndentation with | None -> Assert.IsTrue(actualIndentation.IsNone, "No indentation was expected at line {0}", lineNumber) - | Some indentation -> Assert.AreEqual(expectedIndentation.Value, actualIndentation.Value, "Indentation on line {0} doesn't match", lineNumber) + | Some _ -> Assert.AreEqual(expectedIndentation.Value, actualIndentation.Value, "Indentation on line {0} doesn't match", lineNumber) [] member this.TestAutoIndentation() = @@ -192,4 +192,4 @@ while true do let actualIndentation = FSharpIndentationService.GetDesiredIndentation(documentId, sourceText, filePath, lineNumber, tabSize, indentStyle, parsingOptions) match expectedIndentation with | None -> Assert.IsTrue(actualIndentation.IsNone, "No indentation was expected at line {0}", lineNumber) - | Some indentation -> Assert.AreEqual(expectedIndentation.Value, actualIndentation.Value, "Indentation on line {0} doesn't match", lineNumber) + | Some _ -> Assert.AreEqual(expectedIndentation.Value, actualIndentation.Value, "Indentation on line {0} doesn't match", lineNumber) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs index 2ae86637bc1..5c388aeb1a3 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs @@ -118,11 +118,10 @@ type UsingMSBuild() as this = "distinct"; "exists"; "find"; "all"; "head"; "nth"; "skip"; "skipWhile"; "sumBy"; "take" "takeWhile"; "sortByNullable"; "sortByNullableDescending"; "thenByNullable"; "thenByNullableDescending"] - let AA l = Some(System.IO.Path.Combine(System.IO.Path.GetTempPath(), ".NETFramework,Version=v4.0.AssemblyAttributes.fs")), l let notAA l = None,l let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a _ = ResetStopWatch() let result = op a //printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds @@ -135,7 +134,7 @@ type UsingMSBuild() as this = // There are some dot completion tests in this type as well, in the systematic tests for queries member private this.VerifyDotCompListContainAllAtStartOfMarker(fileContents : string, marker : string, list :string list, ?addtlRefAssy:list, ?coffeeBreak:bool) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) //to add references if defaultArg coffeeBreak false then TakeCoffeeBreak(this.VS) @@ -144,7 +143,7 @@ type UsingMSBuild() as this = // There are some quickinfo tests in this file as well, in the systematic tests for queries member public this.InfoInDeclarationTestQuickInfoImpl(code : string,marker,expected,atStart, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(code, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(code, ?references = addtlRefAssy) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) if atStart then @@ -252,20 +251,20 @@ type UsingMSBuild() as this = /////Helper Functios //DotCompList ContainAll At End Of Marker Helper Function member private this.VerifyDotCompListContainAllAtEndOfMarker(fileContents : string, marker : string, list : string list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) let completions = DotCompletionAtEndOfMarker file marker AssertCompListContainsAll(completions, list) //DoesNotContainAny At Start Of Marker Helper Function member private this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker(fileContents : string, marker : string, list : string list, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) let completions = DotCompletionAtStartOfMarker file marker AssertCompListDoesNotContainAny(completions, list) //DotCompList Is Empty At Start Of Marker Helper Function member private this.VerifyDotCompListIsEmptyAtStartOfMarker(fileContents : string, marker : string, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) let completions = DotCompletionAtStartOfMarker file marker AssertCompListIsEmpty(completions) @@ -793,7 +792,7 @@ for i in 0..a."] for (code, marker, should, shouldnot) in useCases do let code = prologue @ [code] - let shouldnot = shouldnot @ ["abs"] + let _ = shouldnot @ ["abs"] AssertCtrlSpaceCompleteContains code marker should ["abs"] [] @@ -2431,7 +2430,7 @@ let x = new MyClass2(0) for customOperation in ["select";"skip";"contains";"groupJoin"] do printfn " Running systematic tests looking for completion of '%s' at multiple locations" customOperation for idText in strictPrefixes customOperation do - for i,fileContents in this.QueryExpressionFileExamples() |> List.mapi (fun i x -> (i,x)) do + for _,fileContents in this.QueryExpressionFileExamples() |> List.mapi (fun i x -> (i,x)) do let fileContents = fileContents.Replace("(*TYPING*)",idText+"(*Marker*)") try this.VerifyCtrlSpaceListContainAllAtStartOfMarker( @@ -2584,7 +2583,7 @@ let aaaaaa = 0 "NoClosingBrace,NextDefinition", " \nlet nextDefinition () = 1\n"; "NoClosingBrace,NextTypeDefinition", " \ntype NextDefinition() = member x.P = 1\n" ] - let lines b = + let lines _ = [ "BL1", "let f() = seq { while abb(*C*)" , [AC "(*C*)" "abbbbc"] "BL2", "let f() = seq { while abbbbc(*D1*)" , [QI "while abbbbc" "val abbbbc"; DC "(*D1*)" "Length"] "BL3", "let f() = seq { while abbbbc(*D1*) do (*C*)" , [QI "while abbbbc" "val abbbbc"; DC "(*D1*)" "Length"; AC "(*C*)" "abbbbc"] @@ -2626,7 +2625,7 @@ let aaaaaa = 0 "NoClosingBrace,NextDefinition", " \nlet nextDefinition () = 1\n"; "NoClosingBrace,NextTypeDefinition", " \ntype NextDefinition() = member x.P = 1\n" ] - let lines b = + let lines _ = [ "CL1", "let x = query { for bbbb in abbbbc(*D0*) do join " , [QI "for bbbb" "val bbbb"; QI "in abbbbc" "val abbbbc"; DC "(*D0*)" "Length"; QI "join" "join"] "CL2", "let x = query { for bbbb in abbbbc(*D0*) do join cccc " , [QI "for bbbb" "val bbbb"; QI "in abbbbc" "val abbbbc"; DC "(*D0*)" "Length"; QI "join" "join"] "CL2a", "let x = query { for bbbb in abbbbc(*D0*) do join cccc )" , [QI "for bbbb" "val bbbb"; QI "in abbbbc" "val abbbbc"; DC "(*D0*)" "Length"; QI "join" "join"] @@ -2680,7 +2679,7 @@ let aaaaaa = 0 "NoClosingBrace,NextDefinition", " \nlet nextDefinition () = 1\n"; "NoClosingBrace,NextTypeDefinition", " \ntype NextDefinition() = member x.P = 1\n" ] - let lines b = + let lines _ = [ "DL1", """ let x = query { for bbbb in abbbbc(*D0*) do join @@ -3157,7 +3156,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " arr.[0]." ] let (_, _, file) = this.CreateSingleFileProject(code) TakeCoffeeBreak(this.VS) - let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) + let _ = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file, "arr.[0].") let completions = AutoCompleteAtCursor file AssertCompListContainsExactly(completions, []) // we don't want any completions on . when has unknown type due to errors @@ -4390,7 +4389,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ") - let file = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "(*marker*) " ]) @@ -4505,14 +4504,14 @@ let x = query { for bbbb in abbbbc(*D0*) do let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", [""]) - let file1 = OpenFile(project,"File1.fs") + let _ = AddFileFromText(project,"File1.fs", [""]) + let _ = OpenFile(project,"File1.fs") //file1. - let file2 = AddFileFromText(project,"File2.fs", ["let x = 4"; "x."]) + let _ = AddFileFromText(project,"File2.fs", ["let x = 4"; "x."]) let file2 = OpenFile(project,"File2.fs") - let file3 = AddFileFromText(project,"File3.fs", [""]) + let _ = AddFileFromText(project,"File3.fs", [""]) let file3 = OpenFile(project,"File3.fs") // ensure that the incremental builder is running @@ -4537,7 +4536,7 @@ let x = query { for bbbb in abbbbc(*D0*) do use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "let y = System.Deployment.Application." "()"]) @@ -4565,7 +4564,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ") - let file = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "let y = System.Deployment.Application." "()"]) @@ -4593,7 +4592,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ") SetConfigurationAndPlatform(project, "Debug|AnyCPU") - let file = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "let y = System.Deployment.Application." "()"]) @@ -4639,7 +4638,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let project = CreateProject(solution,"testproject") - let file = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "let y = System.Deployment.Application." "()"]) @@ -4979,7 +4978,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem("Tail" as name,_,_,_,decl) -> count<-count + 1 AssertIsDecl(name,decl,DeclarationType.Property) - | CompletionItem(name,_,_,_,x) -> () + | CompletionItem(_,_,_,_,_) -> () Assert.AreEqual(2,count) @@ -5003,7 +5002,7 @@ let x = query { for bbbb in abbbbc(*D0*) do match completion with | CompletionItem("BackgroundColor" as name,_,_,_,decl) -> AssertIsDecl(name,decl,DeclarationType.Property) | CompletionItem("CancelKeyEvent" as name,_,_,_,decl) -> AssertIsDecl(name,decl,DeclarationType.Event) - | CompletionItem(name,_,_,_,x) -> () + | CompletionItem(_,_,_,_,_) -> () // Test completions in an incomplete computation expression (case 1: for "let") [] @@ -5071,8 +5070,8 @@ let x = query { for bbbb in abbbbc(*D0*) do let solution = this.CreateSolution() let projName = "testproject" let project = CreateProject(solution,projName) - let dir = ProjectDirectory(project) - let file1 = AddFileFromText(project,"File1.fs", + let _ = ProjectDirectory(project) + let _ = AddFileFromText(project,"File1.fs", [ "module File1" "#if COMPILED" @@ -5081,7 +5080,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "let y = 1" "#endif" ]) - let file2 = AddFileFromText(project,"File2.fs", + let _ = AddFileFromText(project,"File2.fs", [ "module File2" "File1." @@ -5105,7 +5104,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let projName = "testproject" let project = CreateProject(solution,projName) let dir = ProjectDirectory(project) - let file = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "let x = 0" "let y = x." @@ -5116,7 +5115,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // printf "Completions=%A\n" completions Assert.IsTrue(completions.Length>0) this.CloseSolution(solution) - let project,solution = OpenExistingProject(this.VS, dir, projName) + let project,_ = OpenExistingProject(this.VS, dir, projName) let file = List.item 0 (GetOpenFiles(project)) MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." @@ -5193,27 +5192,21 @@ let x = query { for bbbb in abbbbc(*D0*) do //*********************************************Previous Completion test and helper***** - member private this.VerifyCompListDoesNotContainAnyAtStartOfMarker(fileContents : string, marker : string, list : string list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) - MoveCursorToStartOfMarker(file, marker) - let completions = AutoCompleteAtCursor(file) - AssertCompListDoesNotContainAny(completions,list) - member private this.VerifyCtrlSpaceListDoesNotContainAnyAtStartOfMarker(fileContents : string, marker : string, list : string list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToStartOfMarker(file, marker) let completions = CtrlSpaceCompleteAtCursor file AssertCompListDoesNotContainAny(completions,list) member private this.VerifyCompListContainAllAtStartOfMarker(fileContents : string, marker : string, list : string list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToStartOfMarker(file, marker) let completions = AutoCompleteAtCursor(file) AssertCompListContainsAll(completions, list) member private this.VerifyCtrlSpaceListContainAllAtStartOfMarker(fileContents : string, marker : string, list : string list, ?coffeeBreak:bool, ?addtlRefAssy:list) = let coffeeBreak = defaultArg coffeeBreak false - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToStartOfMarker(file, marker) if coffeeBreak then TakeCoffeeBreak(this.VS) let completions = CtrlSpaceCompleteAtCursor file @@ -5221,13 +5214,13 @@ let x = query { for bbbb in abbbbc(*D0*) do member private this.VerifyAutoCompListIsEmptyAtEndOfMarker(fileContents : string, marker : string) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file, marker) let completions = AutoCompleteAtCursor(file) AssertEqual(0,completions.Length) member private this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker(fileContents : string, marker : string) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file, marker) let completions = CtrlSpaceCompleteAtCursor(file) AssertEqual(0,completions.Length) @@ -5761,7 +5754,7 @@ let x = query { for bbbb in abbbbc(*D0*) do val x:int = 1 x(*MarkerInsideaSignatureFile*) """ - let (solution, project, openfile) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSI) + let (_, _, openfile) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSI) let completions = DotCompletionAtStartOfMarker openfile "(*MarkerInsideaSignatureFile*)" AssertCompListContainsAll(completions, []) // .fsi will not contain completions for this (it doesn't make sense) @@ -5770,7 +5763,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let i = 1 i(*MarkerInsideSourceFile*) """ - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) let completions = DotCompletionAtStartOfMarker file "(*MarkerInsideSourceFile*)" AssertCompListContainsAll(completions, ["CompareTo"; "Equals"]) @@ -5795,7 +5788,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "System.Numerics" // code uses bigint ] - let (solution, project, file) = this.CreateSingleFileProject(fileContents, references = references) + let (_, _, file) = this.CreateSingleFileProject(fileContents, references = references) let completions = DotCompletionAtStartOfMarker file "(*Mupcast*)" AssertCompListContainsAll(completions, ["Name"; "Speak"]) @@ -6887,7 +6880,7 @@ let rec f l = let tn = new TreeNode("") tn.Nodes(*Marker1*)""" - let (solution, project, file) = this.CreateSingleFileProject(fileContents, references = ["System.Windows.Forms"]) + let (_, _, file) = this.CreateSingleFileProject(fileContents, references = ["System.Windows.Forms"]) let completions = DotCompletionAtStartOfMarker file "(*Marker1*)" AssertCompListDoesNotContainAny(completions, ["Nodes"]) @@ -6928,7 +6921,7 @@ let rec f l = let type1 = typeof """ - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) //Completion list Not comes up after DUType parameter let completions = DotCompletionAtStartOfMarker file "(*MarkerDUTypeParam*)" @@ -7041,7 +7034,7 @@ let rec f l = type testattribute() = member x.Empty = 0 """ - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) //Completion List----where completion list does not come up let completions = DotCompletionAtStartOfMarker file "(*Mattribute1*)" @@ -7064,7 +7057,7 @@ let rec f l = let x = "System.Console(*Minstring*)" """ - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, _, file) = this.CreateSingleFileProject(fileContents) // description="Completion List----where completion list does not come up @@ -7882,10 +7875,10 @@ let rec f l = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") this.AddAssemblyReference(project, "System.Xml.Linq") - let file1 = AddFileFromTextBlob(project,"File1.fs",datacode) + let _ = AddFileFromTextBlob(project,"File1.fs",datacode) //build - let file2 = AddFileFromTextBlob(project,"File2.fs",fileContents) - let file1 = OpenFile(project,"File1.fs") + let _ = AddFileFromTextBlob(project,"File2.fs",fileContents) + let _ = OpenFile(project,"File1.fs") let file2 = OpenFile(project,"File2.fs") TakeCoffeeBreak(this.VS) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs index a308bec56aa..ff96f9804b1 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs @@ -43,7 +43,7 @@ type UsingMSBuild() as this = yield error] let CheckErrorList (content : string) f : unit = - let (_, project, file) = this.CreateSingleFileProject(content) + let (_, project, _) = this.CreateSingleFileProject(content) Build(project) |> ignore TakeCoffeeBreak(this.VS) @@ -77,7 +77,7 @@ type UsingMSBuild() as this = //verify the error list Count member private this.VerifyErrorListCountAtOpenProject(fileContents : string, num : int) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, project, _) = this.CreateSingleFileProject(fileContents) let errorList = GetErrors(project) let errorTexts = new System.Text.StringBuilder() for error in errorList do @@ -95,7 +95,7 @@ type UsingMSBuild() as this = //Verify the warning list Count member private this.VerifyWarningListCountAtOpenProject(fileContents : string, expectedNum : int, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, project, _) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) @@ -103,7 +103,7 @@ type UsingMSBuild() as this = //verify no the error list member private this.VerifyNoErrorListAtOpenProject(fileContents : string, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, project, _) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let errorList = GetErrors(project) @@ -114,7 +114,7 @@ type UsingMSBuild() as this = //Verify the error list containd the expected string member private this.VerifyErrorListContainedExpectedString(fileContents : string, expectedStr : string, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, project, _) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. @@ -154,7 +154,7 @@ let g (t : T) = t.Count() [] member public this.``ErrorsInScriptFile``() = - let (solution, project, file) = this.CreateSingleFileProject("", fileKind = SourceFileKind.FSX) + let (_, project, file) = this.CreateSingleFileProject("", fileKind = SourceFileKind.FSX) let checkErrors expected = let l = List.length (GetErrors project) @@ -190,7 +190,7 @@ let g (t : T) = t.Count() let _ = AddFileFromTextBlob(project, "File1.fs", "namespace LineDirectives") let _ = AddFileFromTextBlob(project,"File2.fs", fileContents) - let file = OpenFile(project, "File1.fs") + let _ = OpenFile(project, "File1.fs") let _ = OpenFile(project,"File2.fs") Assert.IsFalse(Build(project).BuildSucceeded) @@ -231,7 +231,7 @@ let x = query { match errors with | [err] -> Assert.AreEqual("Invalid join relation in 'groupJoin'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) - | errs -> + | _ -> Assert.Fail("Unexpected content of error list") [] @@ -248,7 +248,7 @@ let t = match errors with | [err] -> Assert.AreEqual("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) - | errs -> + | _ -> Assert.Fail("Unexpected content of error list") [] @@ -265,7 +265,7 @@ let t = match errors with | [err] -> Assert.AreEqual("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) - | errs -> + | _ -> Assert.Fail("Unexpected content of error list") @@ -284,7 +284,7 @@ let x = match errors with | [err] -> Assert.AreEqual("Invalid join relation in 'join'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) - | errs -> + | _ -> Assert.Fail("Unexpected content of error list") [] @@ -407,7 +407,7 @@ type staticInInterface = let checkList n = printfn "===TypeProvider.MultipleErrors: %d===" n let content = sprintf "type Err = TPErrors.TP<%d>" n - let (solution, project, file) = this.CreateSingleFileProject(content, references = [tpRef]) + let (_, project, _) = this.CreateSingleFileProject(content, references = [tpRef]) TakeCoffeeBreak(this.VS) let errorList = GetErrors(project) @@ -564,7 +564,7 @@ but here has type let fn x = 0 let y = fn 1""" // Turn off the "Obsolete" warning. - let (solution, project, file) = this.CreateSingleFileProject(fileContent, disabledWarnings = ["44"]) + let (_, project, _) = this.CreateSingleFileProject(fileContent, disabledWarnings = ["44"]) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let errorList = GetErrors(project) @@ -579,8 +579,8 @@ but here has type let _ = AddFileFromTextBlob(project,"新規baProgram.fsi","") let _ = AddFileFromTextBlob(project,"新規bcrogram.fs","") - let file = OpenFile(project,"新規baProgram.fsi") - let file = OpenFile(project,"新規bcrogram.fs") + let _ = OpenFile(project,"新規baProgram.fsi") + let _ = OpenFile(project,"新規bcrogram.fs") Assert.IsFalse(Build(project).BuildSucceeded) Assert.IsTrue(GetErrors(project) @@ -606,8 +606,8 @@ but here has type let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") SetVersionFile(project,"nonexistent") - let file = AddFileFromText(project,"File1.fs",["#light"]) - let file = OpenFile(project,"File1.fs") + let _ = AddFileFromText(project,"File1.fs",["#light"]) + let _ = OpenFile(project,"File1.fs") TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. VerifyErrorListContainedExpectedStr("nonexistent",project) @@ -752,9 +752,9 @@ but here has type let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") let _ = AddFileFromTextBlob(project,"File1.fs",fileContents1) - let file1 = OpenFile(project,"File1.fs") + let _ = OpenFile(project,"File1.fs") let _ = AddFileFromTextBlob(project,"File2.fs",fileContents2) - let file2 = OpenFile(project,"File2.fs") + let _ = OpenFile(project,"File2.fs") //this.VerifyErrorListNumberAtOpenProject this.VerifyCountAtSpecifiedFile(project,1) TakeCoffeeBreak(this.VS) @@ -918,7 +918,7 @@ but here has type open System mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin""" - let (_, project, file) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) + let (_, project, _) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) Assert.AreEqual(20,warnList.Length) @@ -929,7 +929,7 @@ but here has type open System //mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin //mixin mixin mixin mixin mixin mixin mixin mixin mixin mixin""" - let (_, project, file) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) + let (_, project, _) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) Assert.AreEqual(0,warnList.Length) @@ -942,7 +942,7 @@ but here has type let mutable m_age = (fun () -> x) #nowarn "47" """ - let (_, project, file) = this.CreateSingleFileProject(fileContent) + let (_, project, _) = this.CreateSingleFileProject(fileContent) Assert.IsTrue(Build(project).BuildSucceeded) TakeCoffeeBreak(this.VS) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs index 19bd078dfab..c7845fde4bb 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs @@ -19,7 +19,7 @@ type UsingMSBuild() = //Verify the error list containd the expected string member private this.VerifyErrorListContainedExpectedString(fileContents : string, expectedStr : string) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents) + let (_, project, _) = this.CreateSingleFileProject(fileContents) let errorList = GetErrors(project) let GetErrorMessages(errorList : Error list) = [ for i = 0 to errorList.Length - 1 do diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs index 7bf26561c21..c78fdc54763 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs @@ -67,43 +67,9 @@ type UsingMSBuild() = printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds result - let publicTypesInAsm(asmfile : string) = - printfn "Validating assembly '%s'" asmfile - let codeBase = (new Uri(Assembly.GetExecutingAssembly().EscapedCodeBase)).LocalPath |> Path.GetDirectoryName - let asm = Assembly.LoadFrom(Path.Combine(codeBase, asmfile)) - - // For public types that have ComVisible, validate that the constructor is internal - asm.GetTypes() - |> Seq.fold(fun n t -> - if t.IsPublic then - if Array.length (t.GetCustomAttributes(typeof, false)) > 0 then - t.GetConstructors() - |> Seq.fold(fun m c -> - if c.IsPublic then - printfn " Public type (ComVisible, public Constructor),%s" t.FullName - m + 1 - else m - ) n - else - printfn " Type: %s" t.FullName - n + 1 - else - let CVAs = t.GetCustomAttributes(typeof, false) - let CVAs = CVAs |> Array.map (fun o -> o :?> ComVisibleAttribute) - for cva in CVAs do - if cva.Value then - Assert.Fail(sprintf "Type %s is internal, but also ComVisible(true)" t.FullName) - let CIAs = t.GetCustomAttributes(typeof, false) - let CIAs = CIAs |> Array.map (fun o -> o :?> ClassInterfaceAttribute) - for cia in CIAs do - if cia.Value <> ClassInterfaceType.None then - Assert.Fail(sprintf "Type %s is internal, but also ClassInterface()" t.FullName) - n - ) 0 - [] member public this.``ReconcileErrors.Test1``() = - let (_solution, project, file) = this.CreateSingleFileProject(["erroneous"]) + let (_solution, project, _) = this.CreateSingleFileProject(["erroneous"]) Build project |> ignore TakeCoffeeBreak(this.VS) // Error list is populated on idle () @@ -115,11 +81,11 @@ type UsingMSBuild() = if OutOfConeFilesAreAddedAsLinks(this.VS) then let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromTextEx(project, @"..\LINK.FS", @"..\link.fs", BuildAction.Compile, + let _ = AddFileFromTextEx(project, @"..\LINK.FS", @"..\link.fs", BuildAction.Compile, ["#light" "type Bob() = " " let x = 1"]) - let file1 = OpenFile(project, @"..\link.fs") + let _ = OpenFile(project, @"..\link.fs") Save(project) let projFileText = System.IO.File.ReadAllText(ProjectFile(project)) AssertMatchesRegex '<' @"\s*\s*link.fs" projFileText @@ -227,14 +193,14 @@ type UsingMSBuild() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace N" "module M = " " type LineChart() =" " member x.Plot(f : float->float, xmin:float, xmax:float) = ()" " member x.Plot(f : System.Func, xmin:float, xmax:float) = ()" ]) - let fs2 = AddFileFromText(project,"File2.fs", + let _ = AddFileFromText(project,"File2.fs", ["let p = new N.M.LineChart()" "p.Plot(sin, 0., 0.)"]) let build = time1 Build project "Time to build project" diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs index 95b52add9ea..9278add8def 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs @@ -21,7 +21,7 @@ type UsingMSBuild() = //GoToDefinitionSuccess Helper Function member private this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents : string, marker : string, definitionCode : string,?addtlRefAssy : list) = - let (sln, proj, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToStartOfMarker (file, marker) let identifier = (GetIdentifierAtCursor file).Value |> fst //use marker to get the identifier @@ -54,7 +54,7 @@ type UsingMSBuild() = //GoToDefinitionFail Helper Function member private this.VerifyGoToDefnFailAtStartOfMarker(fileContents : string, marker :string, f : OpenFile * GotoDefnResult -> unit, ?addtlRefAssy : list) = - let (sln, proj, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToStartOfMarker (file, marker) let result = GotoDefinitionAtCursor file @@ -66,7 +66,7 @@ type UsingMSBuild() = // Fail at automation lab // Succeed on dev machine with enlistment installed. member private this.VerifyGoToDefnNoErrorDialogAtStartOfMarker(fileContents : string, marker :string, definitionCode : string, ?addtlRefAssy : list) = - let (sln, proj, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToStartOfMarker (file, marker) let identifier = (GetIdentifierAtCursor file).Value |> fst //use marker to get the identifier @@ -177,7 +177,7 @@ type UsingMSBuild() = // Note that the verification helped method is custom because we *do* care about the column as well, // which is something that the general purpose method in this file (surprisingly!) does not do. let VerifyGoToDefnSuccessAtStartOfMarkerColumn(fileContents : string, marker : string, definitionCode : string, typeProviderAssembly : string, columnMarker : string) = - let (sln, proj, file) = GlobalFunctions.CreateNamedSingleFileProject (this.VS, (fileContents, "File.fs")) + let (_, proj, file) = GlobalFunctions.CreateNamedSingleFileProject (this.VS, (fileContents, "File.fs")) // Add reference to the type provider this.AddAssemblyReference(proj,typeProviderAssembly) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.IncrementalBuild.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.IncrementalBuild.fs index 57f66145bfc..8d8dd2728da 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.IncrementalBuild.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.IncrementalBuild.fs @@ -98,7 +98,7 @@ type IncrementalBuild() = bound <- DoCertainStep bound let cache = TimeStampCache(System.DateTime.UtcNow) match IncrementalBuild.Step cache ctok save (Target (mapped, None)) bound |> Cancellable.runWithoutCancellation with - | Some bound -> failwith "Build should have stopped" + | Some _ -> failwith "Build should have stopped" | None -> () @@ -107,11 +107,11 @@ type IncrementalBuild() = member public rb.StampScan() = let mapSuffix = ref "Suffix1" - let Scan ctok acc filename = + let Scan _ acc filename = eventually { return acc+"-"+filename+"-"+(!mapSuffix) } let stampAs = ref DateTime.UtcNow - let StampFile _cache _ctok filename = + let StampFile _cache _ctok _ = !stampAs let buildDesc = new BuildDescriptionScope() @@ -154,9 +154,9 @@ type IncrementalBuild() = [] member public rb.aaZeroElementVector() = // Starts with 'aa' to put it at the front. let stamp = ref DateTime.UtcNow - let Stamp _cache _ctok (s:string) = !stamp - let Map ctok (s:string) = s - let Demult ctok (a:string[]) = a.Length |> cancellable.Return + let Stamp _cache _ctok (_:string) = !stamp + let Map _ (s:string) = s + let Demult _ (a:string[]) = a.Length |> cancellable.Return let buildDesc = new BuildDescriptionScope() let inputVector = InputVector "InputVector" @@ -175,7 +175,7 @@ type IncrementalBuild() = let build1Evaled = Eval cache ctok save result build1 |> Cancellable.runWithoutCancellation let r1 = GetScalarResult (result, build1Evaled) match r1 with - | Some(v,dt) -> Assert.AreEqual(1,v) + | Some(v,_) -> Assert.AreEqual(1,v) | None -> failwith "Expected the value 1 to be returned." // Now with zero. This was the original bug. @@ -187,7 +187,7 @@ type IncrementalBuild() = let build0Evaled = Eval cache ctok save result build0 |> Cancellable.runWithoutCancellation let r0 = GetScalarResult (result, build0Evaled) match r0 with - | Some(v,dt) -> Assert.AreEqual(0,v) + | Some(v,_) -> Assert.AreEqual(0,v) | None -> failwith "Expected the value 0 to be returned." () @@ -197,10 +197,9 @@ type IncrementalBuild() = member public rb.MultiplexTransitionUp() = let elements = ref 1 let timestamp = ref System.DateTime.UtcNow - let Input() : string array = [| for i in 1..!elements -> sprintf "Element %d" i |] - let Stamp _cache ctok s = !timestamp - let Map ctok (s:string) = sprintf "Mapped %s " s - let Result ctok (a:string[]) = String.Join(",", a) |> cancellable.Return + let Stamp _cache _ _ = !timestamp + let Map _ (s:string) = sprintf "Mapped %s " s + let Result _ (a:string[]) = String.Join(",", a) |> cancellable.Return let now = System.DateTime.UtcNow let FixedTimestamp _cache _ctok _ = now @@ -224,7 +223,7 @@ type IncrementalBuild() = let bound = Eval cache ctok save result bound |> Cancellable.runWithoutCancellation let r1 = GetScalarResult(result, bound) match r1 with - | Some(s,dt) -> printfn "%s" s + | Some(s,_) -> printfn "%s" s | None -> failwith "" // Now, re-evaluate it with value 2 @@ -236,7 +235,7 @@ type IncrementalBuild() = let bound = Eval cache ctok save result bound |> Cancellable.runWithoutCancellation let r2 = GetScalarResult (result, bound) match r2 with - | Some(s,dt) -> Assert.AreEqual("Mapped Input 0 ",s) + | Some(s,_) -> Assert.AreEqual("Mapped Input 0 ",s) | None -> failwith "" (* @@ -322,11 +321,11 @@ type IncrementalBuild() = member public rb.StampMap() = let mapSuffix = ref "Suffix1" - let MapIt ctok filename = + let MapIt _ filename = filename+"."+(!mapSuffix) let stampAs = ref DateTime.UtcNow - let StampFile _cache ctok filename = + let StampFile _cache _ _ = !stampAs let buildDesc = new BuildDescriptionScope() @@ -367,11 +366,11 @@ type IncrementalBuild() = member public rb.StampDemultiplex() = let joinedResult = ref "Join1" - let Join ctok (filenames:_[]) = + let Join _ (_:_[]) = !joinedResult |> cancellable.Return let stampAs = ref DateTime.UtcNow - let StampFile _cache ctok filename = + let StampFile _cache _ _ = !stampAs let buildDesc = new BuildDescriptionScope() @@ -411,8 +410,8 @@ type IncrementalBuild() = /// Test that Demultiplex followed by ScanLeft works [] member public rb.DemultiplexScanLeft() = - let Size ctok (ar:_[]) = ar.Length |> cancellable.Return - let Scan ctok acc (file :string) = eventually { return acc + file.Length } + let Size _ (ar:_[]) = ar.Length |> cancellable.Return + let Scan _ acc (file :string) = eventually { return acc + file.Length } let buildDesc = new BuildDescriptionScope() let inVector = InputVector "InputVector" let vectorSize = Vector.Demultiplex "Demultiplex" Size inVector @@ -449,7 +448,7 @@ type IncrementalBuild() = /// Test that ScanLeft works. [] member public rb.ScanLeft() = - let DoIt ctok (a:int*string) (b:string) = + let DoIt _ (a:int*string) (b:string) = eventually { return ((fst a)+1,b) } let buildDesc = new BuildDescriptionScope() @@ -485,7 +484,7 @@ type IncrementalBuild() = let e = Eval cache ctok save result bound |> Cancellable.runWithoutCancellation let r = GetScalarResult (result, e) match r with - | Some(r,ts)-> + | Some(r,_)-> if "File3.fs"<>(r.[2]) then printf "Got %A\n" (r.[2]) Assert.Fail() @@ -517,19 +516,15 @@ type IncrementalBuild() = /// that were new at the time: Scalars, Invalidation, Disposal [] member public rb.AssemblyReferenceModel() = - let ParseTask ctok filename = sprintf "Parse(%s)" filename + let ParseTask _ filename = sprintf "Parse(%s)" filename let now = System.DateTime.UtcNow - let StampFileNameTask _cache ctok filename = now - let TimestampReferencedAssemblyTask _cache ctok reference = now - let ApplyMetaCommands ctok (parseResults:string[]) = "tcConfig-of("+String.Join(",",parseResults)+")" - let GetReferencedAssemblyNames ctok (tcConfig) = [|"Assembly1.dll";"Assembly2.dll";"Assembly3.dll"|] - let ReadAssembly ctok assemblyName = sprintf "tcImport-of(%s)" assemblyName - let CombineImportedAssembliesTask ctok imports = "tcAcc" |> cancellable.Return - let TypeCheckTask ctok tcAcc parseResults = eventually { return tcAcc } - let FinalizeTypeCheckTask ctok results = "finalized" |> cancellable.Return + let StampFileNameTask _cache _ _ = now + let TimestampReferencedAssemblyTask _cache _ _ = now + let CombineImportedAssembliesTask _ _ = "tcAcc" |> cancellable.Return + let TypeCheckTask _ tcAcc _ = eventually { return tcAcc } + let FinalizeTypeCheckTask _ _ = "finalized" |> cancellable.Return // Build rules. - let buildDesc = new BuildDescriptionScope() // Inputs let fileNamesNode = InputVector "Filenames" @@ -560,13 +555,13 @@ type IncrementalBuild() = let bound = buildDesc.GetInitialPartialBuild(inputs) let cache = TimeStampCache(System.DateTime.UtcNow) let e = Eval cache ctok save finalizedTypeCheckNode bound |> Cancellable.runWithoutCancellation - let r = GetScalarResult(finalizedTypeCheckNode,e) + let _ = GetScalarResult(finalizedTypeCheckNode,e) () [] member public rb.OneToOneWorks() = - let VectorModify ctok (input:int) : string = + let VectorModify _ (input:int) : string = sprintf "Transformation of %d" input let buildDesc = new BuildDescriptionScope() @@ -586,7 +581,7 @@ type IncrementalBuild() = /// The getExprById function couldn't find it. [] member public rb.HiddenOutputGroup() = - let VectorModify ctok (input:int) : string = + let VectorModify _ (input:int) : string = sprintf "Transformation of %d" input let buildDesc = new BuildDescriptionScope() @@ -611,7 +606,7 @@ type IncrementalBuild() = /// Empty build should just be a NOP. [] member public rb.EmptyBuildIsNop() = - let VectorModify ctok (input:int) : string = + let VectorModify _ (input:int) : string = sprintf "Transformation of %d" input let buildDesc = new BuildDescriptionScope() @@ -623,6 +618,6 @@ type IncrementalBuild() = let cache = TimeStampCache(System.DateTime.UtcNow) let evaled = Eval cache ctok save outputs bound |> Cancellable.runWithoutCancellation - let outputs = GetVectorResult(outputs,evaled) + let _ = GetVectorResult(outputs,evaled) () diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs deleted file mode 100644 index 06c9bc76a62..00000000000 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Tests.LanguageService.NavigationBar - -open System -open NUnit.Framework -open Salsa.Salsa -open Salsa.VsOpsUtils -open UnitTests.TestLib.Salsa -open UnitTests.TestLib.Utils -open UnitTests.TestLib.LanguageService -open UnitTests.TestLib.ProjectSystem - -[] -[] -[] -type UsingMSBuild() = - inherit LanguageServiceBaseTests() - - (* Files for testing and tests --------------------------------------------------------- *) - - let NavigationFile1 = - [ "#light" - "module Example.Module" - "" - "module SomeModule = " - " type Rec = (*1s*){" - " RFirst : int " - " RSecond : string }(*1e*)" - "" - " type Rec2 = " - " (*2s*){ R2First : int " - " R2Second : string " - " }(*2e*)" - "" - " type Abbrev = (*3s*)Microsoft.FSharp.Collections.List(*3e*)" - "" - " type Enum = " - "(*4s*)| Aaa = 0" - " | Bbb = 3(*4e*)" - "" - " type EnumOneLine = (*5s*)| OUAaa = 0 | OUBbb = 3(*5e*)" ] - - let NavigationFile2 = - [ "#light" - "module A = " - "" - " type RecWith = (*7s*){ " - " WRFirst : int " - " WRSecond : string } with" - " member zz.RecMember(s:string) = " - " printfn \"recdmember\"" - " 3(*7e*)" - "" - "module B = " - " type Union = " - "(*8s*)| UFirst" - " | USecond of int * string" - " member x.A = 0(*8e*)" - "" - " type A() = " - "(*9s*)let rec a = (fun () -> b)" - " and b = a() + 1" - " member xx.Prop = 10" - " member x.Func() = ()" - " interface System.IDisposable with" - " member x.Dispose() = ()(*9e*)" - "" - " exception SomeCrash of (*10s*)int * string * list(*10e*)" - " " - " module MyList = (*11s*)Microsoft.FSharp.Collections.List(*11e*)" - "" - " module MoreNested = " - " type MyEnum =" - " (*12s*)| One = 1" - " | Two = 2" - " | Three = 3(*12e*)" - " " - " type AExt with // this isn't valid extension, but it's ok for the parser" - "(*13s*)member x.Extension1() = 2" - " member x.Extension2() = 2(*13e*) // TODO: this doesn't work correctly" - " " - " type Z() =" - "(*14s*)let mutable cache = 0" - " member x.Z : int = // type annotation can cause issues" - " 0(*14e*)" - "" - " module (*15s*)FooBaz = // collapsed immediately after the identifier" - " let toplevel () = " - " let nested = 10" - " 0" - " " - " module (*16s*)NestedModule = " - " let nestedThing () =" - " 0(*16e*)" - " " - " module OtherNested =" - " let aa () =" - " 1(*15e*) " ] - - -// Context project system -[] -type UsingProjectSystem() = - inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index 5b05e438935..99957a1adc6 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -24,18 +24,11 @@ type UsingMSBuild() = let GetParamDisplays(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED) = [ for i = 0 to methods.GetCount() - 1 do yield [ for j = 0 to methods.GetParameterCount(i) - 1 do - let (name,display,description) = methods.GetParameterInfo(i,j) + let (_,display,_) = methods.GetParameterInfo(i,j) yield display ] ] let AssertEmptyMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option) = - Assert.IsTrue(resultMethodGroup.IsNone, "Expected an empty method group") - - let AssertMethodGroupDesciptionsDoNotContain(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED, expectNotToBeThere) = - for i = 0 to methods.GetCount() - 1 do - let description = methods.GetDescription(i) - if (description.Contains(expectNotToBeThere)) then - Console.WriteLine("Expected description {0} to not contain {1}", description, expectNotToBeThere) - AssertNotContains(description,expectNotToBeThere) + Assert.IsTrue(resultMethodGroup.IsNone, "Expected an empty method group") let AssertMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNamesSet:string list list) = Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group") @@ -60,7 +53,7 @@ type UsingMSBuild() = paramDisplay.Contains(expectedParamName)))) member private this.GetMethodListForAMethodTip(fileContents : string, marker : string, ?addtlRefAssy : list) = - let (solution, project, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) + let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = addtlRefAssy) MoveCursorToStartOfMarker(file, marker) @@ -89,7 +82,7 @@ type UsingMSBuild() = let paramDisplays = [ for i = 0 to methodstr.GetParameterCount(index) - 1 do - let (name,display,description) = methodstr.GetParameterInfo(index,i) + let (_,display,_) = methodstr.GetParameterInfo(index,i) yield display] Assert.IsTrue((expectedParams, paramDisplays) ||> List.forall2 (fun expectedParam paramDisplay -> paramDisplay.Contains(expectedParam))) @@ -428,7 +421,7 @@ type UsingMSBuild() = [] [] member public this.``Single.InMatchClause``() = - let v461 = Version(4,6,1) + let _ = Version(4,6,1) let fileContent = """ let rec f l = match l with @@ -640,7 +633,6 @@ type UsingMSBuild() = [] member public this.``Single.Generics.Typeof``() = - let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("typeof(", []) [] [] @@ -889,7 +881,7 @@ type UsingMSBuild() = let (_, _, file) = this.CreateSingleFileProject(code) TakeCoffeeBreak(this.VS) - let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) + let _ = GlobalParseAndTypeCheckCounter.StartNew(this.VS) // In this case, we quickly type "f1(" and then see what parameter info would pop up. // This simulates the case when the user quickly types after the file has been TCed before. @@ -912,7 +904,7 @@ type UsingMSBuild() = let (_, _, file) = this.CreateSingleFileProject(code) TakeCoffeeBreak(this.VS) - let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) + let _ = GlobalParseAndTypeCheckCounter.StartNew(this.VS) // In this case, we quickly type "new Foo(" and then see what parameter info would pop up. // This simulates the case when the user quickly types after the file has been TCed before. @@ -1057,7 +1049,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_,_, file) = this.CreateSingleFileProject(testLines) MoveCursorToStartOfMarker(file, "let zz") // in the bug, this caused an assert to fire - let info = GetParameterInfoAtCursor file + let _ = GetParameterInfoAtCursor file () [] @@ -1068,7 +1060,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_,_, file) = this.CreateSingleFileProject(testLines) MoveCursorToStartOfMarker(file, "printfn") // in the bug, this caused an assert to fire - let info = GetParameterInfoAtCursor file + let _ = GetParameterInfoAtCursor file () [] @@ -1508,7 +1500,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let actualDisplays = [ for i = 0 to methodGroup.GetCount() - 1 do yield [ for j = 0 to methodGroup.GetParameterCount(i) - 1 do - let (name,display,description) = methodGroup.GetParameterInfo(i,j) + let (_,display,_) = methodGroup.GetParameterInfo(i,j) yield display ] ] let expected = [["Param1: string"; "ParamIgnored: int"]] // key here is we want e.g. "int" and not "System.Int32" AssertEqual(expected, actualDisplays) @@ -1962,7 +1954,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let fileContents = """ open System.ServiceModel let serviceHost = new ServiceHost((*Mark*))""" - let (solution, project, file) = this.CreateSingleFileProject(fileContents, references = ["System.ServiceModel"]) + let (_, _, file) = this.CreateSingleFileProject(fileContents, references = ["System.ServiceModel"]) MoveCursorToStartOfMarker(file, "(*Mark*)") TakeCoffeeBreak(this.VS) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs index 200db7b2727..32c54f4bccc 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs @@ -28,7 +28,7 @@ type UsingMSBuild() = let stopWatch = new System.Diagnostics.Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = + let time1 op a _ = ResetStopWatch() let result = op a //printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds @@ -110,10 +110,10 @@ type UsingMSBuild() = AssertIdentifierInToolTipExactlyOnce(ident, tooltip) gpatcc.AssertExactly(0,0) - member this.VerifyOrderOfNestedTypesInQuickInfo (source : string, marker : string, expectedExactOrder : string list, ?extraRefs : string list) = + member this.VerifyOrderOfNestedTypesInQuickInfo (source : string, expectedExactOrder : string list, ?extraRefs : string list) = let (_, _, file) = this.CreateSingleFileProject(source, ?references = extraRefs) - let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) + let _ = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToStartOfMarker(file, "(*M*)") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" AssertContainsInOrder(tooltip, expectedExactOrder) @@ -122,7 +122,6 @@ type UsingMSBuild() = member public this.``NestedTypesOrder``() = this.VerifyOrderOfNestedTypesInQuickInfo( source = "type t = System.Runtime.CompilerServices.RuntimeHelpers(*M*)", - marker = "(*M*)", expectedExactOrder = ["GetHashCode"; "GetObjectValue"] ) @@ -283,7 +282,6 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") let tpReference = PathRelativeToTestAssembly( @"DummyProviderForLanguageServiceTesting.dll") this.VerifyOrderOfNestedTypesInQuickInfo( source = code, - marker = "(*M*)", expectedExactOrder = ["A"; "X"; "Z"], extraRefs = [tpReference] ) @@ -1038,7 +1036,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate use _guard = this.UsingNewVS() let solution = this.CreateSolution() let projectLib = CreateProject(solution,"testlib") - let file = AddFileFromText(projectLib,"MyLibrary.fs", + let _ = AddFileFromText(projectLib,"MyLibrary.fs", [ "module MyLibrary" "let x = 1" "module Nested =" @@ -1047,7 +1045,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate " let z = 3" ]) let project = CreateProject(solution,"testapp") - let file = AddFileFromText(project,"App.fs", + let _ = AddFileFromText(project,"App.fs", [ "let a = MyLibrary.Nested.Deeper.z" ]) SetConfigurationAndPlatform(project, "Debug|AnyCPU") // we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(projectLib, "Debug|AnyCPU") // we must set config/platform when building with ProjectReferences @@ -1174,14 +1172,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#light" "type Bob() = " " let x = 1"]) - let file2 = AddFileFromText(project,"File2.fs", + let _ = AddFileFromText(project,"File2.fs", ["#light" "let bob = new File1.Bob()"]) - let file1 = OpenFile(project,"File1.fs") + let _ = OpenFile(project,"File1.fs") let file2 = OpenFile(project,"File2.fs") // Get the tooltip at type Bob @@ -1202,14 +1200,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddLinkedFileFromTextEx(project, @"..\LINK.FS", @"..\link.fs", @"MyLink.fs", + let _ = AddLinkedFileFromTextEx(project, @"..\LINK.FS", @"..\link.fs", @"MyLink.fs", ["#light" "type Bob() = " " let x = 1"]) - let file2 = AddFileFromText(project,"File2.fs", + let _ = AddFileFromText(project,"File2.fs", ["#light" "let bob = new Link.Bob()"]) - let file1 = OpenFile(project, @"..\link.fs") + let _ = OpenFile(project, @"..\link.fs") let file2 = OpenFile(project, @"File2.fs") // Get the tooltip at type Bob @@ -1593,13 +1591,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project1 = CreateProject(solution,"testproject1") - let file1 = AddFileFromText(project1,"File1.fs", + let _ = AddFileFromText(project1,"File1.fs", ["#light" "type (*bob*)Bob1() = " " let x = 1"]) let file1 = OpenFile(project1,"File1.fs") let project2 = CreateProject(solution,"testproject2") - let file2 = AddFileFromText(project2,"File2.fs", + let _ = AddFileFromText(project2,"File2.fs", ["#light" "type (*bob*)Bob2() = " " let x = 1"]) @@ -1623,14 +1621,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#light" "type Bob() = " " let x = 1"]) - let file2 = AddFileFromText(project,"..\\File2.fs", + let _ = AddFileFromText(project,"..\\File2.fs", ["#light" "let bob = new File1.Bob()"]) - let file1 = OpenFile(project,"File1.fs") + let _ = OpenFile(project,"File1.fs") let file2 = OpenFile(project,"..\\File2.fs") // Get the tooltip at type Bob @@ -3010,18 +3008,18 @@ query." type ControlEventHandler = delegate of int -> unit""" let file2 = if (crossProject = true) then - let file1 = AddFileFromTextBlob(project,"File1.fs",testLibCode) + let _ = AddFileFromTextBlob(project,"File1.fs",testLibCode) let project2 = CreateProject(solution,"codeProject") - let file2 = AddFileFromTextBlob(project2,"File2.fs",fileContent) + let _ = AddFileFromTextBlob(project2,"File2.fs",fileContent) Build(project).BuildSucceeded |> ignore AddProjectReference(project2, project) - let file1 = OpenFile(project,"File1.fs") + let _ = OpenFile(project,"File1.fs") let file2 = OpenFile(project2,"File2.fs") file2 else - let file1 = AddFileFromTextBlob(project,"File1.fs",testLibCode) - let file2 = AddFileFromTextBlob(project,"File2.fs",fileContent) - let file1 = OpenFile(project,"File1.fs") + let _ = AddFileFromTextBlob(project,"File1.fs",testLibCode) + let _ = AddFileFromTextBlob(project,"File2.fs",fileContent) + let _ = OpenFile(project,"File1.fs") let file2 = OpenFile(project,"File2.fs") file2 //Build(project).BuildSucceeded |> printf "%b" @@ -3196,10 +3194,10 @@ query." let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") this.AddAssemblyReference(project, "System.Xml.Linq") - let file1 = AddFileFromTextBlob(project,"File1.fs",datacode) + let _ = AddFileFromTextBlob(project,"File1.fs",datacode) //build - let file2 = AddFileFromTextBlob(project,"File2.fs",code) - let file1 = OpenFile(project,"File1.fs") + let _ = AddFileFromTextBlob(project,"File2.fs",code) + let _ = OpenFile(project,"File1.fs") let file2 = OpenFile(project,"File2.fs") let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index ec5f5f29188..5e3aaea7144 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -20,10 +20,6 @@ type UsingMSBuild() as this = let notAA l = None,l - let createSingleFileFsx (code : string) = - let (_, p, f) = this.CreateSingleFileProject(code, fileKind = SourceFileKind.FSX) - (p, f) - let createSingleFileFsxFromLines (code : list) = let (_, p, f) = this.CreateSingleFileProject(code, fileKind = SourceFileKind.FSX) (p, f) @@ -87,7 +83,7 @@ type UsingMSBuild() as this = AssertExactlyCountErrorSeenContaining(project,text,1) /// Assert that a given squiggle is an Error (or warning) containing the given text - let AssertSquiggleIsErrorContaining,AssertSquiggleIsWarningContaining, AssertSquiggleIsErrorNotContaining,AssertSquiggleIsWarningNotContaining = + let AssertSquiggleIsErrorContaining,AssertSquiggleIsWarningContaining, AssertSquiggleIsErrorNotContaining,_ = let AssertSquiggle expectedSeverity nameOfExpected nameOfNotExpected assertf (squiggleOption,containing) = match squiggleOption with | None -> Assert.Fail("Expected a squiggle but none was seen.") @@ -102,12 +98,12 @@ type UsingMSBuild() as this = //Verify the error list in fsx file containd the expected string member private this.VerifyFSXErrorListContainedExpectedString(fileContents : string, expectedStr : string) = - let (_, project, file) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSX) + let (_, project, _) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSX) VerifyErrorListContainedExpetedStr(expectedStr,project) //Verify no error list in fsx file member private this.VerifyFSXNoErrorList(fileContents : string) = - let (_, project, file) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSX) + let (_, project, _) = this.CreateSingleFileProject(fileContents, fileKind = SourceFileKind.FSX) AssertNoErrorsOrWarnings(project) //Verify QuickInfo Containd In Fsx file member public this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile (code : string) marker expected = @@ -177,21 +173,21 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public Property = 0" ]) - let file1 = OpenFile(project,"File1.fs") - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = OpenFile(project,"File1.fs") + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"File1.fs\"" ]) - let script2 = OpenFile(project,"Script2.fsx") - let script2 = AddFileFromText(project,"Script1.fsx", + let _ = OpenFile(project,"Script2.fsx") + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"Script1.fsx\"" "Namespace.Foo.Property" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") TakeCoffeeBreak(this.VS) AssertNoErrorsOrWarnings(project) @@ -202,19 +198,19 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public Property = 0" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"File1.fs\"" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"Script2.fsx\"" "Namespace.Foo.NonExistingProperty" ]) - let script1 = OpenFile(project,"Script1.fsx") + let _ = OpenFile(project,"Script1.fsx") TakeCoffeeBreak(this.VS) AssertExactlyOneErrorSeenContaining(project, "NonExistingProperty") @@ -245,14 +241,14 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#light" "namespace MyNamespace" " module MyModule =" " let x = 1" ]) - let fsx = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "//#load \"File1.fs\"" "open MyNamespace.MyModule" @@ -276,14 +272,14 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#light" "namespace MyNamespace" " module MyModule =" " let x = 1" ]) - let fsx = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "#load \"File1.fs\"" "open MyNamespace.MyModule" @@ -306,7 +302,7 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["module InDifferentFS" "#if INTERACTIVE" "let x = 1" @@ -320,7 +316,7 @@ type UsingMSBuild() as this = "#endif" ]) - let fsx = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", [ "#load \"File1.fs\"" "InDifferentFS." @@ -368,21 +364,21 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public Property = 0" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "#load \"File1.fs\"" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"Script2.fsx\"" "#load \"File1.fs\"" "Namespace.Foo.Property" ]) - let script1 = OpenFile(project,"Script1.fsx") + let _ = OpenFile(project,"Script1.fsx") TakeCoffeeBreak(this.VS) AssertNoErrorsOrWarnings(project) @@ -393,26 +389,26 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fsi\"" "#load \"File1.fs\"" "Namespace.Foo.Property" ]) - let script1 = OpenFile(project,"Script1.fsx") + let _ = OpenFile(project,"Script1.fsx") AssertNoErrorsOrWarnings(project) // #load of .fsi is respected at second #load level (for non-hidden property) @@ -422,29 +418,29 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fsi\"" "#load \"File1.fs\"" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "Namespace.Foo.Property" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") AssertNoErrorsOrWarnings(project) // #load of .fsi is respected when dispersed between two #load levels (for non-hidden property) @@ -454,29 +450,29 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fsi\"" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "#load \"File1.fs\"" "Namespace.Foo.Property" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") AssertNoErrorsOrWarnings(project) // #load of .fsi is respected when dispersed between two #load levels (the other way) (for non-hidden property) @@ -486,29 +482,29 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fs\"" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"File1.fsi\"" "#load \"Script1.fsx\"" "Namespace.Foo.Property" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") AssertNoErrorsOrWarnings(project) // #nowarn seen in closed .fsx is global to the closure @@ -518,10 +514,10 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let thisProject = AddFileFromText(project,"ThisProject.fsx", + let _ = AddFileFromText(project,"ThisProject.fsx", ["#nowarn \"44\"" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"ThisProject.fsx\"" // Should bring in #nowarn "44" so we don't see this warning: "[]" "let fn x = 0" @@ -587,7 +583,7 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"lib.fs", + let _ = AddFileFromText(project,"lib.fs", ["module Lib" "let X = 42" ]) @@ -603,11 +599,11 @@ type UsingMSBuild() as this = Directory.CreateDirectory(script2Dir) |> ignore File.Move(bld.ExecutableOutput, Path.Combine(ProjectDirectory(project), "aaa\\lib.exe")) - let script1 = File.WriteAllLines(script1Path, + let _ = File.WriteAllLines(script1Path, ["#load \"../aaa/bbb/Script2.fsx\"" "printfn \"%O\" Lib.X" ]) - let script2 = File.WriteAllLines(script2Path, + let _ = File.WriteAllLines(script2Path, ["#r \"../lib.exe\"" ]) @@ -624,7 +620,7 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"lib.fs", + let _ = AddFileFromText(project,"lib.fs", ["module Lib" "let X = 42" ]) @@ -640,11 +636,11 @@ type UsingMSBuild() as this = Directory.CreateDirectory(script2Dir) |> ignore File.Move(bld.ExecutableOutput, Path.Combine(ProjectDirectory(project), "aaa\\lib.exe")) - let script1 = File.WriteAllLines(script1Path, + let _ = File.WriteAllLines(script1Path, ["#load \"../aaa/Script2.fsx\"" "printfn \"%O\" Lib.X" ]) - let script2 = File.WriteAllLines(script2Path, + let _ = File.WriteAllLines(script2Path, ["#r \"lib.exe\"" ]) @@ -661,20 +657,20 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#light" "namespace MyNamespace" " module MyModule =" " let x = 1" ]) - let fsx = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "#load \"File1.fs\"" "open MyNamespace.MyModule" "printfn \"%d\" x" ]) - let fsx = OpenFile(project,"File2.fsx") + let _ = OpenFile(project,"File2.fsx") AssertNoErrorsOrWarnings(project) // In this bug the #loaded file contains a level-4 warning (copy to avoid mutation). This warning was reported at the #load in file2.fsx but shouldn't have been.s @@ -684,17 +680,17 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["module File1Module" "let x = System.DateTime.Now - System.DateTime.Now" "x.Add(x) |> ignore" ]) - let fsx = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", [ "#load \"File1.fs\"" ]) - let fsx = OpenFile(project,"File2.fsx") + let _ = OpenFile(project,"File2.fsx") AssertNoErrorsOrWarnings(project) /// FEATURE: .fsx files have automatic imports of certain system assemblies. @@ -723,21 +719,21 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public Property = 0" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "#load \"File1.fs\"" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"Script2.fsx\"" "#load \"File1.fs\"" "Namespace.Foo.NonExistingProperty" ]) - let script1 = OpenFile(project,"Script1.fsx") + let _ = OpenFile(project,"Script1.fsx") AssertExactlyOneErrorSeenContaining(project, "NonExistingProperty") // #load of .fsi is respected @@ -747,26 +743,26 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fsi\"" "#load \"File1.fs\"" "Namespace.Foo.HiddenProperty" ]) - let script1 = OpenFile(project,"Script1.fsx") + let _ = OpenFile(project,"Script1.fsx") AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected at second #load level @@ -776,29 +772,29 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fsi\"" "#load \"File1.fs\"" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "Namespace.Foo.HiddenProperty" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected when dispersed between two #load levels @@ -808,29 +804,29 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fsi\"" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "#load \"File1.fs\"" "Namespace.Foo.HiddenProperty" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected when dispersed between two #load levels (the other way) @@ -840,29 +836,29 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1fsi = AddFileFromText(project,"File1.fsi", + let _ = AddFileFromText(project,"File1.fsi", ["namespace Namespace" "type Foo =" " class" " static member Property : int" // Not exposing 'HiddenProperty' " end" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["namespace Namespace" "type Foo = " " static member public HiddenProperty = 0" " static member public Property = 0" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fs\"" ]) - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"File1.fsi\"" "#load \"Script1.fsx\"" "Namespace.Foo.HiddenProperty" ]) - let script2 = OpenFile(project,"Script2.fsx") + let _ = OpenFile(project,"Script2.fsx") AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // Bug seen during development: A #load in an .fs would be followed. @@ -872,21 +868,21 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file2 = AddFileFromText(project,"File2.fs", + let _ = AddFileFromText(project,"File2.fs", ["namespace Namespace" "type Type() =" " static member Property = 0" ]) - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#load \"File2.fs\"" // This is not allowed but it was working anyway. "namespace File2Namespace" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"File1.fs\"" "Namespace.Type.Property" ]) - let script1 = OpenFile(project,"Script1.fsx") + let _ = OpenFile(project,"Script1.fsx") TakeCoffeeBreak(this.VS) AssertExactlyOneErrorSeenContaining(project, "Namespace") @@ -904,7 +900,7 @@ type UsingMSBuild() as this = let code = ["System.ConsoleModifiers.Shift |> ignore " "(3).ToString().Length |> ignore "] - let (project, file) = createSingleFileFsxFromLines code + let (_, file) = createSingleFileFsxFromLines code MoveCursorToEndOfMarker(file, "System.ConsoleModifiers.Sh") let tooltip = GetQuickInfoAtCursor file AssertContains(tooltip, @"[Signature:F:System.ConsoleModifiers.Shift]") // A message from the mock IDocumentationBuilder @@ -977,7 +973,7 @@ type UsingMSBuild() as this = let code = ["#light" "#r \"Bar.dll\""] - let (project, file) = createSingleFileFsxFromLines code + let (_, file) = createSingleFileFsxFromLines code MoveCursorToEndOfMarker(file,"#r \"Ba") let squiggle = GetSquiggleAtCursor(file) TakeCoffeeBreak(this.VS) @@ -990,11 +986,11 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let script2 = AddFileFromText(project,"Script2.fsx", + let _ = AddFileFromText(project,"Script2.fsx", ["#load \"Script1.fsx\"" "#r \"NonExisting\"" ]) - let script1 = AddFileFromText(project,"Script1.fsx", + let _ = AddFileFromText(project,"Script1.fsx", ["#load \"Script2.fsx\"" "#r \"System\"" ]) @@ -1057,13 +1053,13 @@ type UsingMSBuild() as this = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["#light" "module File1" "DogChow" // <-- error ]) - let file2 = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "#load @\"File1.fs\"" ]) @@ -1083,13 +1079,13 @@ type UsingMSBuild() as this = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", ["module File1Module" "type WarningHere<'a> = static member X() = 0" "let y = WarningHere.X" ]) - let file2 = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "#load @\"File1.fs\"" ]) @@ -1107,14 +1103,14 @@ type UsingMSBuild() as this = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", + let _ = AddFileFromText(project,"File1.fs", [ "#light" "module File1" "let a = 1 + \"\"" "let c = new obj()" "let b = c.foo()" ]) - let file2 = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "#load @\"File1.fs\"" ]) @@ -1139,12 +1135,12 @@ type UsingMSBuild() as this = result let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromText(project,"File1.fs", ["#light"]) + let _ = AddFileFromText(project,"File1.fs", ["#light"]) let projectOutput = time1 Build project "Time to build project" printfn "Output of building project was %s" projectOutput.ExecutableOutput printfn "Project directory is %s" (ProjectDirectory project) - let file2 = AddFileFromText(project,"File2.fsx", + let _ = AddFileFromText(project,"File2.fsx", ["#light" "#reference @\"bin\\Debug\\testproject.exe\"" ]) @@ -1234,7 +1230,7 @@ type UsingMSBuild() as this = "#I @\"?\"" """#r @"C:\path\does\not\exist.dll" """ ] - let (_, file) = createSingleFileFsxFromLines code + let (_, _) = createSingleFileFsxFromLines code TakeCoffeeBreak(this.VS) // This used to assert /// FEATURE: .fsx files have INTERACTIVE #defined @@ -1259,7 +1255,7 @@ type UsingMSBuild() as this = let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let file1 = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["printfn \"Hello world\""]) let build = time1 Build project "Time to build project" Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") @@ -1274,12 +1270,12 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromTextEx(project,"File.fs","File.fs",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"File.fs","File.fs",BuildAction.Compile, ["namespace Namespace" "module Module =" " let Value = 1" ]) - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["#load \"File.fs\"" "printfn \"%d\" Namespace.Module.Value"]) let build = time1 Build project "Time to build project" @@ -1297,12 +1293,12 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs = AddFileFromTextEx(project,"File.fs","File.fs",BuildAction.None, + let _ = AddFileFromTextEx(project,"File.fs","File.fs",BuildAction.None, ["namespace Namespace" "module Module =" " let Value = 1" ]) - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["#load \"File.fs\"" "printfn \"%d\" Namespace.Module.Value"]) let build = time1 Build project "Time to build project" @@ -1320,7 +1316,7 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["let x = fsi.CommandLineArgs"]) let build = time1 Build project "Time to build project" if SupportsOutputWindowPane(this.VS) then @@ -1350,7 +1346,7 @@ type UsingMSBuild() as this = " binariesFolder binariesFolder) - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["let x = fsi.CommandLineArgs"]) let build = time1 Build project "Time to build project" if SupportsOutputWindowPane(this.VS) then @@ -1369,17 +1365,17 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs1 = AddFileFromTextEx(project,"File1.fs","File1.fs",BuildAction.None, + let _ = AddFileFromTextEx(project,"File1.fs","File1.fs",BuildAction.None, ["namespace Namespace" "module Module1 =" " let Value = 1" ]) - let fs2 = AddFileFromTextEx(project,"File2.fs","File2.fs",BuildAction.None, + let _ = AddFileFromTextEx(project,"File2.fs","File2.fs",BuildAction.None, ["namespace Namespace" "module Module2 =" " let Value = Module1.Value" ]) - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, [ "#load \"File1.fs\"" "#load \"File2.fs\"" @@ -1400,17 +1396,17 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fs1 = AddFileFromTextEx(project,"File1.fs","File1.fs",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"File1.fs","File1.fs",BuildAction.Compile, ["namespace Namespace" "module Module1 =" " let Value = 1" ]) - let fs2 = AddFileFromTextEx(project,"File2.fs","File2.fs",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"File2.fs","File2.fs",BuildAction.Compile, ["namespace Namespace" "module Module2 =" " let Value = Module1.Value" ]) - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, [ "#load \"File2.fs\"" // Wrong order "#load \"File1.fs\"" @@ -1432,7 +1428,7 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, [ "#load \"NonexistentFile.fs\"" ]) @@ -1453,7 +1449,7 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let solution = this.CreateSolution() let project = CreateProject(solution,"testproject") - let fsx = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, + let _ = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, [ "#r \"System.Messaging\"" "let a = new System.Messaging.AccessControlEntry()" @@ -1557,7 +1553,7 @@ type UsingMSBuild() as this = [ PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll") ] - let (_, project, file) = this.CreateSingleFileProject(code, references = refs) + let (_, project, _) = this.CreateSingleFileProject(code, references = refs) TakeCoffeeBreak(this.VS) AssertNoErrorsOrWarnings(project) @@ -1605,7 +1601,7 @@ type UsingMSBuild() as this = let project = CreateProject(solution,"testproject" + string (i % 20)) this.AddAssemblyReference(project, PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")) let fileName = sprintf "File%d.fs" i - let file1 = AddFileFromText(project,fileName, ["let x" + string i + " = N1.T1()" ]) + let _ = AddFileFromText(project,fileName, ["let x" + string i + " = N1.T1()" ]) let file = OpenFile(project,fileName) TakeCoffeeBreak(this.VS) AssertNoErrorsOrWarnings project // ...and not an error on the first line. @@ -1615,9 +1611,9 @@ type UsingMSBuild() as this = let tooltip = GetQuickInfoAtCursor file AssertContains(tooltip, "T1") ignore (GetF1KeywordAtCursor file) - let parmInfo = GetParameterInfoAtCursor file + let _ = GetParameterInfoAtCursor file - let file1 = OpenFile(project,fileName) + let _ = OpenFile(project,fileName) // The disposals should be at least one less let c = countCreations() @@ -1648,7 +1644,7 @@ type UsingMSBuild() as this = Assert.IsTrue((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()), "Check4b2, all invlidation handlers removed, iteration " + string i) let c = countCreations() - let d = countDisposals() + let _ = countDisposals() Assert.IsTrue(c >= 50, "Check5, at end, countCreations() >= 50") ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs index 4fdf86bca8d..38179b2860d 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs @@ -57,12 +57,12 @@ type UsingMSBuild() = let project2 = CreateProject(solution,"testproject2") SetConfigurationAndPlatform(project1, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(project2, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences - let file1 = AddFileFromText(project1,"File1.fs", ["#light" - "let xx = 42" - "printfn \"hi\""]) - let file2 = AddFileFromText(project2,"File2.fs", ["#light" - "let yy = File1.xx" - "printfn \"hi\""]) + let _ = AddFileFromText(project1,"File1.fs", ["#light" + "let xx = 42" + "printfn \"hi\""]) + let _ = AddFileFromText(project2,"File2.fs", ["#light" + "let yy = File1.xx" + "printfn \"hi\""]) // Add a project-to-project reference. // WARNING: See bug 4434 - when unit testing this actually goes and builds project1!!!! AddProjectReference(project2,project1) @@ -76,8 +76,8 @@ type UsingMSBuild() = TakeCoffeeBreak(this.VS) // Open files in editor. - let file1 = OpenFile(project1,"File1.fs") - let file2 = OpenFile(project2,"File2.fs") + let _ = OpenFile(project1,"File1.fs") + let _ = OpenFile(project2,"File2.fs") // Now clean project1 printfn "cleaning dependent project..." @@ -98,16 +98,16 @@ type UsingMSBuild() = let project2 = CreateProject(solution,"testproject2") SetConfigurationAndPlatform(project1, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences SetConfigurationAndPlatform(project2, "Debug|AnyCPU") // maybe due to msbuild bug on dev10, we must set config/platform when building with ProjectReferences - let file1 = AddFileFromText(project1,"File1.fs", ["#light"]) - let file2 = AddFileFromText(project2,"File2.fs", ["#light"]) + let _ = AddFileFromText(project1,"File1.fs", ["#light"]) + let _ = AddFileFromText(project2,"File2.fs", ["#light"]) // Add a project-to-project reference. // WARNING: See bug 4434 - when unit testing this actually goes and builds project1!!!! AddProjectReference(project2,project1) // Open files in editor. - let file1 = OpenFile(project1,"File1.fs") - let file2 = OpenFile(project2,"File2.fs") + let _ = OpenFile(project1,"File1.fs") + let _ = OpenFile(project2,"File2.fs") // Wait for things to settle down and make sure there is an error TakeCoffeeBreak(this.VS) @@ -130,26 +130,26 @@ type UsingMSBuild() = // Create the projects/ let project1 = CreateProject(solution,"testproject1") let project2 = CreateProject(solution,"testproject2") - let file1 = AddFileFromText(project1,"File1.fs", ["#light" - "let xx = 42" - "printfn \"hi\""]) - let file2 = AddFileFromText(project2,"File2.fs", ["#light" - "let yy = File1.xx" - "printfn \"hi\""]) + let _ = AddFileFromText(project1,"File1.fs", ["#light" + "let xx = 42" + "printfn \"hi\""]) + let _ = AddFileFromText(project2,"File2.fs", ["#light" + "let yy = File1.xx" + "printfn \"hi\""]) // Add an assembly reference between the projects (a P2P would fall victim to 4434) let p1exe = BuildTarget(project1, "Clean") // just a handy way to get the filename of the exe that would be built this.AddAssemblyReference(project2, p1exe.ExecutableOutput) // open a file to see the errors - let file2 = OpenFile(project2,"File2.fs") + let _ = OpenFile(project2,"File2.fs") TakeCoffeeBreak(this.VS) let errs = GetErrors(project2) Assert.IsTrue(List.length errs > 0, "There should be errors (unresolved reference)") // switch focus to a different file (to turn off 'focus' idle processing for file2) - let file1 = OpenFile(project1,"File1.fs") + let _ = OpenFile(project1,"File1.fs") // Now build project1 printfn "building dependent project..." @@ -171,12 +171,12 @@ type UsingMSBuild() = let solution = this.CreateSolution() let project1 = CreateProject(solution,"testproject1") - let file1 = AddFileFromText(project1,"File1.fs", + let _ = AddFileFromText(project1,"File1.fs", ["#light"] ) let file1 = OpenFile(project1,"File1.fs") let project2 = CreateProject(solution,"testproject2") - let file2 = AddFileFromText(project2,"File2.fs", + let _ = AddFileFromText(project2,"File2.fs", ["#light" "File1.File1." "()"]) @@ -218,18 +218,18 @@ type UsingMSBuild() = let solution = this.CreateSolution() let project1 = CreateProject(solution,"testproject1") - let MakeRelativePath(path1:string, path2) = + let MakeRelativePath(path1:string, _) = // Pretend to return a path to path1 relative to path2. let temp = (System.IO.Path.GetTempPath()) let tempLen = temp.Length ".."+(path1.Substring(tempLen-1)) - let file1 = AddFileFromText(project1,"File1.fs", + let _ = AddFileFromText(project1,"File1.fs", ["#light"] ) let file1 = OpenFile(project1,"File1.fs") let project2 = CreateProject(solution,"testproject2") - let file2 = AddFileFromText(project2,"File2.fs", + let _ = AddFileFromText(project2,"File2.fs", ["#light" "File1.File1." "()"]) @@ -273,12 +273,12 @@ type UsingMSBuild() = let solution = this.CreateSolution() let project1 = CreateProject(solution,"testproject1") - let file1 = AddFileFromText(project1,"File1.fs", + let _ = AddFileFromText(project1,"File1.fs", ["#light"] ) let file1 = OpenFile(project1,"File1.fs") let project2 = CreateProject(solution,"testproject2") - let file2 = AddFileFromText(project2,"File2.fs", + let _ = AddFileFromText(project2,"File2.fs", ["#light" "File1.File1." "()"]) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs index ff06f80bac6..74286eb7c79 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs @@ -42,7 +42,7 @@ type Config() = member this.TargetPlatform () = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectMulitplatBoilerplate "Library", - (fun project ccn projFileName -> + (fun project ccn _ -> ccn((project :> IVsHierarchy), "Debug|x86") project.ComputeSourcesAndFlags() let flags = project.CompilationOptions |> List.ofArray diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs index 1f5dfff2054..0b6a3470e43 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs @@ -36,7 +36,7 @@ type Miscellaneous() = //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working member public this.EnsureThatUnhandledExceptionsCauseAnAssert() = - this.MakeProjectAndDo([], ["System"], "", (fun proj -> + this.MakeProjectAndDo([], ["System"], "", (fun _ -> let t = new System.Threading.Thread(new System.Threading.ThreadStart(fun () -> failwith "foo")) t.Start() System.Threading.Thread.Sleep(1000) @@ -91,7 +91,7 @@ type Miscellaneous() = [] member public this.``Miscellaneous.FSharpFileNode.RelativeFilePath`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> - let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") + let _ = Path.Combine(project.ProjectFolder, "orig1.fs") let files = new List() project.FindNodesOfType(files) Assert.AreEqual(1, files.Count) @@ -103,7 +103,7 @@ type Miscellaneous() = [] member public this.``Miscellaneous.FSharpFileNode.CreateServices`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> - let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") + let _ = Path.Combine(project.ProjectFolder, "orig1.fs") let files = new List() project.FindNodesOfType(files) Assert.AreEqual(1, files.Count) @@ -249,7 +249,7 @@ type Miscellaneous() = member public this.``LoadProject.x86`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], ["System"], this.MSBuildProjectMultiPlatform(["x86",""],"x86"), - (fun project projFileName -> + (fun project _ -> this.CheckPlatformNames(project, [|"x86"|]) let refContainer = let l = new List() @@ -264,7 +264,7 @@ type Miscellaneous() = member public this.``BuildAndClean``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Library", - (fun project ccn projFileName -> + (fun project _ _ -> let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "#light") File.AppendAllText(fooPath, "module Foo") @@ -280,7 +280,7 @@ type Miscellaneous() = let success = ref false use event = new System.Threading.ManualResetEvent(false) - let (hr, cookie) = + let (_, cookie) = buildableCfg.AdviseBuildStatusCallback( { new IVsBuildStatusCallback with member this.BuildBegin pfContinue = pfContinue <- 1; VSConstants.S_OK @@ -335,7 +335,7 @@ type Miscellaneous() = member public this.``DebuggingDLLFailsFunc``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Library", - (fun project ccn projFileName -> + (fun project ccn _ -> ccn((project :> IVsHierarchy), "Debug|Any CPU") let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "#light") @@ -360,7 +360,7 @@ type Miscellaneous() = member public this.``DebuggingEXESucceeds``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Exe", - (fun project ccn projFileName -> + (fun project ccn _ -> ccn((project :> IVsHierarchy), "Debug|Any CPU") let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "#light") @@ -392,7 +392,6 @@ type Miscellaneous() = let mkDoc = Path.Combine(project.ProjectFolder, relPath) let priority = [|VSDOCUMENTPRIORITY.DP_Unsupported|] let mutable found = 0 - let mutable itemId = 0ul let hr,_ = project.IsDocumentInProject(mkDoc, &found, priority) AssertEqual VSConstants.S_OK hr AssertEqual shouldBeInProject (found <> 0) @@ -427,8 +426,7 @@ type Miscellaneous() = )) [] - member public this.``BuildMacroValues`` () = - let logger (message:string) = System.IO.File.AppendAllText(@"c:\temp\logfile.txt", (message + Environment.NewLine)) + member public this.``BuildMacroValues`` () = DoWithTempFile "MyAssembly.fsproj" (fun file -> @@ -499,7 +497,7 @@ type Miscellaneous() = DEBUG;TRACE prompt 3 - ", fun project configChangeNotifier projFile -> + ", fun project _ projFile -> let projFileText = File.ReadAllText(projFile) // We need to add text _after_ the import of Microsoft.FSharp.Targets. let i = projFileText.IndexOf(" let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier40() - let refLibPath = this.prepTest(projFile) + let _ = this.prepTest(projFile) use project = TheTests.CreateProject(projFile, "true", ccn, sp) let validate (fn : System.Runtime.Versioning.FrameworkName) eR eS = diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs index 87994c1949f..0933549f8a6 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs @@ -34,18 +34,6 @@ type Project() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - static let DefaultBuildActionOfFilename(filename) : Salsa.BuildAction = - match Path.GetExtension(filename) with - | ".fsx" -> Salsa.BuildAction.None - | ".resx" - | ".resources" -> Salsa.BuildAction.EmbeddedResource - | _ -> Salsa.BuildAction.Compile - - static let GetReferenceContainerNode(project : ProjectNode) = - let l = new List() - project.FindNodesOfType(l) - l.[0] - [] member public this.NewFolderOnProjectMenu() = printfn "starting..." @@ -256,10 +244,10 @@ type Project() = [] member public this.``FsprojFileToSolutionExplorer.FileMovement.MoveUpShouldDirtyProject``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) - this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> + this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project _ -> // Save the project first, then move the file, and check for dirty. SaveProject(project) - let foo = TheTests.FindNodeWithCaption(project, "foo.fs") + let _ = TheTests.FindNodeWithCaption(project, "foo.fs") let bar = TheTests.FindNodeWithCaption(project, "bar.fs") TheTests.MoveUp(bar) AssertEqual true project.IsProjectFileDirty @@ -273,11 +261,11 @@ type Project() = [] member public this.``FsprojFileToSolutionExplorer.FileMovement.MoveDownShouldDirtyProject``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) - this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> + this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project _ -> // Save the project first, then move the file, and check for dirty. SaveProject(project) let foo = TheTests.FindNodeWithCaption(project, "foo.fs") - let bar = TheTests.FindNodeWithCaption(project, "bar.fs") + let _ = TheTests.FindNodeWithCaption(project, "bar.fs") TheTests.MoveDown(foo) AssertEqual true project.IsProjectFileDirty // Tests the tree diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs index 0727925db6f..7a538e94b03 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs @@ -36,14 +36,7 @@ type References() = ///////////////////////////////// // project helpers static let SaveProject(project : UnitTestingFSharpProjectNode) = - project.Save(null, 1, 0u) |> ignore - - static let DefaultBuildActionOfFilename(filename) : Salsa.BuildAction = - match Path.GetExtension(filename) with - | ".fsx" -> Salsa.BuildAction.None - | ".resx" - | ".resources" -> Salsa.BuildAction.EmbeddedResource - | _ -> Salsa.BuildAction.Compile + project.Save(null, 1, 0u) |> ignore static let GetReferenceContainerNode(project : ProjectNode) = let l = new List() @@ -91,7 +84,7 @@ type References() = this.CreateDummyTestProjectBuildItAndDo(fun exe -> Assert.IsTrue(File.Exists exe, "failed to build exe") this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], - ".\\Test.dll", "v4.0", (fun project file -> + ".\\Test.dll", "v4.0", (fun project _ -> let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode Assert.IsFalse(assemRef.CanShowDefaultIcon(), "reference should be banged out, does not resolve") // add reference to Test.exe @@ -108,7 +101,7 @@ type References() = this.CreateDummyTestProjectBuildItAndDo(fun exe -> Assert.IsTrue(File.Exists exe, "failed to build exe") this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], - sprintf "%s" exe, "v4.0", (fun project file -> + sprintf "%s" exe, "v4.0", (fun project _ -> let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode Assert.IsTrue(assemRef.CanShowDefaultIcon(), "reference should not be banged out, does resolve") // add reference to Test.exe diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs index 88cff3a9d7f..fa5c4a13086 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs @@ -124,7 +124,7 @@ type RoundTrip() = | e when obj.ReferenceEquals(e,ex) -> Assert.Fail("did not expect to succeed creating project") | :? InvalidOperationException as e when e.ToString().Contains("rendered") -> printfn "As expected, failed to create project. Reason: %s" (e.Message) - | e -> Assert.Fail("failed to create project, but for wrong reason") + | _ -> Assert.Fail("failed to create project, but for wrong reason") () ) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs index 41b596fcfac..f190366bbca 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs @@ -382,56 +382,4 @@ type UpToDate() = VSConstants.VSUTDCF_PRIVATE, 0 VSConstants.VSUTDCF_REBUILD, 0 ] |> List.iter (fun (flag, expected) -> testFlag flag expected) - )) - -[] -type ``UpToDate PreserveNewest`` () = - - [] - member public this.IsUpToDatePreserveNewest () = - - let test (input, inputTimestamp) (output, outputTimestamp) = - let logs = ref [] - let outputPanel = VsMocks.vsOutputWindowPane(logs) - let logger = OutputWindowLogger((fun () -> true), outputPanel) - - let tryTimestamp (path: string) (_l: OutputWindowLogger) = - let toN = function Some d -> Nullable<_>(d) | None -> Nullable<_>() - match path with - | x when x = input -> toN inputTimestamp - | x when x = output -> toN outputTimestamp - | _ -> failwithf "unexpected %s" path - - let u = ProjectConfig.IsUpToDatePreserveNewest(logger, (Func<_,_,_>(tryTimestamp)), input, output) - u, !logs - - let now = System.DateTime.UtcNow - let before = now.AddHours(-1.0) - - let ``no input -> not up-to-date and log`` = - let u, logs = test ("readme.md", None) ("leggimi.md", None) - Assert.IsFalse(u) - logs - |> List.exists (fun s -> s.Contains("readme.md") && s.Contains("can't find expected input")) - |> Assert.IsTrue - - let ``no output -> not up-to-date and log`` = - let u, logs = test ("from.txt", Some now) ("to.txt", None) - Assert.IsFalse(u) - logs - |> List.exists (fun s -> s.Contains("to.txt") && s.Contains("can't find expected output")) - |> Assert.IsTrue - - let ``a newer version of output file is ok`` = - let u, logs = test ("before.doc", Some before) ("after.doc", Some now) - Assert.IsTrue(u) - logs |> AssertEqual [] - - let ``stale output file -> not up-to-date and log`` = - let u, logs = test ("logo.png", Some now) ("animatedlogo.gif", Some before) - Assert.IsFalse(u) - logs - |> List.exists (fun s -> s.Contains("animatedlogo.gif") && s.Contains("stale")) - |> Assert.IsTrue - - () + )) diff --git a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs index fbd950480f9..36022aa66b3 100644 --- a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs +++ b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs @@ -60,13 +60,13 @@ type internal Helper = let Check line col = //printfn "line=%d col=%d" line col MoveCursorTo(file,line,col) - let tooltip = GetQuickInfoAtCursor file - let parameterInfo = GetParameterInfoAtCursor file - let squiggle = GetSquiggleAtCursor file - let tokenType = GetTokenTypeAtCursor file - let ctrlspacecompletion = CtrlSpaceCompleteAtCursor file + let _ = GetQuickInfoAtCursor file + let _ = GetParameterInfoAtCursor file + let _ = GetSquiggleAtCursor file + let _ = GetTokenTypeAtCursor file + let _ = CtrlSpaceCompleteAtCursor file if col > 1 && lines.[line-1].[col-2] = '.' then // -2 because, -1 to get to 0-based coords, and -1 more because want to look one char left of cursor for the dot - let autocompletion = AutoCompleteAtCursor file + let _ = AutoCompleteAtCursor file () () let lines = lines |> List.toArray @@ -155,7 +155,7 @@ type internal Helper = AssertMatches regex s i <- regexStr.IndexOf(c, i+1) -type internal GlobalParseAndTypeCheckCounter private(initialParseCount:int, initialTypeCheckCount:int, initialEventNum:int, vs) = +type internal GlobalParseAndTypeCheckCounter private(_initialParseCount:int, _initialTypeCheckCount:int, initialEventNum:int, vs) = static member StartNew(vs) = TakeCoffeeBreak(vs) let n = IncrementalBuilderEventTesting.GetCurrentIncrementalBuildEventNum() @@ -260,12 +260,7 @@ type LanguageServiceBaseTests() = (* Timings ----------------------------------------------------------------------------- *) let stopWatch = new Stopwatch() - let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - let time1 op a message = - ResetStopWatch() - let result = op a - printf "%s %d ms\n" message stopWatch.ElapsedMilliseconds - result + let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() member internal this.VsOpts with set op = ops <- op diff --git a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs index 0cd346e1314..a4589632caf 100644 --- a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs +++ b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs @@ -49,32 +49,20 @@ type Tree<'T> = | Tree of (*data*)'T * (*firstChild*)Tree<'T> * (*nextSibling*)Tree<'T> | Nil -type TheTests() = - static let Net35RefAssemPathOnThisMachine() = - let key = @"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\Microsoft .NET Framework 3.5 Reference Assemblies" - let hklm = Registry.LocalMachine - let rkey = hklm.OpenSubKey(key) - rkey.GetValue("") :?> string +type TheTests() = static let ANYTREE = Tree("",Nil,Nil) ///////////////////////////////// // project helpers - static let SaveProject(project : UnitTestingFSharpProjectNode) = - project.Save(null, 1, 0u) |> ignore static let DefaultBuildActionOfFilename(filename) : Salsa.BuildAction = match Path.GetExtension(filename) with | ".fsx" -> Salsa.BuildAction.None | ".resx" | ".resources" -> Salsa.BuildAction.EmbeddedResource - | _ -> Salsa.BuildAction.Compile - - static let GetReferenceContainerNode(project : ProjectNode) = - let l = new List() - project.FindNodesOfType(l) - l.[0] + | _ -> Salsa.BuildAction.Compile ///////////////////////////////// /// Called per test @@ -119,7 +107,7 @@ type TheTests() = Print(node.NextSibling, level) Print(node, 0) - static member internal CreateProject(filename : string, forceUTF8 : string, configChangeNotifier, serviceProvider) = + static member internal CreateProject(filename : string, forceUTF8 : string, _, serviceProvider) = UIStuff.SetupSynchronizationContext() let buildEngine = Utilities.InitializeMsBuildEngine(null) let buildProject = Utilities.InitializeMsBuildProject(buildEngine, filename, null) @@ -369,7 +357,7 @@ type TheTests() = let ipsf = project :> IProvideProjectSite let ips = ipsf.GetProjectSite() let changed = ref false - let handle = ips.AdviseProjectSiteChanges("EnsureCausesNotificationTest", new AdviseProjectSiteChanges(fun () -> changed := true)) + let _ = ips.AdviseProjectSiteChanges("EnsureCausesNotificationTest", new AdviseProjectSiteChanges(fun () -> changed := true)) code() AssertEqual true (!changed) static member MsBuildCompileItems(project : Microsoft.Build.Evaluation.Project) = @@ -507,7 +495,7 @@ type TheTests() = member internal this.HelperEnsureAtLeastOne projFileBoilerplate expectedConfigs expectedPlatforms = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], projFileBoilerplate, - (fun project projFileName -> + (fun project _ -> this.CheckPlatformNames(project, expectedPlatforms) this.CheckConfigNames(project, expectedConfigs) )) @@ -537,8 +525,8 @@ and (*type*) MSBuildItem = let pathParts = s.Split([| '\\' |], StringSplitOptions.RemoveEmptyEntries) pathParts.[pathParts.Length - 1] | CompileItem(s) -> Path.GetFileName(s) - | LinkedCompileItem(inc,n) -> Path.GetFileName(n) - | OtherItem(name,inc) -> Path.GetFileName(inc) + | LinkedCompileItem(_,n) -> Path.GetFileName(n) + | OtherItem(_,inc) -> Path.GetFileName(inc) member this.IntoFolder(folder : string) = // return new copy of item in the folder Debug.Assert(folder.EndsWith("\\"), "folders should end with slash") match this with @@ -666,8 +654,8 @@ module LanguageServiceExtension = member x.DestroyHook () = if projInfo.Project = NULL then () else projInfo.Project.Close () |> ignore - match projectDict |> Seq.tryFind(fun (KeyValue(k,v)) -> obj.ReferenceEquals(v, projInfo)) with - | Some(KeyValue(k,v)) -> projectDict.Remove(k) |> ignore + match projectDict |> Seq.tryFind(fun (KeyValue(_,v)) -> obj.ReferenceEquals(v, projInfo)) with + | Some(KeyValue(k,_)) -> projectDict.Remove(k) |> ignore | None -> failwith "uh-oh, where was it in the dict?" projInfo.Project <- NULL diff --git a/vsintegration/tests/UnitTests/TestLib.Utils.fs b/vsintegration/tests/UnitTests/TestLib.Utils.fs index d67e55fe8ee..2bc8f989859 100644 --- a/vsintegration/tests/UnitTests/TestLib.Utils.fs +++ b/vsintegration/tests/UnitTests/TestLib.Utils.fs @@ -112,7 +112,7 @@ module Spawn = UserProcessorTime=proc.UserProcessorTime.TotalMilliseconds TotalProcessorTime=proc.TotalProcessorTime.TotalMilliseconds } - with :? InvalidOperationException as e -> + with :? InvalidOperationException -> // There is what appears to be an unresolvable race here. The process may exit while building the record. { PeakPagedMemorySize=0L PeakVirtualMemorySize=0L @@ -130,7 +130,7 @@ module Spawn = UserProcessorTime=max proc.UserProcessorTime.TotalMilliseconds original.UserProcessorTime TotalProcessorTime=max proc.TotalProcessorTime.TotalMilliseconds original.TotalProcessorTime } - with :? InvalidOperationException as e -> + with :? InvalidOperationException -> // There is what appears to be an unresolvable race here. The process may exit while building the record. original @@ -196,7 +196,7 @@ module Spawn = let capture (msg:DataReceivedEventArgs) = lock outlock (fun () -> captured := msg.Data :: !captured) - let exitWithResult command arguments actualCode _ = + let exitWithResult _ _ actualCode _ = actualCode, (!captured)|>List.rev|>Array.ofList spawnDetailed capture capture exitWithResult command fmt @@ -211,7 +211,7 @@ module Spawn = let capture (msg:DataReceivedEventArgs) = lock outlock (fun () -> captured := msg.Data :: !captured) - let exitWithResult command arguments actualCode _ = + let exitWithResult _ _ actualCode _ = actualCode, (!captured)|>List.rev|>Array.ofList FilesystemHelpers.DoWithTempFile @@ -299,7 +299,7 @@ namespace TestLibrary | Variable x -> lookup g x | Lambda _ -> e | Apply (e1, e2) -> match eval g e1 with - | Lambda (x, e) -> eval (add g x (eval g e2)) e1 + | Lambda (x, _) -> eval (add g x (eval g e2)) e1 | _ -> raise <| EvalFailure "Unexpected operator in application; need a lambda." module OtherTests = @@ -350,9 +350,9 @@ namespace TestLibrary member this.fold (f : 'a -> Point -> 'a)(acc : 'a) = match this.getVertices () with | [] -> acc - | p :: ps -> f (this.refold f acc) p + | p :: _ -> f (this.refold f acc) p - member this.refold (f : 'a -> Point -> 'a)(acc : 'a) = + member this.refold (_ : 'a -> Point -> 'a)(acc : 'a) = let ps = this.getVertices () let set ps = this.clearVertices () @@ -360,7 +360,6 @@ namespace TestLibrary match ps with | [] -> () | _ :: ps -> set ps - let res = this.fold f acc set ps acc diff --git a/vsintegration/tests/UnitTests/Tests.Build.fs b/vsintegration/tests/UnitTests/Tests.Build.fs index c011dcfe260..efaf9de4550 100644 --- a/vsintegration/tests/UnitTests/Tests.Build.fs +++ b/vsintegration/tests/UnitTests/Tests.Build.fs @@ -40,7 +40,7 @@ type MyLogger(f : string -> unit) = type FauxHostObject() = let mutable myFlags : string[] = null let mutable mySources : string[] = null - member x.Compile(compile:System.Func, flags:string[], sources:string[]) = + member x.Compile(_:System.Func, flags:string[], sources:string[]) = myFlags <- flags mySources <- sources 0 diff --git a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs index 2506296bb6c..5d337b23491 100644 --- a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs +++ b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs @@ -56,11 +56,11 @@ type XmlDocComments() = let solution = this.CreateSolution() let project1 = CreateProject(solution, "FSLibrary") let project2 = CreateProject(solution, "FSClient") - let file1 = AddFileFromTextBlob(project1,"File1.fs", fileContent1) + let _ = AddFileFromTextBlob(project1,"File1.fs", fileContent1) AddProjectReference(project2,project1) Build(project1) |> fun result -> Assert.IsTrue(result.BuildSucceeded) - let file2 = AddFileFromTextBlob(project2,"File2.fs", fileContent2) + let _ = AddFileFromTextBlob(project2,"File2.fs", fileContent2) let file = OpenFile(project2, "File2.fs") MoveCursorToStartOfMarker(file, marker) GetQuickInfoAtCursor file diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index c3028d5b8c9..a796ba51e74 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -42,7 +42,6 @@ -