This is an archive of the discontinued LLVM Phabricator instance.

[SemaObjC] Forbid storing an unboxed integer literal in an NSNumber
ClosedPublic

Authored by erik.pilkington on Apr 13 2020, 5:01 PM.

Details

Summary

This fixes a common mistake (the 3 should be @3): NSNumber *n = 3. This extends an existing check for NSString. Also, this only errs if the initializer isn't a null pointer constant, so NSNumber *n = 0; continues to work.

Fixes rdar://47029572

Diff Detail

Event Timeline

Seems reasonable to me. Thanks @erik.pilkington!

bendjones accepted this revision.Apr 13 2020, 5:31 PM
This revision is now accepted and ready to land.Apr 13 2020, 5:31 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2020, 12:28 PM