fix issue KT-5234: 'when' statement in 'for', 'while', 'doWhile'