Skip to content

Commit f07a16f

Browse files
committed
Sema: Disable special handling of OneWayEqual constraints
1 parent 43919e8 commit f07a16f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

include/swift/Sema/Constraint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ class Constraint final : public llvm::ilist_node<Constraint>,
859859

860860
/// Whether this is a one-way constraint.
861861
bool isOneWayConstraint() const {
862-
return Kind == ConstraintKind::OneWayEqual;
862+
return false;
863863
}
864864

865865
/// Retrieve the overload choice for an overload-binding constraint.

test/expr/closure/closures_swift6.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,18 @@ class TestGithubIssue70089 {
501501
}
502502

503503
doVoidStuff { [weak self] in
504-
doVoidStuff { [self] in
505-
x += 1 // expected-error {{explicit use of 'self' is required when 'self' is optional, to make control flow explicit}} expected-note{{reference 'self?.' explicitly}}
504+
doVoidStuff { [self] in // expected-error {{value of optional type 'TestGithubIssue70089?' must be unwrapped to a value of type 'TestGithubIssue70089'}}
505+
// expected-note@-1 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
506+
// expected-note@-2 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
507+
x += 1
506508
}
507509
}
508510

509511
doVoidStuff { [weak self] in
510-
doVoidStuff { [self] in
511-
self.x += 1 // expected-error {{value of optional type 'TestGithubIssue70089?' must be unwrapped to refer to member 'x' of wrapped base type 'TestGithubIssue70089'}} expected-note {{chain the optional using '?' to access member 'x' only for non-'nil' base values}} expected-note{{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
512+
doVoidStuff { [self] in // expected-error {{value of optional type 'TestGithubIssue70089?' must be unwrapped to a value of type 'TestGithubIssue70089'}}
513+
// expected-note@-1 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
514+
// expected-note@-2 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
515+
self.x += 1
512516
}
513517
}
514518

0 commit comments

Comments
 (0)