diff --git a/spec/errors.md b/spec/errors.md index fb74f82d6d..5e49c1cd38 100644 --- a/spec/errors.md +++ b/spec/errors.md @@ -129,10 +129,9 @@ or contains a _variable_ that does not directly or indirectly reference a _decla ### Duplicate Declaration -A **_Duplicate Declaration_** error occurs when a _variable_ appears in two _declarations_. -This includes when an _input-declaration_ binds a _variable_ that appears in a previous _declaration_, -when a _local-declaration_ binds a _variable_ that appears in a previous _declaration_, -or when a _local-declaration_ refers to its bound _variable_ in its _expression_. +A **_Duplicate Declaration_** error occurs when a _variable_ is declared more than once. +Note that an input _variable_ is implicitly declared when it is first used, +so explicitly declaring it after such use is also an error. > Examples of invalid messages resulting in a _Duplicate Declaration_ error: > @@ -149,6 +148,10 @@ or when a _local-declaration_ refers to its bound _variable_ in its _expression_ > .local $var = {$ext :number maxFractionDigits=0} > {{Redeclaration of an input variable}} > +> .input {$var :number minFractionDigits=$var2} +> .input {$var2 :number} +> {{Redeclaration of the implicit input variable $var2}} +> > .local $var = {$ext :someFunction} > .local $var = {$error} > .local $var2 = {$var2 :error} diff --git a/spec/syntax.md b/spec/syntax.md index b176e26a3d..268aee73df 100644 --- a/spec/syntax.md +++ b/spec/syntax.md @@ -175,14 +175,14 @@ local-declaration = local s variable [s] "=" [s] expression _Variables_, once declared, MUST NOT be redeclared. A _message_ that does any of the following is not _valid_ and will produce a _Duplicate Declaration_ error during processing: -- An _input-declaration_ MUST NOT bind a _variable_ that appears as a _variable_ in a previous - _declaration_. -- A _local-declaration_ MUST NOT bind a _variable_ that appears as a _variable_ in a previous - _declaration_. +- A _declaration_ MUST NOT bind a _variable_ + that appears as a _variable_ anywhere within a previous _declaration_. +- An _input-declaration_ MUST NOT bind a _variable_ + that appears anywhere within the _annotation_ of its _variable-expression_. - A _local-declaration_ MUST NOT bind a _variable_ that appears in its _expression_. A _local-declaration_ MAY overwrite an external input value as long as the -external input value does not appear in a _declaration_. +external input value does not appear in a previous _declaration_. > [!Note] > These restrictions only apply to _declarations_.