From 17f3ff31763ae1b8dfebda4cc54049f6ce8f3688 Mon Sep 17 00:00:00 2001 From: johannes karoff Date: Mon, 20 Nov 2023 23:53:09 +0100 Subject: [PATCH] let empty return Observable[Nothing]/Rx[Nothing] --- colibri/src/main/scala/colibri/Observable.scala | 4 ++-- reactive/src/main/scala/colibri/reactive/Reactive.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/colibri/src/main/scala/colibri/Observable.scala b/colibri/src/main/scala/colibri/Observable.scala index c5262057..1374f2f5 100644 --- a/colibri/src/main/scala/colibri/Observable.scala +++ b/colibri/src/main/scala/colibri/Observable.scala @@ -89,8 +89,8 @@ object Observable { @inline def unsafeSubscribe(sink: Observer[Nothing]): Cancelable = Cancelable.empty } - @inline def empty[A]: Observable[A] = Empty - val unit: Observable[Unit] = Observable.pure(()) + @inline def empty: Observable[Nothing] = Empty + val unit: Observable[Unit] = Observable.pure(()) def pure[T](value: T): Observable[T] = new Observable[T] { def unsafeSubscribe(sink: Observer[T]): Cancelable = { diff --git a/reactive/src/main/scala/colibri/reactive/Reactive.scala b/reactive/src/main/scala/colibri/reactive/Reactive.scala index 33f6bc9d..f2a51d49 100644 --- a/reactive/src/main/scala/colibri/reactive/Reactive.scala +++ b/reactive/src/main/scala/colibri/reactive/Reactive.scala @@ -112,7 +112,7 @@ trait RxEvent[+A] extends RxSource[A] with RxSourceSelf[RxEvent, RxEvent, A] { object RxEvent extends RxPlatform { private val _empty: RxEvent[Nothing] = observableUnshared(Observable.empty) - @inline def empty[A]: RxEvent[A] = _empty + @inline def empty: RxEvent[Nothing] = _empty @inline def apply[A](values: A*): RxEvent[A] = iterable(values) @@ -148,7 +148,7 @@ trait RxLater[+A] extends RxState[A] with RxSourceSelf[RxLater, RxLater, A] { } object RxLater { - @inline def empty[A]: RxLater[A] = RxLaterEmpty + @inline def empty: RxLater[Nothing] = RxLaterEmpty def future[A](future: => Future[A]): RxLater[A] = observable(Observable.fromFuture(future)) def effect[F[_]: RunEffect, A](effect: F[A]): RxLater[A] = observable(Observable.fromEffect(effect))