@@ -349,22 +349,36 @@ GenericSignatureImpl::getLocalRequirements(Type depType) const {
349
349
auto rqmResult = computeViaRQM ();
350
350
auto gsbResult = computeViaGSB ();
351
351
352
- auto typesEqual = [&](Type lhs, Type rhs) {
352
+ auto typesEqual = [&](Type lhs, Type rhs, bool canonical ) {
353
353
if (!lhs || !rhs)
354
354
return !lhs == !rhs;
355
- return lhs->isEqual (rhs);
355
+ if (lhs->isEqual (rhs))
356
+ return true ;
357
+
358
+ if (canonical)
359
+ return false ;
360
+
361
+ if (getCanonicalTypeInContext (lhs) ==
362
+ getCanonicalTypeInContext (rhs))
363
+ return true ;
364
+
365
+ return false ;
356
366
};
357
367
358
368
auto compare = [&]() {
359
369
// If the types are concrete, we don't care about the rest.
360
370
if (gsbResult.concreteType || rqmResult.concreteType ) {
361
- if (!typesEqual (gsbResult.concreteType , rqmResult.concreteType ))
371
+ if (!typesEqual (gsbResult.concreteType ,
372
+ rqmResult.concreteType ,
373
+ false ))
362
374
return false ;
363
375
364
376
return true ;
365
377
}
366
378
367
- if (!typesEqual (gsbResult.anchor , rqmResult.anchor ))
379
+ if (!typesEqual (gsbResult.anchor ,
380
+ rqmResult.anchor ,
381
+ true ))
368
382
return false ;
369
383
370
384
if (gsbResult.layout != rqmResult.layout )
@@ -378,6 +392,11 @@ GenericSignatureImpl::getLocalRequirements(Type depType) const {
378
392
if (lhsProtos != rhsProtos)
379
393
return false ;
380
394
395
+ if (!typesEqual (gsbResult.superclass ,
396
+ rqmResult.superclass ,
397
+ false ))
398
+ return false ;
399
+
381
400
return true ;
382
401
};
383
402
@@ -770,7 +789,11 @@ Type GenericSignatureImpl::getConcreteType(Type type) const {
770
789
auto check = [&]() {
771
790
if (!gsbResult || !rqmResult)
772
791
return !gsbResult == !rqmResult;
773
- return gsbResult->isEqual (rqmResult);
792
+ if (gsbResult->isEqual (rqmResult))
793
+ return true ;
794
+
795
+ return (getCanonicalTypeInContext (gsbResult)
796
+ == getCanonicalTypeInContext (rqmResult));
774
797
};
775
798
776
799
if (!check ()) {
0 commit comments