Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing NO_VARIANCE checks #344

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Rx.NET/Source/src/System.Reactive/IEventPattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ namespace System.Reactive
/// The type of the event data generated by the event.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
public interface IEventPattern<
#if !NO_VARIANCE
out TSender, out TEventArgs
#else
TSender, TEventArgs
#endif
>
public interface IEventPattern<out TSender, out TEventArgs>
#if !NO_EVENTARGS_CONSTRAINT
where TEventArgs : EventArgs
#endif
Expand Down
6 changes: 1 addition & 5 deletions Rx.NET/Source/src/System.Reactive/IEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ namespace System.Reactive
/// The type of the event data generated by the event.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
public interface IEventSource<
#if !NO_VARIANCE && !SILVERLIGHT4 // SL4 doesn't mark Action<T> as contravariant!
out
#endif
T>
public interface IEventSource<out T>
{
/// <summary>
/// Event signaling the next element in the data stream.
Expand Down
4 changes: 0 additions & 4 deletions Rx.NET/Source/src/System.Reactive/IObserver.Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ namespace System.Reactive
/// The type of the result returned from the observer's notification handlers.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
#if !NO_VARIANCE
public interface IObserver<in TValue, out TResult>
#else
public interface IObserver<TValue, TResult>
#endif
{
/// <summary>
/// Notifies the observer of a new element in the sequence.
Expand Down
6 changes: 1 addition & 5 deletions Rx.NET/Source/src/System.Reactive/Internal/Producer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ namespace System.Reactive
/// Interface with variance annotation; allows for better type checking when detecting capabilities in SubscribeSafe.
/// </summary>
/// <typeparam name="TSource">Type of the resulting sequence's elements.</typeparam>
internal interface IProducer<
#if !NO_VARIANCE
out
#endif
TSource> : IObservable<TSource>
internal interface IProducer<out TSource> : IObservable<TSource>
{
IDisposable SubscribeRaw(IObserver<TSource> observer, bool enableSafeguard);
}
Expand Down
4 changes: 0 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Linq/IGroupedObservable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ namespace System.Reactive.Linq
/// The type of the elements in the group.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
#if !NO_VARIANCE
public interface IGroupedObservable<out TKey, out TElement> : IObservable<TElement>
#else
public interface IGroupedObservable<TKey, TElement> : IObservable<TElement>
#endif
{
/// <summary>
/// Gets the common key.
Expand Down
6 changes: 1 addition & 5 deletions Rx.NET/Source/src/System.Reactive/Linq/IQbservable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ namespace System.Reactive.Linq
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Qbservable", Justification = "What a pleasure to write 'by design' here.")]
public interface IQbservable<
#if !NO_VARIANCE
out
#endif
T> : IQbservable, IObservable<T>
public interface IQbservable<out T> : IQbservable, IObservable<T>
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,7 @@ public virtual IEventPatternSource<TEventArgs> ToEventPattern<TEventArgs>(IObser
#endif
{
return new EventPatternSource<TEventArgs>(
#if !NO_VARIANCE
source,
#else
source.Select(x => (EventPattern<object, TEventArgs>)x),
#endif
(h, evt) => h(evt.Sender, evt.EventArgs)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ namespace System.Reactive.Subjects
/// The type of the elements in the sequence.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
#if !NO_VARIANCE
public interface IConnectableObservable<out T> : IObservable<T>
#else
public interface IConnectableObservable<T> : IObservable<T>
#endif
{
/// <summary>
/// Connects the observable wrapper to its source. All subscribed observers will receive values from the underlying observable sequence as long as the connection is established.
Expand Down
4 changes: 0 additions & 4 deletions Rx.NET/Source/src/System.Reactive/Subjects/ISubject.Multi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ namespace System.Reactive.Subjects
/// The type of the elements produced by the subject.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
/// </typeparam>
#if !NO_VARIANCE
public interface ISubject<in TSource, out TResult> : IObserver<TSource>, IObservable<TResult>
#else
public interface ISubject<TSource, TResult> : IObserver<TSource>, IObservable<TResult>
#endif
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1893,11 +1893,7 @@ public void Qbservable_Extensibility_Missing()
[Fact]
public void Qbservable_HigherOrder()
{
#if NO_VARIANCE
var res = Qbservable.Return(Qbservable.Provider, 42).Select(_ => (IObservable<int>)Qbservable.Return(Qbservable.Provider, 42)).Switch().Single();
#else
var res = Qbservable.Return(Qbservable.Provider, 42).Select(_ => Qbservable.Return(Qbservable.Provider, 42)).Switch().Single();
#endif
Assert.Equal(42, res);
}
}
Expand Down