about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/strings.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index edc31b4e9e36..897fa3e3a204 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -798,8 +798,17 @@ rec {
   in lib.warnIf (!precise) "Imprecise conversion from float to string ${result}"
     result;
 
-  /* Check whether a value can be coerced to a string */
-  isCoercibleToString = x:
+  /* Soft-deprecated name for isMoreCoercibleToString */
+  isCoercibleToString = lib.warnIf (lib.isInOldestRelease 2305)
+    "lib.strings.isCoercibleToString is deprecated in favor of either isSimpleCoercibleToString or isMoreCoercibleString. Only use the latter if it needs to return true for null, numbers, booleans and list of similarly coercibles."
+    isMoreCoercibleToString;
+
+  /* Check whether a list or other value can be passed to toString.
+
+     Many types of value are coercible to string this way, including int, float,
+     null, bool, list of similarly coercible values.
+  */
+  isMoreCoercibleToString = x:
     elem (typeOf x) [ "path" "string" "null" "int" "float" "bool" ] ||
     (isList x && lib.all isCoercibleToString x) ||
     x ? outPath ||