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
History
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
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 523 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 370.0 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 55.3 KB
Makefile -rw-r--r-- 30.1 KB
NEWS.md -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 7.3 KB
THIRDPARTY.md -rw-r--r-- 3.8 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 35.8 KB
pkgimage.mk -rw-r--r-- 6.0 KB
sysimage.mk -rw-r--r-- 4.3 KB

README.md

back to top