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

[compiler] Teach type inference that GotoIfNot can throw #48583

Merged
merged 1 commit into from
Feb 7, 2023

Commits on Feb 7, 2023

  1. [compiler] Teach type inference that GotoIfNot can throw

    Previously, the effects system would ignore certain cases where
    `GotoIfNot` nodes would be capable of throwing; this resulted in simple
    examples such as the following being marked as `nothrow`:
    
    ```
    julia> foo(x) = x > 0 ? x : 0
           Base.infer_effects(foo, (Missing,))
    (+c,+e,+n,+t,+s,+m,+i)
    ```
    
    With this change, we correctly notice when a `GotoIfNot` node is given a
    non-`Bool` condition, annotate the basic block as possibly throwing, and
    further end type inference if the condition is provably non-`Bool`.
    staticfloat committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    43235e9 View commit details
    Browse the repository at this point in the history