[SR-4196] Allow #if (conditional compilation) to guard switch cases #46779
Labels
compiler
The Swift compiler itself
duplicate
Resolution: Duplicates another issue
feature
A feature request or implementation
good first issue
Good for newcomers
improvement
parser
Area → compiler: The legacy C++ parser
Additional Detail from JIRA
md5: c3d4da1a290a1496adc214b1fce9223b
relates to:
Issue Description:
Currently
#if
can only be used to guard complete declarations or complete statements, due to the (deliberate) modeling as part of the AST rather than as a textual preprocessing step. However, there's one more place where it would structurally make sense to allow#if
: switch cases. This may be important if a new case is added in a new version of Swift. Right now you'd have to write the switch twice.The text was updated successfully, but these errors were encountered: