Fix Json.writes[X] so that it works with non-local names too. Issue #2903.

The added code in `JsonExtensionSpec.scala` fails to compile without the change in `JsMacroImpl.scala`. The error is:

    JsonExtensionSpec.scala:55: not found: value Foreigner
      implicit val foreignerReads = Json.reads[foreign.Foreigner]