From 3b82235112f1cf9312697a0b434f21da54cbe374 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Thu, 6 Mar 2025 12:36:19 -0800 Subject: [PATCH 1/4] Make option resolution return something if `rv` is a fallback value Fixes #1053. --- spec/formatting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/formatting.md b/spec/formatting.md index 6d1b1746a5..37fcdf0b1f 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -399,7 +399,7 @@ For each _option_: 1. Else: 1. If the _option value_ consists of a _literal_: 1. Mark `rv` as a _literal_ _option value_. - 1. Set `res[id]` to be `rv`. + 1. Set `res[id]` to be `rv`. 1. Return `res`. The result of _option resolution_ MUST be a (possibly empty) mapping From 78ecb08a1110f4207b55572f957cc8e94a8825fa Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Fri, 7 Mar 2025 09:50:00 -0800 Subject: [PATCH 2/4] Add note and rephrase slightly Added a note explaining the fallback resolved values are not valid options and the option is thus omitted. I also reworded the emit-bad-option step to make it not look like an if statement missing an else --- spec/formatting.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/formatting.md b/spec/formatting.md index 37fcdf0b1f..cc6f59d758 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -395,13 +395,17 @@ For each _option_: 1. Let `id` be the string value of the _identifier_ of the _option_. 1. Let `rv` be the _resolved value_ of the _option value_. 1. If `rv` is a _fallback value_: - 1. If supported, emit a _Bad Option_ error. + 1. Emit a _Bad Option_ error, if supported. 1. Else: 1. If the _option value_ consists of a _literal_: 1. Mark `rv` as a _literal_ _option value_. - 1. Set `res[id]` to be `rv`. + 1. Set `res[id]` to be `rv`. 1. Return `res`. +> [!NOTE] +> If the _resolved value_ of an _option value_ contains a _fallback value_, +> the _option_ is intentionally omitted from the list of _options_. + The result of _option resolution_ MUST be a (possibly empty) mapping of string identifiers to values; that is, errors MAY be emitted, but such errors MUST NOT be fatal. @@ -409,7 +413,7 @@ This mapping can be empty. > [!NOTE] > The _resolved value_ of a _function_ _operand_ -> can also include resolved option values. +> can also include resolved _option values_. > These are not included in the _option resolution_ result, > and need to be processed separately by a _function handler_. From 1c885e626ba72897ec90ec9d5c380e150dd7ebe6 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Sun, 9 Mar 2025 08:12:44 -0700 Subject: [PATCH 3/4] Update spec/formatting.md Co-authored-by: Eemeli Aro --- spec/formatting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/formatting.md b/spec/formatting.md index cc6f59d758..b638da9ac0 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -403,8 +403,8 @@ For each _option_: 1. Return `res`. > [!NOTE] -> If the _resolved value_ of an _option value_ contains a _fallback value_, -> the _option_ is intentionally omitted from the list of _options_. +> If the _resolved value_ of an _option value_ is a _fallback value_, +> the _option_ is intentionally omitted from the mapping of resolved options. The result of _option resolution_ MUST be a (possibly empty) mapping of string identifiers to values; From ea3f0ba9f638cb27e7497291aa6c4580a2fe0079 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 10 Mar 2025 09:50:28 -0700 Subject: [PATCH 4/4] Update spec/formatting.md Co-authored-by: Eemeli Aro --- spec/formatting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/formatting.md b/spec/formatting.md index b638da9ac0..d45f7b557b 100644 --- a/spec/formatting.md +++ b/spec/formatting.md @@ -413,7 +413,7 @@ This mapping can be empty. > [!NOTE] > The _resolved value_ of a _function_ _operand_ -> can also include resolved _option values_. +> can also include resolved option values. > These are not included in the _option resolution_ result, > and need to be processed separately by a _function handler_.