Skip to content

Commit 5432c34

Browse files
committed
[ConstraintSystem] Adjust Double<->CGFloat locator when used as dictionary key/value
Original locator carries information about key and value types which is necessary for diagnostics but cannot be retrieved in its original state during solution application, so it could be dropped from Double<->CGFloat constructor locator.
1 parent 1d1f065 commit 5432c34

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,11 @@ ConstraintLocator *ConstraintSystem::getImplicitValueConversionLocator(
429429
SmallVector<LocatorPathElt, 4> path;
430430
auto anchor = root.getLocatorParts(path);
431431
{
432+
if (isExpr<DictionaryExpr>(anchor) && path.size() > 1) {
433+
// Drop everything except for first `tuple element #`.
434+
path.pop_back_n(path.size() - 1);
435+
}
436+
432437
// Drop any value-to-optional conversions that were applied along the
433438
// way to reach this one.
434439
while (!path.empty()) {

0 commit comments

Comments
 (0)