Change 'original' to 'previous' to clarify multiple extensions #1123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@benhead described this well in #1116
Essentially the issue boils down to:
Bar
norBaz
exist in the original union (Foo
)Bar
norQux
are referenced in the union on line 1.Bar
is already included in the composite unionFoo | Bar | Baz
.I believe we actually mean the previous (i.e. combined) version. This is certainly what the reference implementation seems to do:
yields:
I attempted to add a non-normative note to clarify that "original here means the previous version, which may itself be an extended type..." or something but couldn't get happy with the wording. Then I realised that simply changing
original
toprevious
would convey the intent well, and by sheer coincidence they happen to have the same number of characters!There is one caveat to this solution, and that is that original type definitions are "hoisted", so though the order of type extensions in the document is significant, the original type (actual original!) can occur anywhere, so the use of "previous" is arguably dubious in this case (though I'd argue that named type definitions always precede type extensions in order of processing, so this is still fine):
Also, I can no longer read the word
union
without seeing it asonion
, so that's a fun malapropism that's going to haunt me now 🙄