@@ -6298,6 +6298,27 @@ void SwiftDeclConverter::recordObjCOverride(AbstractFunctionDecl *decl) {
6298
6298
}
6299
6299
}
6300
6300
6301
+ // Note: This function ignores labels.
6302
+ static bool areParameterTypesEqual (const ParameterList ¶ms1,
6303
+ const ParameterList ¶ms2) {
6304
+ if (params1.size () != params2.size ())
6305
+ return false ;
6306
+
6307
+ for (unsigned i : indices (params1)) {
6308
+ if (!params1[i]->getInterfaceType ()->isEqual (
6309
+ params2[i]->getInterfaceType ())) {
6310
+ return false ;
6311
+ }
6312
+
6313
+ if (params1[i]->getValueOwnership () !=
6314
+ params2[i]->getValueOwnership ()) {
6315
+ return false ;
6316
+ }
6317
+ }
6318
+
6319
+ return true ;
6320
+ }
6321
+
6301
6322
void SwiftDeclConverter::recordObjCOverride (SubscriptDecl *subscript) {
6302
6323
// Figure out the class in which this subscript occurs.
6303
6324
auto classTy = subscript->getDeclContext ()->getSelfClassDecl ();
@@ -6314,22 +6335,14 @@ void SwiftDeclConverter::recordObjCOverride(SubscriptDecl *subscript) {
6314
6335
subscript->getModuleContext ()->lookupQualified (
6315
6336
superDecl, subscript->getFullName (),
6316
6337
NL_QualifiedDefault | NL_KnownNoDependency, lookup);
6317
- Type unlabeledIndices;
6338
+
6318
6339
for (auto result : lookup) {
6319
6340
auto parentSub = dyn_cast<SubscriptDecl>(result);
6320
6341
if (!parentSub)
6321
6342
continue ;
6322
6343
6323
- // Compute the type of indices for our own subscript operation, lazily.
6324
- if (!unlabeledIndices) {
6325
- unlabeledIndices = subscript->getIndicesInterfaceType ()
6326
- ->getUnlabeledType (Impl.SwiftContext );
6327
- }
6328
-
6329
- // Compute the type of indices for the subscript we found.
6330
- auto parentUnlabeledIndices = parentSub->getIndicesInterfaceType ()
6331
- ->getUnlabeledType (Impl.SwiftContext );
6332
- if (!unlabeledIndices->isEqual (parentUnlabeledIndices))
6344
+ if (!areParameterTypesEqual (*subscript->getIndices (),
6345
+ *parentSub->getIndices ()))
6333
6346
continue ;
6334
6347
6335
6348
// The index types match. This is an override, so mark it as such.
0 commit comments