ChatGPT (and GPT-3) can criticize its own output, and then incorporate its own feedback into an improved version. This works for essays, for code...
I'm waiting for a Copilot upgrade that puts red squigglies under "probably wrong" code, because GPT-3 can already detect and fix most of it.