Skip to content

Commit

Permalink
fix ObserveSort comparer nullable annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Sep 3, 2024
1 parent dce0bb6 commit 7a57328
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/ObservableCollections.R3/ObservableCollectionR3Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static Observable<Unit> ObserveClear<T>(this IObservableCollection<T> sou
return new ObservableCollectionReverse<T>(source, cancellationToken);
}

public static Observable<(int Index, int Count, IComparer<T> Comparer)> ObserveSort<T>(this IObservableCollection<T> source, CancellationToken cancellationToken = default)
public static Observable<(int Index, int Count, IComparer<T>? Comparer)> ObserveSort<T>(this IObservableCollection<T> source, CancellationToken cancellationToken = default)
{
return new ObservableCollectionSort<T>(source, cancellationToken);
}
Expand Down Expand Up @@ -290,18 +290,18 @@ protected override void Handler(in NotifyCollectionChangedEventArgs<T> eventArgs
}
}

sealed class ObservableCollectionSort<T>(IObservableCollection<T> collection, CancellationToken cancellationToken) : Observable<(int Index, int Count, IComparer<T> Comparer)>
sealed class ObservableCollectionSort<T>(IObservableCollection<T> collection, CancellationToken cancellationToken) : Observable<(int Index, int Count, IComparer<T>? Comparer)>
{
protected override IDisposable SubscribeCore(Observer<(int Index, int Count, IComparer<T> Comparer)> observer)
protected override IDisposable SubscribeCore(Observer<(int Index, int Count, IComparer<T>? Comparer)> observer)
{
return new _ObservableCollectionSort(collection, observer, cancellationToken);
}

sealed class _ObservableCollectionSort(
IObservableCollection<T> collection,
Observer<(int Index, int Count, IComparer<T> Comparer)> observer,
Observer<(int Index, int Count, IComparer<T>? Comparer)> observer,
CancellationToken cancellationToken)
: ObservableCollectionObserverBase<T, (int Index, int Count, IComparer<T> Comparer)>(collection, observer, cancellationToken)
: ObservableCollectionObserverBase<T, (int Index, int Count, IComparer<T>? Comparer)>(collection, observer, cancellationToken)
{
protected override void Handler(in NotifyCollectionChangedEventArgs<T> eventArgs)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ObservableCollections/NotifyCollectionChangedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public SortOperation(int index, int count, IComparer<T>? comparer)
Comparer = comparer ?? NullComparerSentinel.Instance;
}

public (int Index, int Count, IComparer<T> Comparer) AsTuple()
public (int Index, int Count, IComparer<T>? Comparer) AsTuple()
{
return (Index, Count, Comparer!);
return (Index, Count, Comparer);
}

public static SortOperation<T> CreateReverse(int index, int count)
Expand Down

0 comments on commit 7a57328

Please sign in to comment.