Skip to content

Commit 6032264

Browse files
authored
Cleanup warning noise (#630)
1 parent e3b1916 commit 6032264

File tree

13 files changed

+23
-6
lines changed

13 files changed

+23
-6
lines changed

docsrc/content/applicative-functors.fsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ A List functor can be thought of as a function which takes an integer index to r
7878
So, you can think of ``map`` on a List functor as composing a function:
7979
8080
**)
81+
82+
#nowarn "0025" // Incomplete pattern matches on this expression. For example, the value '3' may indicate a case not covered by the pattern(s)
83+
8184
let listFunc = function 0 -> 1 | 1 -> 2 | 2 -> 3 // [1;2;3]
8285
let r01'' = map (fun x -> string (x + 10)) listFunc
8386

docsrc/content/type-free.fsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// This block of code is omitted in the generated HTML documentation. Use
33
// it to define helpers that you do not want to show in the documentation.
44
#r @"../../src/FSharpPlus/bin/Release/net8.0/FSharpPlus.dll"
5+
#nowarn "0040" // This and other recursive references to the object(s) being defined will be checked for initialization-soundness at runtime through the use of a delayed reference.
6+
// This is because you are defining one or more recursive objects, rather than recursive functions.
7+
58
(**
69
Free<'Functor<'T>, 'T>
710
======================
@@ -89,7 +92,7 @@ type Reservation = {
8992
Name : string
9093
Email : string
9194
Quantity : int }
92-
with static member Create (Quantity, Date, Name, Email) = { Date = Date; Name = Name; Email = Email; Quantity = Quantity }
95+
with static member Create (quantity, date, name, email) = { Date = date; Name = name; Email = email; Quantity = quantity }
9396

9497
let readReservationRequest =
9598
curryN Reservation.Create

docsrc/content/type-seqt.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// it to define helpers that you do not want to show in the documentation.
44

55
#r @"../../src/FSharpPlus/bin/Release/net8.0/FSharpPlus.dll"
6+
#nowarn "0044" // Suppress warning FS0044: This construct is deprecated. WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.
67

78
// For some reason AsyncDownloadString is not found during doc build. The following is a dumb implementation just to make the compiler happy.
89
// TODO find out why.

src/FSharpPlus.Docs/Samples/Learn You a Haskell.fsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ let addStuff4 = // 19
322322
State monad
323323
--------------------------------------------------*)
324324

325+
#nowarn "0025" // Incomplete pattern matches on this expression. For example, the value '[]' may indicate a case not covered by the pattern(s)
326+
325327
type Stack = List<int>
326328

327329
let pop (x::xs) = (x,xs)

src/FSharpPlus.TypeLevel/FSharpPlus.TypeLevel.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<Platforms>AnyCPU</Platforms>
88
<LangVersion Condition=" '$(Configuration)' == 'Fable'">5.0</LangVersion>
99
<DefineConstants Condition=" '$(Configuration)' == 'Fable'">$(DefineConstants);FABLE_COMPILER</DefineConstants>
10+
<OtherFlags>--nowarn:0044 $(OtherFlags)</OtherFlags>
1011
</PropertyGroup>
1112

1213
<ItemGroup>

src/FSharpPlus.TypeLevel/Providers/FSharpPlus.Providers.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<AssemblyVersion>$(VersionPrefix).0</AssemblyVersion>
1212
<FileVersion>$(VersionPrefix).0</FileVersion>
1313
<GenerateDocumentationFile>true</GenerateDocumentationFile>
14-
<OtherFlags>--warnon:1182 $(OtherFlags)</OtherFlags>
14+
<OtherFlags>--nowarn:0044 --warnon:1182 $(OtherFlags)</OtherFlags>
1515
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
1616
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
1717
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>

src/FSharpPlus/Control/Monad.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ type Join =
136136
match v.TryGetValue (k) with
137137
| true, v -> dct.Add (k, v)
138138
| _ -> ()
139-
dct :> IDictionary<'Key, 'U>
139+
dct :> IDictionary<'Key, 'Value>
140140

