• Tobias Tebbi's avatar
    [torque] disallow using logical operators in value contexts · e569438b
    Tobias Tebbi authored
    This CL makes sure, that logical operators (||, &&) always have return
    type never. Together with a check that never is never passed as a
    function argument, this prevents faulty evaluation as in !(x || y).
    
    Before, the logical operators had a behavior similar to
    (bool labels Taken, NotTaken), with a fast exit if the left-hand side
    allowed shor-circuit evaluation, but returning the right-hand side
    otherwise. Since we want to allow existing (a || b || c) patterns in
    the codebase, this requires weakening the restriction that the left-
    and right-hand side need to have the same type. Now the possibilites
    are:
    bool, never
    never, bool
    never, never
    bool, bool
    constexpr bool, constexpr bool
    
    Bug: v8:8137
    Change-Id: I9576b337dc4008ac58b4625e77fef4e73bcdd6e3
    Reviewed-on: https://chromium-review.googlesource.com/1215162Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
    Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#55750}
    e569438b
implementation-visitor.cc 73 KB