Variables bound in the case item pattern should be available inside the
case body and in the where clause, but not elsewhere within the
statement (e.g. other case items). The added accessor
CaseStmt.getLabelItemsRange() is needed to be able to determine the
difference between a completion location after a colon and one where
the colon doesn’t exist (in both cases this would be in the — implicit
— body statement range).
Parser now accepts multiple patterns in switch cases that contain variables.
Every pattern must contain the same variable names, but can be in arbitrary
positions. New error for variable that doesn't exist in all patterns.
Sema now checks cases with multiple patterns that each occurence of a variable
name is bound to the same type. New error for unexpected types.
SILGen now shares basic blocks for switch cases that contain multiple
patterns. That BB takes incoming arguments from each applicable pattern match
emission with the specific var decls for the pattern that matched.
Added tests for all three of these, and some simple IDE completion
sanity tests.
This is still a subject of discussion on swift-dev, but it seems like clearly the right
way to go to me. If it turns out that this isn't a good direction, I'll revert this and
subsequent patches built on top of it.
Swift SVN r26168
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK. The driver was defaulting to the
host OS. Thus, we could not run the tests when the standard library was
not built for OS X.
Swift SVN r24504