fix Issue 12390 - "has no effect in expression" diagnostic regression

When value discarding check on statements, the side-effect check should not be done deeply.
Merge pull request #3432 from 9rnsr/fix12390

[REG2.066a] Issue 12390 - "has no effect in expression" diagnostic regression