https://github.com/JuliaLang/julia
Revision c5e462137298a6876ca8bd0939f6e5ff79996d14 authored by Shuhei Kadowaki on 19 July 2023, 05:01:21 UTC, committed by GitHub on 19 July 2023, 05:01:21 UTC
At present, in very rare cases, `PartialStruct` used for const-prop'
might have type information that's less strict than type information
that can be derived from the method's type signature, e.g.:
```julia
Base.@constprop :aggressive function refine_partial_struct((a, b)::Tuple{String,Int})
    if iszero(b)
        println("b=0") # to prevent semi-concrete eval
        return nothing
    else
        return a
    end
end
@test Base.return_types((AbstractString,)) do s
    refine_partial_struct((s, 42))
end |> only === String
```

This commit enhances the accuracy of const-prop' by propagating `tmeet`
of `PartialStruct` and the declared type in such situations.
1 parent 0bf560a
Raw File
Tip revision: c5e462137298a6876ca8bd0939f6e5ff79996d14 authored by Shuhei Kadowaki on 19 July 2023, 05:01:21 UTC
inference: refine `PartialStruct` with declared method signature (#50590)
Tip revision: c5e4621
.gitignore
/*.tar.gz
/tmp
/dist
/dist-extras
/julia
/julia.bat
/usr
/oprofile_data
/usr-staging
/Make.user
/julia-*
/source-dist.tmp
/source-dist.tmp1

*.expmap
*.exe
*.dll
*.dwo
*.do
*.o
*.o.tmp
*.obj
*.so
*.dylib
*.dSYM
*.h.gen
*.jl.cov
*.jl.*.cov
*.jl.mem
*.jl.*.mem
*.ji

/perf*
.DS_Store
.idea/*
.vscode/*
*.heapsnapshot
.cache
# Buildkite: Ignore the entire .buildkite directory
/.buildkite

# Buildkite: Ignore the unencrypted repo_key
repo_key

# Buildkite: Ignore any agent keys (public or private) we have stored
agent_key*
back to top