Skip to content

Commit ba2bf82

Browse files
committed
[CSBindings] Adjust Double<->CGFloat handling since Bindings are now a SetVector
1 parent 24472c9 commit ba2bf82

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/Sema/CSBindings.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,21 +524,18 @@ void BindingSet::addBinding(PotentialBinding binding) {
524524
llvm::any_of(Bindings, [](const PotentialBinding &binding) {
525525
return binding.BindingType->isDoubleType();
526526
}))
527-
return;
527+
return false;
528528

529529
if (type->isDoubleType()) {
530530
auto inferredCGFloat =
531531
llvm::find_if(Bindings, [](const PotentialBinding &binding) {
532532
return binding.BindingType->isCGFloatType();
533533
});
534534

535-
// TODO: If CGFloat has been already inferred, we can't simply remove it
536-
// because that would break supertype join logic - index stored in
537-
// `lastSupertypeIndex` would get invalidated. Instead let's replace type
538-
// of an existing binding with Double.
539535
if (inferredCGFloat != Bindings.end()) {
540-
inferredCGFloat->BindingType = type;
541-
return;
536+
Bindings.erase(inferredCGFloat);
537+
Bindings.insert(inferredCGFloat->withType(type));
538+
return false;
542539
}
543540
}
544541
}

0 commit comments

Comments
 (0)