From bb27341cd0f296b2c11f46451c8702ce63e7d512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volker=20Wei=C3=9Fmann?= Date: Fri, 17 Mar 2023 21:15:47 +0100 Subject: [PATCH] Better error message when custom_targets has duplicates in the output kwarg --- mesonbuild/interpreter/type_checking.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 129668b5c..e1ee82a93 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -296,6 +296,13 @@ OVERRIDE_OPTIONS_KW: KwargInfo[T.List[str]] = KwargInfo( def _output_validator(outputs: T.List[str]) -> T.Optional[str]: + output_set = set(outputs) + if len(output_set) != len(outputs): + seen = set() + for el in outputs: + if el in seen: + return f"contains {el!r} multiple times, but no duplicates are allowed." + seen.add(el) for i in outputs: if i == '': return 'Output must not be empty.'