Should ObjCMethodDecl::getCanonicalDecl search superclass?

Should the getCanonicalDecl method on ObjCMethodDecl also search its superclasses? For example, if I have the following:

@interface MyBaseClass {
}

  • (void)method1;
    @end

@interface MyClass : MyBaseClass {
}

  • (void)method2:(id)argument;
    @end

@implementation MyClass

  • (void)method1 {
    }

  • (void)method2:(id)argument {
    }
    @end

I would expect that in the implementation of MyClass, that the canonical decl for both methods 1 and 2 should be their definitions in MyClass and MyBaseClass. Currently, only method2 resolves to the declaration. method1 returns itself.

Kevin

Furthermore, if I have:

@interface MyClass {
}
@end

@interface MyClass ()

  • (void)someOtherCategoryMethod;
    @end

@implementation MyClass

  • (void)someOtherCategoryMethod {
    }
    @end

I would expect the canonical decl for someOtherCategoryMethod in the implementation of MyClass to be the declaration in the required category.

Kevin

In this case, MyClass() is an extension of class MyClass and not its category.

  • Fariborz

In this case you are implementing a new [MyClass method1] class which has no relationship to [MyBaseClass method1].
You need to provide implementation of [MyBaseClass method1] when @implementing MyBaseClass.

  • Fariborz