Skip to content

Intent of uniqueness rules for multiple extensions #1116

Answered by benjie
benhead asked this question in Q&A
Discussion options

You must be logged in to vote

It may be poorly worded, but I think essentially the "original type" is replaced by the extension. So in this example:

union MyUnion = Foo
extend union MyUnion = Bar | Baz
extend union MyUnion = Bar | Qux

After line one, MyUnion is newly created, with union MyUnion = Foo
After line two, MyUnion has been replaced such that now union MyUnion = Foo | Bar | Baz
Line three would be invalid since the "original" MyUnion type we're extending is the type defined on line 2, and already contains Bar.

I think the usage of the word "original" here may be problematic, really we're just referencing the "current type with this name before the extension is applied" rather than "the first instance of this …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@benhead
Comment options

@benjie
Comment options

Answer selected by benhead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants