XSharpPublic
XSharpPublic copied to clipboard
Missing warning about not used value assigned to variable
First snippet causes a correct warning about unused value assigned to variable, but the next ones do not produce one. Shouldn't they?
FUNCTION Start() AS VOID
LOCAL n,m,k AS INT
n := 1
n := 2 // warning XS0219: The variable 'n' is assigned but its value is never used
m := 1
m := m * 2 // no warning
k := 1
k++ // no warning
In the examples with m and k, then the value of m is used in the 2nd expression and the value of k is also used in the second expression. So strictly speaking the original assignment to m and k is used on a subsequent statement.
Roslyn does not support this.