mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] Allow synthesis of protocol conformances in extensions.
This works for all protocols except for Decodable on non-final classes, because the init requirement has to be 'required' and thus in the type's declaration. Fixes most of https://bugs.swift.org/browse/SR-6803.
This commit is contained in:
@@ -682,7 +682,7 @@ bool DerivedConformance::canDeriveEquatable(TypeChecker &tc,
|
||||
}
|
||||
|
||||
ValueDecl *DerivedConformance::deriveEquatable(ValueDecl *requirement) {
|
||||
if (checkAndDiagnoseDisallowedContext())
|
||||
if (checkAndDiagnoseDisallowedContext(requirement))
|
||||
return nullptr;
|
||||
|
||||
// Build the necessary decl.
|
||||
@@ -1197,7 +1197,7 @@ ValueDecl *DerivedConformance::deriveHashable(ValueDecl *requirement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (checkAndDiagnoseDisallowedContext())
|
||||
if (checkAndDiagnoseDisallowedContext(requirement))
|
||||
return nullptr;
|
||||
|
||||
if (auto ED = dyn_cast<EnumDecl>(Nominal)) {
|
||||
|
||||
Reference in New Issue
Block a user