From c6fba6b2bb49d95a586e326a7f24a4b05e1c842e Mon Sep 17 00:00:00 2001 From: Chris Garvis Date: Tue, 12 May 2026 22:25:07 -0400 Subject: [PATCH] Widen ValidationError :key type to allow lists The struct already stores a list of atoms for the "unknown options" error (lib/nimble_options.ex:524 passes a list of keys; test "unknown options" asserts `key: [:not_an_option1, :not_an_option2]`). The @type for the field said `atom()` only, so the new set-theoretic checker in elixir-lang/elixir#15366 flags every caller of error_tuple at that site and cascades into every package that depends on nimble_options. Widening to `atom() | [atom()]` matches actual runtime behavior. Doc updated to call out the multi-key case. No code change, no test change. Signed-off-by: Chris Garvis --- lib/nimble_options/validation_error.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/nimble_options/validation_error.ex b/lib/nimble_options/validation_error.ex index 02a4ed0..d76f85f 100644 --- a/lib/nimble_options/validation_error.ex +++ b/lib/nimble_options/validation_error.ex @@ -9,7 +9,7 @@ defmodule NimbleOptions.ValidationError do """ @type t() :: %__MODULE__{ - key: atom(), + key: atom() | [atom()], keys_path: [atom()], redact: boolean, value: term() @@ -21,7 +21,9 @@ defmodule NimbleOptions.ValidationError do Only the following documented fields are considered public. All other fields are considered private and should not be referenced: - * `:key` (`t:atom/0`) - The key that did not successfully validate. + * `:key` (`t:atom/0` or list of `t:atom/0`) - The key that did not successfully + validate. When several keys are involved in the same error (for example, + unknown options reported as a group), this is the list of those keys. * `:keys_path` (list of `t:atom/0`) - If the key is nested, this is the path to the key.