mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ConstraintSystem] Adjust locator for implicit conversions between tuple elements
Drop `TupleType` element which is only used for diagnostics and cannot be re-created by `ExprRewriter` during solution application. Resolves: rdar://97389698
This commit is contained in:
@@ -452,6 +452,18 @@ ConstraintLocator *ConstraintSystem::getImplicitValueConversionLocator(
|
||||
anchor = ASTNode();
|
||||
path.clear();
|
||||
}
|
||||
|
||||
// If conversion is for a tuple element, let's drop `TupleType`
|
||||
// components from the path since they carry information for
|
||||
// diagnostics that `ExprRewriter` won't be able to re-construct
|
||||
// during solution application.
|
||||
if (!path.empty() && path.back().is<LocatorPathElt::TupleElement>()) {
|
||||
path.erase(llvm::remove_if(path,
|
||||
[](const LocatorPathElt &elt) {
|
||||
return elt.is<LocatorPathElt::TupleType>();
|
||||
}),
|
||||
path.end());
|
||||
}
|
||||
}
|
||||
|
||||
return getConstraintLocator(/*base=*/getConstraintLocator(anchor, path),
|
||||
|
||||
Reference in New Issue
Block a user