Skip to content

Commit f718b7d

Browse files
committed
More review comments
1 parent b429d92 commit f718b7d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

proposals/NNNN-extensible-enums.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ case .hawaiian:
5959
throw BadFlavorError()
6060
case .pepperoni:
6161
try validateNoVegetariansEating()
62+
return .delicious
6263
case .cheese:
6364
return .delicious
6465
}
@@ -149,8 +150,8 @@ Modules consuming other modules with the language feature enabled will be forced
149150
to add an `@unknown default:` case to any switch state for enumerations that are
150151
not marked with `@frozen`. Importantly, this only applies to enums that are
151152
imported from other modules that are not in the same package. For enums inside
152-
the same modules of the declaring package switches is still required to be
153-
exhaustive and doesn't require an `@unknown default:` case.
153+
the same modules of the declaring package switches are still required to be
154+
exhaustive and don't require an `@unknown default:` case.
154155

155156
Since enabling a language feature applies to the whole module at once we also
156157
propose adding a new attribute `@extensible` analogous to `@frozen`. This
@@ -166,6 +167,9 @@ right default choice in both resilient and non-resilient modules and the new
166167
proposed `@extensible` attribute primiarly exists to give developers a migration
167168
path.
168169

170+
In non-resilient modules, adding the `@extensible` attribute to non-public enums
171+
will produce a warning since those enums can only be matched exhaustively.
172+
169173
## Source compatibility
170174

171175
Enabling the language feature `ExtensibleEnums` in a module that contains public
@@ -176,9 +180,9 @@ Changing the annotation from `@extensible` to `@frozen` is a source compatible
176180
change and will only result in a warning code that used `@unknown default:`
177181
clause. This allows developers to commit to the API of an enum in a non-source
178182
breaking way.
179-
Adding an `@extensible` annotation is a source breaking change in modules that
180-
have **not** enabled the `ExtensibleEnums` language features or are compiled
181-
with resiliency.
183+
Adding an `@extensible` annotation to an exisitng public enum is a source
184+
breaking change in modules that have **not** enabled the `ExtensibleEnums`
185+
language features or are compiled with resiliency.
182186

183187
## Effect on ABI stability
184188

0 commit comments

Comments
 (0)