Преглед изворни кода

Removing NO_VARIANCE checks.

Bart De Smet пре 8 година
родитељ
комит
376a1ac91b

+ 1 - 7
Rx.NET/Source/src/System.Reactive/IEventPattern.cs

@@ -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

+ 1 - 5
Rx.NET/Source/src/System.Reactive/IEventSource.cs

@@ -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.

+ 0 - 4
Rx.NET/Source/src/System.Reactive/IObserver.Result.cs

@@ -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.

+ 1 - 5
Rx.NET/Source/src/System.Reactive/Internal/Producer.cs

@@ -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);
     }

+ 0 - 4
Rx.NET/Source/src/System.Reactive/Linq/IGroupedObservable.cs

@@ -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.

+ 1 - 5
Rx.NET/Source/src/System.Reactive/Linq/IQbservable.cs

@@ -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>
     {
     }
 

+ 0 - 4
Rx.NET/Source/src/System.Reactive/Linq/QueryLanguage.Conversions.cs

@@ -118,11 +118,7 @@ namespace System.Reactive.Linq
 #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)
             );
         }

+ 0 - 4
Rx.NET/Source/src/System.Reactive/Subjects/IConnectableObservable.cs

@@ -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.

+ 0 - 4
Rx.NET/Source/src/System.Reactive/Subjects/ISubject.Multi.cs

@@ -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
     {
     }
 }

+ 0 - 4
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/QbservableTest.cs

@@ -1893,11 +1893,7 @@ namespace ReactiveTests.Tests
         [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);
         }
     }