diff --git a/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala b/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala index c527fd35e..1e33bca26 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/operator/EventBundle.scala @@ -118,7 +118,7 @@ trait Event[+T] extends MacroAccess[Option[T]] with Disconnectable { * @group conversion */ final def iterate[A](init: A)(f: A => A)(implicit ticket: CreationTicket[State]): Signal[A] = - fold(init)((acc, _) => f(acc)): @nowarn + fold(init)((acc, _) => f(acc)) /** Counts the occurrences of the event. * The argument of the event is discarded. @@ -133,19 +133,19 @@ trait Event[+T] extends MacroAccess[Option[T]] with Disconnectable { * @group conversion */ final def hold[A >: T](init: A)(implicit ticket: CreationTicket[State]): Signal[A] = - fold(init)((_, v) => v): @nowarn + fold(init)((_, v) => v) /** returns a signal holding the latest value of the event. * @group conversion */ final def hold[A >: T]()(implicit ticket: CreationTicket[State]): Signal[A] = - Fold(throw EmptySignalControlThrowable(info))(this act { v => v }): @nowarn + Fold(throw EmptySignalControlThrowable(info))(this act { v => v }) /** Holds the latest value of an event as an Option, None before the first event occured * @group conversion */ final def holdOption[A >: T]()(implicit ticket: CreationTicket[State]): Signal[Option[A]] = - fold(Option.empty[A]) { (_, v) => Some(v) }: @nowarn + fold(Option.empty[A]) { (_, v) => Some(v) } /** Returns a signal which holds the last n events in a list. At the beginning the * list increases in size up to when n values are available @@ -157,14 +157,14 @@ trait Event[+T] extends MacroAccess[Option[T]] with Disconnectable { else fold(Queue[A]()) { (queue: Queue[A], v: T) => if (queue.lengthCompare(n) >= 0) queue.tail.enqueue(v) else queue.enqueue(v) - }: @nowarn + } } /** collects events resulting in a variable holding a list of all values. * @group conversion */ final def list[A >: T]()(implicit ticket: CreationTicket[State]): Signal[List[A]] = - fold(List[A]())((acc, v) => v :: acc): @nowarn + fold(List[A]())((acc, v) => v :: acc) /** Switch back and forth between two signals on occurrence of event e * @group conversion @@ -172,7 +172,7 @@ trait Event[+T] extends MacroAccess[Option[T]] with Disconnectable { final def toggle[A](a: Signal[A], b: Signal[A])(implicit ticket: CreationTicket[State]): Signal[A] = ticket.scope.embedCreation { ict => val switched: Signal[Boolean] = iterate(false) { !_ }(using ict) - Signal.dynamic(using ict) { if switched.value then b.value else a.value }: @nowarn + Signal.dynamic(using ict) { if switched.value then b.value else a.value } } /** Filters the event, only propagating the value when the filter is true. diff --git a/Modules/Reactives/shared/src/main/scala/reactives/operator/FlattenBundle.scala b/Modules/Reactives/shared/src/main/scala/reactives/operator/FlattenBundle.scala index 2605d0797..28cfe0259 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/operator/FlattenBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/operator/FlattenBundle.scala @@ -20,7 +20,7 @@ object Flatten { implicit def flattenImplicitForsignal[B](using CreationTicket[State]): Flatten[ Signal[Signal[B]], Signal[B] - ] = sig => Signal.dynamic(sig.value.value): @nowarn + ] = sig => Signal.dynamic(sig.value.value) /** Flatten a Signal[Array[Signal[B]\]\] into a Signal[Array[B]\] where the new Signal updates whenever any of the inner or the outer signal updates */ implicit def flattenImplicitForArraySignals[B: ClassTag, Sig[U] <: Signal[U]](using @@ -28,25 +28,25 @@ object Flatten { ): Flatten[ Signal[Array[Sig[B]]], Signal[Array[B]] - ] = sig => Signal.dynamic { sig.value.map(_.value) }: @nowarn + ] = sig => Signal.dynamic { sig.value.map(_.value) } /** Flatten a Signal[Option[Signal[B]\]\] into a Signal[Option[B]\] where the new Signal updates whenever any of the inner or the outer signal updates */ implicit def flattenImplicitForOptionSignal[B, Sig[U] <: Signal[U]](using CreationTicket[State]): Flatten[ Signal[Option[Sig[B]]], Signal[Option[B]] - ] = sig => Signal.dynamic { sig.value.map { _.value } }: @nowarn + ] = sig => Signal.dynamic { sig.value.map { _.value } } /** Flatten a Signal[Event[B]]\] into a Event[B] where the new Event fires whenever the current inner event fires */ implicit def flattenImplicitForevent[A, B, Evnt[A1] <: Event[A1]](using CreationTicket[State]): Flatten[ Signal[Evnt[B]], Event[B] - ] = sig => Event.dynamic(sig.value.value): @nowarn + ] = sig => Event.dynamic(sig.value.value) /** Flatten a Event[Option[B]\] into a Event[B] that fires whenever the inner option is defined. */ implicit def flattenImplicitForoption[A, B](using CreationTicket[State]): Flatten[ Event[Option[B]], Event[B] - ] = event => Event.static { event.value.flatten }: @nowarn + ] = event => Event.static { event.value.flatten } /** Flatten a Signal[Traversable[Signal[B]\]\] into a Signal[Traversable[B]\] where the new Signal updates whenever any of the inner or the outer signal updates */ implicit def flattenImplicitForIterableSignals[ @@ -56,7 +56,7 @@ object Flatten { ](using CreationTicket[State]): Flatten[ Signal[Iter[Sig[B]]], Signal[Iter[B]] - ] = sig => Signal.dynamic { sig.value.map { (r: Signal[B]) => r.value } }: @nowarn + ] = sig => Signal.dynamic { sig.value.map { (r: Signal[B]) => r.value } } /** Flatten a Signal[Traversable[Event[B]\]\] into a Event[B]. The new Event fires the value of any inner firing Event. * If multiple inner Events fire, the first one in iteration order is selected. @@ -72,7 +72,7 @@ object Flatten { Event.dynamic { val all = sig.value map { _.value } all.collectFirst { case Some(e) => e } - }: @nowarn + } /** Flatten a Signal[Traversable[Event[B]\]\] into a Event[Traversable[Option[B]\]\] where the new Event fires whenever any of the inner events fire */ def traversableOfAllOccuringEventValues[ @@ -86,5 +86,5 @@ object Flatten { Event.dynamic { val all = sig.value map { (r: Event[B]) => r.value } if (all.exists(_.isDefined)) Some(all) else None - }: @nowarn + } } diff --git a/Modules/Reactives/shared/src/main/scala/reactives/operator/SignalBundle.scala b/Modules/Reactives/shared/src/main/scala/reactives/operator/SignalBundle.scala index dfefffed9..ae5bb4828 100644 --- a/Modules/Reactives/shared/src/main/scala/reactives/operator/SignalBundle.scala +++ b/Modules/Reactives/shared/src/main/scala/reactives/operator/SignalBundle.scala @@ -83,7 +83,7 @@ trait Signal[+T] extends Disconnectable with MacroAccess[T] with ReSource { catch { case NonFatal(e) => onFailure.applyOrElse[Throwable, R](e, throw _) } - }: @nowarn + } /** Adds another error message in case this signal is empty, also disallows handling exceptions in observers */ final def abortOnError(message: String)(implicit ticket: CreationTicket[State]): Signal[T] = @@ -98,7 +98,7 @@ trait Signal[+T] extends Disconnectable with MacroAccess[T] with ReSource { catch { case EmptySignalControlThrowable => value } - }: @nowarn + } /** Flattens the inner value. * @group operator @@ -214,12 +214,12 @@ object Signal { } def lift[A1, B](n1: Signal[A1])(fun: A1 => B)(using CreationTicket[State]): Signal[B] = - Signal { fun(n1.value) }: @nowarn + Signal { fun(n1.value) } def lift[A1, A2, B](n1: Signal[A1], n2: Signal[A2])(fun: (A1, A2) => B)(using CreationTicket[State] ): Signal[B] = { - Signal { fun(n1.value, n2.value) }: @nowarn + Signal { fun(n1.value, n2.value) } } }