https://github.com/JuliaLang/julia
Revision 7cde4be23d5531b515e3cc176b1aec5431d8aa46 authored by Shuhei Kadowaki on 22 March 2022, 02:44:08 UTC, committed by GitHub on 22 March 2022, 02:44:08 UTC
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 inference (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
```
1 parent cf999af
History
Tip revision: 7cde4be23d5531b515e3cc176b1aec5431d8aa46 authored by Shuhei Kadowaki on 22 March 2022, 02:44:08 UTC
inference: override `InterConditional` result with `Const` carefully (#44668)
Tip revision: 7cde4be
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
.codecov.yml -rw-r--r-- 52 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 493 bytes
.mailmap -rw-r--r-- 12.1 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 22.5 KB
HISTORY.md -rw-r--r-- 349.5 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 49.7 KB
Makefile -rw-r--r-- 26.4 KB
NEWS.md -rw-r--r-- 2.6 KB
README.md -rw-r--r-- 7.3 KB
THIRDPARTY.md -rw-r--r-- 3.7 KB
VERSION -rw-r--r-- 10 bytes
julia.spdx.json -rw-r--r-- 35.8 KB
sysimage.mk -rw-r--r-- 4.1 KB

README.md

back to top