File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2758,6 +2758,9 @@ class ConstraintSystem {
2758
2758
if (!x.hasNonDefaultableBindings ())
2759
2759
return false ;
2760
2760
2761
+ if (x.FullyBound || x.SubtypeOfExistentialType )
2762
+ return false ;
2763
+
2761
2764
llvm::SmallPtrSet<Constraint *, 8 > intersection (x.Sources );
2762
2765
llvm::set_intersect (intersection, y.Sources );
2763
2766
@@ -2774,7 +2777,9 @@ class ConstraintSystem {
2774
2777
return x.TypeVar == typeVar;
2775
2778
}
2776
2779
2777
- return false ;
2780
+ // If the only difference is default types,
2781
+ // prioritize bindings with fewer of them.
2782
+ return x.NumDefaultableBindings < y.NumDefaultableBindings ;
2778
2783
}
2779
2784
2780
2785
void foundLiteralBinding (ProtocolDecl *proto) {
Original file line number Diff line number Diff line change @@ -194,3 +194,10 @@ struct S_35740653 {
194
194
func rdar35740653( val: S_35740653 ) {
195
195
let _ = 0 ... Int ( val / . value( 1.0 / 42.0 ) ) // Ok
196
196
}
197
+
198
+ protocol P_37290898 { }
199
+ struct S_37290898 : P_37290898 { }
200
+
201
+ func rdar37290898( _ arr: inout [ P_37290898 ] , _ element: S_37290898 ? ) {
202
+ arr += [ element ] . compactMap { $0 } // Ok
203
+ }
You can’t perform that action at this time.
0 commit comments