mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Modify computeSubSeqRelation to return true when both paths are empty.
Note: this is not the same as one path does not have value. A path can have no value when we can not find a projection path between Base and Derived. If we've found paths for both projections, and they turn'ed out to be both empty. Its safe to say that they are accessing the same fields in the object. I failed to create a test case as the changed code is currently not reached with the current way we use it. But it will be used as i use projection to do more analysis on epilogue release matcher.
This commit is contained in:
@@ -374,15 +374,6 @@ ProjectionPath::hasNonEmptySymmetricDifference(const ProjectionPath &RHS) const{
|
||||
if (BaseType != RHS.BaseType)
|
||||
return false;
|
||||
|
||||
// We assume that the two paths must be non-empty.
|
||||
//
|
||||
// I believe that we assume this since in the code that uses this we check for
|
||||
// full differences before we use this code path.
|
||||
//
|
||||
// TODO: Is this necessary.
|
||||
if (empty() || RHS.empty())
|
||||
return false;
|
||||
|
||||
// Otherwise, we have a common base and perhaps some common subpath.
|
||||
auto LHSIter = Path.begin();
|
||||
auto RHSIter = RHS.Path.begin();
|
||||
@@ -443,9 +434,9 @@ ProjectionPath::computeSubSeqRelation(const ProjectionPath &RHS) const {
|
||||
if (BaseType != RHS.BaseType)
|
||||
return SubSeqRelation_t::Unknown;
|
||||
|
||||
// If either path is empty, we can not prove anything, return Unknown.
|
||||
if (empty() || RHS.empty())
|
||||
return SubSeqRelation_t::Unknown;
|
||||
// If both paths are empty, return Equal.
|
||||
if (empty() && RHS.empty())
|
||||
return SubSeqRelation_t::Equal;
|
||||
|
||||
auto LHSIter = begin();
|
||||
auto RHSIter = RHS.begin();
|
||||
|
||||
Reference in New Issue
Block a user