When Rubberduck can evaluate expression types, we'll be able to warn the user about a suspicious implicit conversion from Boolean to Long happening here (assuming i is Long).
Similarly, consider this Open statement:
Dim fn As Long
fn = FreeFile
Open path For Input As #fn
Here fn is correctly assigned from FreeFile, however it's declared As Long; thus we can have a warning here, about an implicit downcast to Byte (right?)
There are a bunch of statements in the grammar, that demand specific types or have specific constraints, and take expressions that VBA coerces to a specific type - and we can inspect that.
This requires us to be able to evaluate expression types.
Consider a
For
loop:If
foo
is an integer type, no problem. However what if it's aDouble
? Or aBoolean
?When Rubberduck can evaluate expression types, we'll be able to warn the user about a suspicious implicit conversion from
Boolean
toLong
happening here (assumingi
isLong
).Similarly, consider this
Open
statement:Here
fn
is correctly assigned fromFreeFile
, however it's declaredAs Long
; thus we can have a warning here, about an implicit downcast toByte
(right?)There are a bunch of statements in the grammar, that demand specific types or have specific constraints, and take expressions that VBA coerces to a specific type - and we can inspect that.