From 68b6443ed635a3e87a62a5a8dcfd05e952c93192 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 28 Dec 2022 23:34:15 +0100 Subject: [PATCH] lib.strings: Rename isCoercibleToString -> isMoreCoercibleToString --- lib/strings.nix | 13 +++++++++++-- 1 file 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 ||