Fix DCHECK to handle dangling else (#18295)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18295
Replace "if (false)" with "while (false)" which fixes potential dangling else issue as shown in added test case.
Reviewed By: ezyang
Differential Revision: D14569608
fbshipit-source-id: 407052db9182ce27b7a59841e90fa50d3eca262e