Skip to content

Adapt to Tuple-In-OptionalSome Patterns in Space Projection #31714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions lib/Sema/TypeCheckSwitchStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ namespace {
}
return Space(T, H, SP);
}
static Space forConstructor(Type T, DeclName H,
std::forward_list<Space> SP) {
// No need to filter SP here; this is only used to copy other
// Constructor spaces.
return Space(T, H, SP);
}
static Space forBool(bool C) {
return Space(C);
}
Expand Down Expand Up @@ -1441,7 +1435,7 @@ namespace {
if (subSpace.getKind() == SpaceKind::Constructor &&
subSpace.getHead().getBaseIdentifier().empty()) {
return Space::forConstructor(item->getType(), name,
std::move(subSpace.getSpaces()));
{subSpace});
}
return Space::forConstructor(item->getType(), name, subSpace);
}
Expand Down
12 changes: 12 additions & 0 deletions test/Sema/exhaustive_switch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1438,3 +1438,15 @@ enum SR11212Tests {
}

} // end SR11212Tests

func sr12412() {
enum E {
case x
case y
}
switch (E.x, true) as Optional<(e: E, b: Bool)> {
case nil, (e: .x, b: _)?: break
case (e: .y, b: false)?: break
case (e: .y, b: true)?: break
}
}