File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -1860,26 +1860,29 @@ static Constraint *selectBestBindingDisjunction(
1860
1860
// type variable.
1861
1861
SmallVector<Constraint *, 8 > bindingDisjunctions;
1862
1862
for (auto *disjunction : disjunctions) {
1863
- llvm::Optional< TypeVariableType *> commonTypeVariable;
1863
+ TypeVariableType *commonTypeVariable = nullptr ;
1864
1864
if (llvm::all_of (
1865
1865
disjunction->getNestedConstraints (),
1866
1866
[&](Constraint *bindingConstraint) {
1867
1867
if (bindingConstraint->getKind () != ConstraintKind::Bind)
1868
1868
return false ;
1869
1869
1870
- auto *tv =
1871
- bindingConstraint->getFirstType ()->getAs <TypeVariableType>();
1870
+ auto *tv = cs.simplifyType (bindingConstraint->getFirstType ())
1871
+ ->getRValueType ()
1872
+ ->getAs <TypeVariableType>();
1872
1873
// Only do this for simple type variable bindings, not for
1873
1874
// bindings like: ($T1) -> $T2 bind String -> Int
1874
1875
if (!tv)
1875
1876
return false ;
1876
1877
1877
- if (!commonTypeVariable.hasValue ())
1878
- commonTypeVariable = tv;
1879
-
1880
- if (commonTypeVariable.getValue () != tv)
1878
+ // If we've seen a variable before, make sure that this is
1879
+ // the same one.
1880
+ if (commonTypeVariable == tv)
1881
+ return true ;
1882
+ if (commonTypeVariable)
1881
1883
return false ;
1882
1884
1885
+ commonTypeVariable = tv;
1883
1886
return true ;
1884
1887
})) {
1885
1888
bindingDisjunctions.push_back (disjunction);
Original file line number Diff line number Diff line change @@ -104,3 +104,11 @@ struct Modify {
104
104
nonmutating set { } // expected-note {{setter defined here}}
105
105
}
106
106
}
107
+
108
+ struct ImplicitlyUnwrapped {
109
+ var x : Int !
110
+ var y : Int ? {
111
+ _read { yield x }
112
+ _modify { yield & x }
113
+ }
114
+ }
You can’t perform that action at this time.
0 commit comments