mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Deserialization] Require labels to match when looking for closely-matching clang declarations
This commit is contained in:
@@ -372,6 +372,8 @@ enum class TypeMatchFlags {
|
|||||||
IgnoreSendability = 1 << 7,
|
IgnoreSendability = 1 << 7,
|
||||||
/// Ignore global actor isolation attributes on functions when matching types.
|
/// Ignore global actor isolation attributes on functions when matching types.
|
||||||
IgnoreFunctionGlobalActorIsolation = 1 << 8,
|
IgnoreFunctionGlobalActorIsolation = 1 << 8,
|
||||||
|
/// Require parameter labels to match.
|
||||||
|
RequireMatchingParameterLabels = 1 << 9,
|
||||||
};
|
};
|
||||||
using TypeMatchOptions = OptionSet<TypeMatchFlags>;
|
using TypeMatchOptions = OptionSet<TypeMatchFlags>;
|
||||||
|
|
||||||
|
|||||||
@@ -3604,6 +3604,11 @@ static bool matches(CanType t1, CanType t2, TypeMatchOptions matchMode,
|
|||||||
OptionalUnwrapping::None)) {
|
OptionalUnwrapping::None)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (matchMode.contains(TypeMatchFlags::RequireMatchingParameterLabels)&&
|
||||||
|
fn1Params[i].getLabel() != fn2Params[i].getLabel()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Results are covariant.
|
// Results are covariant.
|
||||||
|
|||||||
@@ -2013,7 +2013,8 @@ namespace {
|
|||||||
return TypeComparison::Equal;
|
return TypeComparison::Equal;
|
||||||
|
|
||||||
if (nearMatchOk) {
|
if (nearMatchOk) {
|
||||||
TypeMatchOptions options = TypeMatchFlags::AllowTopLevelOptionalMismatch;
|
TypeMatchOptions options = TypeMatchFlags::RequireMatchingParameterLabels;
|
||||||
|
options |= TypeMatchFlags::AllowTopLevelOptionalMismatch;
|
||||||
options |= TypeMatchFlags::AllowNonOptionalForIUOParam;
|
options |= TypeMatchFlags::AllowNonOptionalForIUOParam;
|
||||||
options |= TypeMatchFlags::IgnoreNonEscapingForOptionalFunctionParam;
|
options |= TypeMatchFlags::IgnoreNonEscapingForOptionalFunctionParam;
|
||||||
options |= TypeMatchFlags::IgnoreFunctionSendability;
|
options |= TypeMatchFlags::IgnoreFunctionSendability;
|
||||||
|
|||||||
Reference in New Issue
Block a user