-
Couldn't load subscription status.
- Fork 10.6k
Closed as duplicate of#42628
Copy link
Labels
#ifFeature → compiler control statements: Conditional compilation blocksFeature → compiler control statements: Conditional compilation blockscompilerThe Swift compiler itselfThe Swift compiler itselfcompiler control statementsFeature: compiler control statementsFeature: compiler control statementsimprovementparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parser
Description
| Previous ID | SR-4196 |
| Radar | rdar://problem/16980851 |
| Original Reporter | @belkadan |
| Type | Improvement |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Improvement, LanguageFeatureRequest, StarterProposal |
| Assignee | @rintaro |
| Priority | Medium |
md5: c3d4da1a290a1496adc214b1fce9223b
relates to:
- SR-4079 Availability of enum case does not propagate to its switch case scope.
- SR-2 Build configuration directives can not wrap switch cases
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.
Metadata
Metadata
Assignees
Labels
#ifFeature → compiler control statements: Conditional compilation blocksFeature → compiler control statements: Conditional compilation blockscompilerThe Swift compiler itselfThe Swift compiler itselfcompiler control statementsFeature: compiler control statementsFeature: compiler control statementsimprovementparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parser