You will often get code being underlined as invalid when you are missing a semi-colon, which is your first obvious clue there is something going on. VA getting confused like this is another clue. This is our way of prompting you that there is a problem
Identifying why the code does not make much sense is a hard problem, as you will sometimes see from the compilers error messages and warning.