In the example you talk about propagating type information backward from the update - I agree that wouldn’t work. But propagating type information down from the field access should work just fine - and that’s the behaviour I talked about. In the example you give the at the first line the point.w expression should give a type of “has w field” to the point variable. When we reach the update expression, the type-checker should fail to unify the type of expected %Point struct with the “has w field” type since the struct doesn’t have a w field.
As I said, the error would be in a less helpful location, but there should be an error regardless.
For reference, here’s the snippet:
def absolute_z(condition, point) do
point.w
if condition do
%Point{point | z: abs(point.z)}
else
point
end
end






















