File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -2443,9 +2443,13 @@ bool ClangImporter::Implementation::matchesHashableBound(Type type) {
2443
2443
// Match generic parameters against their bounds.
2444
2444
if (auto *genericTy = type->getAs <GenericTypeParamType>()) {
2445
2445
if (auto *generic = genericTy->getDecl ()) {
2446
- type = generic->getSuperclass ();
2447
- if (!type)
2448
- return false ;
2446
+ auto genericSig =
2447
+ generic->getDeclContext ()->getGenericSignatureOfContext ();
2448
+ if (genericSig && genericSig->getConformsTo (type).empty ()) {
2449
+ type = genericSig->getSuperclassBound (type);
2450
+ if (!type)
2451
+ return false ;
2452
+ }
2449
2453
}
2450
2454
}
2451
2455
Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ func testHashableGenerics(
413
413
let _: Int = any. foo // expected-error{{cannot convert value of type 'Set<AnyHashable>' to specified type 'Int'}}
414
414
let _: Int = constrained. foo // expected-error{{cannot convert value of type 'Set<ElementConcrete>' to specified type 'Int'}}
415
415
let _: Int = insufficient. foo // expected-error{{cannot convert value of type 'Set<AnyHashable>' to specified type 'Int'}}
416
- let _: Int = extra. foo // expected-error{{cannot convert value of type 'Set<ElementConcrete >' to specified type 'Int'}}
416
+ let _: Int = extra. foo // expected-error{{cannot convert value of type 'Set<AnyHashable >' to specified type 'Int'}}
417
417
let _: Int = existential. foo // expected-error{{cannot convert value of type 'Set<AnyHashable>' to specified type 'Int'}}
418
418
}
419
419
You can’t perform that action at this time.
0 commit comments