141141
static member Join (x: IReadOnlyDictionary<_, IReadOnlyDictionary<_, _>>, [<Optional>]_output: IReadOnlyDictionary<'Key, 'Value>, [<Optional>]_mthd: Join) : IReadOnlyDictionary<'Key, 'Value> =
142142
let dct = Dictionary ()
143143
for KeyValue(k, v) in x do
144144
match v.TryGetValue (k) with
145145
| true, v -> dct.Add (k, v)
146146
| _ -> ()
147-
dct :> IReadOnlyDictionary<'Key, 'U>
147+
dct :> IReadOnlyDictionary<'Key, 'Value>
148148

149149
static member Join (x: ResizeArray<ResizeArray<'T>> , [<Optional>]_output: ResizeArray<'T> , [<Optional>]_mthd: Join) = ResizeArray (Seq.bind seq<_> x) : ResizeArray<'T>
150150

src/FSharpPlus/Data/NonEmptyList.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ module NonEmptyList =
166166
/// <summary>Splits the list in head and tail.</summary>
167167
/// <param name="list">The input list.</param>
168168
/// <returns>A tuple with the head and the tail of the original list.</returns>
169-
let unconsAsList ({ Head = x; Tail = xs } as list) = x, xs
169+
let unconsAsList { Head = x; Tail = xs } = x, xs
170170

171171
/// Returns the first element of a new non empty list. You can also use property nel.Head.
172172
let head {Head = x; Tail = _ } = x

tests/CSharpLib/CustomerId.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public struct CustomerId : IEquatable<CustomerId>, ICustomerId
77
public long Value { get; }
88
public CustomerId(long value) => this.Value = value;
99
public static readonly CustomerId Empty = new CustomerId();
10+
#pragma warning disable CA2013 // Do not use ReferenceEquals with value types
1011
public bool Equals(CustomerId other) => !ReferenceEquals(null, other) && Equals(Value, other.Value);
12+
#pragma warning restore CA2013 // Do not use ReferenceEquals with value types
1113
public override bool Equals(object obj) => obj is CustomerId id && Equals(id);
1214
public override int GetHashCode() => Value.GetHashCode();
1315
public override string ToString() => Value.ToString();

tests/FSharpPlusFable.Tests/FSharpPlusFable.Tests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<DefineConstants Condition=" '$(Configuration)' == 'Fable'">$(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_FAKE</DefineConstants>
88
<DefineConstants Condition=" '$(Configuration)' == 'Fable4'">$(DefineConstants);FABLE_COMPILER;FABLE_COMPILER_4;FABLE_COMPILER_FAKE</DefineConstants>
99
<TargetFramework>net8.0</TargetFramework>
10+
<OtherFlags>--nowarn:3520 $(OtherFlags)</OtherFlags>
1011
</PropertyGroup>
1112

1213

tests/FSharpPlusFable.Tests/FSharpTests/General/Monoid.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ let monoid = testList "Monoid" [
5656
let z = x |> map (Seq.singleton >> dict >> map List.singleton) |> Seq.sum
5757
Assert.IsInstanceOf<Option< Dictionary<string,int list>>> (Some y)
5858
Assert.IsInstanceOf<Option<IDictionary<string,int list>>> (Some z)
59+
#else
60+
let _ = x // Avoid unused variable warning
5961
#endif
6062
SideEffects.reset ()
6163

tests/FSharpPlusFable.Tests/FSharpTests/General/MonoidCompile.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ let testCompile =
7878

7979
#if !FABLE_COMPILER
8080
let mapAB = plus mapA mapB
81+
#else
82+
let _ = mapA, mapB // avoid unused warning for mapA and mapB
8183
#endif
8284
#if !FABLE_COMPILER
8385
let _greeting1 = Async.RunSynchronously mapAB.[2]

tests/benchmarks/ExtensionsBenchmarks.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module ResultOldVersion =
9292
module ResultNewVersion =
9393

9494
let sequence (t: seq<Result<int, string>>) : Result<int seq, string> =
95-
let mutable accumulator = ArrayCollector<'T> ()
95+
let mutable accumulator = ArrayCollector<_> ()
9696
let mutable error = None
9797
use e = t.GetEnumerator ()
9898
while e.MoveNext () && error.IsNone do

0 commit comments

Comments
 (0)