Fix iteration on empty RB tree, add test
Fix parser test that checks for invalid promise type
Make sure function 'and' gets a caller promise, add acceptance test

Close #3173
Do not exit from loop in ExpandScalar if parts of it is still expandable

Close #3144