Why this fires¶
An assignment or a let overwrites or shadows a linear value that is still
owed, so nothing could ever consume the old value.
let f = open("a")
f = open("b") // TE176: the first file is lostA defer over f does not make the assignment safe: it reads the variable
when it fires, so it would close the second file and the first would still
leak. A shadowing let f = … is accepted when a defer already covers the
old f, because the shadow is a new variable and the defer keeps the old
one.
Fix it¶
Consume the old value first, or give the new one another name.