summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steve Elliott <steell@google.com> 2025-01-07 18:10:18 -0500
committer Steve Elliott <steell@google.com> 2025-01-10 14:21:34 -0500
commit487d67641e64c1807919038a1272f9bc6d6a13e5 (patch)
tree5a759fcf960ac2cff0e78502313d94f29521a5bd
parentc366a6c4cf963691a85611fffe9cdbaa562fb3d7 (diff)
[kairos] Fix KDoc code snippet rendering
Flag: EXEMPT no code changed Test: n/a Change-Id: Ib26de454dd1e3ff1a03280d556e763763a0b8f72
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt28
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Events.kt10
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Filter.kt8
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/GroupBy.kt6
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Incremental.kt4
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Merge.kt18
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/State.kt12
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/StateScope.kt60
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Transactional.kt4
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/store/MapK.kt8
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/MapPatch.kt2
-rw-r--r--packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/Maybe.kt2
12 files changed, 81 insertions, 81 deletions
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt
index bd2173cd2393..c9fae70353f1 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/BuildScope.kt
@@ -100,7 +100,7 @@ interface BuildScope : HasNetwork, StateScope {
* observation of new emissions. It will however *not* cancel any running effects from previous
* emissions. To achieve this behavior, use [launchScope] or [asyncScope] to create a child
* build scope:
- * ``` kotlin
+ * ```
* val job = launchScope {
* events.observe { x ->
* launchEffect { longRunningEffect(x) }
@@ -141,7 +141,7 @@ interface BuildScope : HasNetwork, StateScope {
*
* By default, [builder] is only running while the returned [Events] is being
* [observed][observe]. If you want it to run at all times, simply add a no-op observer:
- * ``` kotlin
+ * ```
* events { ... }.apply { observe() }
* ```
*/
@@ -158,7 +158,7 @@ interface BuildScope : HasNetwork, StateScope {
*
* By default, [builder] is only running while the returned [Events] is being
* [observed][observe]. If you want it to run at all times, simply add a no-op observer:
- * ``` kotlin
+ * ```
* events { ... }.apply { observe() }
* ```
*
@@ -196,7 +196,7 @@ interface BuildScope : HasNetwork, StateScope {
* outside of the current Kairos transaction; when [transform] returns, the returned value is
* emitted from the result [Events] in a new transaction.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<A>.mapAsyncLatest(transform: suspend (A) -> B): Events<B> =
* mapLatestBuild { a -> asyncEvent { transform(a) } }.flatten()
* ```
@@ -571,7 +571,7 @@ interface BuildScope : HasNetwork, StateScope {
/**
* Shorthand for:
- * ``` kotlin
+ * ```
* flow.toEvents().holdState(initialValue)
* ```
*/
@@ -579,7 +579,7 @@ interface BuildScope : HasNetwork, StateScope {
/**
* Shorthand for:
- * ``` kotlin
+ * ```
* flow.scan(initialValue, operation).toEvents().holdState(initialValue)
* ```
*/
@@ -588,7 +588,7 @@ interface BuildScope : HasNetwork, StateScope {
/**
* Shorthand for:
- * ``` kotlin
+ * ```
* flow.scan(initialValue) { a, f -> f(a) }.toEvents().holdState(initialValue)
* ```
*/
@@ -665,7 +665,7 @@ interface BuildScope : HasNetwork, StateScope {
* be used to make further modifications to the Kairos network, and/or perform side-effects via
* [effect].
*
- * ``` kotlin
+ * ```
* fun <A> State<A>.observeBuild(block: BuildScope.(A) -> Unit = {}): Job = launchScope {
* block(sample())
* changes.observeBuild(block)
@@ -698,7 +698,7 @@ interface BuildScope : HasNetwork, StateScope {
* outside of the current Kairos transaction; when it completes, the returned [Events] emits in a
* new transaction.
*
- * ``` kotlin
+ * ```
* fun <A> BuildScope.asyncEvent(block: suspend () -> A): Events<A> =
* events { emit(block()) }.apply { observe() }
* ```
@@ -719,7 +719,7 @@ fun <A> BuildScope.asyncEvent(block: suspend () -> A): Events<A> =
* executed if this [BuildScope] is still active by that time. It can be deactivated due to a
* -Latest combinator, for example.
*
- * ``` kotlin
+ * ```
* fun BuildScope.effect(
* context: CoroutineContext = EmptyCoroutineContext,
* block: EffectScope.() -> Unit,
@@ -740,7 +740,7 @@ fun BuildScope.effect(
* done because the current [BuildScope] might be deactivated within this transaction, perhaps due
* to a -Latest combinator. If this happens, then the coroutine will never actually be started.
*
- * ``` kotlin
+ * ```
* fun BuildScope.launchEffect(block: suspend KairosScope.() -> Unit): Job =
* effect { effectCoroutineScope.launch { block() } }
* ```
@@ -757,7 +757,7 @@ fun BuildScope.launchEffect(block: suspend KairosCoroutineScope.() -> Unit): Job
* to a -Latest combinator. If this happens, then the coroutine will never actually be started.
*
* Shorthand for:
- * ``` kotlin
+ * ```
* fun <R> BuildScope.asyncEffect(block: suspend KairosScope.() -> R): Deferred<R> =
* CompletableDeferred<R>.apply {
* effect { effectCoroutineScope.launch { complete(block()) } }
@@ -789,7 +789,7 @@ fun BuildScope.launchScope(block: BuildSpec<*>): Job = asyncScope(block).second
*
* By default, [builder] is only running while the returned [Events] is being
* [observed][BuildScope.observe]. If you want it to run at all times, simply add a no-op observer:
- * ``` kotlin
+ * ```
* events { ... }.apply { observe() }
* ```
*
@@ -813,7 +813,7 @@ fun <In, Out> BuildScope.coalescingEvents(
*
* By default, [builder] is only running while the returned [Events] is being
* [observed][BuildScope.observe]. If you want it to run at all times, simply add a no-op observer:
- * ``` kotlin
+ * ```
* events { ... }.apply { observe() }
* ```
*
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Events.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Events.kt
index 8f468c153743..1a13773d71bf 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Events.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Events.kt
@@ -105,7 +105,7 @@ class EventsLoop<A> : Events<A>() {
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> Lazy<Events<A>>.defer() = deferredEvents { value }
* ```
*
@@ -122,7 +122,7 @@ class EventsLoop<A> : Events<A>() {
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> DeferredValue<Events<A>>.defer() = deferredEvents { get() }
* ```
*
@@ -160,7 +160,7 @@ fun <A, B> Events<A>.mapMaybe(transform: TransactionScope.(A) -> Maybe<B>): Even
* Returns an [Events] that contains only the non-null results of applying [transform] to each value
* of the original [Events].
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.mapNotNull(transform: TransactionScope.(A) -> B?): Events<B> =
* mapMaybe { if (it == null) absent else present(it) }
* ```
@@ -201,7 +201,7 @@ fun <A, B> Events<A>.mapCheap(transform: TransactionScope.(A) -> B): Events<B> =
* Returns an [Events] that invokes [action] before each value of the original [Events] is emitted.
* Useful for logging and debugging.
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.onEach(action: TransactionScope.(A) -> Unit): Events<A> =
* map { it.also { action(it) } }
* ```
@@ -220,7 +220,7 @@ fun <A> Events<A>.onEach(action: TransactionScope.(A) -> Unit): Events<A> = map
* Splits an [Events] of pairs into a pair of [Events], where each returned [Events] emits half of
* the original.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<Pair<A, B>>.unzip(): Pair<Events<A>, Events<B>> {
* val lefts = map { it.first }
* val rights = map { it.second }
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Filter.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Filter.kt
index 8ca5ac8652db..d412b849e441 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Filter.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Filter.kt
@@ -29,7 +29,7 @@ fun <A> Events<A>.filter(state: State<Boolean>): Events<A> = filter { state.samp
/**
* Returns an [Events] containing only values of the original [Events] that are not null.
*
- * ``` kotlin
+ * ```
* fun <A> Events<A?>.filterNotNull(): Events<A> = mapNotNull { it }
* ```
*
@@ -41,7 +41,7 @@ fun <A> Events<A?>.filterNotNull(): Events<A> = mapCheap { it.toMaybe() }.filter
/**
* Returns an [Events] containing only values of the original [Events] that are instances of [A].
*
- * ``` kotlin
+ * ```
* inline fun <reified A> Events<*>.filterIsInstance(): Events<A> =
* mapNotNull { it as? A }
* ```
@@ -55,7 +55,7 @@ inline fun <reified A> Events<*>.filterIsInstance(): Events<A> =
/**
* Returns an [Events] containing only values of the original [Events] that are present.
*
- * ``` kotlin
+ * ```
* fun <A> Events<Maybe<A>>.filterPresent(): Events<A> = mapMaybe { it }
* ```
*
@@ -69,7 +69,7 @@ fun <A> Events<Maybe<A>>.filterPresent(): Events<A> =
* Returns an [Events] containing only values of the original [Events] that satisfy the given
* [predicate].
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.filter(predicate: TransactionScope.(A) -> Boolean): Events<A> =
* mapMaybe { if (predicate(it)) present(it) else absent }
* ```
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/GroupBy.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/GroupBy.kt
index 45da34ac9ae6..27fc1b4cf54c 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/GroupBy.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/GroupBy.kt
@@ -63,7 +63,7 @@ fun <K, A> Events<Map<K, A>>.groupByKey(numKeys: Int? = null): GroupedEvents<K,
* downstream [Events]. The downstream [Events] are associated with a [key][K], which is derived
* from each emission of the original [Events] via [extractKey].
*
- * ``` kotlin
+ * ```
* fun <K, A> Events<A>.groupBy(
* numKeys: Int? = null,
* extractKey: TransactionScope.(A) -> K,
@@ -108,7 +108,7 @@ class GroupedEvents<in K, out A> internal constructor(internal val impl: DemuxIm
* Using this is equivalent to `upstream.filter(predicate) to upstream.filter { !predicate(it) }`
* but is more efficient; specifically, [partition] will only invoke [predicate] once per element.
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.partition(
* predicate: TransactionScope.(A) -> Boolean
* ): Pair<Events<A>, Events<A>> =
@@ -133,7 +133,7 @@ fun <A> Events<A>.partition(
* [First]s and once for [Second]s, but is slightly more efficient; specifically, the
* [filterIsInstance] check is only performed once per element.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<Either<A, B>>.partitionEither(): Pair<Events<A>, Events<B>> =
* map { it.asThese() }.partitionThese()
* ```
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Incremental.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Incremental.kt
index d88ae3b81349..02941bdded30 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Incremental.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Incremental.kt
@@ -62,7 +62,7 @@ fun <K, V> incrementalOf(value: Map<K, V>): Incremental<K, V> {
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> Lazy<Incremental<K, V>>.defer() = deferredIncremental { value }
* ```
*/
@@ -78,7 +78,7 @@ fun <K, V> Lazy<Incremental<K, V>>.defer(): Incremental<K, V> = deferInline { va
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> DeferredValue<Incremental<K, V>>.defer() = deferredIncremental { get() }
* ```
*/
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Merge.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Merge.kt
index de9dca43b5d5..cc4ce53ca40a 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Merge.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Merge.kt
@@ -33,7 +33,7 @@ import com.android.systemui.kairos.util.map
* function is used to combine coincident emissions to produce the result value to be emitted by the
* merged [Events].
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.mergeWith(
* other: Events<A>,
* transformCoincidence: TransactionScope.(A, A) -> A = { a, _ -> a },
@@ -62,7 +62,7 @@ fun <A> Events<A>.mergeWith(
* Merges the given [Events] into a single [Events] that emits events from all. All coincident
* emissions are collected into the emitted [List], preserving the input ordering.
*
- * ``` kotlin
+ * ```
* fun <A> merge(vararg events: Events<A>): Events<List<A>> = events.asIterable().merge()
* ```
*
@@ -76,7 +76,7 @@ fun <A> merge(vararg events: Events<A>): Events<List<A>> = events.asIterable().m
* Merges the given [Events] into a single [Events] that emits events from all. In the case of
* coincident emissions, the emission from the left-most [Events] is emitted.
*
- * ``` kotlin
+ * ```
* fun <A> mergeLeft(vararg events: Events<A>): Events<A> = events.asIterable().mergeLeft()
* ```
*
@@ -92,7 +92,7 @@ fun <A> mergeLeft(vararg events: Events<A>): Events<A> = events.asIterable().mer
* function is used to combine coincident emissions to produce the result value to be emitted by the
* merged [Events].
*
- * ``` kotlin
+ * ```
* fun <A> merge(vararg events: Events<A>, transformCoincidence: (A, A) -> A): Events<A> =
* merge(*events).map { l -> l.reduce(transformCoincidence) }
* ```
@@ -117,7 +117,7 @@ fun <A> Iterable<Events<A>>.merge(): Events<List<A>> =
* coincident emissions, the emission from the left-most [Events] is emitted.
*
* Semantically equivalent to the following definition:
- * ``` kotlin
+ * ```
* fun <A> Iterable<Events<A>>.mergeLeft(): Events<A> =
* merge().mapCheap { it.first() }
* ```
@@ -135,7 +135,7 @@ fun <A> Iterable<Events<A>>.mergeLeft(): Events<A> =
* Creates a new [Events] that emits events from all given [Events]. All simultaneous emissions are
* collected into the emitted [List], preserving the input ordering.
*
- * ``` kotlin
+ * ```
* fun <A> Sequence<Events<A>>.merge(): Events<List<A>> = asIterable().merge()
* ```
*
@@ -148,7 +148,7 @@ fun <A> Iterable<Events<A>>.mergeLeft(): Events<A> =
* collected into the emitted [Map], and are given the same key of the associated [Events] in the
* input [Map].
*
- * ``` kotlin
+ * ```
* fun <K, A> Map<K, Events<A>>.merge(): Events<Map<K, A>> =
* asSequence()
* .map { (k, events) -> events.map { a -> k to a } }
@@ -173,7 +173,7 @@ fun <K, A> Map<K, Events<A>>.merge(): Events<Map<K, A>> =
* [Map.applyPatch][com.android.systemui.kairos.util.applyPatch].
*
* Conceptually this is equivalent to:
- * ``` kotlin
+ * ```
* fun <K, V> State<Map<K, V>>.mergeEventsIncrementally(): Events<Map<K, V>> =
* map { it.merge() }.switchEvents()
* ```
@@ -218,7 +218,7 @@ fun <K, V> Incremental<K, Events<V>>.mergeEventsIncrementally(): Events<Map<K, V
* [Map.applyPatch][com.android.systemui.kairos.util.applyPatch].
*
* Conceptually this is equivalent to:
- * ``` kotlin
+ * ```
* fun <K, V> State<Map<K, V>>.mergeEventsIncrementallyPromptly(): Events<Map<K, V>> =
* map { it.merge() }.switchEventsPromptly()
* ```
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/State.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/State.kt
index 22ca83c6a15a..e8b005ec8788 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/State.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/State.kt
@@ -76,7 +76,7 @@ fun <A> stateOf(value: A): State<A> {
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> Lazy<State<A>>.defer() = deferredState { value }
* ```
*/
@@ -91,7 +91,7 @@ fun <A> stateOf(value: A): State<A> {
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> DeferredValue<State<A>>.defer() = deferredState { get() }
* ```
*/
@@ -150,7 +150,7 @@ fun <A, B> State<A>.mapCheapUnsafe(transform: KairosScope.(A) -> B): State<B> {
* Splits a [State] of pairs into a pair of [Events][State], where each returned [State] holds half
* of the original.
*
- * ``` kotlin
+ * ```
* fun <A, B> State<Pair<A, B>>.unzip(): Pair<State<A>, State<B>> {
* val first = map { it.first }
* val second = map { it.second }
@@ -186,7 +186,7 @@ fun <A, B> State<A>.flatMap(transform: KairosScope.(A) -> State<B>): State<B> {
/**
* Returns a [State] that behaves like the current value of the original [State].
*
- * ``` kotlin
+ * ```
* fun <A> State<State<A>>.flatten() = flatMap { it }
* ```
*
@@ -201,7 +201,7 @@ fun <A, B> State<A>.flatMap(transform: KairosScope.(A) -> State<B>): State<B> {
* recent value is used.
*
* Effectively equivalent to:
- * ``` kotlin
+ * ```
* ConflatedMutableEvents(kairosNetwork).holdState(initialValue)
* ```
*/
@@ -328,7 +328,7 @@ private inline fun <A> deferInline(crossinline block: InitScope.() -> State<A>):
* Like [changes] but also includes the old value of this [State].
*
* Shorthand for:
- * ``` kotlin
+ * ```
* stateChanges.map { WithPrev(previousValue = sample(), newValue = it) }
* ```
*/
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/StateScope.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/StateScope.kt
index faeffe84e2e8..8020896d228a 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/StateScope.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/StateScope.kt
@@ -116,7 +116,7 @@ interface StateScope : TransactionScope {
* [Events] emitted from this, following the patch rules outlined in
* [Map.applyPatch][com.android.systemui.kairos.util.applyPatch].
*
- * ``` kotlin
+ * ```
* fun <K, V> Events<MapPatch<K, Events<V>>>.mergeEventsIncrementally(
* initialEvents: DeferredValue<Map<K, Events<V>>>,
* ): Events<Map<K, V>> =
@@ -135,7 +135,7 @@ interface StateScope : TransactionScope {
* [Events] emitted from this, following the patch rules outlined in
* [Map.applyPatch][com.android.systemui.kairos.util.applyPatch].
*
- * ``` kotlin
+ * ```
* fun <K, V> Events<MapPatch<K, Events<V>>>.mergeEventsIncrementallyPromptly(
* initialEvents: DeferredValue<Map<K, Events<V>>>,
* ): Events<Map<K, V>> =
@@ -155,7 +155,7 @@ interface StateScope : TransactionScope {
* [Events] emitted from this, following the patch rules outlined in
* [Map.applyPatch][com.android.systemui.kairos.util.applyPatch].
*
- * ``` kotlin
+ * ```
* fun <K, V> Events<MapPatch<K, Events<V>>>.mergeEventsIncrementally(
* initialEvents: Map<K, Events<V>>,
* ): Events<Map<K, V>> =
@@ -174,7 +174,7 @@ interface StateScope : TransactionScope {
* [Events] emitted from this, following the patch rules outlined in
* [Map.applyPatch][com.android.systemui.kairos.util.applyPatch].
*
- * ``` kotlin
+ * ```
* fun <K, V> Events<MapPatch<K, Events<V>>>.mergeEventsIncrementallyPromptly(
* initialEvents: Map<K, Events<V>>,
* ): Events<Map<K, V>> =
@@ -220,7 +220,7 @@ interface StateScope : TransactionScope {
* [mapLatestStateful], accumulation is not stopped with each subsequent emission of the
* original [Events].
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<A>.mapStateful(transform: StateScope.(A) -> B): Events<B> =
* map { statefully { transform(it) } }.applyStatefuls()
* ```
@@ -234,7 +234,7 @@ interface StateScope : TransactionScope {
*
* Unlike [applyLatestStateful], state accumulation is not stopped with each state change.
*
- * ``` kotlin
+ * ```
* fun <A> State<Stateful<A>>.applyStatefuls(): State<A> =
* changes
* .applyStatefuls()
@@ -252,7 +252,7 @@ interface StateScope : TransactionScope {
* Returns an [Events] that acts like the most recent [Events] to be emitted from the original
* [Events].
*
- * ``` kotlin
+ * ```
* fun <A> Events<Events<A>>.flatten() = holdState(emptyEvents).switchEvents()
* ```
*
@@ -267,7 +267,7 @@ interface StateScope : TransactionScope {
* [transform] can perform state accumulation via its [StateScope] receiver. With each
* invocation of [transform], state accumulation from previous invocation is stopped.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<A>.mapLatestStateful(transform: StateScope.(A) -> B): Events<B> =
* map { statefully { transform(it) } }.applyLatestStateful()
* ```
@@ -282,7 +282,7 @@ interface StateScope : TransactionScope {
* [transform] can perform state accumulation via its [StateScope] receiver. With each
* invocation of [transform], state accumulation from previous invocation is stopped.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<A>.flatMapLatestStateful(
* transform: StateScope.(A) -> Events<B>
* ): Events<B> =
@@ -495,7 +495,7 @@ interface StateScope : TransactionScope {
*
* The optional [numKeys] argument is an optimization used to initialize the internal storage.
*
- * ``` kotlin
+ * ```
* fun <K, A, B> Events<MapPatch<K, A>>.mapLatestStatefulForKey(
* numKeys: Int? = null,
* transform: StateScope.(A) -> B,
@@ -516,7 +516,7 @@ interface StateScope : TransactionScope {
* If the original [Events] is emitting an event at this exact time, then it will be the only
* even emitted from the result [Events].
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.nextOnly(): Events<A> =
* EventsLoop<A>().apply {
* loopback = map { emptyEvents }.holdState(this@nextOnly).switchEvents()
@@ -535,7 +535,7 @@ interface StateScope : TransactionScope {
/**
* Returns an [Events] that skips the next emission of the original [Events].
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.skipNext(): Events<A> =
* nextOnly().map { this@skipNext }.holdState(emptyEvents).switchEvents()
* ```
@@ -554,7 +554,7 @@ interface StateScope : TransactionScope {
* If the original [Events] emits at the same time as [stop], then the returned [Events] will
* emit that value.
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.takeUntil(stop: Events<*>): Events<A> =
* stop.map { emptyEvents }.nextOnly().holdState(this).switchEvents()
* ```
@@ -586,7 +586,7 @@ interface StateScope : TransactionScope {
* Returns an [Events] that emits values from the original [Events] up to and including a value
* is emitted that satisfies [predicate].
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.takeUntil(predicate: TransactionScope.(A) -> Boolean): Events<A> =
* takeUntil(filter(predicate))
* ```
@@ -602,7 +602,7 @@ interface StateScope : TransactionScope {
* have been processed; this keeps the value of the [State] consistent during the entire Kairos
* transaction.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<A>.foldState(
* initialValue: B,
* transform: TransactionScope.(A, B) -> B,
@@ -630,7 +630,7 @@ interface StateScope : TransactionScope {
* have been processed; this keeps the value of the [State] consistent during the entire Kairos
* transaction.
*
- * ``` kotlin
+ * ```
* fun <A, B> Events<A>.foldStateDeferred(
* initialValue: DeferredValue<B>,
* transform: TransactionScope.(A, B) -> B,
@@ -663,7 +663,7 @@ interface StateScope : TransactionScope {
* have been processed; this keeps the value of the [State] consistent during the entire Kairos
* transaction.
*
- * ``` kotlin
+ * ```
* fun <A> Events<Stateful<A>>.holdLatestStateful(init: Stateful<A>): State<A> {
* val (changes, initApplied) = applyLatestStateful(init)
* return changes.holdStateDeferred(initApplied)
@@ -724,7 +724,7 @@ interface StateScope : TransactionScope {
* Returns an [Events] that wraps each emission of the original [Events] into an [IndexedValue],
* containing the emitted value and its index (starting from zero).
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.withIndex(): Events<IndexedValue<A>> {
* val index = fold(0) { _, oldIdx -> oldIdx + 1 }
* return sample(index) { a, idx -> IndexedValue(idx, a) }
@@ -740,7 +740,7 @@ interface StateScope : TransactionScope {
* Returns an [Events] containing the results of applying [transform] to each value of the
* original [Events] and its index (starting from zero).
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.mapIndexed(transform: TransactionScope.(Int, A) -> B): Events<B> {
* val index = foldState(0) { _, i -> i + 1 }
* return sample(index) { a, idx -> transform(idx, a) }
@@ -755,7 +755,7 @@ interface StateScope : TransactionScope {
/**
* Returns an [Events] where all subsequent repetitions of the same value are filtered out.
*
- * ``` kotlin
+ * ```
* fun <A> Events<A>.distinctUntilChanged(): Events<A> {
* val state: State<Any?> = holdState(Any())
* return filter { it != state.sample() }
@@ -774,7 +774,7 @@ interface StateScope : TransactionScope {
* Note that the returned [Events] will not emit anything until [other] has emitted at least one
* value.
*
- * ``` kotlin
+ * ```
* fun <A, B, C> Events<A>.sample(
* other: Events<B>,
* transform: TransactionScope.(A, B) -> C,
@@ -796,7 +796,7 @@ interface StateScope : TransactionScope {
* Returns a [State] that samples the [Transactional] held by the given [State] within the same
* transaction that the state changes.
*
- * ``` kotlin
+ * ```
* fun <A> State<Transactional<A>>.sampleTransactionals(): State<A> =
* changes
* .sampleTransactionals()
@@ -815,7 +815,7 @@ interface StateScope : TransactionScope {
* Note that this is less efficient than [State.map], which should be preferred if [transform]
* does not need access to [TransactionScope].
*
- * ``` kotlin
+ * ```
* fun <A, B> State<A>.mapTransactionally(transform: TransactionScope.(A) -> B): State<B> =
* map { transactionally { transform(it) } }.sampleTransactionals()
* ```
@@ -830,7 +830,7 @@ interface StateScope : TransactionScope {
* Note that this is less efficient than [combine], which should be preferred if [transform]
* does not need access to [TransactionScope].
*
- * ``` kotlin
+ * ```
* fun <A, B, Z> combineTransactionally(
* stateA: State<A>,
* stateB: State<B>,
@@ -895,7 +895,7 @@ interface StateScope : TransactionScope {
* Note that this is less efficient than [flatMap], which should be preferred if [transform]
* does not need access to [TransactionScope].
*
- * ``` kotlin
+ * ```
* fun <A, B> State<A>.flatMapTransactionally(
* transform: TransactionScope.(A) -> State<B>
* ): State<B> = map { transactionally { transform(it) } }.sampleTransactionals().flatten()
@@ -950,7 +950,7 @@ interface StateScope : TransactionScope {
* Returns an [Incremental] that reflects the state of the original [Incremental], but also adds
* / removes entries based on the state of the original's values.
*
- * ``` kotlin
+ * ```
* fun <K, V> Incremental<K, State<Maybe<V>>>.applyStateIncrementally(): Incremental<K, V> =
* mapValues { (_, v) -> v.changes }
* .mergeEventsIncrementallyPromptly()
@@ -971,7 +971,7 @@ interface StateScope : TransactionScope {
* / removes entries based on the [State] returned from applying [transform] to the original's
* entries.
*
- * ``` kotlin
+ * ```
* fun <K, V, U> Incremental<K, V>.mapIncrementalState(
* transform: KairosScope.(Map.Entry<K, V>) -> State<Maybe<U>>
* ): Incremental<K, U> = mapValues { transform(it) }.applyStateIncrementally()
@@ -986,7 +986,7 @@ interface StateScope : TransactionScope {
* / removes entries based on the [State] returned from applying [transform] to the original's
* entries, such that entries are added when that state is `true`, and removed when `false`.
*
- * ``` kotlin
+ * ```
* fun <K, V> Incremental<K, V>.filterIncrementally(
* transform: KairosScope.(Map.Entry<K, V>) -> State<Boolean>
* ): Incremental<K, V> = mapIncrementalState { entry ->
@@ -1004,7 +1004,7 @@ interface StateScope : TransactionScope {
* Returns an [Incremental] that samples the [Transactionals][Transactional] held by the
* original within the same transaction that the incremental [updates].
*
- * ``` kotlin
+ * ```
* fun <K, V> Incremental<K, Transactional<V>>.sampleTransactionals(): Incremental<K, V> =
* updates
* .map { patch -> patch.mapValues { (k, mv) -> mv.map { it.sample() } } }
@@ -1027,7 +1027,7 @@ interface StateScope : TransactionScope {
* Note that this is less efficient than [mapValues], which should be preferred if [transform]
* does not need access to [TransactionScope].
*
- * ``` kotlin
+ * ```
* fun <K, V, U> Incremental<K, V>.mapValuesTransactionally(
* transform: TransactionScope.(Map.Entry<K, V>) -> U
* ): Incremental<K, U> =
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Transactional.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Transactional.kt
index cf98821fdadb..5050511a1371 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Transactional.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/Transactional.kt
@@ -51,7 +51,7 @@ fun <A> transactionalOf(value: A): Transactional<A> =
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> DeferredValue<Transactional<A>>.defer() = deferredTransactional { get() }
* ```
*/
@@ -67,7 +67,7 @@ fun <A> DeferredValue<Transactional<A>>.defer(): Transactional<A> = deferInline
*
* Useful for recursive definitions.
*
- * ``` kotlin
+ * ```
* fun <A> Lazy<Transactional<A>>.defer() = deferredTransactional { value }
* ```
*/
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/store/MapK.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/store/MapK.kt
index e193a4957bd0..3dbc6f00c623 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/store/MapK.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/internal/store/MapK.kt
@@ -21,28 +21,28 @@ package com.android.systemui.kairos.internal.store
*
* Let's say you want to write a class that is generic over both a map, and the type of data within
* the map:
- * ``` kotlin
+ * ```
* class Foo<TMap, TKey, TValue> {
* val container: TMap<TKey, TElement> // disallowed!
* }
* ```
*
* You can use `MapK` to represent the "higher-kinded" type variable `TMap`:
- * ``` kotlin
+ * ```
* class Foo<TMap, TKey, TValue> {
* val container: MapK<TMap, TKey, TValue> // OK!
* }
* ```
*
* Note that Kotlin will not let you use the generic type without parameters as `TMap`:
- * ``` kotlin
+ * ```
* val fooHk: MapK<HashMap, Int, String> // not allowed: HashMap requires two type parameters
* ```
*
* To work around this, you need to declare a special type-witness object. This object is only used
* at compile time and can be stripped out by a minifier because it's never used at runtime.
*
- * ``` kotlin
+ * ```
* class Foo<A, B> : MapK<FooWitness, A, B> { ... }
* object FooWitness
*
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/MapPatch.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/MapPatch.kt
index 8fe41bc20dfa..dde5d822f052 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/MapPatch.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/MapPatch.kt
@@ -47,7 +47,7 @@ fun <K, V> Map<K, V>.applyPatch(patch: MapPatch<K, V>): Map<K, V> {
* Returns a [MapPatch] that, when applied, includes all of the values from the original [Map].
*
* Shorthand for:
- * ``` kotlin
+ * ```
* mapValues { (key, value) -> Maybe.present(value) }
* ```
*/
diff --git a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/Maybe.kt b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/Maybe.kt
index 4754bc443329..4373705597ed 100644
--- a/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/Maybe.kt
+++ b/packages/SystemUI/utils/kairos/src/com/android/systemui/kairos/util/Maybe.kt
@@ -69,7 +69,7 @@ object MaybeScope {
*
* This can be used instead of Kotlin's built-in nullability (`?.` and `?:`) operators when dealing
* with complex combinations of nullables:
- * ``` kotlin
+ * ```
* val aMaybe: Maybe<Any> = ...
* val bMaybe: Maybe<Any> = ...
* val result: String = maybe {