Skip to content

Commit 762cd4d

Browse files
authored
Merge pull request #66565 from hamishknight/connect-two
2 parents 4ec8276 + f18293b commit 762cd4d

File tree

4 files changed

+64
-5
lines changed

4 files changed

+64
-5
lines changed

lib/Sema/CSGen.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,10 +2949,6 @@ namespace {
29492949
PreWalkAction walkToDeclPre(Decl *D) override {
29502950
return Action::VisitChildrenIf(isa<PatternBindingDecl>(D));
29512951
}
2952-
2953-
PreWalkResult<Pattern *> walkToPatternPre(Pattern *P) override {
2954-
return Action::SkipChildren(P);
2955-
}
29562952
} collectVarRefs(CS);
29572953

29582954
// Walk the capture list if this closure has one, because it could

lib/Sema/CSSyntacticElement.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2625,8 +2625,10 @@ void ConjunctionElement::findReferencedVariables(
26252625
}
26262626

26272627
if (element.is<Decl *>() || element.is<StmtConditionElement *>() ||
2628-
element.is<Expr *>() || element.isStmt(StmtKind::Return))
2628+
element.is<Expr *>() || element.isPattern(PatternKind::Expr) ||
2629+
element.isStmt(StmtKind::Return)) {
26292630
element.walk(refFinder);
2631+
}
26302632
}
26312633

26322634
Type constraints::isPlaceholderVar(PatternBindingDecl *PB) {

test/Constraints/issue-66561.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
// https://github.com/apple/swift/issues/66561
4+
5+
@propertyWrapper
6+
struct WrapperValue<Value> {
7+
var value: Value
8+
init(wrappedValue: Value) {
9+
self.value = wrappedValue
10+
}
11+
12+
var projectedValue: Self {
13+
return self
14+
}
15+
16+
var wrappedValue: Value {
17+
get {
18+
self.value
19+
}
20+
set {
21+
self.value = newValue
22+
}
23+
}
24+
}
25+
26+
func test() {
27+
let _ = {
28+
@WrapperValue var value: Bool = false
29+
switch value {
30+
case $value.wrappedValue:
31+
break
32+
default:
33+
break
34+
}
35+
}
36+
}

test/Constraints/rdar110617471.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
// rdar://110617471: Make sure we can type-check this.
4+
class C {
5+
var prop = 0
6+
}
7+
8+
func foo(_ fn: () -> Void) {}
9+
10+
class D {
11+
let c = C()
12+
13+
func bar() {
14+
foo { [c] in
15+
foo {
16+
switch 0 {
17+
case c.prop:
18+
break
19+
default:
20+
break
21+
}
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)