Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recognize when an intermediate class has overridden a method #4

Closed
wants to merge 2 commits into from
Closed

Conversation

samsonjs
Copy link
Contributor

@samsonjs samsonjs commented Apr 1, 2015

This makes the following code work. Model overrides the method indirectly by subclassing _Model.

I also snuck in a quick fix to SubclassesOfClass so it doesn't return the base class it receives as a param.

@interface Base : NSObject
- (id)someMethod;
@end
@implementation Base
- (id)someMethod { SUBCLASS_MUST_OVERRIDE; return nil; }
@end

@interface _Model : Base @end
@implementation _Model
- (id)someMethod { return @42; }
@end

@interface Model : _Model @end
@implementation Model @end

@samsonjs
Copy link
Contributor Author

samsonjs commented Apr 1, 2015

So, this definitely needs more work (or maybe it won't work at all). When a method is implemented in a leaf class instead of an intermediate class then the intermediate class fails the assertion. I'm not really sure how to properly handle that without making a lot of poor assumptions.

@samsonjs
Copy link
Contributor Author

samsonjs commented May 7, 2015

This is not a good idea. Closing.

@samsonjs samsonjs closed this May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant