I once solved a particularly nasty bug, causing a c++ server to segfault in production about once a week, in a dream! The eureka adrenaline woke me up, and I rushed to my laptop to find the insight was real. I had been trying to comprehend that segfault for several long days. It wasn't the most restful night though.
> in a dream! The eureka adrenaline woke me up
YES! I have never told anyone this (because it feels so random) but it's great to know I'm not the only one. I pretty much expect this when I am in depths of an issue I cant somehow consciously resolve, so much that I keep a pen and writing pad next to me, before I sleep, because the code I saw in my dream often gets lost by the time I go to my office and resume the laptop.
I even figured out a hack - I just force myself to go to sleep if I can't consciously resolve it for more than an hour. It's as if my brain gets an otherwise untapped firepower.
That said, this absolutely destroys my sleep cycle for the next day or two and spikes my BP for the rest of the day to the point where I feel sick.
Although in theory I'm sleeping more than the 8h, I feel horribly mentally exhausted. I can work out, physically just fine but my brain is on empty - because of this, I limit this to critical blockers.
I used to do this regularly when I first started coding, I called them "Codemares". They were like nightmares with the shouting of commands I didn't quite understand would invade my dreams.