The code that you wrote may have been an over-simplification. It does not compile in either of my orgs. If it does happen to compile, you may have stumbled across a compiler bug.
However, it is possible to end up constructing code like the following:
String json = JSON.deserialize(RestContext.request.requestBody.toString());
This works because "json" has not been defined until after the current statement executes, so it resolves without causing an error. However, once defined, you can no longer refer to the system library as JSON, but instead have to refer to it as System.JSON to disambiguate the token.
As a general rule, you should not use any standard library name (e.g. Schema, Account, Test, JSON, EncodingUtil, etc), unless you want to break your code in spectacularly amazing ways. For example, a top-level class named Test will cause practically all of your well-written unit tests to fail.
Since, as far as I can tell, the first code example should not compile, do not use it, because one day in the future, if and/or when this bug is fixed, your code will automatically fail to compile one day. In fact, your code may prevent salesforce.com from fixing the bug, since it will likely fail the Hammer Test.