-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
literal number from a conditional expression is not being coerced to assignee type #5557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would personally have expected for peer type resolution to kick in here and only require a single |
The peer type resolution kicks in when the last else branch has the When other branches have the |
Huh, interesting, I guess this makes some sense as it is the matching branch to the root if expression. |
This explains the behavior, but is there a reason why coercion can't or shouldn't happen without an |
I think the problem is that result location stuff doesn't work through nested branches. Result location works on a one-level-deep conditional like Your example will work with an I think the reason result location doesn't work through nested branches is just that no one has implemented it yet, and i hear that part of the compiler codebase is gnarly. |
@dbandstra is correct. The current plan is to implement this correctly in stage2 only and then delete the stage1 codebase. |
duplicate of #4629 and fixed in master branch. |
The following assignment
yields the error
To get rid of the error, I had to use
@as(u32, ...)
on all 4 constants.It seems to me that type coercion should happen automatically here, since the required type is known.
The text was updated successfully, but these errors were encountered: