Skip to content

Commit 14553f7

Browse files
Address Rider complaints (#640)
also, fuck Rider
1 parent 635691e commit 14553f7

File tree

10 files changed

+37
-34
lines changed

10 files changed

+37
-34
lines changed

Source/SuperLinq.Async/Join.HashJoin.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SuperLinq.Async;
1+
namespace SuperLinq.Async;
22

33
public static partial class AsyncSuperEnumerable
44
{
@@ -210,7 +210,7 @@ public static IAsyncEnumerable<TResult> InnerHashJoin<TLeft, TRight, TKey, TResu
210210
ArgumentNullException.ThrowIfNull(leftKeySelector);
211211
ArgumentNullException.ThrowIfNull(rightKeySelector);
212212

213-
return JoinHash(
213+
return JoinHash<TLeft, TRight, TKey, (TLeft, TRight?)>(
214214
left, right,
215215
leftKeySelector, rightKeySelector,
216216
static left => (left, default),
@@ -366,7 +366,7 @@ public static IAsyncEnumerable<TResult> LeftOuterHashJoin<TLeft, TRight, TKey, T
366366
ArgumentNullException.ThrowIfNull(leftKeySelector);
367367
ArgumentNullException.ThrowIfNull(rightKeySelector);
368368

369-
return JoinHash(
369+
return JoinHash<TLeft, TRight, TKey, (TLeft?, TRight)>(
370370
left, right,
371371
leftKeySelector, rightKeySelector,
372372
leftResultSelector: default,
@@ -522,7 +522,7 @@ public static IAsyncEnumerable<TResult> RightOuterHashJoin<TLeft, TRight, TKey,
522522
ArgumentNullException.ThrowIfNull(leftKeySelector);
523523
ArgumentNullException.ThrowIfNull(rightKeySelector);
524524

525-
return JoinHash(
525+
return JoinHash<TLeft, TRight, TKey, (TLeft?, TRight?)>(
526526
left, right,
527527
leftKeySelector, rightKeySelector,
528528
static left => (left, default),

Source/SuperLinq.Async/Join.LoopJoin.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SuperLinq.Async;
1+
namespace SuperLinq.Async;
22

33
public static partial class AsyncSuperEnumerable
44
{
@@ -205,7 +205,7 @@ public static IAsyncEnumerable<TResult> InnerLoopJoin<TLeft, TRight, TKey, TResu
205205
ArgumentNullException.ThrowIfNull(leftKeySelector);
206206
ArgumentNullException.ThrowIfNull(rightKeySelector);
207207

208-
return LoopJoin(
208+
return LoopJoin<TLeft, TRight, TKey, (TLeft, TRight?)>(
209209
left, right,
210210
leftKeySelector, rightKeySelector,
211211
static left => (left, default),

Source/SuperLinq.Async/Join.MergeJoin.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics.CodeAnalysis;
1+
using System.Diagnostics.CodeAnalysis;
22

33
namespace SuperLinq.Async;
44

@@ -215,7 +215,7 @@ public static IAsyncEnumerable<TResult> InnerMergeJoin<TLeft, TRight, TKey, TRes
215215
ArgumentNullException.ThrowIfNull(leftKeySelector);
216216
ArgumentNullException.ThrowIfNull(rightKeySelector);
217217

218-
return JoinMerge(
218+
return JoinMerge<TLeft, TRight, TKey, (TLeft, TRight?)>(
219219
left, right,
220220
leftKeySelector, rightKeySelector,
221221
static left => (left, default),
@@ -373,7 +373,7 @@ public static IAsyncEnumerable<TResult> LeftOuterMergeJoin<TLeft, TRight, TKey,
373373
ArgumentNullException.ThrowIfNull(leftKeySelector);
374374
ArgumentNullException.ThrowIfNull(rightKeySelector);
375375

376-
return JoinMerge(
376+
return JoinMerge<TLeft, TRight, TKey, (TLeft?, TRight)>(
377377
left, right,
378378
leftKeySelector, rightKeySelector,
379379
leftResultSelector: default,
@@ -531,7 +531,7 @@ public static IAsyncEnumerable<TResult> RightOuterMergeJoin<TLeft, TRight, TKey,
531531
ArgumentNullException.ThrowIfNull(leftKeySelector);
532532
ArgumentNullException.ThrowIfNull(rightKeySelector);
533533

534-
return JoinMerge(
534+
return JoinMerge<TLeft, TRight, TKey, (TLeft?, TRight?)>(
535535
left, right,
536536
leftKeySelector, rightKeySelector,
537537
static left => (left, default),

Source/SuperLinq/FillForward.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics.CodeAnalysis;
1+
using System.Diagnostics.CodeAnalysis;
22

33
namespace SuperLinq;
44

@@ -112,10 +112,12 @@ private static IEnumerable<T> FillForwardCore<T>(IEnumerable<T> source, Func<T,
112112
{
113113
if (predicate(item))
114114
{
115+
// ! is valid here - could be `null` because `predicate` returned true when an item is `null` but in
116+
// that case, `T` will be nullable as well. using forgiveness here protects `T` in other cases.
115117
yield return (seed, fillSelector) switch
116118
{
117-
((true, var s), { } f) => f(item, s),
118-
((true, var s), _) => s,
119+
((true, var s), { } f) => f(item, s!),
120+
((true, var s), _) => s!,
119121
_ => item,
120122
};
121123
}

Source/SuperLinq/Join.HashJoin.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SuperLinq;
1+
namespace SuperLinq;
22

33
public static partial class SuperEnumerable
44
{
@@ -210,7 +210,7 @@ public static IEnumerable<TResult> InnerHashJoin<TLeft, TRight, TKey, TResult>(
210210
ArgumentNullException.ThrowIfNull(leftKeySelector);
211211
ArgumentNullException.ThrowIfNull(rightKeySelector);
212212

213-
return JoinHash(
213+
return JoinHash<TLeft, TRight, TKey, (TLeft, TRight?)>(
214214
left, right,
215215
leftKeySelector, rightKeySelector,
216216
static left => (left, default),
@@ -366,7 +366,7 @@ public static IEnumerable<TResult> LeftOuterHashJoin<TLeft, TRight, TKey, TResul
366366
ArgumentNullException.ThrowIfNull(leftKeySelector);
367367
ArgumentNullException.ThrowIfNull(rightKeySelector);
368368

369-
return JoinHash(
369+
return JoinHash<TLeft, TRight, TKey, (TLeft?, TRight)>(
370370
left, right,
371371
leftKeySelector, rightKeySelector,
372372
leftResultSelector: default,
@@ -522,7 +522,7 @@ public static IEnumerable<TResult> RightOuterHashJoin<TLeft, TRight, TKey, TResu
522522
ArgumentNullException.ThrowIfNull(leftKeySelector);
523523
ArgumentNullException.ThrowIfNull(rightKeySelector);
524524

525-
return JoinHash(
525+
return JoinHash<TLeft, TRight, TKey, (TLeft?, TRight?)>(
526526
left, right,
527527
leftKeySelector, rightKeySelector,
528528
static left => (left, default),

Source/SuperLinq/Join.LoopJoin.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace SuperLinq;
1+
namespace SuperLinq;
22

33
public static partial class SuperEnumerable
44
{
@@ -205,7 +205,7 @@ public static IEnumerable<TResult> InnerLoopJoin<TLeft, TRight, TKey, TResult>(
205205
ArgumentNullException.ThrowIfNull(leftKeySelector);
206206
ArgumentNullException.ThrowIfNull(rightKeySelector);
207207

208-
return LoopJoin(
208+
return LoopJoin<TLeft, TRight, TKey, (TLeft, TRight?)>(
209209
left, right,
210210
leftKeySelector, rightKeySelector,
211211
static left => (left, default),

Source/SuperLinq/Join.MergeJoin.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics.CodeAnalysis;
1+
using System.Diagnostics.CodeAnalysis;
22

33
namespace SuperLinq;
44

@@ -215,7 +215,7 @@ public static IEnumerable<TResult> InnerMergeJoin<TLeft, TRight, TKey, TResult>(
215215
ArgumentNullException.ThrowIfNull(leftKeySelector);
216216
ArgumentNullException.ThrowIfNull(rightKeySelector);
217217

218-
return JoinMerge(
218+
return JoinMerge<TLeft, TRight, TKey, (TLeft, TRight?)>(
219219
left, right,
220220
leftKeySelector, rightKeySelector,
221221
static left => (left, default),
@@ -373,7 +373,7 @@ public static IEnumerable<TResult> LeftOuterMergeJoin<TLeft, TRight, TKey, TResu
373373
ArgumentNullException.ThrowIfNull(leftKeySelector);
374374
ArgumentNullException.ThrowIfNull(rightKeySelector);
375375

376-
return JoinMerge(
376+
return JoinMerge<TLeft, TRight, TKey, (TLeft?, TRight)>(
377377
left, right,
378378
leftKeySelector, rightKeySelector,
379379
leftResultSelector: default,
@@ -531,7 +531,7 @@ public static IEnumerable<TResult> RightOuterMergeJoin<TLeft, TRight, TKey, TRes
531531
ArgumentNullException.ThrowIfNull(leftKeySelector);
532532
ArgumentNullException.ThrowIfNull(rightKeySelector);
533533

534-
return JoinMerge(
534+
return JoinMerge<TLeft, TRight, TKey, (TLeft?, TRight?)>(
535535
left, right,
536536
leftKeySelector, rightKeySelector,
537537
static left => (left, default),

Tests/SuperLinq.Async.Test/.editorconfig

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ dotnet_diagnostic.CS1712.severity = none # CS1712: Type parameter
1515
# xUnit errors
1616
dotnet_diagnostic.xUnit1008.severity = error # xUnit1008: Test data attribute should only be used on a Theory
1717
dotnet_diagnostic.xUnit1013.severity = error # xUnit1013: Public method should be marked as test
18+
dotnet_diagnostic.xUnit1042.severity = none # xUnit1042: The member referenced by the MemberData attribute returns untyped data rows

Tests/SuperLinq.Async.Test/GetShortestPathTest.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Test.Async;
1+
namespace Test.Async;
22

33
public static class GetShortestPathTest
44
{
@@ -85,7 +85,7 @@ public async Task GetStringIntCostByState(
8585
[Theory]
8686
[MemberData(nameof(GetStringIntCostData))]
8787
public async Task GetStringIntCostByFunction(
88-
IEqualityComparer<string> stateComparer,
88+
IEqualityComparer<string>? stateComparer,
8989
IComparer<int>? costComparer,
9090
int expectedCost,
9191
int expectedCount)
@@ -189,7 +189,7 @@ public async Task GetStringIntPathByFunction(
189189
[
190190
null,
191191
null,
192-
Seq(
192+
Seq<(string, (string?, int))>(
193193
("start", (null, 0)),
194194
("a", ("start", 1)),
195195
("b", ("a", 3)),
@@ -205,7 +205,7 @@ public async Task GetStringIntPathByFunction(
205205
[
206206
StringComparer.InvariantCultureIgnoreCase,
207207
null,
208-
Seq(
208+
Seq<(string, (string?, int))>(
209209
("start", (null, 0)),
210210
("a", ("start", 1)),
211211
("b", ("a", 3)),
@@ -216,7 +216,7 @@ public async Task GetStringIntPathByFunction(
216216
[
217217
null,
218218
Comparer<int>.Create((x, y) => -x.CompareTo(y)),
219-
Seq(
219+
Seq<(string, (string?, int))>(
220220
("start", (null, 0)),
221221
("a", ("start", 1)),
222222
("b", ("a", 3)),
@@ -232,7 +232,7 @@ public async Task GetStringIntPathByFunction(
232232
[
233233
StringComparer.InvariantCultureIgnoreCase,
234234
Comparer<int>.Create((x, y) => -x.CompareTo(y)),
235-
Seq(
235+
Seq<(string, (string?, int))>(
236236
("start", (null, 0)),
237237
("a", ("start", 10)),
238238
("b", ("a", 30)),

Tests/SuperLinq.Test/GetShortestPathTest.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Test;
1+
namespace Test;
22

33
public static class GetShortestPathTest
44
{
@@ -189,7 +189,7 @@ public void GetStringIntPathByFunction(
189189
[
190190
null,
191191
null,
192-
Seq(
192+
Seq<(string, (string?, int))>(
193193
("start", (null, 0)),
194194
("a", ("start", 1)),
195195
("b", ("a", 3)),
@@ -205,7 +205,7 @@ public void GetStringIntPathByFunction(
205205
[
206206
StringComparer.InvariantCultureIgnoreCase,
207207
null,
208-
Seq(
208+
Seq<(string, (string?, int))>(
209209
("start", (null, 0)),
210210
("a", ("start", 1)),
211211
("b", ("a", 3)),
@@ -216,7 +216,7 @@ public void GetStringIntPathByFunction(
216216
[
217217
null,
218218
Comparer<int>.Create((x, y) => -x.CompareTo(y)),
219-
Seq(
219+
Seq<(string, (string?, int))>(
220220
("start", (null, 0)),
221221
("a", ("start", 1)),
222222
("b", ("a", 3)),
@@ -232,7 +232,7 @@ public void GetStringIntPathByFunction(
232232
[
233233
StringComparer.InvariantCultureIgnoreCase,
234234
Comparer<int>.Create((x, y) => -x.CompareTo(y)),
235-
Seq(
235+
Seq<(string, (string?, int))>(
236236
("start", (null, 0)),
237237
("a", ("start", 10)),
238238
("b", ("a", 30)),

0 commit comments

Comments
 (0)