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

inference: override InterConditional result with Const carefully #44668

Merged
merged 2 commits into from
Mar 22, 2022

Commits on Mar 19, 2022

  1. inference: override InterConditional result with Const carefully

    I found that a tricky thing can happen when constant inference derives
    `Const`-result while non-constant inference has derived (non-constant)
    `InterConditional` result beforehand. In such a case, currently we discard
    the result with constant infernece (since `!(Const ⊑ InterConditional)`),
    but we can achieve more accuracy by not discarding that `Const`-information, e.g.:
    ```julia
    julia> iszero_simple(x) = x === 0
    iszero_simple (generic function with 1 method)
    
    julia> @test Base.return_types() do
               iszero_simple(0) ? nothing : missing
           end |> only === Nothing
    Test Passed
    ```
    aviatesk committed Mar 19, 2022
    Configuration menu
    Copy the full SHA
    f4e47e5 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2022

  1. Update test/compiler/inference.jl

    Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com>
    aviatesk and KristofferC authored Mar 20, 2022
    Configuration menu
    Copy the full SHA
    2b22df5 View commit details
    Browse the repository at this point in the history