Problem
An if without an else has unit as its false-branch type. If its true branch produces a non-unit value, this can indicate a missing semicolon or an unintended discarded value, but no diagnostic is emitted.
Desired outcome
Add a helpful warning for this pattern, while avoiding false positives for diverging (Never) branches.
Location
ndc_analyser/src/analyser.rs, Expression::If.
Problem
An
ifwithout anelsehas unit as its false-branch type. If its true branch produces a non-unit value, this can indicate a missing semicolon or an unintended discarded value, but no diagnostic is emitted.Desired outcome
Add a helpful warning for this pattern, while avoiding false positives for diverging (
Never) branches.Location
ndc_analyser/src/analyser.rs,Expression::If.