Skip to content
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

Add test for eval order for a+=b #79293

Merged
merged 1 commit into from
Nov 23, 2020

Commits on Nov 22, 2020

  1. Add test for eval order for a+=b

    Yes, the order of evaluation *does* change depending on the types of
    the operands. Cursed, I know.
    
    I've elected to place this test into `expr/compound-assignment` creating
    both the `expr` directory and the `compound-assignment` directory. I
    plan in a future PR to also move the `if` directory and the loose `if`
    tests into `expr/if` and other similar cleanups of the `test/ui`
    directory.
    
    Future work: Test more than just `+=`, but all operators. I don't know
    if using a macro to generate these tests cases would be okay or not,
    but it'd be boilerplatey without it. I'm also confident you cannot
    change the evaluation order of one operator without changing all of
    them.
    
    Future work: Additionally, test more than just `i32 += i32` for the
    primitive version. I don't actually know the full set of primitive
    implementations, but I imagine there's enough to cause a combinatorial
    explosion with the previous future work item. Somewhere on the order of
    one to two hundred individual functions.
    Havvy committed Nov 22, 2020
    Configuration menu
    Copy the full SHA
    b6f9705 View commit details
    Browse the repository at this point in the history