swift
3c14208f - LifetimeResolution: nothing is demanded of storage before it exists

Commit
2 days ago
LifetimeResolution: nothing is demanded of storage before it exists A root that starts uninitialized killed no demand, so demand from a use before initialization flowed above the allocation. In a loop it went around the back-edge into the previous iteration, where it turned the final consume of the variable into a copy. So a use-before-init error included a false "used after consume" error in code like this: ``` for _ in 0..<n { var x: NC borrowNC(x) // error: variable 'x' used before being initialized x = NC() consumeNC(x) // error: 'x' used after consume (false) } ``` Every root now kills all demand. Whatever demand reaches it is still seen and checked in the legalization phase of demand analysis. This just stops the unsatisfied demand from going any further and producing extra diagnostics.
Author
Parents
Loading