aboutsummaryrefslogtreecommitdiff
path: root/core/flags/internal_validation.odin
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-09 11:27:06 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-09 11:39:10 -0400
commit2e199c669f539fe327dcc52a82d0216e66da974b (patch)
treee6df9010a4557742e0c71a94c37e57d4e2837ce6 /core/flags/internal_validation.odin
parentcae43b801f01206ee26f85e80181658754f886e1 (diff)
flags: Forbid combination of `pos` and `manifold`
Diffstat (limited to 'core/flags/internal_validation.odin')
-rw-r--r--core/flags/internal_validation.odin7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/flags/internal_validation.odin b/core/flags/internal_validation.odin
index 42ea08c78..b68df8cb5 100644
--- a/core/flags/internal_validation.odin
+++ b/core/flags/internal_validation.odin
@@ -59,7 +59,8 @@ validate_structure :: proc(model_type: $T, style: Parsing_Style, loc := #caller_
}
}
- if pos_str, has_pos := get_struct_subtag(args_tag, SUBTAG_POS); has_pos {
+ pos_str, has_pos := get_struct_subtag(args_tag, SUBTAG_POS)
+ if has_pos {
#partial switch specific_type_info in field.type.variant {
case runtime.Type_Info_Map:
fmt.panicf("%T.%s has `%s` defined, and this does not make sense on a map type.",
@@ -110,6 +111,10 @@ validate_structure :: proc(model_type: $T, style: Parsing_Style, loc := #caller_
}
if length, is_manifold := get_struct_subtag(args_tag, SUBTAG_MANIFOLD); is_manifold {
+ fmt.assertf(!has_pos,
+ "%T.%s has both `%s` and `%s` defined. This is disallowed.\n\tSuggestion: Use a dynamic array field named `%s` to accept unspecified positional arguments.",
+ model_type, field.name, SUBTAG_POS, SUBTAG_MANIFOLD, INTERNAL_VARIADIC_FLAG, loc = loc)
+
if value, parse_ok := strconv.parse_u64_of_base(length, 10); parse_ok {
fmt.assertf(value > 0,
"%T.%s has `%s` set to %i. It must be greater than zero.",