[go: nahoru, domu]

Merge "Rename useOrElse() to takeOrElse()" into androidx-master-dev
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BaseTextField.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BaseTextField.kt
index b87870cf..fb9396c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BaseTextField.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BaseTextField.kt
@@ -23,7 +23,7 @@
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.text.SoftwareKeyboardController
 import androidx.compose.ui.text.TextLayoutResult
 import androidx.compose.ui.text.TextStyle
@@ -119,7 +119,7 @@
     onTextInputStarted: (SoftwareKeyboardController) -> Unit = {},
     cursorColor: Color = AmbientContentColor.current
 ) {
-    val color = textColor.useOrElse { textStyle.color.useOrElse { AmbientContentColor.current } }
+    val color = textColor.takeOrElse { textStyle.color.takeOrElse { AmbientContentColor.current } }
     val mergedStyle = textStyle.merge(TextStyle(color = color))
 
     BasicTextField(
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt
index 0051606..0f13853 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt
@@ -28,7 +28,7 @@
 import androidx.compose.runtime.structuralEqualityPolicy
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.text.AnnotatedString
 import androidx.compose.ui.text.Paragraph
 import androidx.compose.ui.text.TextLayoutResult
@@ -217,7 +217,7 @@
     onTextLayout: (TextLayoutResult) -> Unit = {},
     style: TextStyle = AmbientTextStyle.current
 ) {
-    val textColor = color.useOrElse { style.color.useOrElse { AmbientContentColor.current } }
+    val textColor = color.takeOrElse { style.color.takeOrElse { AmbientContentColor.current } }
     val mergedStyle = style.merge(
         TextStyle(
             color = textColor,
diff --git a/compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/Ripple.kt b/compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/Ripple.kt
index 1daba13..5b0c252 100644
--- a/compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/Ripple.kt
+++ b/compose/material/material-ripple/src/commonMain/kotlin/androidx/compose/material/ripple/Ripple.kt
@@ -39,7 +39,7 @@
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.drawscope.DrawScope
 import androidx.compose.ui.graphics.drawscope.clipRect
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.platform.AmbientAnimationClock
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.util.fastForEach
@@ -89,7 +89,7 @@
 ): Indication {
     val theme = AmbientRippleTheme.current
     val clock = AmbientAnimationClock.current.asDisposableClock()
-    val resolvedColor = color.useOrElse { theme.defaultColor() }
+    val resolvedColor = color.takeOrElse { theme.defaultColor() }
     val colorState = remember { mutableStateOf(resolvedColor, structuralEqualityPolicy()) }
     colorState.value = resolvedColor
     val rippleAlpha = theme.rippleAlpha()
@@ -136,7 +136,7 @@
 ): Indication {
     val theme = AmbientRippleTheme.current
     val clock = AmbientAnimationClock.current.asDisposableClock()
-    val resolvedColor = color.useOrElse { theme.defaultColor() }
+    val resolvedColor = color.takeOrElse { theme.defaultColor() }
     val colorState = remember { mutableStateOf(resolvedColor, structuralEqualityPolicy()) }
     colorState.value = resolvedColor
     val rippleAlpha = theme.rippleAlpha()
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Colors.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Colors.kt
index 493497b..2881b3c 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Colors.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Colors.kt
@@ -24,7 +24,7 @@
 import androidx.compose.runtime.staticAmbientOf
 import androidx.compose.runtime.structuralEqualityPolicy
 import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 
 /**
  * Collection of colors in the
@@ -260,7 +260,7 @@
  */
 @Composable
 fun contentColorFor(color: Color) =
-    MaterialTheme.colors.contentColorFor(color).useOrElse { AmbientContentColor.current }
+    MaterialTheme.colors.contentColorFor(color).takeOrElse { AmbientContentColor.current }
 
 /**
  * Updates the internal values of the given [Colors] with values from the [other] [Colors]. This
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTextSelectionColors.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTextSelectionColors.kt
index 4cd516e..0f032e0 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTextSelectionColors.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTextSelectionColors.kt
@@ -21,7 +21,7 @@
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.compositeOver
 import androidx.compose.ui.graphics.luminance
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.selection.TextSelectionColors
 import androidx.compose.ui.util.annotation.VisibleForTesting
 import kotlin.math.max
@@ -41,7 +41,7 @@
     // 'worst case' scenario. We explicitly don't test with ContentAlpha.disabled, as disabled
     // text shouldn't be selectable / is noted as disabled for accessibility purposes.
     val textColorWithLowestAlpha = colors.contentColorFor(backgroundColor)
-        .useOrElse {
+        .takeOrElse {
             AmbientContentColor.current
         }.copy(
             alpha = ContentAlpha.medium
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt
index d96a672..d0b7854 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Text.kt
@@ -24,7 +24,7 @@
 import androidx.compose.runtime.structuralEqualityPolicy
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.text.AnnotatedString
 import androidx.compose.ui.text.Paragraph
 import androidx.compose.ui.text.TextLayoutResult
@@ -193,8 +193,8 @@
     onTextLayout: (TextLayoutResult) -> Unit = {},
     style: TextStyle = AmbientTextStyle.current
 ) {
-    val textColor = color.useOrElse {
-        style.color.useOrElse {
+    val textColor = color.takeOrElse {
+        style.color.takeOrElse {
             AmbientContentColor.current.copy(alpha = AmbientContentAlpha.current)
         }
     }
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
index df1666e..f378300 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
@@ -43,7 +43,7 @@
 import androidx.compose.ui.focus.focusReference
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.Shape
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.layout.LayoutModifier
 import androidx.compose.ui.layout.Measurable
 import androidx.compose.ui.layout.MeasureResult
@@ -98,7 +98,7 @@
     shape: Shape
 ) {
     // If color is not provided via the text style, use content color as a default
-    val textColor = textStyle.color.useOrElse {
+    val textColor = textStyle.color.takeOrElse {
         AmbientContentColor.current.copy(alpha = AmbientContentAlpha.current)
     }
     val mergedTextStyle = textStyle.merge(TextStyle(color = textColor))
diff --git a/compose/ui/ui-geometry/api/current.txt b/compose/ui/ui-geometry/api/current.txt
index 74163e5..ef2658a 100644
--- a/compose/ui/ui-geometry/api/current.txt
+++ b/compose/ui/ui-geometry/api/current.txt
@@ -106,7 +106,7 @@
     method public static boolean isSpecified-k-4lQ0M(long);
     method public static inline boolean isUnspecified-k-4lQ0M(long);
     method @androidx.compose.runtime.Stable public static long lerp-tX6QBWo(long start, long stop, float fraction);
-    method public static inline long useOrElse-Yy5JL0A(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Offset> block);
+    method public static inline long takeOrElse-Yy5JL0A(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Offset> block);
   }
 
   @androidx.compose.runtime.Immutable public final class Rect {
@@ -273,11 +273,11 @@
     method public static inline boolean isSpecified-uvyYCjk(long);
     method public static inline boolean isUnspecified-uvyYCjk(long);
     method @androidx.compose.runtime.Stable public static long lerp-3tf5JpU(long start, long stop, float fraction);
+    method public static inline long takeOrElse-GR1djXE(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Size> block);
     method @androidx.compose.runtime.Stable public static inline operator long times-2DtskRk(float, long size);
     method @androidx.compose.runtime.Stable public static inline operator long times-B9jgaKk(double, long size);
     method @androidx.compose.runtime.Stable public static inline operator long times-cEP68aU(int, long size);
     method @androidx.compose.runtime.Stable public static androidx.compose.ui.geometry.Rect toRect-uvyYCjk(long);
-    method public static inline long useOrElse-GR1djXE(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Size> block);
   }
 
 }
diff --git a/compose/ui/ui-geometry/api/public_plus_experimental_current.txt b/compose/ui/ui-geometry/api/public_plus_experimental_current.txt
index 74163e5..ef2658a 100644
--- a/compose/ui/ui-geometry/api/public_plus_experimental_current.txt
+++ b/compose/ui/ui-geometry/api/public_plus_experimental_current.txt
@@ -106,7 +106,7 @@
     method public static boolean isSpecified-k-4lQ0M(long);
     method public static inline boolean isUnspecified-k-4lQ0M(long);
     method @androidx.compose.runtime.Stable public static long lerp-tX6QBWo(long start, long stop, float fraction);
-    method public static inline long useOrElse-Yy5JL0A(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Offset> block);
+    method public static inline long takeOrElse-Yy5JL0A(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Offset> block);
   }
 
   @androidx.compose.runtime.Immutable public final class Rect {
@@ -273,11 +273,11 @@
     method public static inline boolean isSpecified-uvyYCjk(long);
     method public static inline boolean isUnspecified-uvyYCjk(long);
     method @androidx.compose.runtime.Stable public static long lerp-3tf5JpU(long start, long stop, float fraction);
+    method public static inline long takeOrElse-GR1djXE(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Size> block);
     method @androidx.compose.runtime.Stable public static inline operator long times-2DtskRk(float, long size);
     method @androidx.compose.runtime.Stable public static inline operator long times-B9jgaKk(double, long size);
     method @androidx.compose.runtime.Stable public static inline operator long times-cEP68aU(int, long size);
     method @androidx.compose.runtime.Stable public static androidx.compose.ui.geometry.Rect toRect-uvyYCjk(long);
-    method public static inline long useOrElse-GR1djXE(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Size> block);
   }
 
 }
diff --git a/compose/ui/ui-geometry/api/restricted_current.txt b/compose/ui/ui-geometry/api/restricted_current.txt
index 74163e5..ef2658a 100644
--- a/compose/ui/ui-geometry/api/restricted_current.txt
+++ b/compose/ui/ui-geometry/api/restricted_current.txt
@@ -106,7 +106,7 @@
     method public static boolean isSpecified-k-4lQ0M(long);
     method public static inline boolean isUnspecified-k-4lQ0M(long);
     method @androidx.compose.runtime.Stable public static long lerp-tX6QBWo(long start, long stop, float fraction);
-    method public static inline long useOrElse-Yy5JL0A(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Offset> block);
+    method public static inline long takeOrElse-Yy5JL0A(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Offset> block);
   }
 
   @androidx.compose.runtime.Immutable public final class Rect {
@@ -273,11 +273,11 @@
     method public static inline boolean isSpecified-uvyYCjk(long);
     method public static inline boolean isUnspecified-uvyYCjk(long);
     method @androidx.compose.runtime.Stable public static long lerp-3tf5JpU(long start, long stop, float fraction);
+    method public static inline long takeOrElse-GR1djXE(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Size> block);
     method @androidx.compose.runtime.Stable public static inline operator long times-2DtskRk(float, long size);
     method @androidx.compose.runtime.Stable public static inline operator long times-B9jgaKk(double, long size);
     method @androidx.compose.runtime.Stable public static inline operator long times-cEP68aU(int, long size);
     method @androidx.compose.runtime.Stable public static androidx.compose.ui.geometry.Rect toRect-uvyYCjk(long);
-    method public static inline long useOrElse-GR1djXE(long, kotlin.jvm.functions.Function0<androidx.compose.ui.geometry.Size> block);
   }
 
 }
diff --git a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Offset.kt b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Offset.kt
index 2b06f1b..bef6a9f 100644
--- a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Offset.kt
+++ b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Offset.kt
@@ -256,5 +256,5 @@
  * If this [Offset] [isSpecified] then this is returned, otherwise [block] is executed
  * and its result is returned.
  */
-inline fun Offset.useOrElse(block: () -> Offset): Offset =
+inline fun Offset.takeOrElse(block: () -> Offset): Offset =
     if (isSpecified) this else block()
diff --git a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt
index f99ffeb8..39a4b24 100644
--- a/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt
+++ b/compose/ui/ui-geometry/src/commonMain/kotlin/androidx/compose/ui/geometry/Size.kt
@@ -155,7 +155,7 @@
  * If this [Size] [isSpecified] then this is returned, otherwise [block] is executed
  * and its result is returned.
  */
-inline fun Size.useOrElse(block: () -> Size): Size =
+inline fun Size.takeOrElse(block: () -> Size): Size =
     if (isSpecified) this else block()
 
 /**
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt
index 1e7089a..5f252f00 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/OffsetTest.kt
@@ -108,12 +108,12 @@
     }
 
     @Test
-    fun testUseOrElseTrue() {
-        assertTrue(Offset(1f, 1f).useOrElse { Offset.Unspecified }.isSpecified)
+    fun testTakeOrElseTrue() {
+        assertTrue(Offset(1f, 1f).takeOrElse { Offset.Unspecified }.isSpecified)
     }
 
     @Test
-    fun testUseOrElseFalse() {
-        assertTrue(Offset.Unspecified.useOrElse { Offset(1f, 1f) }.isSpecified)
+    fun testTakeOrElseFalse() {
+        assertTrue(Offset.Unspecified.takeOrElse { Offset(1f, 1f) }.isSpecified)
     }
 }
\ No newline at end of file
diff --git a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt
index 79417f8..ada612e 100644
--- a/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt
+++ b/compose/ui/ui-geometry/src/test/kotlin/androidx/compose/ui/geometry/SizeTest.kt
@@ -153,12 +153,12 @@
     }
 
     @Test
-    fun testUseOrElseTrue() {
-        Assert.assertTrue(Size(1f, 1f).useOrElse { Size.Unspecified }.isSpecified)
+    fun testTakeOrElseTrue() {
+        Assert.assertTrue(Size(1f, 1f).takeOrElse { Size.Unspecified }.isSpecified)
     }
 
     @Test
-    fun testUseOrElseFalse() {
-        Assert.assertTrue(Size.Unspecified.useOrElse { Size(1f, 1f) }.isSpecified)
+    fun testTakeOrElseFalse() {
+        Assert.assertTrue(Size.Unspecified.takeOrElse { Size(1f, 1f) }.isSpecified)
     }
 }
\ No newline at end of file
diff --git a/compose/ui/ui-graphics/api/current.txt b/compose/ui/ui-graphics/api/current.txt
index 2ec4e22..0a18e14 100644
--- a/compose/ui/ui-graphics/api/current.txt
+++ b/compose/ui/ui-graphics/api/current.txt
@@ -335,8 +335,9 @@
     method public static inline boolean isUnspecified-8_81llA(long);
     method @androidx.compose.runtime.Stable public static long lerp-m18UwgE(long start, long stop, @FloatRange(from=0.0, to=1.0) float fraction);
     method @androidx.compose.runtime.Stable public static float luminance-8_81llA(long);
+    method public static inline long takeOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
     method @ColorInt @androidx.compose.runtime.Stable public static int toArgb-8_81llA(long);
-    method public static inline long useOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
+    method @Deprecated public static inline long useOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
   }
 
   public final class DegreesKt {
diff --git a/compose/ui/ui-graphics/api/public_plus_experimental_current.txt b/compose/ui/ui-graphics/api/public_plus_experimental_current.txt
index 2ec4e22..0a18e14 100644
--- a/compose/ui/ui-graphics/api/public_plus_experimental_current.txt
+++ b/compose/ui/ui-graphics/api/public_plus_experimental_current.txt
@@ -335,8 +335,9 @@
     method public static inline boolean isUnspecified-8_81llA(long);
     method @androidx.compose.runtime.Stable public static long lerp-m18UwgE(long start, long stop, @FloatRange(from=0.0, to=1.0) float fraction);
     method @androidx.compose.runtime.Stable public static float luminance-8_81llA(long);
+    method public static inline long takeOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
     method @ColorInt @androidx.compose.runtime.Stable public static int toArgb-8_81llA(long);
-    method public static inline long useOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
+    method @Deprecated public static inline long useOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
   }
 
   public final class DegreesKt {
diff --git a/compose/ui/ui-graphics/api/restricted_current.txt b/compose/ui/ui-graphics/api/restricted_current.txt
index 990c84d..5abec76 100644
--- a/compose/ui/ui-graphics/api/restricted_current.txt
+++ b/compose/ui/ui-graphics/api/restricted_current.txt
@@ -366,8 +366,9 @@
     method public static inline boolean isUnspecified-8_81llA(long);
     method @androidx.compose.runtime.Stable public static long lerp-m18UwgE(long start, long stop, @FloatRange(from=0.0, to=1.0) float fraction);
     method @androidx.compose.runtime.Stable public static float luminance-8_81llA(long);
+    method public static inline long takeOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
     method @ColorInt @androidx.compose.runtime.Stable public static int toArgb-8_81llA(long);
-    method public static inline long useOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
+    method @Deprecated public static inline long useOrElse-iYUlWp8(long, kotlin.jvm.functions.Function0<androidx.compose.ui.graphics.Color> block);
   }
 
   public final class DegreesKt {
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt
index 53249d4..d5e194c 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/Color.kt
@@ -594,4 +594,11 @@
  * If this [Color] [isSpecified] then this is returned, otherwise [block] is executed and its result
  * is returned.
  */
+@Deprecated("Use takeOrElse", ReplaceWith("takeOrElse(block)"))
 inline fun Color.useOrElse(block: () -> Color): Color = if (isSpecified) this else block()
+
+/**
+ * If this [Color] [isSpecified] then this is returned, otherwise [block] is executed and its result
+ * is returned.
+ */
+inline fun Color.takeOrElse(block: () -> Color): Color = if (isSpecified) this else block()
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt
index 19bd344..8830895 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/SpanStyle.kt
@@ -21,7 +21,7 @@
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.Shadow
 import androidx.compose.ui.graphics.lerp
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.text.font.FontStyle
 import androidx.compose.ui.text.font.FontSynthesis
@@ -99,7 +99,7 @@
         if (other == null) return this
 
         return SpanStyle(
-            color = other.color.useOrElse { this.color },
+            color = other.color.takeOrElse { this.color },
             fontFamily = other.fontFamily ?: this.fontFamily,
             fontSize = if (!other.fontSize.isUnspecified) other.fontSize else this.fontSize,
             fontWeight = other.fontWeight ?: this.fontWeight,
@@ -114,7 +114,7 @@
             baselineShift = other.baselineShift ?: this.baselineShift,
             textGeometricTransform = other.textGeometricTransform ?: this.textGeometricTransform,
             localeList = other.localeList ?: this.localeList,
-            background = other.background.useOrElse { this.background },
+            background = other.background.takeOrElse { this.background },
             textDecoration = other.textDecoration ?: this.textDecoration,
             shadow = other.shadow ?: this.shadow
         )
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextStyle.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextStyle.kt
index 2da7175..e9806458 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextStyle.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextStyle.kt
@@ -20,7 +20,7 @@
 import androidx.compose.runtime.Stable
 import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.Shadow
-import androidx.compose.ui.graphics.useOrElse
+import androidx.compose.ui.graphics.takeOrElse
 import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.text.font.FontStyle
 import androidx.compose.ui.text.font.FontSynthesis
@@ -258,7 +258,7 @@
  * @return resolved text style.
  */
 fun resolveDefaults(style: TextStyle, direction: LayoutDirection) = TextStyle(
-    color = style.color.useOrElse { DefaultColor },
+    color = style.color.takeOrElse { DefaultColor },
     fontSize = if (style.fontSize.isUnspecified) DefaultFontSize else style.fontSize,
     fontWeight = style.fontWeight ?: FontWeight.Normal,
     fontStyle = style.fontStyle ?: FontStyle.Normal,
@@ -273,7 +273,7 @@
     baselineShift = style.baselineShift ?: BaselineShift.None,
     textGeometricTransform = style.textGeometricTransform ?: TextGeometricTransform.None,
     localeList = style.localeList ?: LocaleList.current,
-    background = style.background.useOrElse { DefaultBackgroundColor },
+    background = style.background.takeOrElse { DefaultBackgroundColor },
     textDecoration = style.textDecoration ?: TextDecoration.None,
     shadow = style.shadow ?: Shadow.None,
     textAlign = style.textAlign ?: TextAlign.Start,
diff --git a/compose/ui/ui-unit/api/current.txt b/compose/ui/ui-unit/api/current.txt
index 3167629..1f76100 100644
--- a/compose/ui/ui-unit/api/current.txt
+++ b/compose/ui/ui-unit/api/current.txt
@@ -133,10 +133,10 @@
     method @androidx.compose.runtime.Stable public static float lerp-7oHWEOI(float start, float stop, float fraction);
     method @androidx.compose.runtime.Stable public static inline float max-ioHfwGI(float a, float b);
     method @androidx.compose.runtime.Stable public static inline float min-ioHfwGI(float a, float b);
+    method public static inline float takeOrElse-RiydCdY(float, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Dp> block);
     method @androidx.compose.runtime.Stable public static inline operator float times-Cp9Wa6o(int, float other);
     method @androidx.compose.runtime.Stable public static inline operator float times-NSq4UQk(double, float other);
     method @androidx.compose.runtime.Stable public static inline operator float times-NnR5yEA(float, float other);
-    method public static inline float useOrElse-RiydCdY(float, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Dp> block);
   }
 
   @androidx.compose.runtime.Immutable public final inline class Duration implements java.lang.Comparable<androidx.compose.ui.unit.Duration> {
@@ -429,10 +429,10 @@
     method @androidx.compose.runtime.Stable public static long lerp-KeuwX78(long a, long b, float t);
     method @androidx.compose.runtime.Stable public static inline long max-8E83U4Q(long a, long b);
     method @androidx.compose.runtime.Stable public static inline long min-8E83U4Q(long a, long b);
+    method public static inline long takeOrElse-bAewZlA(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.TextUnit> block);
     method @androidx.compose.runtime.Stable public static inline operator long times-0PRCd3Q(double, long other);
     method @androidx.compose.runtime.Stable public static inline operator long times-Ew26DjI(float, long other);
     method @androidx.compose.runtime.Stable public static inline operator long times-VJWtCv4(int, long other);
-    method public static inline long useOrElse-bAewZlA(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.TextUnit> block);
   }
 
   public enum TextUnitType {
@@ -472,7 +472,7 @@
     method public static inline boolean isSpecified-fQUwLeo(long);
     method public static inline boolean isUnspecified-fQUwLeo(long);
     method public static operator long plus-I3RPvYE(long, long uptime);
-    method public static inline long useOrElse-N-58ELw(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Uptime> block);
+    method public static inline long takeOrElse-N-58ELw(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Uptime> block);
   }
 
   @androidx.compose.runtime.Immutable public final inline class Velocity {
diff --git a/compose/ui/ui-unit/api/public_plus_experimental_current.txt b/compose/ui/ui-unit/api/public_plus_experimental_current.txt
index 3167629..1f76100 100644
--- a/compose/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/compose/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -133,10 +133,10 @@
     method @androidx.compose.runtime.Stable public static float lerp-7oHWEOI(float start, float stop, float fraction);
     method @androidx.compose.runtime.Stable public static inline float max-ioHfwGI(float a, float b);
     method @androidx.compose.runtime.Stable public static inline float min-ioHfwGI(float a, float b);
+    method public static inline float takeOrElse-RiydCdY(float, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Dp> block);
     method @androidx.compose.runtime.Stable public static inline operator float times-Cp9Wa6o(int, float other);
     method @androidx.compose.runtime.Stable public static inline operator float times-NSq4UQk(double, float other);
     method @androidx.compose.runtime.Stable public static inline operator float times-NnR5yEA(float, float other);
-    method public static inline float useOrElse-RiydCdY(float, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Dp> block);
   }
 
   @androidx.compose.runtime.Immutable public final inline class Duration implements java.lang.Comparable<androidx.compose.ui.unit.Duration> {
@@ -429,10 +429,10 @@
     method @androidx.compose.runtime.Stable public static long lerp-KeuwX78(long a, long b, float t);
     method @androidx.compose.runtime.Stable public static inline long max-8E83U4Q(long a, long b);
     method @androidx.compose.runtime.Stable public static inline long min-8E83U4Q(long a, long b);
+    method public static inline long takeOrElse-bAewZlA(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.TextUnit> block);
     method @androidx.compose.runtime.Stable public static inline operator long times-0PRCd3Q(double, long other);
     method @androidx.compose.runtime.Stable public static inline operator long times-Ew26DjI(float, long other);
     method @androidx.compose.runtime.Stable public static inline operator long times-VJWtCv4(int, long other);
-    method public static inline long useOrElse-bAewZlA(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.TextUnit> block);
   }
 
   public enum TextUnitType {
@@ -472,7 +472,7 @@
     method public static inline boolean isSpecified-fQUwLeo(long);
     method public static inline boolean isUnspecified-fQUwLeo(long);
     method public static operator long plus-I3RPvYE(long, long uptime);
-    method public static inline long useOrElse-N-58ELw(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Uptime> block);
+    method public static inline long takeOrElse-N-58ELw(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Uptime> block);
   }
 
   @androidx.compose.runtime.Immutable public final inline class Velocity {
diff --git a/compose/ui/ui-unit/api/restricted_current.txt b/compose/ui/ui-unit/api/restricted_current.txt
index 91079d0..384d1c6 100644
--- a/compose/ui/ui-unit/api/restricted_current.txt
+++ b/compose/ui/ui-unit/api/restricted_current.txt
@@ -133,10 +133,10 @@
     method @androidx.compose.runtime.Stable public static float lerp-7oHWEOI(float start, float stop, float fraction);
     method @androidx.compose.runtime.Stable public static inline float max-ioHfwGI(float a, float b);
     method @androidx.compose.runtime.Stable public static inline float min-ioHfwGI(float a, float b);
+    method public static inline float takeOrElse-RiydCdY(float, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Dp> block);
     method @androidx.compose.runtime.Stable public static inline operator float times-Cp9Wa6o(int, float other);
     method @androidx.compose.runtime.Stable public static inline operator float times-NSq4UQk(double, float other);
     method @androidx.compose.runtime.Stable public static inline operator float times-NnR5yEA(float, float other);
-    method public static inline float useOrElse-RiydCdY(float, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Dp> block);
   }
 
   @androidx.compose.runtime.Immutable public final inline class Duration implements java.lang.Comparable<androidx.compose.ui.unit.Duration> {
@@ -433,10 +433,10 @@
     method @androidx.compose.runtime.Stable public static inline long max-8E83U4Q(long a, long b);
     method @androidx.compose.runtime.Stable public static inline long min-8E83U4Q(long a, long b);
     method @kotlin.PublishedApi internal static inline long pack(long unitType, float v);
+    method public static inline long takeOrElse-bAewZlA(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.TextUnit> block);
     method @androidx.compose.runtime.Stable public static inline operator long times-0PRCd3Q(double, long other);
     method @androidx.compose.runtime.Stable public static inline operator long times-Ew26DjI(float, long other);
     method @androidx.compose.runtime.Stable public static inline operator long times-VJWtCv4(int, long other);
-    method public static inline long useOrElse-bAewZlA(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.TextUnit> block);
   }
 
   public enum TextUnitType {
@@ -476,7 +476,7 @@
     method public static inline boolean isSpecified-fQUwLeo(long);
     method public static inline boolean isUnspecified-fQUwLeo(long);
     method public static operator long plus-I3RPvYE(long, long uptime);
-    method public static inline long useOrElse-N-58ELw(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Uptime> block);
+    method public static inline long takeOrElse-N-58ELw(long, kotlin.jvm.functions.Function0<androidx.compose.ui.unit.Uptime> block);
   }
 
   @androidx.compose.runtime.Immutable public final inline class Velocity {
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt
index 84040a7..d6b59eb 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt
@@ -142,7 +142,7 @@
  * If this [Dp] [isSpecified] then this is returned, otherwise [block] is executed
  * and its result is returned.
  */
-inline fun Dp.useOrElse(block: () -> Dp): Dp =
+inline fun Dp.takeOrElse(block: () -> Dp): Dp =
     if (isSpecified) this else block()
 
 /**
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/TextUnit.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/TextUnit.kt
index 8d9a508..5e819bc 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/TextUnit.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/TextUnit.kt
@@ -304,7 +304,7 @@
  * If this [TextUnit] [isSpecified] then this is returned, otherwise [block] is executed
  * and its result is returned.
  */
-inline fun TextUnit.useOrElse(block: () -> TextUnit): TextUnit =
+inline fun TextUnit.takeOrElse(block: () -> TextUnit): TextUnit =
     if (isSpecified) this else block()
 
 /**
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Uptime.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Uptime.kt
index d75a4bc..b015313 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Uptime.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Uptime.kt
@@ -86,7 +86,7 @@
  * If this [Uptime] [isSpecified] then this is returned, otherwise [block] is executed
  * and its result is returned.
  */
-inline fun Uptime.useOrElse(block: () -> Uptime): Uptime =
+inline fun Uptime.takeOrElse(block: () -> Uptime): Uptime =
     if (isSpecified) this else block()
 
 /**
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt
index c4cf0ec..519afcb 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/DpTest.kt
@@ -239,12 +239,12 @@
     }
 
     @Test
-    fun testUseOrElseTrue() {
-        assertTrue(Dp(1f).useOrElse { Dp.Unspecified }.isSpecified)
+    fun testTakeOrElseTrue() {
+        assertTrue(Dp(1f).takeOrElse { Dp.Unspecified }.isSpecified)
     }
 
     @Test
-    fun testUseOrElseFalse() {
-        assertTrue(Dp.Unspecified.useOrElse { Dp(1f) }.isSpecified)
+    fun testTakeOrElseFalse() {
+        assertTrue(Dp.Unspecified.takeOrElse { Dp(1f) }.isSpecified)
     }
 }
\ No newline at end of file
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt
index 75ec8d3..602bcfb 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/TextUnitTest.kt
@@ -1080,12 +1080,12 @@
     }
 
     @Test
-    fun testUseOrElseTrue() {
-        Assert.assertTrue(1.sp.useOrElse { TextUnit.Unspecified }.isSpecified)
+    fun testTakeOrElseTrue() {
+        Assert.assertTrue(1.sp.takeOrElse { TextUnit.Unspecified }.isSpecified)
     }
 
     @Test
-    fun testUseOrElseFalse() {
-        Assert.assertTrue(TextUnit.Unspecified.useOrElse { 1.sp }.isSpecified)
+    fun testTakeOrElseFalse() {
+        Assert.assertTrue(TextUnit.Unspecified.takeOrElse { 1.sp }.isSpecified)
     }
 }
\ No newline at end of file
diff --git a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/UptimeTest.kt b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/UptimeTest.kt
index 8a60873..14493a0 100644
--- a/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/UptimeTest.kt
+++ b/compose/ui/ui-unit/src/test/kotlin/androidx/compose/ui/unit/UptimeTest.kt
@@ -79,12 +79,12 @@
     }
 
     @Test
-    fun testUseOrElseTrue() {
-        assertTrue(Uptime(1).useOrElse { Uptime.Unspecified }.isSpecified)
+    fun testTakeOrElseTrue() {
+        assertTrue(Uptime(1).takeOrElse { Uptime.Unspecified }.isSpecified)
     }
 
     @Test
-    fun testUseOrElseFalse() {
-        assertTrue(Uptime.Unspecified.useOrElse { Uptime(1) }.isSpecified)
+    fun testTakeOrElseFalse() {
+        assertTrue(Uptime.Unspecified.takeOrElse { Uptime(1) }.isSpecified)
     }
 }
\ No newline at end of file
diff --git a/compose/ui/ui/api/current.txt b/compose/ui/ui/api/current.txt
index 3897398..b64837d 100644
--- a/compose/ui/ui/api/current.txt
+++ b/compose/ui/ui/api/current.txt
@@ -1987,9 +1987,9 @@
     method public static inline boolean isSpecified-FK8aYYs(long);
     method public static inline boolean isUnspecified-FK8aYYs(long);
     method @androidx.compose.runtime.Stable public static long lerp-bKVCie4(long start, long stop, float fraction);
+    method public static inline long takeOrElse-L-byAFk(long, kotlin.jvm.functions.Function0<androidx.compose.ui.layout.ScaleFactor> block);
     method @androidx.compose.runtime.Stable public static operator long times-Sp6zcS4(long, long size);
     method @androidx.compose.runtime.Stable public static operator long times-ngKnWWw(long, long scaleFactor);
-    method public static inline long useOrElse-L-byAFk(long, kotlin.jvm.functions.Function0<androidx.compose.ui.layout.ScaleFactor> block);
   }
 
   public final class SubcomposeLayoutKt {
diff --git a/compose/ui/ui/api/public_plus_experimental_current.txt b/compose/ui/ui/api/public_plus_experimental_current.txt
index 3897398..b64837d 100644
--- a/compose/ui/ui/api/public_plus_experimental_current.txt
+++ b/compose/ui/ui/api/public_plus_experimental_current.txt
@@ -1987,9 +1987,9 @@
     method public static inline boolean isSpecified-FK8aYYs(long);
     method public static inline boolean isUnspecified-FK8aYYs(long);
     method @androidx.compose.runtime.Stable public static long lerp-bKVCie4(long start, long stop, float fraction);
+    method public static inline long takeOrElse-L-byAFk(long, kotlin.jvm.functions.Function0<androidx.compose.ui.layout.ScaleFactor> block);
     method @androidx.compose.runtime.Stable public static operator long times-Sp6zcS4(long, long size);
     method @androidx.compose.runtime.Stable public static operator long times-ngKnWWw(long, long scaleFactor);
-    method public static inline long useOrElse-L-byAFk(long, kotlin.jvm.functions.Function0<androidx.compose.ui.layout.ScaleFactor> block);
   }
 
   public final class SubcomposeLayoutKt {
diff --git a/compose/ui/ui/api/restricted_current.txt b/compose/ui/ui/api/restricted_current.txt
index e3dabe4..88c1c65 100644
--- a/compose/ui/ui/api/restricted_current.txt
+++ b/compose/ui/ui/api/restricted_current.txt
@@ -2034,9 +2034,9 @@
     method public static inline boolean isSpecified-FK8aYYs(long);
     method public static inline boolean isUnspecified-FK8aYYs(long);
     method @androidx.compose.runtime.Stable public static long lerp-bKVCie4(long start, long stop, float fraction);
+    method public static inline long takeOrElse-L-byAFk(long, kotlin.jvm.functions.Function0<androidx.compose.ui.layout.ScaleFactor> block);
     method @androidx.compose.runtime.Stable public static operator long times-Sp6zcS4(long, long size);
     method @androidx.compose.runtime.Stable public static operator long times-ngKnWWw(long, long scaleFactor);
-    method public static inline long useOrElse-L-byAFk(long, kotlin.jvm.functions.Function0<androidx.compose.ui.layout.ScaleFactor> block);
   }
 
   public final class SubcomposeLayoutKt {
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt
index 99ff43df..8928637 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/layout/ScaleFactor.kt
@@ -128,7 +128,7 @@
  * If this [ScaleFactor] [isSpecified] then this is returned, otherwise [block] is executed
  * and its result is returned.
  */
-inline fun ScaleFactor.useOrElse(block: () -> ScaleFactor): ScaleFactor =
+inline fun ScaleFactor.takeOrElse(block: () -> ScaleFactor): ScaleFactor =
     if (isSpecified) this else block()
 
 /**
diff --git a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt
index 5bb2a4a..fe6e120d 100644
--- a/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt
+++ b/compose/ui/ui/src/test/kotlin/androidx/compose/ui/layout/ScaleFactorTest.kt
@@ -125,12 +125,12 @@
     }
 
     @Test
-    fun testUseOrElseTrue() {
-        assertTrue(ScaleFactor(1f, 1f).useOrElse { ScaleFactor.Unspecified }.isSpecified)
+    fun testTakeOrElseTrue() {
+        assertTrue(ScaleFactor(1f, 1f).takeOrElse { ScaleFactor.Unspecified }.isSpecified)
     }
 
     @Test
-    fun testUseOrElseFalse() {
-        assertTrue(ScaleFactor.Unspecified.useOrElse { ScaleFactor(1f, 1f) }.isSpecified)
+    fun testTakeOrElseFalse() {
+        assertTrue(ScaleFactor.Unspecified.takeOrElse { ScaleFactor(1f, 1f) }.isSpecified)
     }
 }
\ No newline at end of file