From 0d472a62012364d064f0b75f1da491242c6ae9c6 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 8 Jul 2023 22:18:36 +0200 Subject: lib/modules: Report a good error when option tree has bare type Note that this removes the possibility of declaring an option named `_type`. --- lib/tests/modules/options-type-error-configuration.nix | 6 ++++++ lib/tests/modules/options-type-error-typical-nested.nix | 5 +++++ lib/tests/modules/options-type-error-typical.nix | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 lib/tests/modules/options-type-error-configuration.nix create mode 100644 lib/tests/modules/options-type-error-typical-nested.nix create mode 100644 lib/tests/modules/options-type-error-typical.nix (limited to 'lib/tests/modules') diff --git a/lib/tests/modules/options-type-error-configuration.nix b/lib/tests/modules/options-type-error-configuration.nix new file mode 100644 index 000000000000..bcd6db89487a --- /dev/null +++ b/lib/tests/modules/options-type-error-configuration.nix @@ -0,0 +1,6 @@ +{ lib, ... }: { + options = { + # unlikely mistake, but we can catch any attrset with _type + result = lib.evalModules { modules = []; }; + }; +} diff --git a/lib/tests/modules/options-type-error-typical-nested.nix b/lib/tests/modules/options-type-error-typical-nested.nix new file mode 100644 index 000000000000..2c07e19fb8ae --- /dev/null +++ b/lib/tests/modules/options-type-error-typical-nested.nix @@ -0,0 +1,5 @@ +{ lib, ... }: { + options = { + result.here = lib.types.str; + }; +} diff --git a/lib/tests/modules/options-type-error-typical.nix b/lib/tests/modules/options-type-error-typical.nix new file mode 100644 index 000000000000..416f436e0ad7 --- /dev/null +++ b/lib/tests/modules/options-type-error-typical.nix @@ -0,0 +1,5 @@ +{ lib, ... }: { + options = { + result = lib.types.str; + }; +} -- cgit 1.4.1