ObjCMessageExpr gets the actual type through Sema::getMessageSendResultType, instead of using the return type of MethodDecl directly. The final type is generated by considering the receiver and nullability of MethodDecl together. The RetType in NullabilityChecker should all be replaced with M.getOriginExpr()->getType().
@interface A : NSObject @property (nonnull, nonatomic, strong) NSString *name; + (nullable instancetype)shared; @end @[[A shared].name];
Consider the code above, the nullability of the name property should depend on the result of the shared method .
I'm not sure if getOriginExpr is always non-null. How do you know?