|
41 | 41 | #include "swift/AST/ForeignErrorConvention.h"
|
42 | 42 | #include "swift/AST/GenericEnvironment.h"
|
43 | 43 | #include "swift/AST/Initializer.h"
|
44 |
| -#include "swift/AST/InverseMarking.h" |
45 | 44 | #include "swift/AST/MacroDefinition.h"
|
46 | 45 | #include "swift/AST/NameLookup.h"
|
47 | 46 | #include "swift/AST/NameLookupRequests.h"
|
@@ -3218,21 +3217,17 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
|
3218 | 3217 | static void diagnoseInverseOnClass(ClassDecl *decl) {
|
3219 | 3218 | auto &ctx = decl->getASTContext();
|
3220 | 3219 |
|
3221 |
| - for (auto ip : InvertibleProtocolSet::full()) { |
3222 |
| - auto inverseMarking = decl->hasInverseMarking(ip); |
3223 |
| - |
3224 |
| - // Inferred inverses are already ignored for classes. |
3225 |
| - // FIXME: we can also diagnose @_moveOnly here if we use `isAnyExplicit` |
3226 |
| - if (!inverseMarking.is(InverseMarking::Kind::Explicit)) |
3227 |
| - continue; |
| 3220 | + InvertibleProtocolSet inverses; |
| 3221 | + bool anyObject = false; |
| 3222 | + (void) getDirectlyInheritedNominalTypeDecls(decl, inverses, anyObject); |
3228 | 3223 |
|
| 3224 | + for (auto ip : inverses) { |
3229 | 3225 | // Allow ~Copyable when MoveOnlyClasses is enabled
|
3230 | 3226 | if (ip == InvertibleProtocolKind::Copyable
|
3231 | 3227 | && ctx.LangOpts.hasFeature(Feature::MoveOnlyClasses))
|
3232 | 3228 | continue;
|
3233 | 3229 |
|
3234 |
| - |
3235 |
| - ctx.Diags.diagnose(inverseMarking.getLoc(), |
| 3230 | + ctx.Diags.diagnose(decl->getLoc(), |
3236 | 3231 | diag::inverse_on_class,
|
3237 | 3232 | getProtocolName(getKnownProtocolKind(ip)));
|
3238 | 3233 | }
|
|
0 commit comments