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 @@ -2639,6 +2639,9 @@ class ConstraintSystem {
2639
2639
if (!x.hasNonDefaultableBindings ())
2640
2640
return false ;
2641
2641
2642
+ if (x.FullyBound || x.SubtypeOfExistentialType )
2643
+ return false ;
2644
+
2642
2645
llvm::SmallPtrSet<Constraint *, 8 > intersection (x.Sources );
2643
2646
llvm::set_intersect (intersection, y.Sources );
2644
2647
@@ -2655,7 +2658,9 @@ class ConstraintSystem {
2655
2658
return x.TypeVar == typeVar;
2656
2659
}
2657
2660
2658
- return false ;
2661
+ // If the only difference is default types,
2662
+ // prioritize bindings with fewer of them.
2663
+ return x.NumDefaultableBindings < y.NumDefaultableBindings ;
2659
2664
}
2660
2665
2661
2666
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