mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Diagnose redeclarations of Objective-C methods.
@objc methods, initializers, deinitializers, properties, and subscripts all produce Objective-C methods. Diagnose cases where two such entities (which may be of different kinds) produce the same Objective-C method in the same class. As a special exception, one can have an Objective-C method in an extension that conflicts with an Objective-C method in the original class definition, so long as the original class definition is from a different model. This reflects the reality in Objective-C that the category definition wins over the original definition, and is used in at least one overlay (SpriteKit). This is the first part of rdar://problem/18391046; the second part involves checking that overrides are sane. Swift SVN r23147
This commit is contained in:
@@ -642,6 +642,19 @@ public:
|
||||
/// \brief Returns memory used exclusively by constraint solver.
|
||||
size_t getSolverMemory() const;
|
||||
|
||||
/// Note that there is a conflict between different definitions that
|
||||
/// produce the same Objective-C method.
|
||||
void recordObjCMethodConflict(ClassDecl *classDecl, ObjCSelector selector,
|
||||
bool isInstance);
|
||||
|
||||
/// Diagnose all conflicts between members that have the same
|
||||
/// Objective-C selector in the same class.
|
||||
///
|
||||
/// \param sf The source file for which we are diagnosing conflicts.
|
||||
///
|
||||
/// \returns true if there were any conflicts diagnosed.
|
||||
bool diagnoseObjCMethodConflicts(SourceFile &sf);
|
||||
|
||||
private:
|
||||
friend class Decl;
|
||||
Optional<RawComment> getRawComment(const Decl *D);
|
||||
|
||||
Reference in New Issue
Block a user