collapse ternary expression properly if condition is collapsed