fix type narrowing in if/switch expressions
moved inline expression tests to language module