New Issue: Errors for certain (accidentally) promoted conditional expressions are confusing

19107, "bradcray", "Errors for certain (accidentally) promoted conditional expressions are confusing", "2022-01-25T22:50:01Z"

Summary of Problem

Conditionals cannot be promoted today, but since promotion is fairly invisible, it can be easy to stumble into it accidentally. In some cases, the errors we generate are not as clear as they should be:

if debug || D.dim(0) < 80 then  // should be D.dim(0).size                      
day13-error.chpl:5: error: Unable to resolve type of if-expression
note: 'then' branch returns type "bool"
note: 'else' branch returns type "_ir_chpl_promo2_isTrue"

Specifically, in the user's view, there are no then and else branches here, and most users also won't know what an ir_chpl_... identifier is. I'm fairly certain that this is due to the short-circuiting operator, and it may be that the fix is fairly straightforward.

Steps to Reproduce

Associated Future Test(s):
test/studies/adventOfCode/2021/bradc/futures/day13-error.chpl #19028

Configuration Information

  • Output of chpl --version: chpl version 1.26.0 pre-release (56bd177336)